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("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
|
||||
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 TRectype& doc, TString& hfatt, TString& bfatt);
|
||||
// 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
|
||||
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);
|
||||
|
||||
// Controlli comuni
|
||||
|
@ -198,17 +198,31 @@ bool chiave_paf(const TRectype& doc, TString& hfatt, TString& bfatt)
|
||||
chiave_paf(d, hfatt, bfatt);
|
||||
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;
|
||||
get_coddest(tipocf, codcf, codsdi, pec);
|
||||
get_coddest(tipocf, codcf, codsdi, pec, cod_ind_sped);
|
||||
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)
|
||||
{
|
||||
const TCli_for clifo(tipocf, codcf);
|
||||
coddest = clifo.vendite().get("PADESTIN");
|
||||
pec = clifo.get("PEC");
|
||||
coddest.cut(0);
|
||||
pec.cut(0);
|
||||
const TCli_for clifo(tipocf, codcf);
|
||||
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);
|
||||
if (coddest.empty())
|
||||
{
|
||||
@ -1019,13 +1033,13 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc)
|
||||
// Controllo se il documento è almeno in stato di 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;
|
||||
}
|
||||
#endif
|
||||
#ifndef DBG
|
||||
_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");
|
||||
return false;
|
||||
@ -1544,7 +1558,16 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
|
||||
TString rifamm = cco(doc).get("S4");
|
||||
if (rifamm.blank())
|
||||
rifamm = doc.clifor().vendite().get(CFV_PARIFAMM);
|
||||
{
|
||||
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())
|
||||
rifamm = doc.clifor().vendite().get(CFV_PARIFAMM);
|
||||
}
|
||||
paf0200f.set("P2_RIFAMMINISTR", rifamm);
|
||||
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");
|
||||
|
@ -1,21 +1,24 @@
|
||||
#ifndef __INDSP_H
|
||||
#define __INDSP_H
|
||||
|
||||
#define IND_TIPOCF "TIPOCF"
|
||||
#define IND_CODCF "CODCF"
|
||||
#define IND_CODIND "CODIND"
|
||||
#define IND_RAGSOC "RAGSOC"
|
||||
#define IND_INDIR "INDIR"
|
||||
#define IND_CIV "CIV"
|
||||
#define IND_LOCALITA "LOCALITA"
|
||||
#define IND_CAP "CAP"
|
||||
#define IND_STATO "STATO"
|
||||
#define IND_COM "COM"
|
||||
#define IND_PTEL "PTEL"
|
||||
#define IND_TEL "TEL"
|
||||
#define IND_PFAX "PFAX"
|
||||
#define IND_FAX "FAX"
|
||||
#define IND_IVARID "IVARID"
|
||||
#define IND_INDIR2 "INDIR2"
|
||||
#define IND_TIPOCF "TIPOCF"
|
||||
#define IND_CODCF "CODCF"
|
||||
#define IND_CODIND "CODIND"
|
||||
#define IND_RAGSOC "RAGSOC"
|
||||
#define IND_INDIR "INDIR"
|
||||
#define IND_CIV "CIV"
|
||||
#define IND_LOCALITA "LOCALITA"
|
||||
#define IND_CAP "CAP"
|
||||
#define IND_STATO "STATO"
|
||||
#define IND_COM "COM"
|
||||
#define IND_PTEL "PTEL"
|
||||
#define IND_TEL "TEL"
|
||||
#define IND_PFAX "PFAX"
|
||||
#define IND_FAX "FAX"
|
||||
#define IND_IVARID "IVARID"
|
||||
#define IND_INDIR2 "INDIR2"
|
||||
#define IND_CODDEST "CODDEST"
|
||||
#define IND_RIFAMM "RIFAMM"
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user