2005-06-01 17:27:27 +00:00
|
|
|
|
#include <applicat.h>
|
|
|
|
|
#include <automask.h>
|
2006-03-31 12:43:10 +00:00
|
|
|
|
#include <progind.h>
|
2005-06-01 17:27:27 +00:00
|
|
|
|
#include <reprint.h>
|
|
|
|
|
|
|
|
|
|
#include "ci1200.h"
|
|
|
|
|
|
|
|
|
|
#include "../ca/calib01.h"
|
|
|
|
|
#include "../ca/rmovana.h"
|
2006-12-20 14:12:26 +00:00
|
|
|
|
#include "../ve/velib07.h"
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
#include "../include/doc.h"
|
|
|
|
|
#include "../include/rdoc.h"
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
2005-06-07 09:26:43 +00:00
|
|
|
|
// TRiepiloghi_mask
|
2005-06-01 17:27:27 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
class TRiepiloghi_mask : public TAutomask
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
int create_sheet_fields(int lf, int& y, short& dlg, bool required = false);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
void create_sheet();
|
|
|
|
|
|
|
|
|
|
public:
|
2005-06-07 09:26:43 +00:00
|
|
|
|
TRiepiloghi_mask();
|
2005-06-01 17:27:27 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
int TRiepiloghi_mask::create_sheet_fields(int lf, int& y, short& dlg, bool required)
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
TSheet_field& sf = sfield(F_COMMESSE);
|
|
|
|
|
TMask& sm = sf.sheet_mask();
|
|
|
|
|
|
2006-01-30 16:37:13 +00:00
|
|
|
|
const char* field = NULL;
|
|
|
|
|
switch (lf)
|
|
|
|
|
{
|
|
|
|
|
case LF_CDC : field = RMOVANA_CODCCOSTO; break;
|
|
|
|
|
case LF_FASI: field = RMOVANA_CODFASE; break;
|
|
|
|
|
default : field = RMOVANA_CODCMS; break;
|
|
|
|
|
}
|
|
|
|
|
const int h = ca_create_fields(sm, 0, lf, 1, y, dlg, dlg+50, 0, field);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
for (int i = 0; i < h; i++)
|
|
|
|
|
{
|
|
|
|
|
TEdit_field& fld = sm.efield(dlg+i);
|
|
|
|
|
fld.check_type(required ? CHECK_REQUIRED : CHECK_NORMAL);
|
|
|
|
|
|
|
|
|
|
TEdit_field& dfld = sm.efield(dlg+50+i);
|
|
|
|
|
dfld.set_field(EMPTY_STRING); // Toglie campi che fan saltare gli output!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
y += h+1;
|
|
|
|
|
dlg += h;
|
|
|
|
|
|
|
|
|
|
return h;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
void TRiepiloghi_mask::create_sheet()
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
TSheet_field& sf = sfield(F_COMMESSE);
|
|
|
|
|
TMask& sm = sf.sheet_mask();
|
|
|
|
|
sm.hide(-1);
|
|
|
|
|
|
|
|
|
|
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
|
|
|
|
|
|
2005-09-23 08:46:35 +00:00
|
|
|
|
TConfig & ini = ca_config();
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
int y = 1;
|
|
|
|
|
short dlg = S_CDC1 + 100; // id del primo campo da generare
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
|
|
{
|
|
|
|
|
const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2
|
|
|
|
|
if (level == "CDC") // Crea centro di costo
|
|
|
|
|
{
|
|
|
|
|
if (fasinfo.parent() == LF_CDC)
|
2005-06-07 09:26:43 +00:00
|
|
|
|
create_sheet_fields(LF_FASI, y, dlg);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const bool cdc_req = ini.get_bool("CdcRequired");
|
2005-06-07 09:26:43 +00:00
|
|
|
|
create_sheet_fields(LF_CDC, y, dlg);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (level == "CMS") // Crea commessa
|
|
|
|
|
{
|
|
|
|
|
if (fasinfo.parent() == LF_COMMESSE)
|
2005-06-07 09:26:43 +00:00
|
|
|
|
create_sheet_fields(LF_FASI, y, dlg);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2005-06-07 09:26:43 +00:00
|
|
|
|
create_sheet_fields(LF_COMMESSE, y, dlg);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fasinfo.levels() > 0 && fasinfo.parent() <= 0)
|
2005-06-07 09:26:43 +00:00
|
|
|
|
create_sheet_fields(LF_FASI, y, dlg);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
for (short id = S_CDC12; id >= S_CDC1; id--)
|
|
|
|
|
{
|
|
|
|
|
const int pos = sm.id2pos(id+100);
|
|
|
|
|
if (pos >= 0)
|
|
|
|
|
{
|
|
|
|
|
TMask_field& f = sm.fld(pos);
|
|
|
|
|
const int size = f.size();
|
|
|
|
|
const TString& prompt = f.prompt();
|
|
|
|
|
sf.set_column_header(id, prompt);
|
|
|
|
|
sf.set_column_justify(id, f.is_kind_of(CLASS_REAL_FIELD));
|
|
|
|
|
sf.set_column_width(id, (max(3+size, prompt.len()+1)) * CHARX);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sf.delete_column(id);
|
|
|
|
|
sm.hide(id); // Nasconde il campo "segnaposto"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
bool TRiepiloghi_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
TRiepiloghi_mask::TRiepiloghi_mask() : TAutomask("ci1200")
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
create_sheet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
2005-06-07 09:26:43 +00:00
|
|
|
|
// TRiepiloghi_recordset
|
2005-06-01 17:27:27 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
class TRiepiloghi_recordset : public TDocument_recordset
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
TDate _da_data, _a_data;
|
|
|
|
|
long _da_clifo, _a_clifo;
|
|
|
|
|
TString _da_codart, _a_codart;
|
|
|
|
|
TString _codcosto, _codcms, _codfas;
|
|
|
|
|
TString_array _tipidoc;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
static bool rdoc_filter(const TRelation* rel);
|
|
|
|
|
bool valid_record(const TRelation& rel) const;
|
|
|
|
|
|
2006-01-30 16:37:13 +00:00
|
|
|
|
bool has_doc_reference(const char* str) const;
|
2005-06-01 17:27:27 +00:00
|
|
|
|
virtual void set_custom_filter(TCursor& cur) const;
|
|
|
|
|
|
|
|
|
|
public:
|
2005-06-07 09:26:43 +00:00
|
|
|
|
void set_filter(const TRiepiloghi_mask& msk, int cms_row);
|
|
|
|
|
TRiepiloghi_recordset(const TString& sql) : TDocument_recordset(sql) { }
|
2005-06-01 17:27:27 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
static const TRiepiloghi_recordset* myself = NULL;
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
bool TRiepiloghi_recordset::valid_record(const TRelation& rel) const
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
const TRectype& doc = rel.curr(LF_DOC);
|
|
|
|
|
|
|
|
|
|
const TDate data = doc.get(DOC_DATADOC);
|
|
|
|
|
if (data < _da_data || (_a_data.ok() && data > _a_data))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
const long clifo = doc.get_long(DOC_CODCF);
|
|
|
|
|
if (clifo < _da_clifo || (_a_clifo > 0 && clifo > _a_clifo))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
const TRectype& rdoc = rel.curr(LF_RIGHEDOC);
|
|
|
|
|
const TString& codart = rdoc.get(RDOC_CODART);
|
|
|
|
|
if (codart < _da_codart || (_a_codart.not_empty() && codart.compare(_a_codart, _a_codart.len()) > 0))
|
|
|
|
|
return false;
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
if (!_tipidoc.empty())
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
const TString4 codnum = doc.get(DOC_CODNUM);
|
|
|
|
|
const TString4 tipodoc = doc.get(DOC_TIPODOC);
|
2005-06-08 11:16:57 +00:00
|
|
|
|
const TString4 stato = doc.get(DOC_STATO);
|
|
|
|
|
|
2005-06-01 17:27:27 +00:00
|
|
|
|
bool found = false;
|
|
|
|
|
FOR_EACH_ARRAY_ROW(_tipidoc, i, row)
|
|
|
|
|
{
|
|
|
|
|
const TString4 cn = row->get(0);
|
|
|
|
|
const TString4 td = row->get();
|
|
|
|
|
if ((cn.blank() || cn == codnum) && (td.blank() || td == tipodoc))
|
|
|
|
|
{
|
2005-06-08 11:16:57 +00:00
|
|
|
|
const TString4 si = row->get();
|
|
|
|
|
const TString4 sf = row->get();
|
|
|
|
|
|
|
|
|
|
if ((si.blank() || stato >= si) && (sf.blank() || stato <= sf))
|
|
|
|
|
{
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-06-01 17:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!found)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_codcosto.not_empty())
|
|
|
|
|
{
|
|
|
|
|
const TString& cos = rdoc.get(RDOC_CODCOSTO);
|
|
|
|
|
if (cos != _codcosto)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (_codcms.not_empty())
|
|
|
|
|
{
|
|
|
|
|
const TString& cms = rdoc.get(RDOC_CODCMS);
|
|
|
|
|
if (cms != _codcms)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (_codfas.not_empty())
|
|
|
|
|
{
|
|
|
|
|
const TString& fas = rdoc.get(RDOC_FASCMS);
|
|
|
|
|
if (fas != _codfas)
|
|
|
|
|
return false;
|
2006-01-30 16:37:13 +00:00
|
|
|
|
}
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
bool TRiepiloghi_recordset::rdoc_filter(const TRelation* rel)
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
return myself->valid_record(*rel);
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-30 16:37:13 +00:00
|
|
|
|
bool TRiepiloghi_recordset::has_doc_reference(const char* str) const
|
|
|
|
|
{
|
|
|
|
|
TString expr(str); expr.upper();
|
|
|
|
|
return expr.find("DOC.") >= 0 || expr.find("DOC->") >= 0 ||
|
|
|
|
|
expr.find("33.") >= 0 || expr.find("33->") >=0;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
void TRiepiloghi_recordset::set_custom_filter(TCursor& cur) const
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
2006-01-30 16:37:13 +00:00
|
|
|
|
// Quanto segue potrebbe essere una magia degli TISAM_recordset
|
|
|
|
|
// o quanto meno dei TDocument_recordset
|
|
|
|
|
TString filter = cur.filter();
|
|
|
|
|
bool has_doc = false;
|
|
|
|
|
if (has_doc_reference(filter))
|
|
|
|
|
has_doc = true; else
|
|
|
|
|
if (cur.is_sorted() && has_doc_reference(((TSorted_cursor&)cur).get_order()))
|
|
|
|
|
has_doc = true;
|
|
|
|
|
|
2005-06-01 17:27:27 +00:00
|
|
|
|
myself = this;
|
2006-01-30 16:37:13 +00:00
|
|
|
|
cur.set_filterfunction(rdoc_filter, true); // Acc. il true e' obbligatorio :-(
|
|
|
|
|
cur.setfilter(filter, has_doc, 1);
|
|
|
|
|
|
|
|
|
|
int nkey = 6;
|
|
|
|
|
const TMultilevel_code_info* mci = ca_multilevel_code_info_by_index(0);
|
|
|
|
|
if (mci != NULL && mci->logic() == LF_CDC)
|
|
|
|
|
nkey = 7;
|
|
|
|
|
cur.setkey(nkey);
|
|
|
|
|
|
|
|
|
|
TRectype filtrec(LF_RIGHEDOC);
|
|
|
|
|
if (_codcosto.full())
|
|
|
|
|
filtrec.put(RDOC_CODCOSTO, _codcosto);
|
|
|
|
|
if (_codcms.full())
|
|
|
|
|
filtrec.put(RDOC_CODCMS, _codcms);
|
|
|
|
|
cur.setregion(filtrec, filtrec);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
void TRiepiloghi_recordset::set_filter(const TRiepiloghi_mask& msk, int cms_row)
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
_codcosto = _codcms = _codfas = "";
|
|
|
|
|
if (cms_row >= 0)
|
|
|
|
|
{
|
|
|
|
|
TSheet_field& sf = msk.sfield(F_COMMESSE);
|
|
|
|
|
TMask& sm = sf.sheet_mask();
|
|
|
|
|
sf.update_mask(cms_row);
|
|
|
|
|
TRelation rel(LF_RMOVANA);
|
|
|
|
|
sm.autosave(rel);
|
|
|
|
|
_codcosto = rel.curr().get(RMOVANA_CODCCOSTO);
|
2005-06-28 13:16:19 +00:00
|
|
|
|
_codcms = rel.curr().get(RMOVANA_CODCMS);
|
|
|
|
|
_codfas = rel.curr().get(RMOVANA_CODFASE);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
}
|
2005-06-28 13:16:19 +00:00
|
|
|
|
set_var("#S_CDC", TVariant(_codcosto), true);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
set_var("#S_CMS", TVariant(_codcms), true);
|
2005-06-28 13:16:19 +00:00
|
|
|
|
set_var("#S_FAS", TVariant(_codfas), true);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
2005-06-28 13:16:19 +00:00
|
|
|
|
TToken_string td(80, ',');
|
2005-06-01 17:27:27 +00:00
|
|
|
|
_tipidoc.destroy();
|
|
|
|
|
TSheet_field& sf = msk.sfield(F_TIPI);
|
|
|
|
|
FOR_EACH_SHEET_ROW(sf, i, row)
|
|
|
|
|
{
|
|
|
|
|
TToken_string str;
|
2005-06-28 13:16:19 +00:00
|
|
|
|
|
|
|
|
|
const TString8 num = row->get(0);
|
|
|
|
|
const TString8 tip = row->get(2);
|
|
|
|
|
str.add(num, 0);
|
|
|
|
|
str.add(tip, 1);
|
2005-06-08 11:16:57 +00:00
|
|
|
|
str.add(row->get(4), 2);
|
|
|
|
|
str.add(row->get(5), 3);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
_tipidoc.add(str);
|
2005-06-28 13:16:19 +00:00
|
|
|
|
|
|
|
|
|
if (!num.blank() || !tip.blank())
|
|
|
|
|
{
|
|
|
|
|
td.add(num);
|
|
|
|
|
if (!num.blank())
|
|
|
|
|
td << '/' << tip;
|
|
|
|
|
}
|
2005-06-01 17:27:27 +00:00
|
|
|
|
}
|
2005-06-28 13:16:19 +00:00
|
|
|
|
set_var("#S_TIPIDOC", TVariant(td), true);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
_da_data = msk.get_date(F_DA_DATA);
|
|
|
|
|
_a_data = msk.get_date(F_A_DATA);
|
2005-06-28 13:16:19 +00:00
|
|
|
|
set_var("#S_DATEFROM", TVariant(_da_data), true);
|
|
|
|
|
set_var("#S_DATETO", TVariant(_a_data), true);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
_da_clifo = msk.get_long(F_DA_CLIFO);
|
|
|
|
|
_a_clifo = msk.get_long(F_A_CLIFO);
|
2005-06-28 13:16:19 +00:00
|
|
|
|
set_var("#S_DACLIFO", TVariant(_da_clifo), true);
|
|
|
|
|
set_var("#S_ACLIFO", TVariant(_a_clifo), true);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
_da_codart = msk.get(F_DA_CODART);
|
|
|
|
|
_a_codart = msk.get(F_A_CODART);
|
2005-06-28 13:16:19 +00:00
|
|
|
|
set_var("#S_DACODART", TVariant(_da_codart), true);
|
|
|
|
|
set_var("#S_ACODART", TVariant(_a_codart), true);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
2005-06-07 09:26:43 +00:00
|
|
|
|
// TRiepiloghi_report
|
2005-06-01 17:27:27 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
class TRiepiloghi_report : public TReport
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool set_recordset(const TString& sql);
|
|
|
|
|
|
|
|
|
|
public:
|
2005-06-07 09:26:43 +00:00
|
|
|
|
void set_filter(const TRiepiloghi_mask& msk, int cms_row);
|
|
|
|
|
TRiepiloghi_report() { }
|
2005-06-01 17:27:27 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
bool TRiepiloghi_report::set_recordset(const TString& sql)
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
2005-06-07 09:26:43 +00:00
|
|
|
|
TRiepiloghi_recordset* rs = new TRiepiloghi_recordset(sql);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
return TReport::set_recordset(rs);
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
void TRiepiloghi_report::set_filter(const TRiepiloghi_mask& msk, int cms_row)
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
2005-06-07 09:26:43 +00:00
|
|
|
|
TRiepiloghi_recordset* rs = (TRiepiloghi_recordset*)recordset();
|
2005-06-01 17:27:27 +00:00
|
|
|
|
rs->set_filter(msk, cms_row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
2005-06-07 09:26:43 +00:00
|
|
|
|
// TRiepiloghi_app
|
2005-06-01 17:27:27 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
class TRiepiloghi_app : public TSkeleton_application
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
protected:
|
2006-03-31 12:43:10 +00:00
|
|
|
|
const TMultilevel_code_info& get_first_level() const;
|
2005-06-01 17:27:27 +00:00
|
|
|
|
virtual void main_loop();
|
|
|
|
|
};
|
|
|
|
|
|
2006-03-31 12:43:10 +00:00
|
|
|
|
|
|
|
|
|
//metodo per accattarsi o' primo livello della configurazione CA
|
|
|
|
|
const TMultilevel_code_info& TRiepiloghi_app::get_first_level() const
|
|
|
|
|
{
|
|
|
|
|
TConfig& cfg = ca_config();
|
|
|
|
|
const TString& first_lev = cfg.get("Level(1)");
|
|
|
|
|
const int logic = first_lev == "CDC" ? LF_CDC : LF_COMMESSE;
|
|
|
|
|
return ca_multilevel_code_info(logic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-06-07 09:26:43 +00:00
|
|
|
|
void TRiepiloghi_app::main_loop()
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
2006-03-31 12:43:10 +00:00
|
|
|
|
TRiepiloghi_mask mask;
|
|
|
|
|
while (mask.run() != K_QUIT)
|
2005-06-01 17:27:27 +00:00
|
|
|
|
{
|
|
|
|
|
TReport_book book;
|
2005-06-07 09:26:43 +00:00
|
|
|
|
TRiepiloghi_report rep;
|
2006-03-31 12:43:10 +00:00
|
|
|
|
const TString& repname = mask.get(F_REPORT);
|
2005-06-01 17:27:27 +00:00
|
|
|
|
rep.load(repname);
|
|
|
|
|
|
2006-03-31 12:43:10 +00:00
|
|
|
|
TSheet_field& sheet = mask.sfield(F_COMMESSE);
|
|
|
|
|
TString video_string; //stringa che compare nella progind
|
|
|
|
|
if (sheet.empty()) //se non ci sono righe sullo sheet (selezione su tutte le cms/cdc)...
|
|
|
|
|
{
|
|
|
|
|
TToken_string& row = sheet.row(-1); //crea la prima riga dello sheet
|
|
|
|
|
|
|
|
|
|
const TMultilevel_code_info& liv1 = get_first_level(); //stabilisce quale <20> il primo livello (tra CDC e CMS)..
|
|
|
|
|
TISAM_recordset set(liv1.logic() == LF_CDC ? "USE CDC" : "USE COMMESSE"); //..e di conseguenza scrive la use giusta
|
|
|
|
|
|
|
|
|
|
TProgind pi(set.items(), video_string, true, true);
|
|
|
|
|
for (int i = 0; set.move_to(i); i++) //fighissimo metodo per scandire un file in 1 riga!
|
|
|
|
|
{
|
|
|
|
|
pi.addstatus(1);
|
|
|
|
|
if (pi.iscancelled())
|
|
|
|
|
break;
|
|
|
|
|
row = set.get((unsigned int)0).as_string(); //prende il valore del primo campo del file (CDC o CMS code)
|
|
|
|
|
|
|
|
|
|
video_string = TR("Scansione");
|
|
|
|
|
video_string << " " << row; //completa la stringa da visualizzare sulla progind
|
|
|
|
|
pi.set_text(video_string);
|
|
|
|
|
|
|
|
|
|
for (int l = liv1.levels()-2; l >= 0; l--) //se la struttura <20> a pi<70> livelli costruisce la tokenstring
|
|
|
|
|
row.insert("|", liv1.total_len(l));
|
|
|
|
|
|
|
|
|
|
rep.set_filter(mask, 0); //fa la set filter sulla prima riga (che <20> quella usata)
|
|
|
|
|
book.add(rep);
|
|
|
|
|
}
|
|
|
|
|
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
|
|
|
|
|
}
|
|
|
|
|
else //se ha almeno una riga sullo sheet delle cms/cdc...
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row) //per ogni cdc/cms che appare nello sheet di pag.1 della msk..
|
|
|
|
|
{
|
|
|
|
|
rep.set_filter(mask, r); //..chiama il metodone globale che crea e compila il file..
|
|
|
|
|
//..temporaneo i cui dati riempiranno il report
|
|
|
|
|
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-06-01 17:27:27 +00:00
|
|
|
|
|
|
|
|
|
book.print_or_preview();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ci1200(int argc, char* argv[])
|
|
|
|
|
{
|
2005-06-07 09:26:43 +00:00
|
|
|
|
TRiepiloghi_app sd;
|
|
|
|
|
sd.run(argc, argv, "Stampa riepiloghi");
|
2005-06-01 17:27:27 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|