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);
|
||||
|
||||
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(const TRectype& rec);
|
||||
bool doc_to_paf(const TDoc_key& key);
|
||||
|
@ -133,7 +133,7 @@ bool check_tables()
|
||||
s.erase(0, limiter);
|
||||
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
|
||||
void TPaf_record::set(const char* fld, const TVariant& var)
|
||||
{
|
||||
CHECK(fld && *fld, "Null field name");
|
||||
if (var.is_null())
|
||||
{
|
||||
_fields.remove(fld);
|
||||
}
|
||||
else
|
||||
{
|
||||
TVariant* obj = (TVariant*)_fields.objptr(fld);
|
||||
if (obj != NULL)
|
||||
*obj = var;
|
||||
else
|
||||
_fields.add(fld, new TVariant(var));
|
||||
}
|
||||
CHECK(fld && *fld, "Null field name");
|
||||
if (var.is_null())
|
||||
{
|
||||
_fields.remove(fld);
|
||||
}
|
||||
else
|
||||
{
|
||||
TVariant* obj = (TVariant*)_fields.objptr(fld);
|
||||
if (obj != NULL)
|
||||
*obj = var;
|
||||
else
|
||||
_fields.add(fld, new TVariant(var));
|
||||
}
|
||||
}
|
||||
|
||||
// Imposta il valore di un campo intero
|
||||
void TPaf_record::set(const char* fld, long val)
|
||||
{
|
||||
const TVariant var(val);
|
||||
set(fld, var);
|
||||
const TVariant var(val);
|
||||
set(fld, var);
|
||||
}
|
||||
|
||||
// Imposta il valore di un campo stringa
|
||||
void TPaf_record::set(const char* fld, const char* val)
|
||||
{
|
||||
if (val == NULL)
|
||||
set(fld, NULL_VARIANT);
|
||||
else
|
||||
{
|
||||
const TVariant var(val);
|
||||
set(fld, var);
|
||||
}
|
||||
if (val == NULL)
|
||||
set(fld, NULL_VARIANT);
|
||||
else
|
||||
{
|
||||
const TVariant var(val);
|
||||
set(fld, var);
|
||||
}
|
||||
}
|
||||
|
||||
// Imposta il valore di un campo stringa
|
||||
@ -1427,20 +1427,37 @@ bool TDoc_fp::export_paf3200f()
|
||||
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())
|
||||
{
|
||||
TToken_string b(memo, 'n');
|
||||
for (int i = 4; i < b.items(); i++)
|
||||
if (!last) // Prima riga
|
||||
{
|
||||
TToken_string str(b.get(i), ' ');
|
||||
TString20 ndoc = str.get(1);
|
||||
TDate data(str.get(3));
|
||||
if (data == TDate(NULLDATE))
|
||||
data = str.get(2);
|
||||
TFPBuono_di_consegna buono(ndoc, data);
|
||||
buoni.insert({ buono._numdoc, buono });
|
||||
TToken_string b(memo, 'n');
|
||||
for (int i = 4; i < b.items(); i++)
|
||||
{
|
||||
TToken_string str(b.get(i), ' ');
|
||||
TString20 ndoc = str.get(1);
|
||||
TDate data(str.get(3));
|
||||
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");
|
||||
long riga = 1;
|
||||
bool f_buonocons = false;
|
||||
bool first_row = false;
|
||||
map<TString20, TDate> ancestors_s;
|
||||
TString riga_buoni_cons;
|
||||
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);
|
||||
if (descrizione_riga.empty())
|
||||
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);
|
||||
if (rdoc->get_bool(RDOC_DESCLUNGA))
|
||||
memo << rdoc->get(RDOC_DESCEST);
|
||||
riga_buoni_cons = memo;
|
||||
f_buonocons = true;
|
||||
first_row = r == 0;
|
||||
continue;
|
||||
}
|
||||
reset(paf3000f);
|
||||
@ -1979,7 +1998,7 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
||||
if (memo.full())
|
||||
{
|
||||
map<TString20, TFPBuono_di_consegna> buoni;
|
||||
fill_buoni(buoni, memo);
|
||||
fill_buoni(buoni, memo, !first_row);
|
||||
paf1600f.set("PF_RIFNUMLINEA", "0");
|
||||
FOR_EACH_BUONI(buoni, n, buono)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user