Corretta gestione campo DATAPAG e continuata stampa Estratti conto

git-svn-id: svn://10.65.10.50/trunk@2222 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-12-01 11:49:57 +00:00
parent dd53428762
commit 754fcfa868
8 changed files with 826 additions and 876 deletions

View File

@ -1,448 +1,53 @@
#include <applicat.h> #include <stdarg.h>
#include <config.h>
#include <form.h>
#include <printer.h>
#include <urldefid.h>
#include "saldacon.h" #include <mask.h>
#include "sc2.h" #include <urldefid.h>
#include "sc2101.h"
#include <clifo.h> #include "sc0100.h"
/////////////////////////////////////////////////////////// bool TSaldaconto_app::create()
// TDecoder {
/////////////////////////////////////////////////////////// open_files(LF_PARTITE, LF_SCADENZE, LF_PAGSCA, 0);
_msk = new TMask("sc0100a");
class TDecoder : private TAssoc_array
{
TLocalisamfile* _file;
const TString _ifield;
const TString _ofield;
public:
const TString& decode(const char* code);
TDecoder(int logicnum, const char* ifield, const char* ofield);
TDecoder(const char* table);
virtual ~TDecoder();
};
TDecoder::TDecoder(int logicnum, const char* ifield, const char* ofield)
: _file(new TLocalisamfile(logicnum)), _ifield(ifield), _ofield(ofield)
{
}
TDecoder::TDecoder(const char* table)
: _file(new TTable(table)), _ifield("CODTAB") , _ofield("S0")
{
}
const TString& TDecoder::decode(const char* code)
{
const TObject* obj = objptr(code);
if (obj == NULL)
{
_file->set_key(1);
_file->put(_ifield, code);
const int err = _file->read();
CHECKS(err == NOERR, "Can't decode ", code);
obj = new TString(_file->get(_ofield));
add(code, obj);
}
const TString& s = (const TString&)*obj;
return s;
}
///////////////////////////////////////////////////////////
// TEC_row
///////////////////////////////////////////////////////////
class TEC_row : public TSortable
{
friend TEC_array;
TDate _data;
int _riga;
TString _causale;
TDate _data_doc;
TString _num_doc;
long _num_prot;
TImporto _totale_doc;
TImporto _importo;
TValuta _valuta;
protected: // TSortable
virtual int compare(const TSortable& s) const;
public:
TEC_row(int r, const TRiga_partite& row, TDecoder& causali);
virtual ~TEC_row() {}
};
int TEC_row::compare(const TSortable& s) const
{
const TEC_row& r = (const TEC_row&)s;
int c = 0;
if (_data = r._data)
c = _riga - r._riga;
else
c = _data > r._data ? +1 : -1;
return c;
}
TEC_row::TEC_row(int r, const TRiga_partite& row) : _riga(r)
{
ecr->_causale = row.get(PART_CODCAUS);
ecr->_data_doc = row.get_date(PART_DATADOC);
ecr->_num_doc = row.get(PART_NUMDOC);
ecr->_num_prot = row.get_long(PART_NUMPROT);
ecr->_valuta.get(row);
// ecr->_totale = ???
}
///////////////////////////////////////////////////////////
// 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;
TDecoder _causali;
TTotal _totali;
TArray _righe;
protected:
static TEC_form& form() { return *_form; }
static void ec_header_handler(TPrinter& p);
static void ec_footer_handler(TPrinter& p);
TTotal& totali() const { return _totali; }
void add_row(const TRiga_partite& r);
public:
long move_cursor(const TRectype& rec);
void print_game(const TPartita& game);
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 = form().section('H', 1);
form().totali().destroy();
head.reset();
pr.resetheader();
head.update();
for (word j = 0; j < head.height(); j++)
pr.setheaderline(j, head.row(j));
}
void TEC_form::ec_footer_handler(TPrinter& p)
{
TRACE("Stamperei un footer");
}
long TEC_form::move_cursor(const TRectype& rec)
{
cursor()->file().curr() = rec;
const long r = cursor()->read();
return r;
}
void TEC_form::add_row(const TRiga_partite& row)
{
if (row.is_fattura())
{
for (int r = row.rate(); r > 0; r--)
{
const TRiga_scadenze& rata = row.rata(r);
TEC_row* ecr = new TEC_row(_righe.items(), row);
ecr->_data = rata.get_date(SCAD_DATASCAD);
ecr->_importo.set(row.sezione(), rata.get_real(SCAD_IMPORTO));
_righe.add(ecr);
}
}
else
{
const TImporto importo(row.sezione(), row.get_real(PART_IMPORTO))
TEC_row* ecr = new TEC_row(_righe.items(), row);
ecr->_data = ecr->_data_doc; // ???
ecr->_importo = importo;
_righe.add(ecr);
const TImporto abbuoni(row.get_char(PART_SEZABB), row.get_real(PART_ABBUONI));
if (!abbuoni.is_zero())
{
ecr = new TEC_row(_righe.items(), row);
ecr->_data = ecr->_data_doc; // ???
ecr->_importo = abbuoni;
_righe.add(ecr);
}
const TImporto diffcam(row.get_char(PART_SEZDIFCAM), row.get_real(PART_DIFFCAM));
if (!diffcam.is_zero())
{
ecr = new TEC_row(_righe.items(), row);
ecr->_data = ecr->_data_doc; // ???
ecr->_importo = diffcam;
_righe.add(ecr);
}
}
}
void TEC_form::print_game(const TPartita& game)
{
_righe.destroy();
for (int r = game.last(); r > 0; r = game.pred(r))
add_row(game.riga(r));
_righe.sort();
TPrinter& pr = printer();
TPrintrow r;
for (int i = 0; i < _righe.items(); i++)
{
if (pr.rows_left() < 2)
pr.formfeed();
TEC_row& r = (TEC_row&)_righe[i];
const TValuta& valuta = r.valuta();
const TImporto& imp = r.importo();
totali().add(valuta.codice(), imp);
r.zero();
r.put("Importo riga ")
r.put(imp.valore.string());
pr.print(r)
}
r.zero();
r.put("Saldo partita");
pr.print(r);
pr.print(NULL);
}
TEC_form::TEC_form(const char* codice, TCursor* cur)
: TForm(BASE_EC_PROFILE, codice),
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
{
_form = this;
_cursore = cur;
TPrinter& pr = printer();
pr.setheaderhandler(ec_header_handler);
pr.headerlen(section('H', 1).height());
pr.setfooterhandler(ec_footer_handler);
pr.footerlen(section('F', 1).height());
}
TEC_form::~TEC_form()
{
TPrinter& pr = printer();
pr.setheaderhandler(NULL);
pr.setfooterhandler(NULL);
_form = NULL;
}
///////////////////////////////////////////////////////////
// Stampa estratti conto
///////////////////////////////////////////////////////////
class TStampaEC_application : public TApplication
{
TEC_mask* _msk;
TEC_form* _form;
TString _lingua;
TString _linprof;
bool _gesval;
protected: // TApplication
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual void on_firm_change();
public:
static TStampaEC_application& app() { return (TStampaEC_application&)main_app(); }
public:
TEC_mask& mask() { return *_msk; }
TCursor_sheet& sheet() { return _msk->cur_sheet(); }
TEC_form& form() { return *_form; }
bool select_ec(); // starting point
bool print_selected(); // print selected items
bool print_ec(); // print one item
TStampaEC_application();
virtual ~TStampaEC_application() {}
};
bool TStampaEC_application::select_ec()
{
TEC_mask& m = mask();
while (m.run() != K_ESC)
{
_linprof = m.get_prof_lang();
_form = new TEC_form(m.get_prof_code(), sheet().cursor());
_form->cursor().set_key(m.get_key());
print_selected();
delete _form;
_form = NULL;
}
return TRUE;
}
bool TStampaEC_application::print_selected()
{
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 (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++;
}
printer().close();
if (analfabeti > 0)
warning_box("%ld clienti/fornitori non sono stati stmapati in quanto "
"il codice lingua non corrispondeva al profilo di stampa", analfabeti);
return TRUE;
}
bool TStampaEC_application::print_ec()
{
TEC_form& f = form();
const TRectype& clf = f.cursor()->file().curr();
const TString lincf(clf.get(CLI_CODLIN));
bool ok = TRUE;
// make controllations per lingua profilo/CF
if ((_linprof == _lingua && !lincf.empty()) || _linprof != _lingua)
ok = lincf == _linprof;
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());
form().print_partita(game);
partite.put(PART_NUMRIG, 9999);
}
printer().formfeed();
return TRUE;
}
///////////////////////////////////////////////////////////
// Generic TApplication methods
///////////////////////////////////////////////////////////
bool TStampaEC_application::create()
{
TApplication::create();
_msk = new TEC_mask("sc2100a");
dispatch_e_menu(MENU_ITEM(1)); dispatch_e_menu(MENU_ITEM(1));
return TRUE; return TRUE;
} }
bool TStampaEC_application::destroy() bool TSaldaconto_app::destroy()
{ {
delete _msk; delete _msk;
return TApplication::destroy(); close_files();
return TRUE;
} }
void TStampaEC_application::on_firm_change() void TSaldaconto_app::open_files(int logicnum, ...)
{ {
TApplication::on_firm_change(); va_list marker;
TConfig c(CONFIG_DITTA, "cg"); va_start(marker, logicnum);
_lingua = c.get("CodLin"); while (logicnum > 0)
_gesval = c.get_bool("GesVal"); {
} CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
_file.add(new TLocalisamfile(logicnum), logicnum);
logicnum = va_arg(marker, int);
}
}
bool TStampaEC_application::menu(MENU_TAG m) void TSaldaconto_app::on_config_change()
{ {
select_ec(); TPartita::carica_allineamento();
return FALSE; }
}
TStampaEC_application::TStampaEC_application() bool TSaldaconto_app::menu(MENU_TAG)
: _lingua(1), _linprof(1), _msk(NULL), _form(NULL) {
{} TMask& m = curr_mask();
while (m.run() == K_ENTER)
int sc2100(int argc, char** argv) edit_partite(m);
{ return 0;
TStampaEC_application app; }
app.run(argc, argv, "Stampa Estratti Conto");
int sc0100(int argc, char* argv[])
{
TSaldaconto_app app;
app.run(argc, argv, "Gestione Saldaconto");
return 0; return 0;
} }

