Stampa EC
git-svn-id: svn://10.65.10.50/trunk@2210 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
20e3b7e767
commit
6aa058cf83
132
sc/sc2100.cpp
132
sc/sc2100.cpp
@ -9,28 +9,92 @@
|
||||
|
||||
#include <clifo.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TEC_row
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TEC_row : public TSortable
|
||||
{
|
||||
TString _causale;
|
||||
TString _desc_causale;
|
||||
TDate _data_doc;
|
||||
TString _num_doc;
|
||||
long _num_prot;
|
||||
TImporto _totale_doc;
|
||||
TDate _data_scad;
|
||||
TImporto _importo;
|
||||
TValuta _valuta;
|
||||
|
||||
protected: // TSortable
|
||||
virtual int compare(const TSortable& s) const;
|
||||
|
||||
public:
|
||||
TEC_row(const TRectype& rec);
|
||||
virtual ~TEC_row() {}
|
||||
};
|
||||
|
||||
TEC_row::TEC_row(const TRectype& rec)
|
||||
{
|
||||
if (rec.logicnum() == LF_SCAD)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Totalizzatore
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TTotal : TAssoc_array
|
||||
{
|
||||
public:
|
||||
void add(const char* val, const TImporto& imp);
|
||||
|
||||
TTotal();
|
||||
virtual ~TTotal() { }
|
||||
};
|
||||
|
||||
void TTotal::add(const char* val, const TImporto& imp)
|
||||
{
|
||||
TObject* obj = objptr(val);
|
||||
if (obj)
|
||||
{
|
||||
TImporto& tot = (TImporto&)*obj;
|
||||
tot += imp;
|
||||
}
|
||||
else
|
||||
{
|
||||
add(val, imp);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Form speciale per estratti conto
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TEC_form : public TForm
|
||||
{
|
||||
{
|
||||
static TEC_form* _form;
|
||||
|
||||
TCursor* _cursore;
|
||||
TTotal _totali;
|
||||
|
||||
protected:
|
||||
static TEC_form& form() { return *_form; }
|
||||
static void ec_header_handler(TPrinter& p);
|
||||
static void ec_footer_handler(TPrinter& p);
|
||||
|
||||
public:
|
||||
long move_cursor(char tipocf, long clifo);
|
||||
long move_cursor(const TRectype& rec);
|
||||
|
||||
TEC_form(const char* codice, TCursor* cursor);
|
||||
virtual ~TEC_form();
|
||||
};
|
||||
|
||||
TEC_form* TEC_form::_form = NULL;
|
||||
|
||||
void TEC_form::ec_header_handler(TPrinter& pr)
|
||||
{
|
||||
TPrint_section& head = section('H', 1);
|
||||
TPrint_section& head = form().section('H', 1);
|
||||
|
||||
head.reset();
|
||||
pr.resetheader();
|
||||
@ -46,18 +110,17 @@ void TEC_form::ec_footer_handler(TPrinter& p)
|
||||
TRACE("Stamperei un footer");
|
||||
}
|
||||
|
||||
long TEC_form::move_cursor(char tipocf, long clifo)
|
||||
long TEC_form::move_cursor(const TRectype& rec)
|
||||
{
|
||||
TRectype& cli = cursor()->file().curr();
|
||||
cli.put(CLI_TIPOCF, tipocf);
|
||||
cli.put(CLI_CODCF, clifo);
|
||||
const long rec = cursor()->read();
|
||||
return rec;
|
||||
cursor()->file().curr() = rec;
|
||||
const long r = cursor()->read();
|
||||
return r;
|
||||
}
|
||||
|
||||
TEC_form::TEC_form(const char* codice, TCursor* cur)
|
||||
: TForm(BASE_EC_PROFILE, codice)
|
||||
{
|
||||
{
|
||||
_form = this;
|
||||
_cursore = cur;
|
||||
|
||||
TPrinter& pr = printer();
|
||||
@ -71,8 +134,10 @@ TEC_form::TEC_form(const char* codice, TCursor* cur)
|
||||
|
||||
TEC_form::~TEC_form()
|
||||
{
|
||||
printer().setheaderhandler(NULL);
|
||||
printer().setfooterhandler(NULL);
|
||||
TPrinter& pr = printer();
|
||||
pr.setheaderhandler(NULL);
|
||||
pr.setfooterhandler(NULL);
|
||||
_form = NULL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -104,7 +169,7 @@ public:
|
||||
|
||||
bool select_ec(); // starting point
|
||||
bool print_selected(); // print selected items
|
||||
bool print_ec(char tipocf, long clifo); // print one item
|
||||
bool print_ec(); // print one item
|
||||
|
||||
TStampaEC_application();
|
||||
virtual ~TStampaEC_application() {}
|
||||
@ -128,20 +193,20 @@ bool TStampaEC_application::select_ec()
|
||||
|
||||
bool TStampaEC_application::print_selected()
|
||||
{
|
||||
TCursor_sheet& c = sheet();
|
||||
const char who = mask().get_who(); // Tipo clienti/fornitori
|
||||
const int key = mask().get_key(); // Tipo di ordinamento
|
||||
const long print_all = !c.one_checked(); // Se non ho selezionato nulla allora li stampo tutti
|
||||
TCursor_sheet& s = sheet();
|
||||
const long print_all = !s.one_checked(); // Se non ho selezionato nulla allora li stampo tutti
|
||||
long analfabeti = 0; // Persone non stampate in quanto aventi lingua errata
|
||||
|
||||
printer().open();
|
||||
|
||||
TCursor& c = *s.cursor();
|
||||
const long items = c.items();
|
||||
for (int i = 0; i < items; i++) if (print_all || c.checked(i))
|
||||
{
|
||||
TToken_string& t = c.row(i);
|
||||
const long clifo = t.get_long(key);
|
||||
const bool ok = print_ec(who, clifo);
|
||||
for (long i = 0; i < items; i++) if (print_all || s.checked(i))
|
||||
{
|
||||
c = i;
|
||||
form().move_cursor(c.file().curr());
|
||||
|
||||
const bool ok = print_ec();
|
||||
if (!ok) analfabeti++;
|
||||
}
|
||||
|
||||
@ -154,10 +219,9 @@ bool TStampaEC_application::print_selected()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TStampaEC_application::print_ec(char tipocf, long clifo)
|
||||
bool TStampaEC_application::print_ec()
|
||||
{
|
||||
TEC_form& f = form();
|
||||
f.move_cursor(tipocf, clifo);
|
||||
|
||||
const TRectype& clf = f.cursor()->file().curr();
|
||||
const TString lincf(clf.get(CLI_CODLIN));
|
||||
@ -170,8 +234,26 @@ bool TStampaEC_application::print_ec(char tipocf, long clifo)
|
||||
|
||||
if (!ok) // Cliente analfabeta
|
||||
return FALSE;
|
||||
|
||||
TRectype filter(LF_PARTITE);
|
||||
filter.put(PART_TIPOCF, clf.get(CLI_TIPOCF));
|
||||
filter.put(PART_SOTTOCONTO, clf.get(CLI_CODCF));
|
||||
|
||||
TLocalisamfile& partite = f.cursor()->file(LF_PARTITE);
|
||||
for (int err = partite.read();
|
||||
err == NOERR && partite.curr() == filter;
|
||||
err = partite.read(_isgreat))
|
||||
{
|
||||
TPartita game(partite.curr());
|
||||
for (int r = game.last(); r > 0; r = game.pred(r))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
partite.put(PART_NUMRIG, 9999);
|
||||
}
|
||||
|
||||
printer().formfeed();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,8 @@ BEGIN
|
||||
INPUT CODPROF[5,5] F_LINPROF
|
||||
DISPLAY "Codice" CODPROF
|
||||
DISPLAY "Descrizione@50" DESC
|
||||
OUTPUT F_CODPROF CODPROF
|
||||
OUTPUT F_LINPROF F_CODPROF
|
||||
OUTPUT F_CODPROF CODPROF[1,4]
|
||||
OUTPUT F_LINPROF CODPROF[5,5]
|
||||
OUTPUT F_DESPROF DESC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
@ -68,6 +68,7 @@ END
|
||||
DATE F_DATALIMSC
|
||||
BEGIN
|
||||
PROMPT 1 10 "Data limite scaduto "
|
||||
FLAGS "A"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
@ -79,8 +80,8 @@ END
|
||||
BOOLEAN F_STAMPCHIU
|
||||
BEGIN
|
||||
PROMPT 1 12 "Stampa partite chiuse"
|
||||
MESSAGE TRUE ENABLE,F_DATACHIU
|
||||
MESSAGE FALSE DISABLE,F_DATACHIU
|
||||
MESSAGE TRUE ENABLE,F_DATACHIU
|
||||
END
|
||||
|
||||
DATE F_DATACHIU
|
||||
|
Loading…
x
Reference in New Issue
Block a user