Modificata la stampa dello scadenzario. Aggiunta la possibilita' di

usare una TSelection_mask derivata, per effettuare la selezione anche
sul piano dei conti. Analogamente per sc2300 (stampa scaduto).
La TSelection_ext_mask e' stata messa in sc2201.h e sc2201.cpp, mentre
il TCursor_sheet_recno, da usare nei filtri, e' stato spostato in
scselect.cpp e scselect.h.


git-svn-id: svn://10.65.10.50/trunk@2225 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1995-12-01 16:40:11 +00:00
parent 2b33f854d2
commit 94be0ac694
5 changed files with 1172 additions and 776 deletions

File diff suppressed because it is too large Load Diff

@ -1,13 +1,11 @@
#include "scselmsk.h"
#define F_DATASTAMPA 101
#define F_DATASCADENZAI 102
#define F_DATASCADENZAF 103
#define F_RATESALDATE 104
#define F_ORDDATA 105
#define F_VALUTA 106
#define F_TIPO 107
#define F_ORDINE 108
#define SC21_BUT_SEL 109
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_DATASTAMPA 103
#define F_DATASCADENZAI 104
#define F_DATASCADENZAF 105
#define F_RATESALDATE 106
#define F_ORDDATA 107
#define F_VALUTA 108

@ -1,10 +1,142 @@
#include "sc2200.h"
PAGE "Stampa Scadenziario" -1 -1 74 12
PAGE "Stampa Scadenziario" -1 -1 68 17
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 1 "Cod. "
FLAGS "DFR"
USE LF_NDITTE
INPUT CODDITTA F_CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE REQUIRED
END
STRING F_RAGSOC 50 46
BEGIN
PROMPT 13 1 "R.S. "
FLAGS "D"
END
BUTTON SC_SELECT 10 1
BEGIN
PROMPT 51 3 "~Selezione"
END
BUTTON SC_RESET 10 1
BEGIN
PROMPT 51 4 "~Azzera"
END
RADIOBUTTON SC_CLIFO 20
BEGIN
PROMPT 1 2 "Selezione"
ITEM "C|Clienti" MESSAGE HIDE,2@|SHOW,1@
ITEM "F|Fornitori" MESSAGE HIDE,2@|SHOW,1@
ITEM "P|Conti" MESSAGE HIDE,1@|SHOW,2@
END
RADIOBUTTON SC_SORTCF 20
BEGIN
GROUP 1
PROMPT 25 2 "Ordinamento"
ITEM "1|Per codice"
ITEM "2|Per ragione sociale"
END
RADIOBUTTON SC_SORTCFPCON 20
BEGIN
GROUP 2
PROMPT 25 2 "Ordinamento"
ITEM "1|Per conto"
ITEM "2|Per descrizione"
END
NUMBER SC_CFCODFR 5
BEGIN
PROMPT 1 7 "Da codice "
GROUP 1
END
NUMBER SC_CFCODTO 5
BEGIN
PROMPT 36 7 "a codice "
GROUP 1
END
NUMBER SC_PCONCODFR1 3
BEGIN
PROMPT 1 7 "Da conto "
GROUP 2
END
NUMBER SC_PCONCODFR2 3
BEGIN
PROMPT 16 7 ""
GROUP 2
END
NUMBER SC_PCONCODFR3 6
BEGIN
PROMPT 20 7 ""
GROUP 2
END
NUMBER SC_PCONCODTO1 3
BEGIN
PROMPT 31 7 "a conto "
GROUP 2
END
NUMBER SC_PCONCODTO2 3
BEGIN
PROMPT 43 7 ""
GROUP 2
END
NUMBER SC_PCONCODTO3 6
BEGIN
PROMPT 47 7 ""
GROUP 2
END
NUMBER SC_NSEL 3
BEGIN
PROMPT 60 7 "N. "
FLAGS "D"
END
BUTTON SC_CFBUTFR 2 1
BEGIN
PROMPT 31 7 ""
PICTURE 109
GROUP 1
END
BUTTON SC_CFBUTTO 2 1
BEGIN
PROMPT 51 7 ""
PICTURE 109
GROUP 1
END
BUTTON SC_PCONBUTFR 2 1
BEGIN
PROMPT 26 7 ""
PICTURE 109
GROUP 2
END
BUTTON SC_PCONBUTTO 2 1
BEGIN
PROMPT 53 7 ""
PICTURE 109
GROUP 2
END
DATE F_DATASTAMPA
BEGIN
PROMPT 2 2 "Data di stampa "
PROMPT 1 9 "Data di stampa "
HELP "Data di stampa dello scadenziario"
CHECKTYPE REQUIRED
WARNING "Si deve specificare la data di stampa dello scadenziario"
@ -13,7 +145,7 @@ END
DATE F_DATASCADENZAI
BEGIN
PROMPT 2 3 "Data di scadenza dal "
PROMPT 1 10 "Data di scadenza dal "
HELP "Data di inizio scadenza"
CHECKTYPE REQUIRED
WARNING "Data di inizio scadenza non valida"
@ -22,7 +154,7 @@ END
DATE F_DATASCADENZAF
BEGIN
PROMPT 39 3 "al "
PROMPT 39 10 "al "
HELP "Data di fine scadenza"
CHECKTYPE REQUIRED
VALIDATE DATE_CMP_FUNC >= F_DATASCADENZAI
@ -31,56 +163,36 @@ END
BOOLEAN F_RATESALDATE
BEGIN
PROMPT 2 4 "Stampa rate saldate"
PROMPT 1 11 "Stampa rate saldate"
HELP "Include le rate saldate nella stampa"
END
LISTBOX F_TIPO 14
BEGIN
PROMPT 2 6 "Tipo di stampa "
ITEM "T|Tutti"
MESSAGE DISABLE,F_ORDINE | "C",F_ORDINE | DISABLE,F_ORDDATA | "X",F_ORDDATA
ITEM "C|Clienti"
MESSAGE ENABLE,F_ORDINE | ENABLE, F_ORDDATA
ITEM "F|Fornitori"
MESSAGE ENABLE,F_ORDINE | ENABLE, F_ORDDATA
ITEM "A|Altri"
MESSAGE ENABLE,F_ORDINE | ENABLE, F_ORDDATA
HELP "Selezionare il tipo di stampa"
CHECKTYPE REQUIRED
WARNING "E' obbligatorio scegliere il tipo di stampa"
END
BOOLEAN F_ORDDATA
BEGIN
PROMPT 45 6 "Ordina per data"
PROMPT 1 12 "Ordina per data"
HELP "Selezionare se l'ordinamento primario deve essere secondo la data"
END
LISTBOX F_ORDINE 14
BOOLEAN F_VALUTA
BEGIN
PROMPT 2 7 "Ordine di stampa "
ITEM "C|Codice"
ITEM "D|Descrizione"
HELP "Selezionare l'ordinamento della stampa"
CHECKTYPE REQUIRED
WARNING "E' obbligatorio scegliere l'ordine di stampa"
PROMPT 1 13 "Stampa in valuta"
HELP "Selezionare se si vuole la stampa in valuta"
END
BUTTON SC21_BUT_SEL 10 2
GROUPBOX DLG_NULL 68 7
BEGIN
PROMPT -13 -1 "~Selezione"
PROMPT 0 8 ""
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -23 -1 ""
PROMPT -12 -1 ""
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -1 ""
PROMPT -22 -1 ""
END
ENDPAGE

