Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento : importazione SI: prima parte git-svn-id: svn://10.65.10.50/branches/R_10_00@21575 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b0ec34b941
commit
cbd7750c75
120
ha/ha1300.cpp
120
ha/ha1300.cpp
@ -531,7 +531,10 @@ void TUpload2Campo::elabora_VC(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
file_cfven.zero();
|
file_cfven.zero();
|
||||||
file_cfven.put(CFV_TIPOCF, 'C');
|
file_cfven.put(CFV_TIPOCF, 'C');
|
||||||
file_cfven.put(CFV_CODCF, codcf);
|
file_cfven.put(CFV_CODCF, codcf);
|
||||||
|
if (_can_write)
|
||||||
err = file_cfven.write();
|
err = file_cfven.write();
|
||||||
|
else
|
||||||
|
err = NOERR;
|
||||||
}
|
}
|
||||||
//se la creazione non va a buon fine avverte
|
//se la creazione non va a buon fine avverte
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
@ -546,9 +549,6 @@ void TUpload2Campo::elabora_VC(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
const TString& codlist = recset.get("CodiceListino").as_string();
|
const TString& codlist = recset.get("CodiceListino").as_string();
|
||||||
file_cfven.put(CFV_CODLIST, codlist);
|
file_cfven.put(CFV_CODLIST, codlist);
|
||||||
|
|
||||||
//se alla fin fine può scrivere -> aggiorna sia clifo che cfven
|
|
||||||
if (_can_write)
|
|
||||||
file_clifo.rewrite();
|
|
||||||
|
|
||||||
//incredibilmente arriva in fondo
|
//incredibilmente arriva in fondo
|
||||||
TString msg;
|
TString msg;
|
||||||
@ -557,7 +557,9 @@ void TUpload2Campo::elabora_VC(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
if (_can_write)
|
if (_can_write)
|
||||||
{
|
{
|
||||||
//alla fine della fiera salva il cliente e il cfven
|
//alla fine della fiera salva il cliente e il cfven
|
||||||
err = file_clifo.rewrite() && file_cfven.rewrite();
|
err = file_clifo.rewrite();
|
||||||
|
if (err == NOERR)
|
||||||
|
err = file_cfven.rewrite();
|
||||||
|
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
{
|
{
|
||||||
@ -577,18 +579,18 @@ void TUpload2Campo::elabora_SI(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
{
|
{
|
||||||
//dati dal recordset di upload (con i relativi controlli)
|
//dati dal recordset di upload (con i relativi controlli)
|
||||||
TString4 codice_terminale = recset.get("CodiceTerminale").as_string();
|
TString4 codice_terminale = recset.get("CodiceTerminale").as_string();
|
||||||
const TString& codice_agente = check_agente(codice_terminale, log);
|
const TString8 codice_agente = check_agente(codice_terminale, log);
|
||||||
const TString& str_codcf = recset.get("CodiceCliente").as_string();
|
const TString& str_codcf = recset.get("CodiceCliente").as_string();
|
||||||
long codcf = check_cliente(str_codcf, log);
|
long codcf = check_cliente(str_codcf, log);
|
||||||
|
|
||||||
//crea un movimento contabile pescando i dati dal recordset (e inventandosene qualcuno!)
|
//crea un movimento contabile pescando i dati dal recordset (e inventandosene qualcuno!)
|
||||||
//testata
|
//testata
|
||||||
const char tipo_cf = 'C';
|
|
||||||
const TDate data_incasso = recset.get("DataIncasso").as_date();
|
const TDate data_incasso = recset.get("DataIncasso").as_date();
|
||||||
const TDate datareg = data_incasso;
|
const TDate datareg = data_incasso;
|
||||||
const TDate datacomp = data_incasso;
|
const TDate datacomp = data_incasso;
|
||||||
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 long numdoc = recset.get("NumeroFattura").as_int();
|
const long numdoc = recset.get("NumeroFattura").as_int();
|
||||||
const TDate datadoc = recset.get("DataFattura").as_date();
|
const TDate datadoc = recset.get("DataFattura").as_date();
|
||||||
const TString4 tipodoc = recset.get("TipoDocumento").as_string();
|
const TString4 tipodoc = recset.get("TipoDocumento").as_string();
|
||||||
@ -596,9 +598,7 @@ void TUpload2Campo::elabora_SI(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
|
|
||||||
TConfig config(CONFIG_DITTA, "ha");
|
TConfig config(CONFIG_DITTA, "ha");
|
||||||
const TString& codcaus = config.get("InpCausale");
|
const TString& codcaus = config.get("InpCausale");
|
||||||
const TCausale caus(codcaus, datareg.year());
|
const TCausale caus(codcaus, anno);
|
||||||
const int riga_abb = RIGA_ABBUONI_PASSIVI;
|
|
||||||
TBill conto_abbuoni; caus.bill(riga_abb, conto_abbuoni);
|
|
||||||
|
|
||||||
TMovimentoPN mov;
|
TMovimentoPN mov;
|
||||||
TRectype& head = mov.curr();
|
TRectype& head = mov.curr();
|
||||||
@ -613,21 +613,92 @@ void TUpload2Campo::elabora_SI(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
head.put(MOV_DATADOC, datadoc);
|
head.put(MOV_DATADOC, datadoc);
|
||||||
head.put(MOV_NUMDOC, numdoc);
|
head.put(MOV_NUMDOC, numdoc);
|
||||||
head.put(MOV_TIPODOC, tipodoc);
|
head.put(MOV_TIPODOC, tipodoc);
|
||||||
|
head.put(MOV_TIPOMOV, caus.tipomov());
|
||||||
|
head.put(MOV_ANNOIVA, anno);
|
||||||
|
head.put(MOV_TOTDOC, incasso);
|
||||||
|
|
||||||
|
long numreg = 999999L;
|
||||||
|
|
||||||
if (_can_write)
|
if (_can_write)
|
||||||
{
|
{
|
||||||
if (mov.write() != NOERR)
|
|
||||||
_can_write = false;
|
|
||||||
TString msg;
|
TString msg;
|
||||||
msg << "Movimento di incasso non registrato. Cliente: " << codcf << " - Agente: " << codice_agente << " - Data: " << data_incasso;
|
msg << " movimento di incasso. Cliente: " << codcf << " - Agente: " << codice_agente << " - Data: " << data_incasso;
|
||||||
|
if (mov.write() != NOERR)
|
||||||
|
{
|
||||||
|
_can_write = false;
|
||||||
|
msg.insert("Impossibile registrare");
|
||||||
log.log(2, msg);
|
log.log(2, msg);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg.insert("Registrato");
|
||||||
|
log.log(0, msg);
|
||||||
|
numreg = head.get_long(MOV_NUMREG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const long numreg = head.get_long(MOV_NUMREG);
|
|
||||||
//righe
|
//righe
|
||||||
|
//panegirico sui conti
|
||||||
|
//conto cliente
|
||||||
|
TToken_string key_clifo;
|
||||||
|
key_clifo.add('C');
|
||||||
|
key_clifo.add(codcf);
|
||||||
|
const TRectype& rec_codcf = cache().get(LF_CLIFO, key_clifo);
|
||||||
|
int gr_cli = rec_codcf.get_int(CLI_GRUPPO);
|
||||||
|
int co_cli = rec_codcf.get_int(CLI_CONTO);
|
||||||
|
TBill zio_clifo(gr_cli, co_cli, codcf ,'C');
|
||||||
|
//se il cliente non ha un suo conto, prova con il primo della causale incassi in configurazione
|
||||||
|
if (zio_clifo.conto() <= 0)
|
||||||
|
{
|
||||||
|
caus.bill(0, zio_clifo);
|
||||||
|
gr_cli = zio_clifo.gruppo();
|
||||||
|
co_cli = zio_clifo.conto();
|
||||||
|
zio_clifo.set(gr_cli, co_cli, codcf, 'C');
|
||||||
|
}
|
||||||
|
//conto agente
|
||||||
|
const TRectype& rec_agente = cache().get(LF_AGENTI, codice_agente);
|
||||||
|
int gr_age = rec_agente.get_int(AGE_GRUPPO);
|
||||||
|
int co_age = rec_agente.get_int(AGE_CONTO);
|
||||||
|
long sott_age = rec_agente.get_long(AGE_SOTTOCONTO);
|
||||||
|
TBill zio_agente(gr_age, co_age, sott_age);
|
||||||
|
//se l'agente non ha un suo conto, prova con il secondo della causale incassi in configurazione
|
||||||
|
if (zio_agente.conto() <= 0)
|
||||||
|
{
|
||||||
|
caus.bill(1, zio_agente);
|
||||||
|
gr_age = zio_agente.gruppo();
|
||||||
|
co_age = zio_agente.conto();
|
||||||
|
sott_age = zio_agente.sottoconto();
|
||||||
|
zio_agente.set(gr_age, co_age, sott_age);
|
||||||
|
}
|
||||||
|
|
||||||
|
//creazione vera e propria delle righe
|
||||||
|
//riga 1: conto cliente
|
||||||
|
TRectype& new_rmov_cli = mov.cg(-1);
|
||||||
|
new_rmov_cli.put(RMV_ROWTYPE, 'K');
|
||||||
|
zio_clifo.put(new_rmov_cli);
|
||||||
|
const char sezione_cli = caus.sezione(0);
|
||||||
|
new_rmov_cli.put(RMV_SEZIONE, sezione_cli);
|
||||||
|
TString descr_rmv_cli;
|
||||||
|
descr_rmv_cli << "Incasso cliente " << codcf;
|
||||||
|
new_rmov_cli.put(RMV_DESCR, descr_rmv_cli);
|
||||||
|
zio_agente.put(new_rmov_cli, true); //conto di contropartita = conto agente
|
||||||
|
new_rmov_cli.put(RMV_IMPORTO, incasso);
|
||||||
|
//riga 2: conto agente
|
||||||
|
TRectype& new_rmov_age = mov.cg(-1);
|
||||||
|
new_rmov_age.put(RMV_ROWTYPE, 'I');
|
||||||
|
zio_agente.put(new_rmov_age);
|
||||||
|
const char sezione_age = caus.sezione(1);
|
||||||
|
new_rmov_age.put(RMV_SEZIONE, sezione_age);
|
||||||
|
TString descr_rmv_age;
|
||||||
|
descr_rmv_age << "Incasso agente " << codice_agente;
|
||||||
|
new_rmov_age.put(RMV_DESCR, descr_rmv_age);
|
||||||
|
zio_clifo.put(new_rmov_age, true); //conto di contropartita = conto cliente
|
||||||
|
new_rmov_age.put(RMV_IMPORTO, incasso);
|
||||||
|
|
||||||
//crea i pagamenti aggiornando anche la partita
|
//crea i pagamenti aggiornando anche la partita (qui si parrà la tua nobilitate!)
|
||||||
|
|
||||||
|
//alla fine della fiera scrive (se può) movimento e pagamento
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +814,7 @@ void TUpload2Campo::elabora_TF(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
{
|
{
|
||||||
char rec_tipodoc = recset.get(DOC_TIPODOC).as_string()[0];
|
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')
|
if (rec_tipodoc == 'A' || rec_tipodoc == 'N' || rec_tipodoc <= ' ')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//1) codice terminale (lungo 3) e codice agente (lungo 5)
|
//1) codice terminale (lungo 3) e codice agente (lungo 5)
|
||||||
@ -1060,8 +1131,6 @@ void TUpload2Campo::elabora_RC(THardy_upload_recordset& recset, TLog_report& log
|
|||||||
|
|
||||||
void TUpload2Campo::elabora(const TMask& mask)
|
void TUpload2Campo::elabora(const TMask& mask)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//creazione del filename del file da importare
|
//creazione del filename del file da importare
|
||||||
TFilename src_file = mask.get(F_PATH);
|
TFilename src_file = mask.get(F_PATH);
|
||||||
src_file.add(UPLOAD_FILE);
|
src_file.add(UPLOAD_FILE);
|
||||||
@ -1097,6 +1166,7 @@ void TUpload2Campo::elabora(const TMask& mask)
|
|||||||
TString4 tipo_record = recset.rec_type();
|
TString4 tipo_record = recset.rec_type();
|
||||||
tipo_record.trim();
|
tipo_record.trim();
|
||||||
|
|
||||||
|
//"SU|VC|TF|RF|SI|BR|RC"
|
||||||
const int pos = tipi_record.get_pos(tipo_record);
|
const int pos = tipi_record.get_pos(tipo_record);
|
||||||
|
|
||||||
//trattazione dei vari tracciati record
|
//trattazione dei vari tracciati record
|
||||||
@ -1105,21 +1175,21 @@ void TUpload2Campo::elabora(const TMask& mask)
|
|||||||
case 0: //tipo record: SU (SetUp...ovvero agente)
|
case 0: //tipo record: SU (SetUp...ovvero agente)
|
||||||
//elabora_SU(recset, log); //non serve a una cippa!
|
//elabora_SU(recset, log); //non serve a una cippa!
|
||||||
break;
|
break;
|
||||||
case 1: //tipo record: TF (Testata Fattura)
|
case 1: //tipo record: VC (nuovi clienti e Variazioni Cliente)
|
||||||
|
elabora_VC(recset, log);
|
||||||
|
break;
|
||||||
|
case 2: //tipo record: TF (Testata Fattura)
|
||||||
elabora_TF(recset, log);
|
elabora_TF(recset, log);
|
||||||
break;
|
break;
|
||||||
case 2: //tipo record: RF (Riga Fattura)
|
case 3: //tipo record: RF (Riga Fattura)
|
||||||
//elabora_RF(recset, log); //non serve! lo fa l'elaborazione di testata
|
//elabora_RF(recset, log); //non serve! lo fa l'elaborazione di testata
|
||||||
break;
|
break;
|
||||||
case 3: //tipo record: SI (incasso documenti)
|
case 4: //tipo record: SI (incasso documenti)
|
||||||
elabora_SI(recset, log);
|
//elabora_SI(recset, log);
|
||||||
break;
|
break;
|
||||||
case 4: //tipo record: BR (righe movimenti magazzino)
|
case 5: //tipo record: BR (righe movimenti magazzino)
|
||||||
elabora_BR(recset, log);
|
elabora_BR(recset, log);
|
||||||
break;
|
break;
|
||||||
case 5: //tipo record: VC (nuovi clienti e Variazioni Cliente)
|
|
||||||
elabora_VC(recset, log);
|
|
||||||
break;
|
|
||||||
case 6: //tipo record: RC (Richiesta Carico)
|
case 6: //tipo record: RC (Richiesta Carico)
|
||||||
elabora_RC(recset, log);
|
elabora_RC(recset, log);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user