Stampa EC

git-svn-id: svn://10.65.10.50/trunk@2210 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-11-27 13:51:46 +00:00
parent 20e3b7e767
commit 6aa058cf83
2 changed files with 111 additions and 28 deletions

View File

@ -9,28 +9,92 @@
#include <clifo.h> #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 // Form speciale per estratti conto
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class TEC_form : public TForm class TEC_form : public TForm
{ {
static TEC_form* _form;
TCursor* _cursore; TCursor* _cursore;
TTotal _totali;
protected: protected:
static TEC_form& form() { return *_form; }
static void ec_header_handler(TPrinter& p); static void ec_header_handler(TPrinter& p);
static void ec_footer_handler(TPrinter& p); static void ec_footer_handler(TPrinter& p);
public: public:
long move_cursor(char tipocf, long clifo); long move_cursor(const TRectype& rec);
TEC_form(const char* codice, TCursor* cursor); TEC_form(const char* codice, TCursor* cursor);
virtual ~TEC_form(); virtual ~TEC_form();
}; };
TEC_form* TEC_form::_form = NULL;
void TEC_form::ec_header_handler(TPrinter& pr) void TEC_form::ec_header_handler(TPrinter& pr)
{ {
TPrint_section& head = section('H', 1); TPrint_section& head = form().section('H', 1);
head.reset(); head.reset();
pr.resetheader(); pr.resetheader();
@ -46,18 +110,17 @@ void TEC_form::ec_footer_handler(TPrinter& p)
TRACE("Stamperei un footer"); 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(); cursor()->file().curr() = rec;
cli.put(CLI_TIPOCF, tipocf); const long r = cursor()->read();
cli.put(CLI_CODCF, clifo); return r;
const long rec = cursor()->read();
return rec;
} }
TEC_form::TEC_form(const char* codice, TCursor* cur) TEC_form::TEC_form(const char* codice, TCursor* cur)
: TForm(BASE_EC_PROFILE, codice) : TForm(BASE_EC_PROFILE, codice)
{ {
_form = this;
_cursore = cur; _cursore = cur;
TPrinter& pr = printer(); TPrinter& pr = printer();
@ -71,8 +134,10 @@ TEC_form::TEC_form(const char* codice, TCursor* cur)
TEC_form::~TEC_form() TEC_form::~TEC_form()
{ {
printer().setheaderhandler(NULL); TPrinter& pr = printer();
printer().setfooterhandler(NULL); pr.setheaderhandler(NULL);
pr.setfooterhandler(NULL);
_form = NULL;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -104,7 +169,7 @@ public:
bool select_ec(); // starting point bool select_ec(); // starting point
bool print_selected(); // print selected items bool print_selected(); // print selected items
bool print_ec(char tipocf, long clifo); // print one item bool print_ec(); // print one item
TStampaEC_application(); TStampaEC_application();
virtual ~TStampaEC_application() {} virtual ~TStampaEC_application() {}
@ -128,20 +193,20 @@ bool TStampaEC_application::select_ec()
bool TStampaEC_application::print_selected() bool TStampaEC_application::print_selected()
{ {
TCursor_sheet& c = sheet(); TCursor_sheet& s = sheet();
const char who = mask().get_who(); // Tipo clienti/fornitori const long print_all = !s.one_checked(); // Se non ho selezionato nulla allora li stampo tutti
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
long analfabeti = 0; // Persone non stampate in quanto aventi lingua errata long analfabeti = 0; // Persone non stampate in quanto aventi lingua errata
printer().open(); printer().open();
TCursor& c = *s.cursor();
const long items = c.items(); const long items = c.items();
for (int i = 0; i < items; i++) if (print_all || c.checked(i)) for (long i = 0; i < items; i++) if (print_all || s.checked(i))
{ {
TToken_string& t = c.row(i); c = i;
const long clifo = t.get_long(key); form().move_cursor(c.file().curr());
const bool ok = print_ec(who, clifo);
const bool ok = print_ec();
if (!ok) analfabeti++; if (!ok) analfabeti++;
} }
@ -154,10 +219,9 @@ bool TStampaEC_application::print_selected()
return TRUE; return TRUE;
} }
bool TStampaEC_application::print_ec(char tipocf, long clifo) bool TStampaEC_application::print_ec()
{ {
TEC_form& f = form(); TEC_form& f = form();
f.move_cursor(tipocf, clifo);
const TRectype& clf = f.cursor()->file().curr(); const TRectype& clf = f.cursor()->file().curr();
const TString lincf(clf.get(CLI_CODLIN)); const TString lincf(clf.get(CLI_CODLIN));
@ -170,8 +234,26 @@ bool TStampaEC_application::print_ec(char tipocf, long clifo)
if (!ok) // Cliente analfabeta if (!ok) // Cliente analfabeta
return FALSE; 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; return TRUE;
} }

View File

@ -34,8 +34,8 @@ BEGIN
INPUT CODPROF[5,5] F_LINPROF INPUT CODPROF[5,5] F_LINPROF
DISPLAY "Codice" CODPROF DISPLAY "Codice" CODPROF
DISPLAY "Descrizione@50" DESC DISPLAY "Descrizione@50" DESC
OUTPUT F_CODPROF CODPROF OUTPUT F_CODPROF CODPROF[1,4]
OUTPUT F_LINPROF F_CODPROF OUTPUT F_LINPROF CODPROF[5,5]
OUTPUT F_DESPROF DESC OUTPUT F_DESPROF DESC
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END
@ -68,6 +68,7 @@ END
DATE F_DATALIMSC DATE F_DATALIMSC
BEGIN BEGIN
PROMPT 1 10 "Data limite scaduto " PROMPT 1 10 "Data limite scaduto "
FLAGS "A"
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END
@ -79,8 +80,8 @@ END
BOOLEAN F_STAMPCHIU BOOLEAN F_STAMPCHIU
BEGIN BEGIN
PROMPT 1 12 "Stampa partite chiuse" PROMPT 1 12 "Stampa partite chiuse"
MESSAGE TRUE ENABLE,F_DATACHIU
MESSAGE FALSE DISABLE,F_DATACHIU MESSAGE FALSE DISABLE,F_DATACHIU
MESSAGE TRUE ENABLE,F_DATACHIU
END END
DATE F_DATACHIU DATE F_DATACHIU