Patch level : 12.0 990
Files correlati : fp0.exe Commento : Aggiunta gestione codici SDI per indirizzi di spedizione.
This commit is contained in:
parent
168f4fd639
commit
37aeb92038
@ -230,7 +230,8 @@ void TPA_mask::fill()
|
|||||||
row.add(rec.get(CFV_CODCF).as_int());
|
row.add(rec.get(CFV_CODCF).as_int());
|
||||||
row.add(rec.get("20." CLI_RAGSOC).as_string());
|
row.add(rec.get("20." CLI_RAGSOC).as_string());
|
||||||
|
|
||||||
TString rif = get_dest_sdi(rec.get(CFV_TIPOCF).as_string()[0], rec.get(CFV_CODCF).as_int());
|
TString cod_ind_sped = rec.get(DOC_CODINDSP).as_string();
|
||||||
|
TString rif = get_dest_sdi(rec.get(CFV_TIPOCF).as_string()[0], rec.get(CFV_CODCF).as_int(), cod_ind_sped);
|
||||||
// Se è ancora vuoto potrebbe essere estero
|
// Se è ancora vuoto potrebbe essere estero
|
||||||
if(rif.empty())
|
if(rif.empty())
|
||||||
{
|
{
|
||||||
|
@ -36,9 +36,9 @@ TString& complete_num_fp(const TCodice_numerazione& codnum, const int numdoc);
|
|||||||
bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt);
|
bool chiave_paf(const TDocumento& doc, TString& hfatt, TString& bfatt);
|
||||||
bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt);
|
bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt);
|
||||||
// Ritorna cod sdi, pec o vuoto. Chiama get_coddest()
|
// Ritorna cod sdi, pec o vuoto. Chiama get_coddest()
|
||||||
TString get_dest_sdi(const char tipocf, const long codcf);
|
TString get_dest_sdi(char tipocf, long codcf, const TString& cod_ind_sped);
|
||||||
// Valorizza codice sdi e pec in base alle configurazioni del monitor
|
// Valorizza codice sdi e pec in base alle configurazioni del monitor
|
||||||
bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& pec);
|
bool get_coddest(char tipocf, long codcf, TString& coddest, TString& pec, const TString& cod_ind_sped);
|
||||||
const TString& tipo_doc_sdi(const TDocumento& doc);
|
const TString& tipo_doc_sdi(const TDocumento& doc);
|
||||||
|
|
||||||
// Controlli comuni
|
// Controlli comuni
|
||||||
|
@ -198,17 +198,31 @@ bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt)
|
|||||||
chiave_paf(d, hfatt, bfatt);
|
chiave_paf(d, hfatt, bfatt);
|
||||||
return hfatt.full();
|
return hfatt.full();
|
||||||
}
|
}
|
||||||
TString get_dest_sdi(const char tipocf, const long codcf)
|
TString get_dest_sdi(const char tipocf, const long codcf, const TString& cod_ind_sped)
|
||||||
{
|
{
|
||||||
TString codsdi, pec;
|
TString codsdi, pec;
|
||||||
get_coddest(tipocf, codcf, codsdi, pec);
|
get_coddest(tipocf, codcf, codsdi, pec, cod_ind_sped);
|
||||||
return pec.full() ? pec : codsdi;
|
return pec.full() ? pec : codsdi;
|
||||||
}
|
}
|
||||||
bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& pec)
|
bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString& pec, const TString& cod_ind_sped)
|
||||||
{
|
{
|
||||||
|
coddest.cut(0);
|
||||||
|
pec.cut(0);
|
||||||
const TCli_for clifo(tipocf, codcf);
|
const TCli_for clifo(tipocf, codcf);
|
||||||
coddest = clifo.vendite().get("PADESTIN");
|
|
||||||
pec = clifo.get("PEC");
|
pec = clifo.get("PEC");
|
||||||
|
|
||||||
|
if(!cod_ind_sped.empty())
|
||||||
|
{
|
||||||
|
TLocalisamfile indsp(LF_INDSP);
|
||||||
|
indsp.put(IND_TIPOCF, tipocf);
|
||||||
|
indsp.put(IND_CODCF, codcf);
|
||||||
|
indsp.put(IND_CODIND, cod_ind_sped);
|
||||||
|
indsp.read();
|
||||||
|
coddest = indsp.get(IND_CODDEST);
|
||||||
|
}
|
||||||
|
if(coddest.empty())
|
||||||
|
coddest = clifo.vendite().get("PADESTIN");
|
||||||
|
|
||||||
const TAnagrafica anag(LF_CLIFO, tipocf, codcf);
|
const TAnagrafica anag(LF_CLIFO, tipocf, codcf);
|
||||||
if (coddest.empty())
|
if (coddest.empty())
|
||||||
{
|
{
|
||||||
@ -1019,13 +1033,13 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc)
|
|||||||
// Controllo se il documento è almeno in stato di stampa
|
// Controllo se il documento è almeno in stato di stampa
|
||||||
if (doc.stato() < doc.tipo().stato_finale_stampa())
|
if (doc.stato() < doc.tipo().stato_finale_stampa())
|
||||||
{
|
{
|
||||||
log(3, "Il documento non è stato ancora stampato, verrà saltato");
|
log(3, "Il documento non e' stato ancora stampato, verra' saltato");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef DBG
|
#ifndef DBG
|
||||||
_is_pa = doc.clifor().get_int("ALLEG") == 7;
|
_is_pa = doc.clifor().get_int("ALLEG") == 7;
|
||||||
if (!get_coddest(doc.clifor().tipo(), doc.clifor().codice(), _coddest, _pec))
|
if (!get_coddest(doc.clifor().tipo(), doc.clifor().codice(), _coddest, _pec, doc.get(DOC_CODINDSP)))
|
||||||
{
|
{
|
||||||
log(1, "Impossibile trovare il codice destinatario per la fattura");
|
log(1, "Impossibile trovare il codice destinatario per la fattura");
|
||||||
return false;
|
return false;
|
||||||
@ -1543,8 +1557,17 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf0200f.set("P2_GESTIONE", "D");
|
paf0200f.set("P2_GESTIONE", "D");
|
||||||
|
|
||||||
TString rifamm = cco(doc).get("S4");
|
TString rifamm = cco(doc).get("S4");
|
||||||
|
if (rifamm.blank())
|
||||||
|
{
|
||||||
|
TLocalisamfile indsp(LF_INDSP);
|
||||||
|
indsp.put(IND_TIPOCF, doc.get(DOC_TIPOCF));
|
||||||
|
indsp.put(IND_CODCF, doc.get(DOC_CODCF));
|
||||||
|
indsp.put(IND_CODIND, doc.get(DOC_CODINDSP));
|
||||||
|
indsp.read();
|
||||||
|
rifamm = indsp.get(IND_RIFAMM);
|
||||||
if(rifamm.blank())
|
if(rifamm.blank())
|
||||||
rifamm = doc.clifor().vendite().get(CFV_PARIFAMM);
|
rifamm = doc.clifor().vendite().get(CFV_PARIFAMM);
|
||||||
|
}
|
||||||
paf0200f.set("P2_RIFAMMINISTR", rifamm);
|
paf0200f.set("P2_RIFAMMINISTR", rifamm);
|
||||||
paf0200f.set("P2_ISCRREASOCIOU", _ditta.sociounico() == 'S' ? "SU" : "SM");
|
paf0200f.set("P2_ISCRREASOCIOU", _ditta.sociounico() == 'S' ? "SU" : "SM");
|
||||||
TISAM_recordset unloc("USE UNLOC\nJOIN COMUNI INTO COM==COMCCIAA\nFROM CODDITTA=#DITTA\nTO CODDITTA=#DITTA");
|
TISAM_recordset unloc("USE UNLOC\nJOIN COMUNI INTO COM==COMCCIAA\nFROM CODDITTA=#DITTA\nTO CODDITTA=#DITTA");
|
||||||
|
@ -17,5 +17,8 @@
|
|||||||
#define IND_FAX "FAX"
|
#define IND_FAX "FAX"
|
||||||
#define IND_IVARID "IVARID"
|
#define IND_IVARID "IVARID"
|
||||||
#define IND_INDIR2 "INDIR2"
|
#define IND_INDIR2 "INDIR2"
|
||||||
|
#define IND_CODDEST "CODDEST"
|
||||||
|
#define IND_RIFAMM "RIFAMM"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user