2009-09-24 09:15:09 +00:00
|
|
|
|
#include <automask.h>
|
|
|
|
|
#include <defmask.h>
|
|
|
|
|
#include <recset.h>
|
|
|
|
|
#include <relapp.h>
|
|
|
|
|
|
|
|
|
|
#include "condv.h"
|
|
|
|
|
#include "rcondv.h"
|
|
|
|
|
|
|
|
|
|
#include "ve2500a.h"
|
2009-09-29 09:12:17 +00:00
|
|
|
|
#include "ve2500b.h"
|
2009-09-24 09:15:09 +00:00
|
|
|
|
|
2009-09-29 09:12:17 +00:00
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
// MASCHERA SECONDARIA DI GENERAZIONE LISTINO
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
class TGestione_listini_semplice_mask_genera: public TAutomask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void crea_listino();
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
TGestione_listini_semplice_mask_genera(TSheet_field& sf_righe);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool TGestione_listini_semplice_mask_genera::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TGestione_listini_semplice_mask_genera::TGestione_listini_semplice_mask_genera(TSheet_field& sf_righe) : TAutomask("ve2500b")
|
|
|
|
|
{
|
|
|
|
|
const bool gesliscv = ini_get_bool(CONFIG_DITTA, "ve", "GESLISCV");
|
|
|
|
|
enable(F_CATVEN, gesliscv);
|
|
|
|
|
enable(F_DESVEN, gesliscv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TGestione_listini_semplice_mask_genera::crea_listino()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
// MASCHERA PRINCIPALE DI GESTIONE LISTINO (quella con lo sheet)
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
2009-09-28 13:27:20 +00:00
|
|
|
|
class TGestione_listini_semplice_mask: public TAutomask
|
2009-09-24 09:15:09 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
|
|
|
|
public:
|
2009-09-25 13:22:32 +00:00
|
|
|
|
int find_art(TSheet_field& s, const char tipo, const TString& art, const int tranne = -1) const;
|
2009-09-28 13:27:20 +00:00
|
|
|
|
int guess_art(TSheet_field& s, const char tipo, const TString& art, const int column) const;
|
2009-09-24 09:15:09 +00:00
|
|
|
|
TGestione_listini_semplice_mask();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TGestione_listini_semplice_mask::TGestione_listini_semplice_mask() : TAutomask("ve2500a")
|
|
|
|
|
{
|
|
|
|
|
//in base alla cervellotica configurazione impostata dall'utonto abilita/disabilita campi
|
|
|
|
|
const bool gesliscv = ini_get_bool(CONFIG_DITTA, "ve", "GESLISCV");
|
|
|
|
|
enable(F_L_CATVEN, gesliscv);
|
|
|
|
|
enable(F_L_DESVEN, gesliscv);
|
|
|
|
|
//attenzione!!! il campo CATVEN <20> in chiave 1! per disabilitarlo ci vuole questo trucco!
|
|
|
|
|
if (!gesliscv)
|
|
|
|
|
efield(F_L_CATVEN).reset_key(1);
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-25 13:22:32 +00:00
|
|
|
|
//metodo per la ricerca al volo di un articolo (serve per posizionare il cursore sullo sheet in tempo reale..
|
|
|
|
|
//..mentre si digita il codice articolo nel campo di ricerca
|
2009-09-28 13:27:20 +00:00
|
|
|
|
int TGestione_listini_semplice_mask::guess_art(TSheet_field& s, const char tipo, const TString& art,
|
|
|
|
|
const int column) const
|
2009-09-25 13:22:32 +00:00
|
|
|
|
{
|
2009-09-28 13:27:20 +00:00
|
|
|
|
int i = -1;
|
|
|
|
|
FOR_EACH_SHEET_ROW(s, r, row)
|
|
|
|
|
{
|
|
|
|
|
const char tiporiga = row->get_char(0);
|
|
|
|
|
const TString& cod = row->get(column);
|
|
|
|
|
if (tipo == tiporiga && cod.starts_with(art, true))
|
|
|
|
|
{
|
|
|
|
|
i = r;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return i;
|
2009-09-25 13:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//metodo che restituisce l'indice della riga dello sheet che contiene
|
|
|
|
|
//la coppia tipo-articolo desiderata (-1 se non lo trova)
|
|
|
|
|
int TGestione_listini_semplice_mask::find_art(TSheet_field& s, const char tipo, const TString& art, const int tranne) const
|
|
|
|
|
{
|
|
|
|
|
int r = -1;
|
|
|
|
|
//scorro le righe dello sheet partendo dall'ultima
|
|
|
|
|
//tranne serve per evitare una riga specifica;di default <20> posto =-1 perch<63> non si usa
|
|
|
|
|
for (r = s.items() - 1; r >= 0; r--)
|
|
|
|
|
{
|
|
|
|
|
if (r != tranne)
|
|
|
|
|
{
|
|
|
|
|
const char* tiporiga = s.row(r).get(0);
|
|
|
|
|
const char* codart = s.row(r).get(1);
|
|
|
|
|
|
|
|
|
|
if (tipo == tiporiga[0] && art == codart)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-09-24 09:15:09 +00:00
|
|
|
|
bool TGestione_listini_semplice_mask::on_field_event(TOperable_field &o, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
switch(o.dlg())
|
|
|
|
|
{
|
2009-09-25 13:22:32 +00:00
|
|
|
|
case F_L_CODRIGA_A:
|
|
|
|
|
case F_L_CODRIGA_G:
|
|
|
|
|
case F_L_CODRIGA_S:
|
|
|
|
|
case F_L_CODRIGA_R:
|
2009-09-28 13:27:20 +00:00
|
|
|
|
if (e == fe_edit || e == fe_modify)
|
|
|
|
|
{
|
|
|
|
|
const char tiporiga = get(F_L_TIPORIGA)[0];
|
|
|
|
|
const TString& codriga = ((TEditable_field&)o).get_window_data();
|
|
|
|
|
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
|
|
|
|
const long riga = guess_art(sf_righe, tiporiga, codriga, 1);
|
|
|
|
|
if (riga >= 0)
|
|
|
|
|
{
|
|
|
|
|
sf_righe.select(riga, true);
|
|
|
|
|
const short f_descr = o.dlg() + 1;
|
|
|
|
|
const char* descr = sf_righe.cell(riga, 2);
|
|
|
|
|
set(f_descr, descr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_L_DESRIGA_A:
|
|
|
|
|
case F_L_DESRIGA_G:
|
|
|
|
|
case F_L_DESRIGA_S:
|
|
|
|
|
case F_L_DESRIGA_R:
|
|
|
|
|
if (e == fe_edit || e == fe_modify)
|
2009-09-25 13:22:32 +00:00
|
|
|
|
{
|
|
|
|
|
const char tiporiga = get(F_L_TIPORIGA)[0];
|
2009-09-28 13:27:20 +00:00
|
|
|
|
const TString& desriga = ((TEditable_field&)o).get_window_data();
|
2009-09-25 13:22:32 +00:00
|
|
|
|
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
2009-09-28 13:27:20 +00:00
|
|
|
|
const long riga = guess_art(sf_righe, tiporiga, desriga, 2);
|
2009-09-25 13:22:32 +00:00
|
|
|
|
if (riga >= 0)
|
2009-09-28 13:27:20 +00:00
|
|
|
|
{
|
2009-09-25 13:22:32 +00:00
|
|
|
|
sf_righe.select(riga, true);
|
2009-09-28 13:27:20 +00:00
|
|
|
|
const short f_cod = o.dlg() - 1;
|
|
|
|
|
const char* cod = sf_righe.cell(riga, 1);
|
|
|
|
|
set(f_cod, cod);
|
|
|
|
|
}
|
2009-09-25 13:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2009-09-24 09:15:09 +00:00
|
|
|
|
//se abilita la gestione scaglioni nello sheet devono comparire le colonne NSCAGL e QLIM
|
|
|
|
|
case F_L_GESTSCAGL:
|
|
|
|
|
if (e == fe_init || e == fe_modify)
|
|
|
|
|
{
|
2009-09-25 13:22:32 +00:00
|
|
|
|
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
2009-09-24 09:15:09 +00:00
|
|
|
|
const bool gest_scagl = o.get().full();
|
|
|
|
|
sf_righe.enable_column(F_NSCAGL, gest_scagl);
|
|
|
|
|
sf_righe.enable_column(F_QLIM, gest_scagl);
|
|
|
|
|
|
|
|
|
|
sf_righe.force_update();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
//stesso giochetto per UM
|
|
|
|
|
case F_L_GESTUM:
|
|
|
|
|
if (e == fe_init || e == fe_modify)
|
|
|
|
|
{
|
2009-09-25 13:22:32 +00:00
|
|
|
|
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
2009-09-24 09:15:09 +00:00
|
|
|
|
const bool gest_um = o.get().full();
|
|
|
|
|
sf_righe.enable_column(F_UM, gest_um);
|
|
|
|
|
|
|
|
|
|
sf_righe.force_update();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
//e anche per i campi omaggio
|
|
|
|
|
case F_L_GESTSCO:
|
|
|
|
|
if (e == fe_init || e == fe_modify)
|
|
|
|
|
{
|
2009-09-25 13:22:32 +00:00
|
|
|
|
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
2009-09-24 09:15:09 +00:00
|
|
|
|
const bool gest_sco = o.get().full();
|
|
|
|
|
sf_righe.enable_column(F_ADDIVA, gest_sco);
|
|
|
|
|
sf_righe.enable_column(F_CODIVA, gest_sco);
|
|
|
|
|
sf_righe.enable_column(F_QOM, gest_sco);
|
|
|
|
|
sf_righe.enable_column(F_QBASE, gest_sco);
|
|
|
|
|
sf_righe.enable_column(F_CODARTOM, gest_sco);
|
|
|
|
|
sf_righe.enable_column(F_UMOM, gest_sco);
|
|
|
|
|
sf_righe.enable_column(F_PROMAGGIO, gest_sco);
|
|
|
|
|
|
|
|
|
|
sf_righe.force_update();
|
|
|
|
|
}
|
|
|
|
|
break;
|
2009-09-25 13:22:32 +00:00
|
|
|
|
//controllo della unicit<69> del tiporiga+codriga nello sheet
|
|
|
|
|
case F_L_RIGHE:
|
|
|
|
|
if (e == se_notify_modify)
|
|
|
|
|
{
|
|
|
|
|
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
|
|
|
|
TToken_string& riga = sf_righe.row(jolly);
|
|
|
|
|
const char tipo = riga.get_char(0);
|
|
|
|
|
const TString& art = riga.get(1);
|
|
|
|
|
const long found_riga = find_art(sf_righe, tipo, art, jolly);
|
|
|
|
|
if (found_riga >= 0)
|
|
|
|
|
return error_box(TR("Non <20> possibile inserire lo stesso articolo pi<70> di una volta!"));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case DLG_CREA:
|
|
|
|
|
if (e == fe_button)
|
|
|
|
|
{
|
2009-09-29 09:12:17 +00:00
|
|
|
|
TSheet_field& sf_righe = sfield(F_L_RIGHE);
|
|
|
|
|
TGestione_listini_semplice_mask_genera mask_gen(sf_righe);
|
|
|
|
|
if (mask_gen.run())
|
|
|
|
|
mask_gen.crea_listino();
|
2009-09-25 13:22:32 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2009-09-24 09:15:09 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
// APPLICAZIONE
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
class TGestione_listini_semplice : public TRelation_application
|
|
|
|
|
{
|
|
|
|
|
TGestione_listini_semplice_mask *_mask;
|
|
|
|
|
TRelation* _rel;
|
|
|
|
|
|
2009-09-24 10:32:09 +00:00
|
|
|
|
private:
|
2009-09-25 13:22:32 +00:00
|
|
|
|
void save_rows();
|
2009-09-24 10:32:09 +00:00
|
|
|
|
TString build_query() const;
|
|
|
|
|
|
2009-09-24 09:15:09 +00:00
|
|
|
|
protected:
|
|
|
|
|
virtual bool user_create();
|
|
|
|
|
virtual bool user_destroy();
|
|
|
|
|
virtual TMask *get_mask(int) { return _mask; }
|
|
|
|
|
virtual bool changing_mask(int) { return false; }
|
2009-09-29 09:12:17 +00:00
|
|
|
|
virtual void init_query_mode(TMask& m);
|
|
|
|
|
virtual void init_insert_mode(TMask& m);
|
|
|
|
|
virtual void init_modify_mode(TMask& m);
|
2009-09-24 09:15:09 +00:00
|
|
|
|
|
|
|
|
|
virtual bool protected_record(TRectype& rec);
|
|
|
|
|
|
|
|
|
|
virtual int read(TMask& m);
|
2009-09-24 10:32:09 +00:00
|
|
|
|
virtual int write(const TMask& m);
|
|
|
|
|
virtual int rewrite(const TMask& m);
|
2009-09-24 09:15:09 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual TRelation *get_relation() const { return _rel; }
|
|
|
|
|
|
|
|
|
|
TGestione_listini_semplice() { _rel = NULL; _mask = NULL;}
|
|
|
|
|
virtual ~TGestione_listini_semplice() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2009-09-24 10:32:09 +00:00
|
|
|
|
|
2009-09-25 13:22:32 +00:00
|
|
|
|
void TGestione_listini_semplice::save_rows()
|
2009-09-24 10:32:09 +00:00
|
|
|
|
{
|
2009-09-28 13:27:20 +00:00
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
|
2009-09-25 13:22:32 +00:00
|
|
|
|
//attenzione!!! fatto questo casino per poter usare la find_art() che <20> un metodo della maschera listini
|
|
|
|
|
const TGestione_listini_semplice_mask& m = *_mask;
|
2009-09-24 10:32:09 +00:00
|
|
|
|
//instanzio un TISAM_recordset sulle righe listino e un localisamfile
|
|
|
|
|
TISAM_recordset righelist(build_query());
|
|
|
|
|
righelist.set_var("#CATVEN", m.get(F_L_CATVEN));
|
|
|
|
|
righelist.set_var("#COD", m.get(F_L_COD));
|
|
|
|
|
|
|
|
|
|
const long righelist_items = righelist.items();
|
|
|
|
|
|
|
|
|
|
TLocalisamfile& file = righelist.cursor()->file();
|
|
|
|
|
|
|
|
|
|
//sheet righe listino da salvare! (righe panda?)
|
2009-09-25 13:22:32 +00:00
|
|
|
|
TSheet_field& righe = m.sfield(F_L_RIGHE);
|
2009-09-24 10:32:09 +00:00
|
|
|
|
|
|
|
|
|
//scorro tutte le righe listino ed elimino tutte quelle che non ci sono pi<70> sullo sheet (modifiche utonto)
|
|
|
|
|
for (bool ok = righelist.move_first(); ok; ok = righelist.move_next())
|
|
|
|
|
{
|
|
|
|
|
const char tiporiga = righelist.get("TIPORIGA").as_string()[0];
|
|
|
|
|
|
|
|
|
|
const TString& art = righelist.get("CODRIGA").as_string();
|
2009-09-25 13:22:32 +00:00
|
|
|
|
if (m.find_art(righe, tiporiga, art) < 0)
|
2009-09-24 10:32:09 +00:00
|
|
|
|
file.remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//procede al salvataggio di testata e righe
|
|
|
|
|
//-----------------------------------------
|
|
|
|
|
|
|
|
|
|
//per prima cosa servono i dati di testata utili per riempire la chiave di riga listino
|
|
|
|
|
const TString& catven = m.get(F_L_CATVEN);
|
|
|
|
|
const TString& cod = m.get(F_L_COD);
|
|
|
|
|
|
|
|
|
|
//recupero la maschera di riga
|
|
|
|
|
TMask& msk = righe.sheet_mask();
|
|
|
|
|
|
|
|
|
|
//per ogni riga dello sheet
|
|
|
|
|
FOR_EACH_SHEET_ROW(righe, r, row)
|
|
|
|
|
{
|
|
|
|
|
file.zero();
|
|
|
|
|
file.put(RCONDV_TIPO, "L");
|
|
|
|
|
file.put(RCONDV_CATVEN, catven);
|
|
|
|
|
file.put(RCONDV_COD, cod);
|
|
|
|
|
|
|
|
|
|
//per ogni campo della maschera setta all'interno del record corrente di file
|
|
|
|
|
//il valore di quei campi che hanno un field
|
|
|
|
|
FOR_EACH_MASK_FIELD(msk, i, f)
|
|
|
|
|
{
|
|
|
|
|
const TFieldref* fr = f->field();
|
|
|
|
|
if (fr != NULL && f->dlg() < 200)
|
|
|
|
|
{
|
|
|
|
|
const int pos = righe.cid2index(f->dlg());
|
|
|
|
|
fr->write(row->get(pos), file.curr());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//se <20> in inserimento deve fare un write, se in modifica la rewrite
|
|
|
|
|
if (m.insert_mode())
|
|
|
|
|
file.write_rewrite();
|
|
|
|
|
else
|
|
|
|
|
file.rewrite_write();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-09-24 09:15:09 +00:00
|
|
|
|
bool TGestione_listini_semplice::protected_record(TRectype& rec)
|
|
|
|
|
{
|
|
|
|
|
//non deve consentire l'eliminazione di un listino se ha dei figli da mantenere!
|
|
|
|
|
TString query;
|
|
|
|
|
query << "USE CONDV\n";
|
|
|
|
|
query << "SELECT (FATHCATVEN=#CATVEN)&&(FATHCOD=#COD)\n";
|
|
|
|
|
query << "FROM TIPO=L\n";
|
|
|
|
|
query << "TO TIPO=L\n";
|
|
|
|
|
TISAM_recordset figli(query);
|
|
|
|
|
figli.set_var("#CATVEN", rec.get(CONDV_CATVEN));
|
|
|
|
|
figli.set_var("#COD", rec.get(CONDV_COD));
|
|
|
|
|
|
|
|
|
|
return figli.items() > 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-24 10:32:09 +00:00
|
|
|
|
TString TGestione_listini_semplice::build_query() const
|
|
|
|
|
{
|
|
|
|
|
TString query;
|
|
|
|
|
query << "USE RCONDV\n";
|
|
|
|
|
query << "FROM TIPO=L CATVEN=#CATVEN COD=#COD\n";
|
|
|
|
|
query << "TO TIPO=L CATVEN=#CATVEN COD=#COD\n";
|
|
|
|
|
|
|
|
|
|
return query;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-24 09:15:09 +00:00
|
|
|
|
int TGestione_listini_semplice::read(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
//eseguo la read() standard
|
|
|
|
|
int err = TRelation_application::read(m);
|
|
|
|
|
//se la read va a buon fine
|
|
|
|
|
if (err == NOERR)
|
|
|
|
|
{
|
2009-09-28 13:27:20 +00:00
|
|
|
|
TWait_cursor hourglass;
|
2009-09-24 09:15:09 +00:00
|
|
|
|
//instanzio un TISAM_recordset sulle righe listino (RCONDV)
|
2009-09-24 10:32:09 +00:00
|
|
|
|
TISAM_recordset righelist(build_query());
|
2009-09-24 09:15:09 +00:00
|
|
|
|
righelist.set_var("#CATVEN", m.get(F_L_CATVEN));
|
|
|
|
|
righelist.set_var("#COD", m.get(F_L_COD));
|
|
|
|
|
|
|
|
|
|
const long righelist_items = righelist.items();
|
|
|
|
|
|
|
|
|
|
const TRectype& rec = righelist.cursor()->curr();
|
|
|
|
|
|
|
|
|
|
//recupero sheet e realtiva mashera di riga
|
2009-09-25 13:22:32 +00:00
|
|
|
|
TSheet_field& sf_righe = m.sfield(F_L_RIGHE);
|
2009-09-24 09:15:09 +00:00
|
|
|
|
TMask& msk = sf_righe.sheet_mask();
|
|
|
|
|
sf_righe.destroy();
|
|
|
|
|
|
|
|
|
|
//per ogni riga dello sheet
|
|
|
|
|
int pos = -1;
|
|
|
|
|
for (bool ok = righelist.move_first(); ok; ok = righelist.move_next())
|
|
|
|
|
{
|
|
|
|
|
++pos;
|
|
|
|
|
TToken_string& row = sf_righe.row(-1);
|
2009-09-24 10:32:09 +00:00
|
|
|
|
//per ogni campo della maschera setta all'interno del record corrente di file
|
2009-09-24 09:15:09 +00:00
|
|
|
|
//il valore di quei campi che hanno un field
|
|
|
|
|
FOR_EACH_MASK_FIELD(msk,i,f)
|
|
|
|
|
{
|
|
|
|
|
const TFieldref* fr = f->field();
|
|
|
|
|
if (fr != NULL)
|
|
|
|
|
row.add(fr->read(rec),sf_righe.cid2index(f->dlg()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//forzo una check_row
|
|
|
|
|
sf_righe.check_row(sf_righe.items()-1, 3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-24 10:32:09 +00:00
|
|
|
|
int TGestione_listini_semplice::rewrite(const TMask& m)
|
|
|
|
|
{
|
|
|
|
|
int err = TRelation_application::rewrite(m);
|
|
|
|
|
|
|
|
|
|
if(err == NOERR)
|
2009-09-25 13:22:32 +00:00
|
|
|
|
save_rows();
|
2009-09-24 10:32:09 +00:00
|
|
|
|
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TGestione_listini_semplice::write(const TMask& m)
|
|
|
|
|
{
|
|
|
|
|
int err = TRelation_application::write(m);
|
|
|
|
|
|
|
|
|
|
if(err == NOERR)
|
2009-09-25 13:22:32 +00:00
|
|
|
|
save_rows();
|
2009-09-24 10:32:09 +00:00
|
|
|
|
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-29 09:12:17 +00:00
|
|
|
|
void TGestione_listini_semplice::init_query_mode(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
m.disable(DLG_CREA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TGestione_listini_semplice::init_insert_mode(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
m.enable(DLG_CREA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TGestione_listini_semplice::init_modify_mode(TMask& m)
|
|
|
|
|
{
|
|
|
|
|
m.enable(DLG_CREA);
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-24 09:15:09 +00:00
|
|
|
|
bool TGestione_listini_semplice::user_create()
|
2009-09-28 13:27:20 +00:00
|
|
|
|
{
|
|
|
|
|
//controlla che solo il producer AGA possa usare questo programma
|
|
|
|
|
const int oem = ini_get_int(CONFIG_OEM, "MAIN", "OEM", -1);
|
|
|
|
|
if (oem != 0)
|
|
|
|
|
{
|
|
|
|
|
error_box(TR("Programma non autorizzato!"));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-24 09:15:09 +00:00
|
|
|
|
_rel = new TRelation(LF_CONDV);
|
|
|
|
|
|
2009-09-28 13:27:20 +00:00
|
|
|
|
//attenzione!! questo <20> il parametro per avere la lunghezza del numero riga sullo sheet
|
2009-09-24 10:32:09 +00:00
|
|
|
|
TSheet_field::set_line_number_width(5);
|
2009-09-24 09:15:09 +00:00
|
|
|
|
|
|
|
|
|
_mask = new TGestione_listini_semplice_mask;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TGestione_listini_semplice::user_destroy()
|
|
|
|
|
{
|
|
|
|
|
delete _mask;
|
|
|
|
|
delete _rel;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ve2500(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
TGestione_listini_semplice a;
|
|
|
|
|
a.run(argc, argv, "Gestione listini");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|