2008-09-11 11:19:22 +00:00
|
|
|
#include <applicat.h>
|
|
|
|
#include <reprint.h>
|
|
|
|
|
|
|
|
class TReport_lv : public TReport
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool TReport_lv::get_usr_val(const TString& name, TVariant& var) const
|
|
|
|
{
|
|
|
|
if (name == "#NEXTCONS")
|
|
|
|
{
|
|
|
|
TRecordset& recset = *recordset();
|
|
|
|
const long clifo = recset.get("CODCF").as_int();
|
|
|
|
const long contr = recset.get("CODCONT").as_int();
|
|
|
|
const TDate dtcons = recset.get("DTCONS").as_date();
|
|
|
|
if (clifo > 0 && contr > 0 && dtcons.ok())
|
|
|
|
{
|
|
|
|
// Scrivere qui il calcolo della prossima data di consegna ...
|
|
|
|
// ... al momento non sono capace di farlo!
|
|
|
|
TDate next_dtcons = dtcons;
|
|
|
|
next_dtcons += 7;
|
|
|
|
var = next_dtcons;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TReport::get_usr_val(name, var);
|
|
|
|
}
|
|
|
|
|
|
|
|
class TStampa_tabelle_lv : public TSkeleton_application
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
virtual void main_loop();
|
2008-09-18 14:55:17 +00:00
|
|
|
virtual void print();
|
2008-09-11 11:19:22 +00:00
|
|
|
};
|
|
|
|
|
2008-09-18 14:55:17 +00:00
|
|
|
void TStampa_tabelle_lv::print()
|
|
|
|
{
|
|
|
|
WINDOW win = cur_win(); // Trova la finestra corrente di XVT
|
|
|
|
if (win != NULL_WIN && win != TASK_WIN) // E' una finestra valida?
|
|
|
|
{
|
|
|
|
TWindow* w = (TWindow*)xvt_vobj_get_data(win); // Risale alla classe originale
|
|
|
|
if (w != NULL) // E' una TWindow valida? (sarebbe TMask)
|
|
|
|
w->stop_run(K_ENTER); // Simula la pressione del bottone stampa
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-11 11:19:22 +00:00
|
|
|
void TStampa_tabelle_lv::main_loop()
|
|
|
|
{
|
|
|
|
// Costruisce il nome del report in base alla riga di comando
|
|
|
|
TFilename rep;
|
|
|
|
if (argc() > 2)
|
|
|
|
{
|
|
|
|
rep = argv(2);
|
|
|
|
rep.strip("-&%$^");
|
|
|
|
if (rep.len() == 3)
|
|
|
|
rep.insert("lvst");
|
|
|
|
rep.ext("rep");
|
|
|
|
}
|
|
|
|
|
|
|
|
TReport_lv r;
|
|
|
|
bool ok = r.load(rep); // Controlla l'effettiva esistenza del report
|
|
|
|
while (ok)
|
|
|
|
{
|
|
|
|
TReport_book b;
|
|
|
|
ok = b.add(r); // Richiede parametri di stampa in base alla maschera omonima
|
|
|
|
if (ok)
|
2008-09-19 13:43:20 +00:00
|
|
|
if(b.pages() >0)
|
|
|
|
b.print_or_preview(); // Stampa effettivamente
|
|
|
|
else
|
|
|
|
warning_box (TR("Nessun record estratto per i parametri inseriti"));
|
2008-09-11 11:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int lv0200(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
TStampa_tabelle_lv app;
|
|
|
|
app.run(argc, argv, TR("Stampa tabelle"));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|