Niente di particolarmente influente sul funzionamento:

usa la set_curr().


git-svn-id: svn://10.65.10.50/trunk@4056 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1997-01-11 10:41:52 +00:00
parent 2325c5c13a
commit 9119de8d94

View File

@ -103,24 +103,25 @@ public:
const TString &get_module_code() { return _module; } // ritorna il codice del modulo di carta
TString_array & exclude_list() { return _exclude_array; }
TDocumentoEsteso& doc() { return *_doc; }
TDocumento_form(TRectype& cur_doc, TRelation& rel, const bool definitiva, const bool interattivo);
TDocumento_form(TRectype&/*TDocumentoEsteso **/ doc, TRelation& rel, const bool definitiva, const bool interattivo);
virtual ~TDocumento_form();
};
TDocumento_form* TDocumento_form::_form = NULL;
TDocumento_form::TDocumento_form(TRectype& cur_doc, TRelation& rel, const bool definitiva, const bool interattivo): TForm(), _firmrel(rel), _valid(FALSE)
TDocumento_form::TDocumento_form(TRectype&/*TDocumentoEsteso**/ doc, TRelation& rel, const bool definitiva, const bool interattivo): TForm(), _firmrel(rel), _valid(FALSE)
{
_form = this;
//_doc = doc;
_tip = new TTable("%TIP");
_tab = new TLocalisamfile(LF_TAB);
TString nomeform;
TFilename profilo;
TString codnum(cur_doc.get(DOC_CODNUM));
TString numdoc(cur_doc.get(DOC_NDOC));
TString codnum(doc.get(DOC_CODNUM));
TString numdoc(doc.get(DOC_NDOC));
_tip->put("CODTAB", cur_doc.get(DOC_TIPODOC)); // posiziona la tabella dei tipi di documento
_tip->put("CODTAB", doc.get(DOC_TIPODOC)); // posiziona la tabella dei tipi di documento
int err=_tip->read(); // legge la tabella
if (err==NOERR)
{ // se non ci sono errori procede con la stampa
@ -134,7 +135,7 @@ TDocumento_form::TDocumento_form(TRectype& cur_doc, TRelation& rel, const bool d
}
TConfig config(profilo, "STAMPA"); // apre il file di configurazione del profilo
TToken_string stati((const char*)config.get("STATIVALIDI"), ','); // legge gli stati validi di questo tipo di documento
if (definitiva && (stati.get_pos(cur_doc.get(DOC_STATO))== -1))
if (definitiva && (stati.get_pos(doc.get(DOC_STATO))== -1))
// se lo stato del doc. corrente non è valido...
if (interattivo)
{
@ -155,7 +156,7 @@ TDocumento_form::TDocumento_form(TRectype& cur_doc, TRelation& rel, const bool d
_cliente= new TCliFor;
_cli_loaded= FALSE;
_doc = new TDocumentoEsteso(cur_doc); // istanzia TDocumentoEsteso
_doc = new TDocumentoEsteso(doc); // istanzia TDocumentoEsteso
_docfile = new TDocisamfile(_doc);
_rdocfile = new TRDocisamfile(_doc);
relation()->replace(_docfile,0);
@ -196,7 +197,7 @@ TDocumento_form::TDocumento_form(TRectype& cur_doc, TRelation& rel, const bool d
TDocumento_form::~TDocumento_form()
{
delete _cliente;
if (_doc) delete _doc;
//if (_doc) delete _doc;
if (_tip) delete _tip;
if (_tab) delete _tab;
if (_docfile) delete _docfile;
@ -231,6 +232,7 @@ void TDocumento_form::print_documento()
TPrint_section& foot = section('F');
TPrinter& pr = printer();
const int righe = _doc->rows();
set_last_page(FALSE); // E' importante settare questo flag, per evitare "Falli di Piede" eheh :-)
@ -256,7 +258,7 @@ void TDocumento_form::print_documento()
void TDocumento_form::print_header(TPrinter& pr)
{
TPrint_section& head = section('H');
head.update();
const word r = head.height()-1;
@ -359,7 +361,7 @@ bool TDocumento_form::print_on_body(int r)
{
TPrint_section& body = section('B');
const TRiga_documento& riga = doc()[r];
TRiga_documento& riga = doc()[r];
TString tiporiga(riga.get(RDOC_TIPORIGA));
TString codart(riga.get(RDOC_CODART));
@ -988,10 +990,12 @@ void TStampaDoc_application::print_selected()
const long items = cur.items();
behaviour whattodo = go;
bool first_inst = TRUE;
//TDocumentoEsteso *documento = new TDocumentoEsteso;
//cur.file().set_curr(documento);
for (long i = 0; i < items; i++)
{
cur = i; // Posiziona il documento
_form = new TDocumento_form(cur.curr(), *_firmrel, _definitiva, _interattivo); // Istanzia il form
_form = new TDocumento_form(cur.curr()/*documento*/, *_firmrel, _definitiva, _interattivo); // Istanzia il form
if (!_form->valid()) break; // interrompe la stampa se il doc corrente non e' tra i tipi validi
const TString &modulo= _form->get_module_code(); // legge dal form il codice del modulo di carta per la stampa
@ -1025,6 +1029,8 @@ void TStampaDoc_application::print_selected()
}
}
// Non viene fatta la delete documento perche' gia' presente nella distruzione del cursore, avendo fatto una set_curr()
if (pi != NULL) delete pi;
printer().close();
}