@ -1,52 +1,334 @@
#ifndef __UTILITY_H
#include <utility.h>
#endif
#ifndef __PCONTI_H
#include <pconti.h>
#endif
#include "sc2201.h"
///////////////////////////////////////////////////////////////////////////////
// TCursor_sheet_RecNo //
// TSelection_ext_mask //
///////////////////////////////////////////////////////////////////////////////
TCursor_sheet_RecNo::TCursor_sheet_RecNo(TCursor * cursor, const char* fields,
const char * title, const char * head, byte buttons)
: TCursor_sheet(cursor, fields, title, head, buttons)
{
_recnos.reset();
}
TSelection_ext_mask::TSelection_ext_mask(const char* name) : TSelection_mask(name),
_pcon_rel(NULL), _pcon_cur_k1(NULL), _pcon_cur_k2(NULL), _pcon_sh_k1(NULL), _pcon_sh_k2(NULL)
{
_pcon_rel = new TRelation(LF_PCON);
_pcon_cur_k1 = new TCursor(_pcon_rel, "", 1);
_pcon_cur_k2 = new TCursor(_pcon_rel, "", 2);
_pcon_sh_k1 = new TCursor_sheet_recno(_pcon_cur_k1, " |GRUPPO|CONTO|SOTTOCONTO|DESCR", "Selezione conti per gruppo/conto/sottoconto",
"@1|Gruppo|Conto|Sottoconto|Descrizione@50");
_pcon_sh_k2 = new TCursor_sheet_recno(_pcon_cur_k2, " |DESCR|GRUPPO|CONTO|SOTTOCONTO", "Selezione conti per descrizione",
"@1|Descrizione@50|Gruppo|Conto|Sottoconto");
bool TCursor_sheet_RecNo::on_key(KEY k)
{
switch(k)
{
case K_SPACE:
{
*cursor() = selected(); // Posiziona il cursore
rec_check(cursor()->file().recno(), !checked(selected()));
break;
}
case K_F2:
rec_uncheck(-1);
break;
case K_F3:
rec_check(-1);
break;
default:
break;
}
return TCursor_sheet::on_key(k);
set_handler(SC_CLIFO, rpcon_handler); // Redefined handler...
set_handler(SC_SORTCFPCON,rsortpcon_handler); // Redefined handler...
set_handler(SC_PCONBUTFR, bfrompcon_handler); // New handler...
set_handler(SC_PCONBUTTO, btopcon_handler); // New handler...
set_handler(SC_SELECT, bselectpcon_handler); // Redefined handler...
set_handler(SC_RESET, bresetpcon_handler); // Redefined handler...
set_handler(SC_PCONCODFR3, ffrompcon_handler); // New handler...
set_handler(SC_PCONCODTO3, ftopcon_handler); // New handler...
}
void TCursor_sheet_RecNo::rec_check(long n, bool on)
TSelection_ext_mask::~TSelection_ext_mask()
{
if (n < 0)
delete _pcon_sh_k2;
delete _pcon_sh_k1;
delete _pcon_cur_k2;
delete _pcon_cur_k1;
delete _pcon_rel;
}
TCursor_sheet_recno& TSelection_ext_mask::cur_sheet()
{
TCursor_sheet_recno* cs;
if (get_key() == 1) cs = get_who() == 'P' ? _pcon_sh_k1 : NULL;
else cs = get_who() == 'P' ? _pcon_sh_k2 : NULL;
if (get_who() != 'P')
return TSelection_mask::cur_sheet();
CHECK(cs, "Can't use a NULL TCursor_sheet_recno");
return *cs;
}
void TSelection_ext_mask::reset_sheets()
{
_pcon_sh_k1->uncheck(-1);
_pcon_sh_k1->rec_uncheck(-1);
_pcon_sh_k2->uncheck(-1);
_pcon_sh_k2->rec_uncheck(-1);
TSelection_mask::reset_sheets();
reset(SC_PCONCODFR1);
reset(SC_PCONCODFR2);
reset(SC_PCONCODFR3);
reset(SC_PCONCODTO1);
reset(SC_PCONCODTO2);
reset(SC_PCONCODTO3);
}
void TSelection_ext_mask::select_pcon_range(int grf, int cof,long sof,int grt,int cot, long sot)
{
TCursor_sheet_recno& c = cur_sheet();
const long items = c.items();
const int key = get_key();
long nsel = get_long(SC_NSEL);
TCursor* crs = c.cursor();
TRectype& rec = crs->file().curr();
rec.zero();
rec.put(PCN_GRUPPO,grf);
rec.put(PCN_CONTO,cof);
rec.put(PCN_SOTTOCONTO,sof);
const TRecnotype start = crs->read(_isgteq);
grf = rec.get_int(PCN_GRUPPO);
cof = rec.get_int(PCN_CONTO);
sof = rec.get_long(PCN_SOTTOCONTO);
rec.zero();
if (grt==0 && cot==0 && sot==0)
{
TToken_string& t = c.row(items-1);
grt = t.get_int(key);
cot = t.get_int(key+1);
sot = t.get_long(key+2);
}
rec.put("GRUPPO",grt);
rec.put("CONTO",cot);
rec.put("SOTTOCONTO",sot);
TRectype recx(rec);
TRecnotype end = crs->read(_isgteq);
if (rec != recx)
{
if (on)
end--;
(*crs)-=1;
}
grt = rec.get_int(PCN_GRUPPO);
cot = rec.get_int(PCN_CONTO);
sot = rec.get_long(PCN_SOTTOCONTO);
for (long i = start; i <= end; i++)
{
if (!c.checked(i))
{
_recnos.set(items()-1); // Force the size of Bit_array
_recnos.set();
}
else
_recnos.reset();
}
else
_recnos.set(n, on);
c.check(i);
c.rec_check(i);
nsel++;
}
}
set(SC_PCONCODFR1, grf);
set(SC_PCONCODFR2, cof);
set(SC_PCONCODFR3, sof);
set(SC_PCONCODTO1, grt);
set(SC_PCONCODTO2, cot);
set(SC_PCONCODTO3, sot);
set(SC_NSEL, nsel);
}
void TSelection_ext_mask::set_pcon_limits()
{
int gf=0,gl=0,cf=0,cl=0;
long sf=0,sl=0;
TCursor_sheet_recno& c = cur_sheet();
const long items = c.items();
const int key = get_key();
bool found = FALSE;
for (long i = 0; i < items && !found; i++)
if (c.checked(i))
{
TToken_string& t = c.row(i);
gf = t.get_int(key);
cf = t.get_int(key+1);
sf = t.get_long(key+2);
found = TRUE;
}
if (found) //Optimization... If nothing was found previously skip this test.
{
found = FALSE;
for (long j = (items-1); j >= 0 && !found; j--)
{
if (c.checked(j))
{
TToken_string& t = c.row(j);
gl = t.get_int(key);
cl = t.get_int(key+1);
sl = t.get_long(key+2);
found = TRUE;
}
}
}
if (gf > gl || (gf==gl && cf > cl) || (gf==gl && cf==cl && sf>sl))
{
int t1 = gf,t2 = cf;long t3 = sf;
gf=gl;cf=cl;sf=sl;
gl=t1;cl=t2;sl=t3;
}
set(SC_PCONCODFR1, gf);
set(SC_PCONCODFR2, cf);
set(SC_PCONCODFR3, sf);
set(SC_PCONCODTO1, gl);
set(SC_PCONCODTO2, cl);
set(SC_PCONCODTO3, sl);
set(SC_NSEL, c.checked());
}
bool TSelection_ext_mask::bfrompcon_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
TCursor_sheet_recno& c = m.cur_sheet();
const int key = m.get_key();
c.disable_check();
if (c.run() == K_ENTER)
{
TToken_string& t = c.row(c.selected());
int grf,grt,cof,cot;
long sof,sot;
grf =t.get_int(key);
cof =t.get_int(key+1);
sof =t.get_long(key+2);
grt = m.get_int(SC_PCONCODTO1);
cot = m.get_int(SC_PCONCODTO2);
sot = m.get_long(SC_PCONCODTO3);
m.set(SC_PCONCODFR1, grf);
m.set(SC_PCONCODFR2, cof);
m.set(SC_PCONCODFR3, sof);
m.select_pcon_range(grf,cof,sof,grt,cot,sot);
}
}
return TRUE;
}
bool TSelection_ext_mask::btopcon_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
TCursor_sheet_recno& c = m.cur_sheet();
const int key = m.get_key();
c.disable_check();
if (c.run() == K_ENTER)
{
TToken_string& t = c.row(c.selected());
int grf,grt,cof,cot;
long sof,sot;
grt =t.get_int(key);
cot =t.get_int(key+1);
sot =t.get_long(key+2);
grf = m.get_int(SC_PCONCODTO1);
cof = m.get_int(SC_PCONCODTO2);
sof = m.get_long(SC_PCONCODTO3);
m.set(SC_PCONCODFR1, grt);
m.set(SC_PCONCODFR2, cot);
m.set(SC_PCONCODFR3, sot);
m.select_pcon_range(grf,cof,sof,grt,cot,sot);
}
}
return TRUE;
}
bool TSelection_ext_mask::ffrompcon_handler(TMask_field& f, KEY k)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
if (k == K_TAB && f.focusdirty())
{
int grf,grt,cof,cot;
long sof,sot;
grf = m.get_int(SC_PCONCODFR1);
cof = m.get_int(SC_PCONCODFR2);
sof = m.get_long(SC_PCONCODFR3);
grt = m.get_int(SC_PCONCODTO1);
cot = m.get_int(SC_PCONCODTO2);
sot = m.get_long(SC_PCONCODTO3);
m.select_pcon_range(grf,cof,sof,grt,cot,sot);
}
else
if (k == K_F9)
{
TMask_field& f = m.field(SC_PCONBUTFR);
f.on_hit();
}
return TRUE;
}
bool TSelection_ext_mask::ftopcon_handler(TMask_field& f, KEY k)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
if (k == K_TAB && f.focusdirty())
{
int grf,grt,cof,cot;
long sof,sot;
grf = m.get_int(SC_PCONCODFR1);
cof = m.get_int(SC_PCONCODFR2);
sof = m.get_long(SC_PCONCODFR3);
grt = m.get_int(SC_PCONCODTO1);
cot = m.get_int(SC_PCONCODTO2);
sot = m.get_long(SC_PCONCODTO3);
m.select_pcon_range(grf,cof,sof,grt,cot,sot);
}
else
if (k == K_F9)
{
TMask_field& f = m.field(SC_PCONBUTTO);
f.on_hit();
}
return TRUE;
}
bool TSelection_ext_mask::bresetpcon_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
m.reset_sheets();
}
return TRUE;
}
bool TSelection_ext_mask::bselectpcon_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
TCursor_sheet_recno& c = m.cur_sheet();
c.enable_check();
c.run();
if (m.get_who() =='P')
m.set_pcon_limits();
else
m.set_clifo_limits();
}
return TRUE;
}
bool TSelection_ext_mask::rpcon_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
m.set_who(f.get()[0]);
m.reset_sheets();
}
return TRUE;
}
bool TSelection_ext_mask::rsortpcon_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSelection_ext_mask& m = (TSelection_ext_mask&)f.mask();
m.set_key(atoi(f.get()));
m.reset_sheets();
}
return TRUE;
}