View File

@ -146,8 +146,8 @@ int TCreatepart_app::crea_partite(int anno_es, int anno_rif, bool check)
for (cur = 0; cur.pos() < items; ++cur) for (cur = 0; cur.pos() < items; ++cur)
{ {
const int gruppo = cur.curr().get_int(SLD_GRUPPO); const int gruppo = cur.curr().get_int(SLD_GRUPPO);
const int conto = cur.curr().get_int(SLD_CONTO); const int conto = cur.curr().get_int(SLD_CONTO);
const long sottoc = cur.curr().get_long(SLD_SOTTOCONTO); const long sottoc = cur.curr().get_long(SLD_SOTTOCONTO);
int indbil; int indbil;
const char cf = is_clifo(gruppo, conto, indbil); const char cf = is_clifo(gruppo, conto, indbil);
@ -202,6 +202,7 @@ int TCreatepart_app::crea_partite(int anno_es, int anno_rif, bool check)
TRiga_partite& riga = game.new_row(); TRiga_partite& riga = game.new_row();
riga.put(PART_DATAREG, _today); riga.put(PART_DATAREG, _today);
riga.put(PART_DATADOC, _today); riga.put(PART_DATADOC, _today);
riga.put(PART_DATAPAG, _today);
riga.put(PART_SEZ, saldo.sezione()); riga.put(PART_SEZ, saldo.sezione());
riga.put(PART_IMPORTO, saldo.valore()); riga.put(PART_IMPORTO, saldo.valore());
riga.put(PART_DESCR, cf == 'C' ? _desccl : _descfo); riga.put(PART_DESCR, cf == 'C' ? _desccl : _descfo);
@ -224,7 +225,6 @@ int TCreatepart_app::crea_partite(int anno_es, int anno_rif, bool check)
const int r = riga.get_int(PART_NRIGA); const int r = riga.get_int(PART_NRIGA);
TRectype& unas = game.unassigned().row(r, TRUE); TRectype& unas = game.unassigned().row(r, TRUE);
unas.put(PAGSCA_IMPORTO, saldo.valore()); unas.put(PAGSCA_IMPORTO, saldo.valore());
unas.put(PAGSCA_DATAPAG, _today);
unas.put(PAGSCA_ACCSAL, 'A'); unas.put(PAGSCA_ACCSAL, 'A');
} }
@ -232,7 +232,8 @@ int TCreatepart_app::crea_partite(int anno_es, int anno_rif, bool check)
n_part++; n_part++;
else else
{ {
error_box("Impossibile scrivere la partita %d *", anno_rif); error_box("Impossibile scrivere la partita %d %s",
anno_rif, (const char *)numero);
break; break;
} }
} }

