Patch level : 12.0 892
Files correlati : fp0.exe Commento : Sistemato creazione ddt per fatturazione differita lavanderie
This commit is contained in:
parent
40c91254f9
commit
afa0d40b1d
@ -552,7 +552,7 @@ protected:
|
|||||||
//void set_rec_clifo(char tipocf, long codcf);
|
//void set_rec_clifo(char tipocf, long codcf);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TString& memo);
|
static void fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TString& memo, bool last = false);
|
||||||
bool doc_to_paf(TDocumentoEsteso& doc);
|
bool doc_to_paf(TDocumentoEsteso& doc);
|
||||||
bool doc_to_paf(const TRectype& rec);
|
bool doc_to_paf(const TRectype& rec);
|
||||||
bool doc_to_paf(const TDoc_key& key);
|
bool doc_to_paf(const TDoc_key& key);
|
||||||
|
@ -133,7 +133,7 @@ bool check_tables()
|
|||||||
s.erase(0, limiter);
|
s.erase(0, limiter);
|
||||||
if(!fp_db().sq_set_exec(query) || !fp_db().sq_commit())
|
if(!fp_db().sq_set_exec(query) || !fp_db().sq_commit())
|
||||||
{
|
{
|
||||||
fatal_box("Impossibile eseguire/salvare la query:\n%s\n%s", query.c_str(), fp_db().sq_get_token_text_error(1));
|
fatal_box("Impossibile eseguire/salvare la query:\n%s\n%s", query.c_str(), fp_db().sq_get_token_text_error(0, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,38 +281,38 @@ TString& add_filter(const TString& field, const TString& from, const TString& to
|
|||||||
// Imposta il valore di un campo variant
|
// Imposta il valore di un campo variant
|
||||||
void TPaf_record::set(const char* fld, const TVariant& var)
|
void TPaf_record::set(const char* fld, const TVariant& var)
|
||||||
{
|
{
|
||||||
CHECK(fld && *fld, "Null field name");
|
CHECK(fld && *fld, "Null field name");
|
||||||
if (var.is_null())
|
if (var.is_null())
|
||||||
{
|
{
|
||||||
_fields.remove(fld);
|
_fields.remove(fld);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TVariant* obj = (TVariant*)_fields.objptr(fld);
|
TVariant* obj = (TVariant*)_fields.objptr(fld);
|
||||||
if (obj != NULL)
|
if (obj != NULL)
|
||||||
*obj = var;
|
*obj = var;
|
||||||
else
|
else
|
||||||
_fields.add(fld, new TVariant(var));
|
_fields.add(fld, new TVariant(var));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Imposta il valore di un campo intero
|
// Imposta il valore di un campo intero
|
||||||
void TPaf_record::set(const char* fld, long val)
|
void TPaf_record::set(const char* fld, long val)
|
||||||
{
|
{
|
||||||
const TVariant var(val);
|
const TVariant var(val);
|
||||||
set(fld, var);
|
set(fld, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Imposta il valore di un campo stringa
|
// Imposta il valore di un campo stringa
|
||||||
void TPaf_record::set(const char* fld, const char* val)
|
void TPaf_record::set(const char* fld, const char* val)
|
||||||
{
|
{
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
set(fld, NULL_VARIANT);
|
set(fld, NULL_VARIANT);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const TVariant var(val);
|
const TVariant var(val);
|
||||||
set(fld, var);
|
set(fld, var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Imposta il valore di un campo stringa
|
// Imposta il valore di un campo stringa
|
||||||
@ -1427,20 +1427,37 @@ bool TDoc_fp::export_paf3200f()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDoc_fp::fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TString& memo)
|
void TDoc_fp::fill_buoni(map<TString20, TFPBuono_di_consegna>& buoni, const TString& memo, bool last)
|
||||||
{
|
{
|
||||||
if (memo.full())
|
if (memo.full())
|
||||||
{
|
{
|
||||||
TToken_string b(memo, 'n');
|
if (!last) // Prima riga
|
||||||
for (int i = 4; i < b.items(); i++)
|
|
||||||
{
|
{
|
||||||
TToken_string str(b.get(i), ' ');
|
TToken_string b(memo, 'n');
|
||||||
TString20 ndoc = str.get(1);
|
for (int i = 4; i < b.items(); i++)
|
||||||
TDate data(str.get(3));
|
{
|
||||||
if (data == TDate(NULLDATE))
|
TToken_string str(b.get(i), ' ');
|
||||||
data = str.get(2);
|
TString20 ndoc = str.get(1);
|
||||||
TFPBuono_di_consegna buono(ndoc, data);
|
TDate data(str.get(3));
|
||||||
buoni.insert({ buono._numdoc, buono });
|
if (data == TDate(NULLDATE))
|
||||||
|
data = str.get(2);
|
||||||
|
TFPBuono_di_consegna buono(ndoc, data);
|
||||||
|
buoni.insert({ buono._numdoc, buono });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Ultima riga
|
||||||
|
{
|
||||||
|
TToken_string b(memo, '\n');
|
||||||
|
// "Buono di consegna n. 1997 del 10-10-2019"
|
||||||
|
for (int i = 0; i < b.items(); ++i)
|
||||||
|
{
|
||||||
|
TToken_string str(b.get(i), ' ');
|
||||||
|
str.replace(" ", " ");
|
||||||
|
TString20 ndoc = str.get(4);
|
||||||
|
TDate data(str.get(6));
|
||||||
|
TFPBuono_di_consegna buono(ndoc, data);
|
||||||
|
buoni.insert({ buono._numdoc, buono });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1712,6 +1729,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
TPaf_record& paf3000f = _paf_container.get_paf("PAF3000F");
|
TPaf_record& paf3000f = _paf_container.get_paf("PAF3000F");
|
||||||
long riga = 1;
|
long riga = 1;
|
||||||
bool f_buonocons = false;
|
bool f_buonocons = false;
|
||||||
|
bool first_row = false;
|
||||||
map<TString20, TDate> ancestors_s;
|
map<TString20, TDate> ancestors_s;
|
||||||
TString riga_buoni_cons;
|
TString riga_buoni_cons;
|
||||||
FOR_EACH_PHYSICAL_FPRDOC(doc, r, rdoc)
|
FOR_EACH_PHYSICAL_FPRDOC(doc, r, rdoc)
|
||||||
@ -1727,13 +1745,14 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
const TString& descrizione_riga = descrizione(*rdoc);
|
const TString& descrizione_riga = descrizione(*rdoc);
|
||||||
if (descrizione_riga.empty())
|
if (descrizione_riga.empty())
|
||||||
continue;
|
continue;
|
||||||
if (!f_buonocons && descrizione_riga.starts_with("Buono di consegna n. "))
|
if (!f_buonocons && descrizione_riga.starts_with("Buono di consegna"))
|
||||||
{
|
{
|
||||||
TString memo; memo << rdoc->get(RDOC_DESCR);
|
TString memo; memo << rdoc->get(RDOC_DESCR);
|
||||||
if (rdoc->get_bool(RDOC_DESCLUNGA))
|
if (rdoc->get_bool(RDOC_DESCLUNGA))
|
||||||
memo << rdoc->get(RDOC_DESCEST);
|
memo << rdoc->get(RDOC_DESCEST);
|
||||||
riga_buoni_cons = memo;
|
riga_buoni_cons = memo;
|
||||||
f_buonocons = true;
|
f_buonocons = true;
|
||||||
|
first_row = r == 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
reset(paf3000f);
|
reset(paf3000f);
|
||||||
@ -1979,7 +1998,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
if (memo.full())
|
if (memo.full())
|
||||||
{
|
{
|
||||||
map<TString20, TFPBuono_di_consegna> buoni;
|
map<TString20, TFPBuono_di_consegna> buoni;
|
||||||
fill_buoni(buoni, memo);
|
fill_buoni(buoni, memo, !first_row);
|
||||||
paf1600f.set("PF_RIFNUMLINEA", "0");
|
paf1600f.set("PF_RIFNUMLINEA", "0");
|
||||||
FOR_EACH_BUONI(buoni, n, buono)
|
FOR_EACH_BUONI(buoni, n, buono)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user