@ -1,32 +1,38 @@
#ifndef __RELATION_H
#include <relation.h>
#ifndef __SC2201_H
#define __SC2201_H
#ifndef __SCSELECT_H
#include "scselect.h"
#endif
#ifndef __UTILITY_H
#include <utility.h>
#endif
#ifndef __EXPR_H
#include <expr.h>
#endif
#ifndef __SHEET_H
#include <sheet.h>
#endif
class TCursor_sheet_RecNo : public TCursor_sheet
class TSelection_ext_mask : public TSelection_mask
{
TBit_array _recnos;
TRelation* _pcon_rel;
TCursor* _pcon_cur_k1;
TCursor* _pcon_cur_k2;
TCursor_sheet_recno* _pcon_sh_k1;
TCursor_sheet_recno* _pcon_sh_k2;
protected:
void select_pcon_range(int grf, int cof,long sof,int grt,int cot, long sot);
void set_pcon_limits();
protected:
virtual bool on_key(KEY k);
public:
TCursor_sheet_RecNo(TCursor * cursor, const char* fields,
const char * title, const char * head, byte buttons = 0);
virtual ~TCursor_sheet_RecNo() {}
bool rec_checked(TRecnotype n) { return _recnos[n]; }
void rec_check(TRecnotype n, bool on = TRUE) ;
void rec_uncheck(TRecnotype n) { rec_check(n,FALSE); }
virtual void reset_sheets();
static bool bfrompcon_handler(TMask_field& f, KEY k);
static bool btopcon_handler(TMask_field& f, KEY k);
static bool ffrompcon_handler(TMask_field& f, KEY k);
static bool ftopcon_handler(TMask_field& f, KEY k);
static bool bresetpcon_handler(TMask_field& f, KEY k);
static bool bselectpcon_handler(TMask_field& f, KEY k);
static bool rpcon_handler(TMask_field& f, KEY k);
static bool rsortpcon_handler(TMask_field& f, KEY k);
public:
virtual TCursor_sheet_recno& cur_sheet();
TSelection_ext_mask(const char* name);
virtual ~TSelection_ext_mask();
};
#endif