View File

@ -26,6 +26,7 @@ END
NUMBER F_ANNO 4 NUMBER F_ANNO 4
BEGIN BEGIN
PROMPT 1 7 "Anno esercizio " PROMPT 1 7 "Anno esercizio "
FLAGS "Z"
USE ESC USE ESC
INPUT CODTAB F_ANNO INPUT CODTAB F_ANNO
DISPLAY "Anno Esercizio" CODTAB DISPLAY "Anno Esercizio" CODTAB

View File

@ -2,100 +2,310 @@
#include <config.h> #include <config.h>
#include <form.h> #include <form.h>
#include <printer.h> #include <printer.h>
#include <tabutil.h>
#include <urldefid.h> #include <urldefid.h>
#include "../cg/saldacon.h" #include "../cg/saldacon.h"
#include "sc2.h" #include "sc2.h"
#include "sc2101.h" #include "sc2101.h"
#include "sc2100a.h"
#include <clifo.h> #include <clifo.h>
#include <causali.h>
/////////////////////////////////////////////////////////// #include <scadenze.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.num() == LF_SCADENZE)
{
}
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Totalizzatore // Totalizzatore
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class TTotal : TAssoc_array class TTotalizer : public TAssoc_array
{ {
public: public:
void add(const char* val, const TImporto& imp); void add(const TImporto& imp, const char* val);
TTotal(); TTotalizer() { }
virtual ~TTotal() { } virtual ~TTotalizer() { }
}; };
void TTotal::add(const char* val, const TImporto& imp) void TTotalizer::add(const TImporto& imp, const char* val)
{ {
TObject* obj = objptr(val); TString16 codice(val);
if (obj) if (codice == "LIT")
codice.cut(0);
TObject* obj = objptr(codice);
if (obj != NULL)
{ {
TImporto& tot = (TImporto&)*obj; TImporto& tot = (TImporto&)*obj;
tot += imp; tot += imp;
} }
else else
{ {
add(val, imp); TAssoc_array::add(codice, new TImporto(imp));
} }
} }
///////////////////////////////////////////////////////////
// TEC_form
///////////////////////////////////////////////////////////
class TEC_form : public TForm
{
static TEC_form* _form;
TCursor* _cursore;
TTotalizer _totali;
TDecoder _causali;
protected:
static void ec_header_handler(TPrinter& p);
static void ec_footer_handler(TPrinter& p);
public:
TTotalizer& totali() { return _totali; }
TDecoder& causali() { return _causali; }
bool print_game(const TPartita& game);
TEC_form(const char* codice, TCursor* cursor);
virtual ~TEC_form();
};
TEC_form* TEC_form::_form = NULL;
///////////////////////////////////////////////////////////
// TEC_row
///////////////////////////////////////////////////////////
class TEC_row : public TSortable
{
TDate _data;
int _riga;
TString _causale;
TString _descrizione;
TDate _data_doc;
TString _num_doc;
long _num_prot;
TImporto _importo;
TValuta _valuta;
TImporto _totale_doc;
protected: // TSortable
virtual int compare(const TSortable& s) const;
public:
void descrizione(const char* s) { _descrizione = s; }
const TValuta& valuta() const { return _valuta; }
const TImporto& importo() const { return _importo; }
void print_on(TPrint_section& body);
TEC_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int riga);
TEC_row(const char* desc, const TImporto& imp);
virtual ~TEC_row() {}
};
TEC_row::TEC_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int riga)
: _riga(riga), _num_prot(0)
{
_data = data;
_causale = row.get(PART_CODCAUS);
_data_doc = row.get(PART_DATADOC);
_num_prot = row.get_long(PART_PROTIVA);
_valuta.get(row);
_importo = imp;
// _totale = row.get_long(???);
}
TEC_row::TEC_row(const char* desc, const TImporto& imp)
: _riga(0), _num_prot(0)
{
_descrizione = desc;
_importo = imp;
}
int TEC_row::compare(const TSortable& s) const
{
const TEC_row& r = (const TEC_row&)s;
int c = 0;
if (_data == r._data)
c = r._riga - _riga;
else
c = _data < r._data ? +1 : -1;
return c;
}
void TEC_row::print_on(TPrint_section& body)
{
TEC_form& form = (TEC_form&)body.form();
body.reset();
if (_causale.not_empty())
{
TForm_item& causale = body.find_field(201);
causale.set(_causale);
if (_descrizione.empty())
{
TDecoder& causali = form.causali();
_descrizione = causali.decode(_causale);
}
}
if (_descrizione.not_empty())
{
TForm_item& descr = body.find_field(202);
descr.set(_descrizione);
}
if (_data_doc.ok())
{
TForm_item& datadoc = body.find_field(203);
datadoc.set(_data_doc.string());
}
if (_num_doc.not_empty())
{
TForm_item& numdoc = body.find_field(204);
numdoc.set(_num_doc);
}
if (_num_prot != 0)
{
TForm_item& numprot = body.find_field(205);
TString16 protiva; protiva << _num_prot;
numprot.set(protiva);
}
if (_data.ok())
{
TForm_item& datapag = body.find_field(207);
datapag.set(_data.string());
}
const real& imp = _importo.valore();
if (!imp.is_zero())
{
TForm_item& dare = body.find_field(208);
TForm_item& avere = body.find_field(209);
if (_importo.sezione() == 'D')
{
dare.set(imp.string());
avere.set("");
}
else
{
avere.set(imp.string());
dare.set("");
}
}
if (!_valuta.in_lire())
{
TForm_item& cambio = body.find_field(212);
cambio.set(_valuta.cambio().string());
if (_valuta.data().ok())
{
TForm_item& datacambio = body.find_field(213);
datacambio.set(_valuta.data().string());
}
}
body.update();
TPrinter& pr = printer();
for (word j = 0; j < body.height(); j++)
pr.print(body.row(j));
}
///////////////////////////////////////////////////////////
// TEC_array
///////////////////////////////////////////////////////////
class TEC_array : public TArray
{
const TEC_form* _form;
protected:
TEC_row& new_row(const TRiga_partite& row, const TDate& data, const TImporto& imp);
void add_row(const TRiga_partite& row);
public:
TEC_row& row(int r) { return (TEC_row&)operator[](r); }
const TEC_form& form() const { return *_form; }
TEC_array(const TPartita& game, const TEC_form* f);
virtual ~TEC_array() {}
};
TEC_row& TEC_array::new_row(const TRiga_partite& row, const TDate& data, const TImporto& imp)
{
const int n = items();
TEC_row* riga = new TEC_row(row, data, imp, n);
add(riga, n);
return *riga;
}
void TEC_array::add_row(const TRiga_partite& row)
{
if (row.is_fattura())
{
for (int r = 1; r <= row.rate(); r++)
{
const TRiga_scadenze& rata = row.rata(r);
const TImporto imp(row.sezione(), rata.get_real(PART_IMPORTO));
const TDate data(rata.get(SCAD_DATASCAD));
new_row(row, data, imp);
}
}
else
{
const TImporto imp(row.sezione(), row.get_real(PART_IMPORTO));
const TDate data(row.get(PART_DATAPAG));
new_row(row, data, imp);
const TImporto abbuoni(row.get_char(PART_SEZABB), row.get_real(PART_ABBUONI));
if (!abbuoni.is_zero())
{
TEC_row& r = new_row(row, data, abbuoni);
const TForm_item& desc_abb = form().find_field('B', odd_page, 302);
r.descrizione(desc_abb.prompt());
}
const TImporto diffcam(row.get_char(PART_SEZDIFCAM), row.get_real(PART_DIFFCAM));
if (!diffcam.is_zero())
{
TEC_row& r = new_row(row, data, diffcam);
const TForm_item& desc_dif = form().find_field('B', odd_page, 303);
r.descrizione(desc_dif.prompt());
}
}
}
TEC_array::TEC_array(const TPartita& game, const TEC_form* f)
: _form(f)
{
for (int r = game.last(); r > 0; r = game.pred(r))
add_row(game.riga(r));
sort();
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Form speciale per estratti conto // 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(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) void TEC_form::ec_header_handler(TPrinter& pr)
{ {
TPrint_section& head = form().section('H', 1); TPrint_section& head = _form->section('H');
head.reset(); head.reset();
pr.resetheader(); pr.resetheader();
@ -111,15 +321,52 @@ void TEC_form::ec_footer_handler(TPrinter& p)
TRACE("Stamperei un footer"); TRACE("Stamperei un footer");
} }
long TEC_form::move_cursor(const TRectype& rec) bool TEC_form::print_game(const TPartita& game)
{ {
cursor()->file().curr() = rec; bool ok = FALSE;
const long r = cursor()->read();
return r; TEC_array righe(game, this);
TPrinter& pr = printer();
TPrintrow prow;
TPrint_section& body = section('B');
TImporto saldo;
// Stampa le righe di partita
for (int r = 0; r < righe.items(); r++)
{
if (pr.rows_left() < body.height())
pr.formfeed();
TEC_row& riga = righe.row(r);
riga.print_on(body);
totali().add(riga.importo(), riga.valuta().codice());
saldo += riga.importo();
ok = TRUE;
}
if (ok)
{
saldo.normalize();
const TForm_item& desc_sld = body.find_field(301);
TEC_row sld(desc_sld.prompt(), saldo);
sld.print_on(body);
// Salta una riga vuota
TPrintrow vuota;
pr.print(vuota);
}
return ok;
} }
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),
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
{ {
_form = this; _form = this;
_cursore = cur; _cursore = cur;
@ -127,10 +374,10 @@ TEC_form::TEC_form(const char* codice, TCursor* cur)
TPrinter& pr = printer(); TPrinter& pr = printer();
pr.setheaderhandler(ec_header_handler); pr.setheaderhandler(ec_header_handler);
pr.headerlen(section('H', 1).height()); pr.headerlen(section('H').height());
pr.setfooterhandler(ec_footer_handler); pr.setfooterhandler(ec_footer_handler);
pr.footerlen(section('F', 1).height()); pr.footerlen(section('F').height());
} }
TEC_form::~TEC_form() TEC_form::~TEC_form()
@ -141,6 +388,37 @@ TEC_form::~TEC_form()
_form = NULL; _form = NULL;
} }
///////////////////////////////////////////////////////////
// TFilearray
///////////////////////////////////////////////////////////
class TFile_array
{
TArray _file;
public:
void open(int num, ...);
TLocalisamfile& file(int num) const { return (TLocalisamfile&)_file[num]; }
TLocalisamfile& operator[](int num) const { return file(num); }
TFile_array() {}
virtual ~TFile_array() {}
};
void TFile_array::open(int logicnum, ...)
{
va_list marker;
va_start(marker, logicnum);
while (logicnum > 0)
{
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
_file.add(new TLocalisamfile(logicnum), logicnum);
logicnum = va_arg(marker, int);
}
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Stampa estratti conto // Stampa estratti conto
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -150,6 +428,8 @@ class TStampaEC_application : public TApplication
TEC_mask* _msk; TEC_mask* _msk;
TEC_form* _form; TEC_form* _form;
TFile_array _file;
TString _lingua; TString _lingua;
TString _linprof; TString _linprof;
bool _gesval; bool _gesval;
@ -194,19 +474,29 @@ bool TStampaEC_application::select_ec()
bool TStampaEC_application::print_selected() bool TStampaEC_application::print_selected()
{ {
TCursor_sheet& s = sheet(); TCursor_sheet& s = sheet();
TCursor& c = *s.cursor();
const char who = mask().get_who();
const int key = mask().get_key();
// Filtra il cursore del form in mode che diventi uguale al cursor_sheet corrente
// Qui sarebbe bello copiarsi l'indice dell'altro cursore
TCursor& fc = *form().cursor();
fc.setkey(key);
TRectype filter(LF_CLIFO);
filter.put(CLI_TIPOCF, who);
fc.setregion(filter, filter);
const long print_all = !s.one_checked(); // Se non ho selezionato nulla allora li stampo tutti 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 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 (long i = 0; i < items; i++) if (print_all || s.checked(i)) for (long i = 0; i < items; i++) if (print_all || s.checked(i))
{ {
c = i; fc = i; // Muove il cursore alla posizione corrente
form().move_cursor(c.file().curr());
const bool ok = print_ec(); const bool ok = print_ec();
if (!ok) analfabeti++; if (!ok) analfabeti++;
} }
@ -214,7 +504,7 @@ bool TStampaEC_application::print_selected()
printer().close(); printer().close();
if (analfabeti > 0) if (analfabeti > 0)
warning_box("%ld clienti/fornitori non sono stati stmapati in quanto " warning_box("%ld clienti/fornitori non sono stati stampati in quanto "
"il codice lingua non corrispondeva al profilo di stampa", analfabeti); "il codice lingua non corrispondeva al profilo di stampa", analfabeti);
return TRUE; return TRUE;
@ -236,24 +526,59 @@ bool TStampaEC_application::print_ec()
if (!ok) // Cliente analfabeta if (!ok) // Cliente analfabeta
return FALSE; return FALSE;
TRectype filter(LF_PARTITE); // Filtra solo le partite del cliente selezionato
filter.put(PART_TIPOCF, clf.get(CLI_TIPOCF)); TLocalisamfile& partite = _file[LF_PARTITE];
filter.put(PART_SOTTOCONTO, clf.get(CLI_CODCF)); partite.zero();
partite.put(PART_TIPOCF, clf.get(CLI_TIPOCF));
TLocalisamfile& partite = f.cursor()->file(LF_PARTITE); partite.put(PART_SOTTOCONTO, clf.get(CLI_CODCF));
for (int err = partite.read(); const TRectype filter(partite.curr());
const bool stampa_chiuse = mask().get_bool(F_STAMPCHIU);
const TDate data_chiuse = mask().get(F_DATACHIU);
const TDate data_scaduto = mask().get(F_DATALIMSC);
const int giorni_rischio = mask().get_int(F_GIORISCH);
bool one_printed = FALSE;
for (int err = partite.read(_isgteq);
err == NOERR && partite.curr() == filter; err == NOERR && partite.curr() == filter;
err = partite.read(_isgreat)) err = partite.read(_isgreat))
{ {
TPartita game(partite.curr()); TPartita game(partite.curr());
for (int r = game.last(); r > 0; r = game.pred(r))
{
}
partite.put(PART_NUMRIG, 9999); if (game.chiusa())
{
TDate data_rischio = data_scaduto; data_rischio -= giorni_rischio;
const TImporto saldo = game.calcola_saldo_al(data_rischio, TRUE);
if (saldo.is_zero())
{
int r = 0;
if (stampa_chiuse)
{
for (r = game.last(); r > 0 ; r = game.pred(r))
{
const TRiga_partite& riga = game.riga(r);
if (riga.is_fattura())
{
const TDate dd(riga.get(PART_DATADOC));
if (dd > data_rischio)
break;
}
}
}
if (r == 0)
continue;
}
}
const bool printed = form().print_game(game);
if (printed)
one_printed = TRUE;
partite.put(PART_NRIGA, 9999);
} }
printer().formfeed(); if (one_printed)
printer().formfeed();
return TRUE; return TRUE;
} }
@ -266,6 +591,10 @@ bool TStampaEC_application::create()
{ {
TApplication::create(); TApplication::create();
_file.open(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_MOV, LF_RMOV, 0);
_file.open(LF_NDITTE, LF_ANAG, LF_COMUNI, 0);
_file.open(LF_CLIFO, LF_PARTITE, LF_SCADENZE, LF_PAGSCA ,0);
_msk = new TEC_mask("sc2100a"); _msk = new TEC_mask("sc2100a");
dispatch_e_menu(MENU_ITEM(1)); dispatch_e_menu(MENU_ITEM(1));
@ -302,3 +631,4 @@ int sc2100(int argc, char** argv)
app.run(argc, argv, "Stampa Estratti Conto"); app.run(argc, argv, "Stampa Estratti Conto");
return 0; return 0;
} }

View File

@ -75,6 +75,7 @@ END
NUMBER F_GIORISCH 3 NUMBER F_GIORISCH 3
BEGIN BEGIN
PROMPT 1 11 "Giorni calcolo rischio " PROMPT 1 11 "Giorni calcolo rischio "
GROUP 1
END END
BOOLEAN F_STAMPCHIU BOOLEAN F_STAMPCHIU
@ -87,6 +88,7 @@ END
DATE F_DATACHIU DATE F_DATACHIU
BEGIN BEGIN
PROMPT 25 12 "dal " PROMPT 25 12 "dal "
FLAGS "D"
END END
STRING F_LUOGOSEND 50 32 STRING F_LUOGOSEND 50 32
@ -102,6 +104,20 @@ BEGIN
END END
RADIOBUTTON SC_CLIFO 20
BEGIN
PROMPT 1 2 "Selezione"
ITEM "C|Clienti" MESSAGE ENABLE,1@
ITEM "F|Fornitori" MESSAGE CLEAR,1@
END
RADIOBUTTON SC_SORTCF 20
BEGIN
PROMPT 25 2 "Ordinamento"
ITEM "1|Per codice"
ITEM "2|Per ragione sociale"
END
BUTTON SC_SELECT 10 1 BUTTON SC_SELECT 10 1
BEGIN BEGIN
PROMPT 51 3 "~Selezione" PROMPT 51 3 "~Selezione"
@ -112,20 +128,6 @@ BEGIN
PROMPT 51 4 "~Azzera" PROMPT 51 4 "~Azzera"
END END
RADIOBUTTON SC_CLIFO 20
BEGIN
PROMPT 1 2 "Selezione"
ITEM "C|Clienti"
ITEM "F|Fornitori"
END
RADIOBUTTON SC_SORTCF 20
BEGIN
PROMPT 25 2 "Ordinamento"
ITEM "1|Per codice"
ITEM "2|Per ragione sociale"
END
NUMBER SC_CFCODFR 5 NUMBER SC_CFCODFR 5
BEGIN BEGIN
PROMPT 1 6 "Da codice " PROMPT 1 6 "Da codice "

View File

@ -1,43 +1,49 @@
#include <prefix.h> #include <prefix.h>
#include "sc2101.h" #include "sc2101.h"
#include "sc2100a.h" #include "sc2100a.h"
TEC_mask::TEC_mask(const char* name) : TSelection_mask(name), _ditta(LF_NDITTE) #include <comuni.h>
{
_ditta.add(LF_ANAG, "TIPOA==TIPOA|CODANAGR==CODANAGR"); TEC_mask::TEC_mask(const char* name) : TSelection_mask(name), _ditta(LF_NDITTE)
_ditta.add(LF_COMUNI, "COM==COMRF(COMRES)", 1, LF_ANAG); {
} _ditta.add(LF_ANAG, "TIPOA==TIPOA|CODANAGR==CODANAGR");
_ditta.add(LF_COMUNI, "COM==COMRF(COMRES)", 1, LF_ANAG, 101);
TEC_mask::~TEC_mask() _ditta.add(LF_COMUNI, "COM==COMRES", 1, LF_ANAG, 102);
{ }
}
TEC_mask::~TEC_mask()
void TEC_mask::on_firm_change() {
{ }
TMask::on_firm_change();
void TEC_mask::on_firm_change()
_ditta[0].put("CODDITTA", prefix().get_codditta()); {
if (_ditta.read() == NOERR) TMask::on_firm_change();
set(F_LUOGOSEND, _ditta[LF_COMUNI].get("DENCOM"));
} _ditta[0].put("CODDITTA", prefix().get_codditta());
if (_ditta.read() == NOERR)
void TEC_mask::start_run() {
{ const int alias = _ditta[LF_ANAG].get_char("TIPOA") == 'F' ? -101 : -102;
on_firm_change(); set(F_LUOGOSEND, _ditta.lfile(alias).get("DENCOM"));
} }
}
const char* TEC_mask::get_prof_base() const
{ void TEC_mask::start_run()
return BASE_EC_PROFILE; {
} on_firm_change();
}
const TString& TEC_mask::get_prof_code() const
{ const char* TEC_mask::get_prof_base() const
return get(F_CODPROF); {
} return BASE_EC_PROFILE;
}
const TString& TEC_mask::get_prof_lang() const
{ const TString& TEC_mask::get_prof_code() const
return get(F_LINPROF); {
} return get(F_CODPROF);
}
const TString& TEC_mask::get_prof_lang() const
{
return get(F_LINPROF);
}

View File

@ -1,10 +1,13 @@
#define F_DATASTAMPA 101 #define F_DATASTAMPA 101
#define F_DATASCADENZAI 102 #define F_DATASCADENZAI 102
#define F_DATASCADENZAF 103 #define F_DATASCADENZAF 103
#define F_RATESALDATE 104 #define F_RATESALDATE 104
#define F_ORDDATA 105 #define F_ORDDATA 105
#define F_VALUTA 106 #define F_VALUTA 106
#define F_TIPO 107
#define F_ORDINE 108
#define SC21_BUT_SEL 109

View File

@ -1,290 +1,292 @@
#include "scselect.h" #include "scselect.h"
TSelection_mask::TSelection_mask(const char* name) TSelection_mask::TSelection_mask(const char* name)
: TMask(name), _who('C'), _key(1), _clifo_rel(NULL), : TMask(name), _who('C'), _key(1), _clifo_rel(NULL),
_cli_cur_k1(NULL), _cli_cur_k2(NULL), _for_cur_k1(NULL), _for_cur_k2(NULL) _cli_cur_k1(NULL), _cli_cur_k2(NULL), _for_cur_k1(NULL), _for_cur_k2(NULL)
{ {
// crea relazioni, cursori e cursor_sheets // crea relazioni, cursori e cursor_sheets
_clifo_rel = new TRelation(LF_CLIFO); _clifo_rel = new TRelation(LF_CLIFO);
_cli_cur_k1 = new TCursor(_clifo_rel, "TIPOCF=\"C\"", 1); TRectype filter(LF_CLIFO);
_cli_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"C\"", 2); filter.put("TIPOCF", "C");
_cli_cur_k1 = new TCursor(_clifo_rel, "", 1, &filter, &filter);
_cli_cur_k2 = new TCursor(_clifo_rel, "", 2, &filter, &filter);
_cli_sh_k1 = new TCursor_sheet(_cli_cur_k1, " |CODCF|RAGSOC", "Selezione clienti per codice",
"@1|Codice|Ragione Sociale@50"); _cli_sh_k1 = new TCursor_sheet(_cli_cur_k1, " |CODCF|RAGSOC", "Selezione clienti per codice",
_cli_sh_k2 = new TCursor_sheet(_cli_cur_k2, " |RAGSOC|CODCF", "Selezione clienti per ragione sociale", "@1|Codice|Ragione Sociale@50");
"@1|Ragione Sociale@50|Codice"); _cli_sh_k2 = new TCursor_sheet(_cli_cur_k2, " |RAGSOC|CODCF", "Selezione clienti per ragione sociale",
"@1|Ragione Sociale@50|Codice");
if (id2pos(SC_CLIFO) >= 0)
{ if (id2pos(SC_CLIFO) >= 0)
_for_cur_k1 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 1); {
_for_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 2); filter.put("TIPOCF", "F");
_for_sh_k1 = new TCursor_sheet(_for_cur_k1, " |CODCF|RAGSOC", "Selezione fornitori per codice", _for_cur_k1 = new TCursor(_clifo_rel, "", 1, &filter, &filter);
"@1|Codice|Ragione Sociale@50"); _for_cur_k2 = new TCursor(_clifo_rel, "", 2, &filter, &filter);
_for_sh_k2 = new TCursor_sheet(_for_cur_k2, " |RAGSOC|CODCF", "Selezione fornitori per ragione sociale", _for_sh_k1 = new TCursor_sheet(_for_cur_k1, " |CODCF|RAGSOC", "Selezione fornitori per codice",
"@1|Ragione Sociale@50|Codice"); "@1|Codice|Ragione Sociale@50");
} _for_sh_k2 = new TCursor_sheet(_for_cur_k2, " |RAGSOC|CODCF", "Selezione fornitori per ragione sociale",
"@1|Ragione Sociale@50|Codice");
set_handler(SC_CLIFO, rclifo_handler); }
set_handler(SC_SORTCF, rsortcf_handler);
set_handler(SC_CFBUTFR, bfrom_handler); set_handler(SC_CLIFO, rclifo_handler);
set_handler(SC_CFBUTTO, bto_handler); set_handler(SC_SORTCF, rsortcf_handler);
set_handler(SC_SELECT, bselect_handler); set_handler(SC_CFBUTFR, bfrom_handler);
set_handler(SC_RESET, breset_handler); set_handler(SC_CFBUTTO, bto_handler);
set_handler(SC_CFCODFR, ffrom_handler); set_handler(SC_SELECT, bselect_handler);
set_handler(SC_CFCODTO, fto_handler); set_handler(SC_RESET, breset_handler);
} set_handler(SC_CFCODFR, ffrom_handler);
set_handler(SC_CFCODTO, fto_handler);
TSelection_mask::~TSelection_mask() }
{
delete _for_sh_k2; TSelection_mask::~TSelection_mask()
delete _for_sh_k1; {
delete _for_cur_k2; delete _for_sh_k2;
delete _for_cur_k1; delete _for_sh_k1;
delete _for_cur_k2;
delete _cli_sh_k2; delete _for_cur_k1;
delete _cli_sh_k1;
delete _cli_cur_k2; delete _cli_sh_k2;
delete _cli_cur_k1; delete _cli_sh_k1;
delete _cli_cur_k2;
delete _clifo_rel; delete _cli_cur_k1;
}
delete _clifo_rel;
void TSelection_mask::set_handler(short fld_id, CONTROL_HANDLER handler) }
{
const int pos = id2pos(fld_id); void TSelection_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
if (pos >= 0) {
fld(pos).set_handler(handler); const int pos = id2pos(fld_id);
} if (pos >= 0)
fld(pos).set_handler(handler);
TCursor_sheet& TSelection_mask::cur_sheet() }
{
TCursor_sheet* cs; TCursor_sheet& TSelection_mask::cur_sheet()
if (get_key() == 1) cs = get_who() == 'C' ? _cli_sh_k1 : _for_sh_k1; {
else cs = get_who() == 'C' ? _cli_sh_k2 : _for_sh_k2; TCursor_sheet* cs;
if (get_key() == 1) cs = get_who() == 'C' ? _cli_sh_k1 : _for_sh_k1;
CHECK(cs, "Can't use a NULL TCursor_sheet"); else cs = get_who() == 'C' ? _cli_sh_k2 : _for_sh_k2;
return *cs;
} CHECK(cs, "Can't use a NULL TCursor_sheet");
return *cs;
void TSelection_mask::reset_sheets() }
{
_cli_sh_k1->uncheck(-1); void TSelection_mask::reset_sheets()
_cli_sh_k2->uncheck(-1); {
if (_for_sh_k1) _cli_sh_k1->uncheck(-1);
{ _cli_sh_k2->uncheck(-1);
_for_sh_k1->uncheck(-1); if (_for_sh_k1)
_for_sh_k2->uncheck(-1); {
} _for_sh_k1->uncheck(-1);
reset(SC_CFCODFR); _for_sh_k2->uncheck(-1);
reset(SC_CFCODTO); }
reset(SC_NSEL); reset(SC_CFCODFR);
} reset(SC_CFCODTO);
reset(SC_NSEL);
}
// Seleziona tutti i clienti con codice compreso tra due estremi
void TSelection_mask::select_clifo_range(long from, long to)
{ // Seleziona tutti i clienti con codice compreso tra due estremi
TCursor_sheet& c = cur_sheet(); void TSelection_mask::select_clifo_range(long from, long to)
const long items = c.items(); {
const int key = get_key(); TCursor_sheet& c = cur_sheet();
const long items = c.items();
long nsel = 0; const int key = get_key();
if (to == 0l) long nsel = 0;
to = c.row(items-1).get_long(key);
if (from == 0l) if (to == 0l)
from = c.row(0).get_long(key); to = c.row(items-1).get_long(key);
if (from == 0l)
if (from > to) from = c.row(0).get_long(key);
{
long tmp = to; if (from > to)
to = from; {
from = tmp; long tmp = to;
} to = from;
from = tmp;
bool go = FALSE; }
bool cod1ok = FALSE, cod2ok = FALSE;
long last = 0l; bool go = FALSE;
long firs = 0l; bool cod1ok = FALSE, cod2ok = FALSE;
long last = 0l;
for (long i = 0; i < items; i++) long firs = 0l;
{
TToken_string& tt = c.row(i); for (long i = 0; i < items; i++)
long cod = tt.get_long(key); {
if (cod >= from && cod <= to) TToken_string& tt = c.row(i);
{ long cod = tt.get_long(key);
c.check(i); if (cod >= from && cod <= to)
nsel ++; {
if (firs == 0l) firs = cod; c.check(i);
last = cod; nsel ++;
} if (firs == 0l) firs = cod;
else c.uncheck(i); last = cod;
}
if (cod == from) cod1ok = TRUE; else c.uncheck(i);
if (cod == to) cod2ok = TRUE;
} if (cod == from) cod1ok = TRUE;
if (cod == to) cod2ok = TRUE;
if (!cod1ok) from = firs; }
if (!cod2ok) to = last;
if (!cod1ok) from = firs;
set(SC_CFCODFR, from); if (!cod2ok) to = last;
set(SC_CFCODTO, to);
set(SC_NSEL, nsel); set(SC_CFCODFR, from);
} set(SC_CFCODTO, to);
set(SC_NSEL, nsel);
// Cerca il primo e l'ultimo cliente selezionati }
void TSelection_mask::set_clifo_limits()
{ // Cerca il primo e l'ultimo cliente selezionati
long first = 0, last = 0, nsel = 0; void TSelection_mask::set_clifo_limits()
{
TCursor_sheet& c = cur_sheet(); long first = 0, last = 0, nsel = 0;
const long items = c.items();
const int key = get_key(); TCursor_sheet& c = cur_sheet();
const long items = c.items();
for (int i = 0; i < items; i++) if (c.checked(i)) const int key = get_key();
{
TToken_string& t = c.row(i); for (int i = 0; i < items; i++) if (c.checked(i))
const long kod = t.get_long(key); {
if (first == 0) TToken_string& t = c.row(i);
{ const long kod = t.get_long(key);
first = last = kod; if (first == 0)
} {
else first = last = kod;
{ }
if (first > kod) first = kod; else
if (last < kod) last = kod; {
} if (first > kod) first = kod;
if (last < kod) last = kod;
nsel++; }
}
set(SC_CFCODFR, first); nsel++;
set(SC_CFCODTO, last); }
set(SC_NSEL, nsel); set(SC_CFCODFR, first);
} set(SC_CFCODTO, last);
set(SC_NSEL, nsel);
// handlers }
bool TSelection_mask::bfrom_handler(TMask_field& f, KEY k)
{ // handlers
if (k == K_SPACE) bool TSelection_mask::bfrom_handler(TMask_field& f, KEY k)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); if (k == K_SPACE)
TCursor_sheet& c = m.cur_sheet(); {
TSelection_mask& m = (TSelection_mask&)f.mask();
c.disable_check(); TCursor_sheet& c = m.cur_sheet();
if (c.run() == K_ENTER)
{ c.disable_check();
TToken_string& t = c.row(c.selected()); if (c.run() == K_ENTER)
const long cod1 = t.get_long(m.get_key()); {
const long cod2 = m.get_long(SC_CFCODTO); TToken_string& t = c.row(c.selected());
m.set(SC_CFCODFR, cod1); const long cod1 = t.get_long(m.get_key());
m.select_clifo_range(cod1, cod2); const long cod2 = m.get_long(SC_CFCODTO);
} m.set(SC_CFCODFR, cod1);
} m.select_clifo_range(cod1, cod2);
return TRUE; }
} }
return TRUE;
bool TSelection_mask::bto_handler(TMask_field& f, KEY k) }
{
if (k == K_SPACE) bool TSelection_mask::bto_handler(TMask_field& f, KEY k)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); if (k == K_SPACE)
TCursor_sheet& c = m.cur_sheet(); {
c.disable_check(); TSelection_mask& m = (TSelection_mask&)f.mask();
if (c.run() == K_ENTER) TCursor_sheet& c = m.cur_sheet();
{ c.disable_check();
TToken_string& t = c.row(c.selected()); if (c.run() == K_ENTER)
const long cod2 = t.get_long(m.get_key()); {
const long cod1 = m.get_long(SC_CFCODFR); TToken_string& t = c.row(c.selected());
m.set(SC_CFCODTO, cod2); const long cod2 = t.get_long(m.get_key());
m.select_clifo_range(cod1, cod2); const long cod1 = m.get_long(SC_CFCODFR);
} m.set(SC_CFCODTO, cod2);
} m.select_clifo_range(cod1, cod2);
return TRUE; }
} }
return TRUE;
bool TSelection_mask::ffrom_handler(TMask_field& f, KEY k) }
{
TSelection_mask& m = (TSelection_mask&)f.mask(); bool TSelection_mask::ffrom_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty()) TSelection_mask& m = (TSelection_mask&)f.mask();
{
const long cod1 = atol(f.get()); if (k == K_TAB && f.focusdirty())
const long cod2 = m.get_long(SC_CFCODTO); {
m.select_clifo_range(cod1, cod2); const long cod1 = atol(f.get());
} const long cod2 = m.get_long(SC_CFCODTO);
else m.select_clifo_range(cod1, cod2);
if (k == K_F9) }
{ else
TMask_field& f = m.field(SC_CFBUTFR); if (k == K_F9)
f.on_hit(); {
} TMask_field& f = m.field(SC_CFBUTFR);
f.on_hit();
return TRUE; }
}
return TRUE;
bool TSelection_mask::fto_handler(TMask_field& f, KEY k) }
{
TSelection_mask& m = (TSelection_mask&)f.mask(); bool TSelection_mask::fto_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty()) TSelection_mask& m = (TSelection_mask&)f.mask();
{
const long cod1 = m.get_long(SC_CFCODFR); if (k == K_TAB && f.focusdirty())
const long cod2 = atol(f.get()); {
m.select_clifo_range(cod1, cod2); const long cod1 = m.get_long(SC_CFCODFR);
} const long cod2 = atol(f.get());
else m.select_clifo_range(cod1, cod2);
if (k == K_F9) }
{ else
TMask_field& f = m.field(SC_CFBUTTO); if (k == K_F9)
f.on_hit(); {
} TMask_field& f = m.field(SC_CFBUTTO);
return TRUE; f.on_hit();
} }
return TRUE;
bool TSelection_mask::breset_handler(TMask_field& f, KEY k) }
{
if (k == K_SPACE) bool TSelection_mask::breset_handler(TMask_field& f, KEY k)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); if (k == K_SPACE)
m.reset_sheets(); {
} TSelection_mask& m = (TSelection_mask&)f.mask();
return TRUE; m.reset_sheets();
} }
return TRUE;
bool TSelection_mask::bselect_handler(TMask_field& f, KEY k) }
{
if (k == K_SPACE) bool TSelection_mask::bselect_handler(TMask_field& f, KEY k)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); if (k == K_SPACE)
TCursor_sheet& c = m.cur_sheet(); {
c.enable_check(); TSelection_mask& m = (TSelection_mask&)f.mask();
c.run(); TCursor_sheet& c = m.cur_sheet();
m.set_clifo_limits(); c.enable_check();
} c.run();
return TRUE; m.set_clifo_limits();
} }
return TRUE;
bool TSelection_mask::rclifo_handler(TMask_field& f, KEY k) }
{
if (k == K_SPACE) bool TSelection_mask::rclifo_handler(TMask_field& f, KEY k)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); if (k == K_SPACE)
m.set_who(f.get()[0]); {
m.reset_sheets(); TSelection_mask& m = (TSelection_mask&)f.mask();
} m.set_who(f.get()[0]);
return TRUE; m.reset_sheets();
} }
return TRUE;
bool TSelection_mask::rsortcf_handler(TMask_field& f, KEY k) }
{
if (k == K_SPACE) bool TSelection_mask::rsortcf_handler(TMask_field& f, KEY k)
{ {
TSelection_mask& m = (TSelection_mask&)f.mask(); if (k == K_SPACE)
m.set_key(atoi(f.get())); {
m.reset_sheets(); TSelection_mask& m = (TSelection_mask&)f.mask();
} m.set_key(atoi(f.get()));
return TRUE; m.reset_sheets();
} }
return TRUE;
}