Patch level :2.1 28
Files correlati :or1.exe Ricompilazione Demo : [ ] Commento : Corretta stampa ordini per numero: nel caso di ordine con piu' righe di differenti tipiriga (ad es. merce), stampava solo le righe del primo tiporiga (merce, nell'esempio) trovato nella tabella dei tipiriga. Correzione estesa a tutti i tipi riga. git-svn-id: svn://10.65.10.50/trunk@11988 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f02c8b44f0
commit
912337c3e7
@ -63,6 +63,7 @@ protected:
|
|||||||
|
|
||||||
bool document_row_filter(const TRectype& row) const;
|
bool document_row_filter(const TRectype& row) const;
|
||||||
static bool document_filter(const TRelation* rel);
|
static bool document_filter(const TRelation* rel);
|
||||||
|
void add_tiporiga(TString& cond, const char tipo);
|
||||||
|
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
@ -163,8 +164,15 @@ bool TStampa_ordini::create()
|
|||||||
TTable tri ("%TRI");
|
TTable tri ("%TRI");
|
||||||
for (err = tri.first(); err == NOERR; err = tri.next())
|
for (err = tri.first(); err == NOERR; err = tri.next())
|
||||||
{
|
{
|
||||||
|
const TString& tiporiga = tri.get("S7");
|
||||||
|
TToken_string* tok = (TToken_string*)_tipi_riga.objptr(tiporiga);
|
||||||
|
if (tok == NULL)
|
||||||
|
{
|
||||||
|
tok = new TToken_string;
|
||||||
|
_tipi_riga.add(tiporiga, tok);
|
||||||
|
}
|
||||||
const TString& ss = tri.get("CODTAB");
|
const TString& ss = tri.get("CODTAB");
|
||||||
_tipi_riga.add(tri.get("S7"), ss);
|
tok->add(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
@ -288,6 +296,23 @@ void TStampa_ordini::show_body_field_for_number(short id, bool on, int from, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TStampa_ordini::add_tiporiga(TString& cond, const char tipo)
|
||||||
|
{
|
||||||
|
TString s;
|
||||||
|
const char strtipo[2] = {tipo, '\0'};
|
||||||
|
TToken_string* codici = (TToken_string*)_tipi_riga.objptr(strtipo);
|
||||||
|
if (codici != NULL)
|
||||||
|
{
|
||||||
|
FOR_EACH_TOKEN((*codici), tok)
|
||||||
|
{
|
||||||
|
s.format("(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC, tok);
|
||||||
|
if (cond.not_empty())
|
||||||
|
cond << "||";
|
||||||
|
cond << s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TStampa_ordini::filter_for_number()
|
void TStampa_ordini::filter_for_number()
|
||||||
{
|
{
|
||||||
CHECK(_frm, "Form non valido");
|
CHECK(_frm, "Form non valido");
|
||||||
@ -398,40 +423,26 @@ void TStampa_ordini::filter_for_number()
|
|||||||
TString cond;
|
TString cond;
|
||||||
|
|
||||||
// Aggiunge filtro sui tipi di riga
|
// Aggiunge filtro sui tipi di riga
|
||||||
s.format("((%d->TIPORIGA==\"%s\")", LF_RIGHEDOC, (const char*)(TString&)_tipi_riga["M"]);
|
// E' abbastanza utile avere tutti i tipi riga merce
|
||||||
cond << s;
|
// Carica i tipi riga dalla tabella TRI
|
||||||
|
add_tiporiga(cond, 'M');
|
||||||
|
|
||||||
if (_pr_spese)
|
if (_pr_spese)
|
||||||
{
|
add_tiporiga(cond, 'S');
|
||||||
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["S"]);
|
|
||||||
cond << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_pr_prest)
|
if (_pr_prest)
|
||||||
{
|
add_tiporiga(cond, 'P');
|
||||||
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["P"]);
|
|
||||||
cond << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_pr_sconti)
|
if (_pr_sconti)
|
||||||
{
|
add_tiporiga(cond, 'C');
|
||||||
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["C"]);
|
|
||||||
cond << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_pr_omaggi)
|
if (_pr_omaggi)
|
||||||
{
|
add_tiporiga(cond, 'O');
|
||||||
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["O"]);
|
|
||||||
cond << s;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_pr_descr)
|
if (_pr_descr)
|
||||||
{
|
add_tiporiga(cond, 'D');
|
||||||
s.format("||(%d->TIPORIGA==\"%s\")", LF_RIGHEDOC,(const char*)(TString&)_tipi_riga["D"]);
|
|
||||||
cond << s;
|
cond.insert("("); cond << ")";
|
||||||
}
|
|
||||||
|
|
||||||
cond << ")";
|
|
||||||
|
|
||||||
// TBI: stampa righe di sconto testata od esenzione. Siccome non sono righe fisiche
|
// TBI: stampa righe di sconto testata od esenzione. Siccome non sono righe fisiche
|
||||||
// credo sara' necessario implementarle con un messaggio nella validate...
|
// credo sara' necessario implementarle con un messaggio nella validate...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user