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
166
sv/sv1100.cpp
166
sv/sv1100.cpp
@ -796,8 +796,9 @@ void TStampa_schede::fill_tot(TRectype& tab)
|
|||||||
|
|
||||||
for (int r = _totali.last(); r >= 0; r--)
|
for (int r = _totali.last(); r >= 0; r--)
|
||||||
{
|
{
|
||||||
|
const real* t = (const real*)_totali.objptr(r);
|
||||||
char erre[4]; sprintf(erre, "R%d", 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("S0", "zzzzzzzz"); // Mi assicuro che sia l'ultima riga
|
||||||
tab.put("S1", descr);
|
tab.put("S1", descr);
|
||||||
|
tab.put("S4", _curagente.left(5));
|
||||||
tab.put("B8", TRUE); // Riga totale
|
tab.put("B8", TRUE); // Riga totale
|
||||||
|
|
||||||
TSheet_field& sheet = _mask->sfield(stampa_dettagliata() || stampa_per_ageart() ? F_DETTAGLIATA : F_SINTETICA);
|
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();
|
TDocumento& doc = (TDocumento&)cur.file().curr();
|
||||||
bool can_print = TRUE;
|
bool can_print = TRUE;
|
||||||
|
bool has_money = FALSE;
|
||||||
|
|
||||||
// Scorre i documenti del cliente corrente
|
// Scorre i documenti del cliente corrente
|
||||||
for (cur = 0; cur.pos() < items && can_print; ++cur)
|
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);
|
can_print = write_tab(tab);
|
||||||
if (can_print)
|
if (can_print)
|
||||||
|
{
|
||||||
update_totage(curtab);
|
update_totage(curtab);
|
||||||
|
has_money = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (can_print && last_clifo)
|
if (can_print && has_money && last_clifo)
|
||||||
{
|
{
|
||||||
// Scrive le righe che mancano
|
// Scrive le righe che mancano
|
||||||
write_artcli_descrizioni(tab);
|
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();
|
const long items = cur.items();
|
||||||
|
|
||||||
TString header(160);
|
TProgind* pi = NULL;
|
||||||
header = "Preparazione file temporaneo di stampa ...";
|
if (items > 4)
|
||||||
if (ragsoc.not_empty())
|
{
|
||||||
header << '\n' << ragsoc;
|
TString header(160);
|
||||||
|
header = "Preparazione file temporaneo di stampa ...";
|
||||||
TProgind pi(items, header, TRUE, TRUE);
|
if (ragsoc.not_empty())
|
||||||
|
header << '\n' << ragsoc;
|
||||||
|
pi = new TProgind(items, header, TRUE, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
cur.file().set_curr(new TDocumento);
|
cur.file().set_curr(new TDocumento);
|
||||||
TDocumento& doc = (TDocumento&)cur.file().curr();
|
TDocumento& doc = (TDocumento&)cur.file().curr();
|
||||||
@ -1019,11 +1028,14 @@ bool TStampa_schede::stampa_clifo(TCursor& cur, const TString& ragsoc, bool last
|
|||||||
|
|
||||||
for (cur = 0; cur.pos() < items && can_print; ++cur)
|
for (cur = 0; cur.pos() < items && can_print; ++cur)
|
||||||
{
|
{
|
||||||
pi.addstatus(1);
|
if (pi != NULL)
|
||||||
if (pi.iscancelled())
|
|
||||||
{
|
{
|
||||||
can_print = FALSE;
|
pi->addstatus(1);
|
||||||
break;
|
if (pi->iscancelled())
|
||||||
|
{
|
||||||
|
can_print = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stampa_sintetica())
|
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)
|
if (can_print && tab->items() > 0)
|
||||||
{
|
{
|
||||||
@ -1266,20 +1279,28 @@ void TStampa_schede::main_loop()
|
|||||||
if (filter.not_empty()) filter << "&&";
|
if (filter.not_empty()) filter << "&&";
|
||||||
filter << "(ANSI(" << DOC_DATADOC << ")>=\"" << _fromdate.string(ANSI) << "\")";
|
filter << "(ANSI(" << DOC_DATADOC << ")>=\"" << _fromdate.string(ANSI) << "\")";
|
||||||
}
|
}
|
||||||
if (_todate.ok())
|
if (_todate.ok() && _todate >= _fromdate)
|
||||||
{
|
{
|
||||||
if (filter.not_empty()) filter << "&&";
|
if (filter.not_empty()) filter << "&&";
|
||||||
filter << "(ANSI(" << DOC_DATADOC << ")<=\"" << _todate.string(ANSI) << "\")";
|
filter << "(ANSI(" << DOC_DATADOC << ")<=\"" << _todate.string(ANSI) << "\")";
|
||||||
}
|
}
|
||||||
if (_fromnum.not_empty())
|
if (_fromnum.not_empty() && _fromnum == _tonum)
|
||||||
{
|
{
|
||||||
if (filter.not_empty()) filter << "&&";
|
if (filter.not_empty()) filter << "&&";
|
||||||
filter << '(' << DOC_CODNUM << ">=\"" << _fromnum << "\")";
|
filter << '(' << DOC_CODNUM << "==\"" << _fromnum << "\")";
|
||||||
}
|
}
|
||||||
if (_tonum.not_empty())
|
else
|
||||||
{
|
{
|
||||||
if (filter.not_empty()) filter << "&&";
|
if (_fromnum.not_empty())
|
||||||
filter << '(' << DOC_CODNUM << "<=\"" << _tonum << "\")";
|
{
|
||||||
|
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())
|
if (_tipodoc.not_empty())
|
||||||
{
|
{
|
||||||
@ -1310,43 +1331,29 @@ void TStampa_schede::main_loop()
|
|||||||
curagenti.freeze();
|
curagenti.freeze();
|
||||||
const TRectype& recagenti = curagenti.curr();
|
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
|
// Crea la lista degli agenti da stampare
|
||||||
TAssoc_array cia;
|
TAssoc_array cia;
|
||||||
|
|
||||||
TRelation rel(LF_DOC);
|
|
||||||
TRectype darec(LF_DOC), arec(LF_DOC);
|
TRectype darec(LF_DOC), arec(LF_DOC);
|
||||||
|
|
||||||
/*
|
|
||||||
int key = 0;
|
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())
|
if (_fromdate.ok() || _todate.ok())
|
||||||
{
|
{
|
||||||
key = 3;
|
key = 3;
|
||||||
|
filterage << "&&(" << DOC_TIPOCF << "=\"" << m.get_who() << "\")";
|
||||||
if (_fromdate.ok())
|
if (_fromdate.ok())
|
||||||
{
|
|
||||||
darec.put(DOC_DATADOC, _fromdate);
|
darec.put(DOC_DATADOC, _fromdate);
|
||||||
}
|
|
||||||
if (_todate.ok())
|
if (_todate.ok())
|
||||||
{
|
|
||||||
arec.put(DOC_DATADOC, _todate);
|
arec.put(DOC_DATADOC, _todate);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1354,39 +1361,62 @@ void TStampa_schede::main_loop()
|
|||||||
darec.put(DOC_TIPOCF, m.get_who());
|
darec.put(DOC_TIPOCF, m.get_who());
|
||||||
arec.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)
|
for (curagenti = 0L; curagenti.pos() < ages && !cancel; ++curagenti)
|
||||||
{
|
{
|
||||||
_totage.destroy(); // Azzera totali agente
|
_curagente = recagenti.get(AGE_CODAGE);
|
||||||
TString filterage(filter);
|
TAssoc_array* sel = (TAssoc_array*)cia.objptr(_curagente);
|
||||||
if (filterage.not_empty()) filterage << "&&";
|
if (sel != NULL)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
|
_totage.destroy(); // Azzera totali agente
|
||||||
|
|
||||||
clifosheet.uncheck(-1);
|
clifosheet.uncheck(-1);
|
||||||
cur.freeze();
|
FOR_EACH_ASSOC_STRING((*sel), h, k, s)
|
||||||
for (cur = 0; cur.pos() < docs; ++cur)
|
|
||||||
{
|
{
|
||||||
const TString16 codcf = cur.curr().get(DOC_CODCF);
|
const long i = clifo2index(clifosheet, atol(k));
|
||||||
if (all || selection.is_key(codcf))
|
if (i >= 0)
|
||||||
{
|
clifosheet.check(i);
|
||||||
long i = clifo2index(clifosheet, atol(codcf));
|
|
||||||
if (i >= 0)
|
|
||||||
clifosheet.check(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cur.freeze(FALSE);
|
|
||||||
if (clifosheet.one_checked())
|
|
||||||
{
|
|
||||||
_curagente = recagenti.get(AGE_CODAGE);
|
|
||||||
_curagente << ' ' << recagenti.get(AGE_RAGSOC);
|
|
||||||
cancel = !stampa_selezione(clifocur, clifosheet, filterage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"
|
#include "sv1100a.h"
|
||||||
|
|
||||||
USE 5 KEY 2
|
USE 5 KEY 2
|
||||||
JOIN LF_AGENTI INTO CODAGE=S4
|
JOIN LF_AGENTI INTO CODAGE==S4
|
||||||
JOIN LF_ANAMAG INTO CODART=S0[1,20]
|
JOIN LF_ANAMAG INTO CODART==S0[1,20]
|
||||||
JOIN LF_CLIFO INTO CODCF=S8|CODCF=I8
|
JOIN LF_CLIFO INTO TIPOCF==S8|CODCF=I8
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user