Patch level : 2.0 652
Files correlati : sv1.exe sv1100b.frm Ricompilazione Demo : [ ] Commento : GF20110 Selezionando ordinamento per agenti la stampa si rallenta fino a quasi non funzionare, o meglio in presenza di più agenti non visualizza nulla se non dopo ore di elaborazione git-svn-id: svn://10.65.10.50/trunk@11656 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
99055d0844
commit
944e79eeab
172
sv/sv1100.cpp
172
sv/sv1100.cpp
@ -796,8 +796,9 @@ void TStampa_schede::fill_tot(TRectype& tab)
|
||||
|
||||
for (int r = _totali.last(); r >= 0; r--)
|
||||
{
|
||||
const real* t = (const real*)_totali.objptr(r);
|
||||
char erre[4]; sprintf(erre, "R%d", r);
|
||||
tab.put(erre, (real&)_totali[r]);
|
||||
tab.put(erre, t == NULL ? ZERO : *t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -917,6 +918,7 @@ void TStampa_schede::fill_totage(TRectype& tab)
|
||||
|
||||
tab.put("S0", "zzzzzzzz"); // Mi assicuro che sia l'ultima riga
|
||||
tab.put("S1", descr);
|
||||
tab.put("S4", _curagente.left(5));
|
||||
tab.put("B8", TRUE); // Riga totale
|
||||
|
||||
TSheet_field& sheet = _mask->sfield(stampa_dettagliata() || stampa_per_ageart() ? F_DETTAGLIATA : F_SINTETICA);
|
||||
@ -941,6 +943,7 @@ bool TStampa_schede::raggruppa_articoli(TCursor& cur, TProgind* pi, bool last_cl
|
||||
|
||||
TDocumento& doc = (TDocumento&)cur.file().curr();
|
||||
bool can_print = TRUE;
|
||||
bool has_money = FALSE;
|
||||
|
||||
// Scorre i documenti del cliente corrente
|
||||
for (cur = 0; cur.pos() < items && can_print; ++cur)
|
||||
@ -963,13 +966,16 @@ bool TStampa_schede::raggruppa_articoli(TCursor& cur, TProgind* pi, bool last_cl
|
||||
{
|
||||
can_print = write_tab(tab);
|
||||
if (can_print)
|
||||
{
|
||||
update_totage(curtab);
|
||||
has_money = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (can_print && last_clifo)
|
||||
if (can_print && has_money && last_clifo)
|
||||
{
|
||||
// Scrive le righe che mancano
|
||||
write_artcli_descrizioni(tab);
|
||||
@ -985,12 +991,15 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc, bool last
|
||||
{
|
||||
const long items = cur.items();
|
||||
|
||||
TString header(160);
|
||||
header = "Preparazione file temporaneo di stampa ...";
|
||||
if (ragsoc.not_empty())
|
||||
header << '\n' << ragsoc;
|
||||
|
||||
TProgind pi(items, header, TRUE, TRUE);
|
||||
TProgind* pi = NULL;
|
||||
if (items > 4)
|
||||
{
|
||||
TString header(160);
|
||||
header = "Preparazione file temporaneo di stampa ...";
|
||||
if (ragsoc.not_empty())
|
||||
header << '\n' << ragsoc;
|
||||
pi = new TProgind(items, header, TRUE, TRUE);
|
||||
}
|
||||
|
||||
cur.file().set_curr(new TDocumento);
|
||||
TDocumento& doc = (TDocumento&)cur.file().curr();
|
||||
@ -1019,12 +1028,15 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc, bool last
|
||||
|
||||
for (cur = 0; cur.pos() < items && can_print; ++cur)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
if (pi.iscancelled())
|
||||
if (pi != NULL)
|
||||
{
|
||||
can_print = FALSE;
|
||||
break;
|
||||
}
|
||||
pi->addstatus(1);
|
||||
if (pi->iscancelled())
|
||||
{
|
||||
can_print = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (stampa_sintetica())
|
||||
{
|
||||
@ -1080,7 +1092,8 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc, bool last
|
||||
}
|
||||
}
|
||||
|
||||
pi.close_modal();
|
||||
if (pi != NULL)
|
||||
delete pi;
|
||||
|
||||
if (can_print && tab->items() > 0)
|
||||
{
|
||||
@ -1266,20 +1279,28 @@ void TStampa_schede::main_loop()
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << "(ANSI(" << DOC_DATADOC << ")>=\"" << _fromdate.string(ANSI) << "\")";
|
||||
}
|
||||
if (_todate.ok())
|
||||
if (_todate.ok() && _todate >= _fromdate)
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << "(ANSI(" << DOC_DATADOC << ")<=\"" << _todate.string(ANSI) << "\")";
|
||||
}
|
||||
if (_fromnum.not_empty())
|
||||
if (_fromnum.not_empty() && _fromnum == _tonum)
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << '(' << DOC_CODNUM << ">=\"" << _fromnum << "\")";
|
||||
filter << '(' << DOC_CODNUM << "==\"" << _fromnum << "\")";
|
||||
}
|
||||
if (_tonum.not_empty())
|
||||
else
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << '(' << DOC_CODNUM << "<=\"" << _tonum << "\")";
|
||||
if (_fromnum.not_empty())
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << '(' << DOC_CODNUM << ">=\"" << _fromnum << "\")";
|
||||
}
|
||||
if (_tonum.not_empty() && _tonum >= _fromnum)
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << '(' << DOC_CODNUM << "<=\"" << _tonum << "\")";
|
||||
}
|
||||
}
|
||||
if (_tipodoc.not_empty())
|
||||
{
|
||||
@ -1310,43 +1331,29 @@ void TStampa_schede::main_loop()
|
||||
curagenti.freeze();
|
||||
const TRectype& recagenti = curagenti.curr();
|
||||
|
||||
const int codpos = m.get_int(SC_SORTCF); // Posizione del codice clifo nello sheet
|
||||
TAssoc_array selection;
|
||||
if (!all)
|
||||
{
|
||||
// Crea la lista degli elementi selezionati dall'utente
|
||||
for (long i = clifosheet.items()-1; i >= 0; i--)
|
||||
{
|
||||
if (clifosheet.checked(i))
|
||||
{
|
||||
TString16 codcf = clifosheet.row(i).get(codpos);
|
||||
selection.add(codcf, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Crea la lista degli agenti da stampare
|
||||
TAssoc_array cia;
|
||||
|
||||
TRelation rel(LF_DOC);
|
||||
TRectype darec(LF_DOC), arec(LF_DOC);
|
||||
|
||||
/*
|
||||
int key = 0;
|
||||
TString filterage;
|
||||
|
||||
|
||||
TString filterage = filter;
|
||||
if (filterage.not_empty())
|
||||
filterage << "&&";
|
||||
filterage << '(' << DOC_CODAG << "!=\"\")";
|
||||
if (!m.field(F_DAAGENTE).empty())
|
||||
filterage << "&&(" << DOC_CODAG << ">=\"" << m.get(F_DAAGENTE) << "\")";
|
||||
if (!m.field(F_ADAGENTE).empty())
|
||||
filterage << "&&(" << DOC_CODAG << "<=\"" << m.get(F_ADAGENTE) << "\")";
|
||||
|
||||
if (_fromdate.ok() || _todate.ok())
|
||||
{
|
||||
key = 3;
|
||||
filterage << "&&(" << DOC_TIPOCF << "=\"" << m.get_who() << "\")";
|
||||
if (_fromdate.ok())
|
||||
{
|
||||
darec.put(DOC_DATADOC, _fromdate);
|
||||
}
|
||||
if (_todate.ok())
|
||||
{
|
||||
arec.put(DOC_DATADOC, _todate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1354,39 +1361,62 @@ void TStampa_schede::main_loop()
|
||||
darec.put(DOC_TIPOCF, m.get_who());
|
||||
arec.put(DOC_TIPOCF, m.get_who());
|
||||
}
|
||||
*/
|
||||
|
||||
TRelation rel(LF_DOC);
|
||||
TCursor cur(&rel, filterage, key, &darec, &arec);
|
||||
cur.set_filterfunction(filtra_doc_per_stat);
|
||||
const TRectype& curdoc = cur.curr();
|
||||
|
||||
const TRecnotype doc_items = cur.items();
|
||||
if (doc_items > 0)
|
||||
{
|
||||
TProgind pi(doc_items, "Selezione documenti", TRUE, TRUE);
|
||||
cur.freeze();
|
||||
for (cur = 0L; cur.pos() < doc_items; ++cur)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
if (pi.iscancelled())
|
||||
{
|
||||
cancel = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
const TString& age = curdoc.get(DOC_CODAG);
|
||||
CHECK(age.not_empty(), "Agente nullo");
|
||||
TAssoc_array* sel = (TAssoc_array*)cia.objptr(age);
|
||||
if (sel == NULL)
|
||||
{
|
||||
sel = new TAssoc_array;
|
||||
cia.add(age, sel);
|
||||
}
|
||||
const TString& clifo = curdoc.get(DOC_CODCF);
|
||||
sel->add(clifo, clifo);
|
||||
}
|
||||
}
|
||||
|
||||
for (curagenti = 0L; curagenti.pos() < ages && !cancel; ++curagenti)
|
||||
{
|
||||
_totage.destroy(); // Azzera totali agente
|
||||
TString filterage(filter);
|
||||
if (filterage.not_empty()) filterage << "&&";
|
||||
filterage << '(' << DOC_CODAG << "==\"" << recagenti.get(AGE_CODAGE) << "\")";
|
||||
TCursor cur(&rel, filterage, 2, &darec, &arec);
|
||||
cur.set_filterfunction(filtra_doc_per_stat);
|
||||
const long docs = cur.items();
|
||||
|
||||
if (docs > 0)
|
||||
{
|
||||
_curagente = recagenti.get(AGE_CODAGE);
|
||||
TAssoc_array* sel = (TAssoc_array*)cia.objptr(_curagente);
|
||||
if (sel != NULL)
|
||||
{
|
||||
_totage.destroy(); // Azzera totali agente
|
||||
|
||||
clifosheet.uncheck(-1);
|
||||
cur.freeze();
|
||||
for (cur = 0; cur.pos() < docs; ++cur)
|
||||
{
|
||||
const TString16 codcf = cur.curr().get(DOC_CODCF);
|
||||
if (all || selection.is_key(codcf))
|
||||
{
|
||||
long i = clifo2index(clifosheet, atol(codcf));
|
||||
if (i >= 0)
|
||||
clifosheet.check(i);
|
||||
}
|
||||
}
|
||||
cur.freeze(FALSE);
|
||||
if (clifosheet.one_checked())
|
||||
FOR_EACH_ASSOC_STRING((*sel), h, k, s)
|
||||
{
|
||||
_curagente = recagenti.get(AGE_CODAGE);
|
||||
_curagente << ' ' << recagenti.get(AGE_RAGSOC);
|
||||
cancel = !stampa_selezione(clifocur, clifosheet, filterage);
|
||||
const long i = clifo2index(clifosheet, atol(k));
|
||||
if (i >= 0)
|
||||
clifosheet.check(i);
|
||||
}
|
||||
|
||||
filterage = filter;
|
||||
if (filterage.not_empty())
|
||||
filterage << "&&";
|
||||
filterage << '(' << DOC_CODAG << "==\"" << _curagente << "\")";
|
||||
|
||||
_curagente << ' ' << recagenti.get(AGE_RAGSOC);
|
||||
cancel = !stampa_selezione(clifocur, clifosheet, filterage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "sv1100a.h"
|
||||
|
||||
USE 5 KEY 2
|
||||
JOIN LF_AGENTI INTO CODAGE=S4
|
||||
JOIN LF_ANAMAG INTO CODART=S0[1,20]
|
||||
JOIN LF_CLIFO INTO CODCF=S8|CODCF=I8
|
||||
JOIN LF_AGENTI INTO CODAGE==S4
|
||||
JOIN LF_ANAMAG INTO CODART==S0[1,20]
|
||||
JOIN LF_CLIFO INTO TIPOCF==S8|CODCF=I8
|
||||
|
||||
END
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user