0a1ecf714e
Files correlati : ve0 ve2 Ricompilazione Demo : [ ] Commento : Aggiunta gestione conto analitico in tabelle analitiche Aggiunta gestione conto analitico in anagrafica articoli git-svn-id: svn://10.65.10.50/trunk@12984 c028cbd2-c16b-5b4b-a496-9718f37d4682
184 lines
4.2 KiB
C++
Executable File
184 lines
4.2 KiB
C++
Executable File
#include <automask.h>
|
|
#include <modaut.h>
|
|
#include <printer.h>
|
|
#include <tabapp.h>
|
|
|
|
#include "vetbnum.h"
|
|
#include "../ca/calib01.h"
|
|
|
|
#include "vetbspp.h"
|
|
#include "vetbprs.h"
|
|
#include "vetbrss.h"
|
|
#include "vetbatr.h"
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TVendite_mask
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TVendite_mask : public TAutomask
|
|
{
|
|
TString4 _tab; // Voglio la tabella sempre sotto mano
|
|
|
|
protected:
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
bool is_table(const char* tab) const { return _tab == tab; }
|
|
|
|
void get_printer_config(TString& name) const;
|
|
bool get_printer_name(TString& name) const;
|
|
void reset_printer_config() const;
|
|
|
|
bool on_num_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
public:
|
|
const TString& table_code() const { return _tab; }
|
|
|
|
TVendite_mask(const char* name);
|
|
virtual ~TVendite_mask() { }
|
|
};
|
|
|
|
void TVendite_mask::get_printer_config(TString& config) const
|
|
{
|
|
config = _tab;
|
|
for (TEditable_field* f = get_key_field(1, TRUE); f;
|
|
f = get_key_field(1, FALSE)) if (f->shown())
|
|
config << f->get();
|
|
}
|
|
|
|
bool TVendite_mask::get_printer_name(TString& name) const
|
|
{
|
|
TString config; get_printer_config(config);
|
|
TConfig ini(CONFIG_STAMPE, config);
|
|
name = ini.get("Name");
|
|
return name.not_empty();
|
|
}
|
|
|
|
void TVendite_mask::reset_printer_config() const
|
|
{
|
|
TString16 config; get_printer_config(config);
|
|
TConfig ini(CONFIG_STAMPE, config);
|
|
ini.remove_all();
|
|
}
|
|
|
|
bool TVendite_mask::on_num_event(TOperable_field& o, TField_event e, long jolly)
|
|
{
|
|
switch(o.dlg())
|
|
{
|
|
case NUM_DEFPRINTER:
|
|
if (e == fe_button && !query_mode())
|
|
{
|
|
TPrinter& pr = printer();
|
|
TString16 config; get_printer_config(config);
|
|
pr.read_configuration(config);
|
|
pr.set();
|
|
e = fe_init;
|
|
}
|
|
if (e == fe_init)
|
|
{
|
|
TString name; get_printer_name(name);
|
|
o.set(name);
|
|
}
|
|
if (e == fe_close && o.empty())
|
|
reset_printer_config();
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
bool TVendite_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
{
|
|
if (is_table("NUM"))
|
|
return on_num_event(o, e, jolly);
|
|
return TRUE;
|
|
}
|
|
|
|
TVendite_mask::TVendite_mask(const char* name) : TAutomask(name)
|
|
{
|
|
const TFixed_string n(name);
|
|
_tab = n.mid(4,3);
|
|
_tab.upper();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TVendite_tabapp
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TVendite_tabapp : public TTable_application
|
|
{
|
|
protected:
|
|
virtual TMask* set_mask(TMask* m);
|
|
virtual void init_query_mode(TMask& m);
|
|
virtual void init_insert_mode(TMask& m);
|
|
virtual void init_modify_mode(TMask& m);
|
|
|
|
public:
|
|
};
|
|
|
|
TMask* TVendite_tabapp::set_mask(TMask* m)
|
|
{
|
|
if (m == NULL)
|
|
{
|
|
TFilename mn; get_mask_name(mn);
|
|
TVendite_mask* vm = new TVendite_mask(mn);
|
|
|
|
if (has_module(CAAUT, CHK_DONGLE) || has_module(CMAUT, CHK_DONGLE))
|
|
{
|
|
// Crea i campi per i conti analitici (vendite e acquisti)
|
|
if (vm->table_code() == "SPP")
|
|
{
|
|
ca_create_fields(*vm, 0, LF_CDC, 2, 11, SPP_CDC_V1, SPP_CDC_V1+10, 0x0, "S1");
|
|
ca_create_fields(*vm, 0, LF_CDC, 2, 16, SPP_CDC_A1, SPP_CDC_A1+10, 0x0, "S2");
|
|
} else
|
|
if (vm->table_code() == "PRS")
|
|
{
|
|
ca_create_fields(*vm, 0, LF_CDC, 2, 12, PRS_CDC_V1, PRS_CDC_V1+10, 0x0, "S1");
|
|
} else
|
|
if (vm->table_code() == "RSS")
|
|
{
|
|
ca_create_fields(*vm, 0, LF_CDC, 2, 16, RSS_CDC_V1, RSS_CDC_V1+10, 0x0, "S1");
|
|
}
|
|
if (vm->table_code() == "ATR")
|
|
{
|
|
ca_create_fields(*vm, 0, LF_CDC, 2, 12, ATR_CDC_V1, ATR_CDC_V1+10, 0x0, "S1");
|
|
}
|
|
}
|
|
|
|
m = vm;
|
|
}
|
|
return TTable_application::set_mask(m);
|
|
}
|
|
|
|
void TVendite_tabapp::init_query_mode(TMask& m)
|
|
{
|
|
if (get_tabname() == "RSS")
|
|
{
|
|
m.enable(RSS_RAGSOC);
|
|
}
|
|
}
|
|
|
|
void TVendite_tabapp::init_insert_mode(TMask& m)
|
|
{
|
|
if (get_tabname() == "RSS")
|
|
{
|
|
m.disable(RSS_RAGSOC);
|
|
}
|
|
}
|
|
|
|
void TVendite_tabapp::init_modify_mode(TMask& m)
|
|
{
|
|
if (get_tabname() == "RSS")
|
|
{
|
|
m.disable(RSS_RAGSOC);
|
|
}
|
|
}
|
|
|
|
int ve0400(int argc, char* argv[])
|
|
{
|
|
TVendite_tabapp vta;
|
|
vta.run(argc, argv, "Tabella Vendite");
|
|
return 0;
|
|
}
|