Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento :Applicazione ci0300 terminata git-svn-id: svn://10.65.10.50/trunk@13050 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2cd60f8950
commit
35eac83b4d
@ -10,7 +10,7 @@ int main(int argc, char** argv)
|
||||
// ci0200(argc,argv); // stampa tabelle
|
||||
break;
|
||||
case 2:
|
||||
// ci0300(argc,argv); // parametri configurazione Contabilita' Industriale
|
||||
ci0300(argc,argv); // parametri configurazione Contabilita' Industriale
|
||||
break;
|
||||
case 3:
|
||||
ci0400(argc,argv); // Immssione documenti
|
||||
|
196
ci/ci0300.cpp
Executable file
196
ci/ci0300.cpp
Executable file
@ -0,0 +1,196 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <doc.h>
|
||||
|
||||
#include "ci0.h"
|
||||
#include "cilib.h"
|
||||
#include "ci0300.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TConfigurazioneIndustriale_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TConfigurazioneIndustriale_mask::add_element(TToken_string& t, long selrow)
|
||||
{
|
||||
if (selrow<-1)
|
||||
return;
|
||||
|
||||
if (selrow>items()-1)
|
||||
selrow = -1;
|
||||
|
||||
rows_array().add(t,selrow);
|
||||
force_update();
|
||||
|
||||
}
|
||||
|
||||
void TConfigurazioneIndustriale_mask::add_element(long selrow)
|
||||
{
|
||||
if (selrow<-1)
|
||||
return;
|
||||
|
||||
if (selrow>items()-1)
|
||||
selrow = -1;
|
||||
|
||||
sheet().insert(selrow, true, true);
|
||||
force_update();
|
||||
|
||||
}
|
||||
|
||||
void TConfigurazioneIndustriale_mask::delete_element(long selrow)
|
||||
{
|
||||
TToken_string t(40);
|
||||
|
||||
if (items()<1)
|
||||
return;
|
||||
|
||||
if (selrow<0)
|
||||
return;
|
||||
|
||||
if (selrow>items()-1)
|
||||
return;
|
||||
|
||||
rows_array().destroy(selrow);
|
||||
force_update();
|
||||
|
||||
}
|
||||
|
||||
void TConfigurazioneIndustriale_mask::moveup_element(long selrow)
|
||||
{
|
||||
if (items()<=1)
|
||||
return;
|
||||
|
||||
if (selrow<=0)
|
||||
return;
|
||||
|
||||
if (selrow>items()-1)
|
||||
return;
|
||||
|
||||
rows_array().swap(selrow,selrow-1);
|
||||
sheet().force_update();
|
||||
sheet().select(selrow-1);
|
||||
|
||||
}
|
||||
|
||||
void TConfigurazioneIndustriale_mask::movedown_element(long selrow)
|
||||
{
|
||||
if (items()<=1)
|
||||
return;
|
||||
|
||||
if (selrow<0)
|
||||
return;
|
||||
|
||||
if (selrow>=items()-1)
|
||||
return;
|
||||
|
||||
rows_array().swap(selrow,selrow+1);
|
||||
sheet().force_update();
|
||||
sheet().select(selrow+1);
|
||||
|
||||
}
|
||||
|
||||
bool TConfigurazioneIndustriale_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_MOVEUP:
|
||||
moveup_element(sheet().selected());
|
||||
break;
|
||||
case F_MOVEDN:
|
||||
movedown_element(sheet().selected());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TConfigurazioneIndustriale_app
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// Overrides
|
||||
|
||||
bool TConfigurazioneIndustriale_app::create()
|
||||
{
|
||||
_mask = new TConfigurazioneIndustriale_mask();
|
||||
|
||||
file_to_sheet();
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TConfigurazioneIndustriale_app::destroy()
|
||||
{
|
||||
delete _mask;
|
||||
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
void TConfigurazioneIndustriale_app::main_loop()
|
||||
{
|
||||
KEY exitval;
|
||||
|
||||
while ((exitval=_mask->run()) != K_QUIT)
|
||||
{
|
||||
|
||||
switch(exitval)
|
||||
{
|
||||
case K_ESC:
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sheet_to_file();
|
||||
}
|
||||
|
||||
// Conversione Array <-> File
|
||||
|
||||
void TConfigurazioneIndustriale_app::file_to_sheet()
|
||||
{
|
||||
TConfig configfile(CONFIG_DITTA, "ci");
|
||||
int item = 0;
|
||||
|
||||
while (configfile.exist("Descr",item))
|
||||
{
|
||||
TToken_string t;
|
||||
t.add(configfile.get("Filter", NULL,item, "F01"));
|
||||
t.add(configfile.get("Descr", NULL,item, "Fatture"));
|
||||
mask().add_element(t);
|
||||
item++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TConfigurazioneIndustriale_app::sheet_to_file()
|
||||
{
|
||||
TConfig configfile(CONFIG_DITTA, "ci");
|
||||
int items;
|
||||
|
||||
items = mask().items();
|
||||
configfile.remove_all();
|
||||
|
||||
for (int i=0;i<items;i++)
|
||||
{
|
||||
configfile.set("Filter", mask().row(i).get(0), NULL, true, i);
|
||||
configfile.set("Descr", mask().row(i).get(1), NULL, true, i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Main
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
int ci0300(int argc, char* argv[])
|
||||
{
|
||||
TConfigurazioneIndustriale_app a ;
|
||||
a.run(argc, argv, TR("Contabilità Industriale"));
|
||||
return 0;
|
||||
}
|
||||
|
63
ci/ci0300.h
Executable file
63
ci/ci0300.h
Executable file
@ -0,0 +1,63 @@
|
||||
#ifndef __CI0300_H
|
||||
#define __CI0300_H
|
||||
|
||||
#include "ci0300a.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TConfigurazioneIndustriale_sheet
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TConfigurazioneIndustriale_mask : public TAutomask
|
||||
{
|
||||
private:
|
||||
int _maxelem;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
void add_element(TToken_string& t, long selrow = -1);
|
||||
void add_element(long selrow = -1);
|
||||
void delete_element(long selrow);
|
||||
void moveup_element(long selrow);
|
||||
void movedown_element(long selrow);
|
||||
|
||||
public:
|
||||
TSheet_field& sheet() { return (TSheet_field&)field(F_SHEET); }
|
||||
int items() { return sheet().items(); }
|
||||
TString_array& rows_array() { return sheet().rows_array(); }
|
||||
TToken_string& row(int i) { return sheet().row(i); }
|
||||
|
||||
public:
|
||||
TConfigurazioneIndustriale_mask(int maxelem = 16) : TAutomask("ci0300a"), _maxelem(maxelem) {}
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TConfigurazioneIndustriale_app
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TConfigurazioneIndustriale_app: public TSkeleton_application
|
||||
{
|
||||
TConfigurazioneIndustriale_mask* _mask;
|
||||
|
||||
private:
|
||||
void file_to_sheet();
|
||||
void sheet_to_file();
|
||||
|
||||
protected:
|
||||
virtual bool create(void);
|
||||
virtual void main_loop();
|
||||
virtual bool destroy(void) ;
|
||||
|
||||
public:
|
||||
TConfigurazioneIndustriale_mask& mask() const {return *_mask; }
|
||||
|
||||
public:
|
||||
TConfigurazioneIndustriale_app() {}
|
||||
virtual ~TConfigurazioneIndustriale_app() {}
|
||||
};
|
||||
|
||||
inline TConfigurazioneIndustriale_app& configurazione_industriale_app() { return (TConfigurazioneIndustriale_app&)main_app(); }
|
||||
|
||||
#endif // __CI0300_H
|
6
ci/ci0300a.h
Executable file
6
ci/ci0300a.h
Executable file
@ -0,0 +1,6 @@
|
||||
// DEFINIZIONE CAMPI MASCHERE PER LA CONFIGURAZIONE di CI
|
||||
// campi maschera ci0300a.uml
|
||||
|
||||
#define F_SHEET 151
|
||||
#define F_MOVEUP 152
|
||||
#define F_MOVEDN 153
|
73
ci/ci0300a.uml
Executable file
73
ci/ci0300a.uml
Executable file
@ -0,0 +1,73 @@
|
||||
#include "ci0300a.h"
|
||||
|
||||
TOOLBAR "" 0 -2 0 2
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -11 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -11 ""
|
||||
MESSAGE EXIT,K_ESC
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Configurazione" -1 -1 78 23
|
||||
|
||||
SPREADSHEET F_SHEET -5
|
||||
BEGIN
|
||||
PROMPT 0 0 ""
|
||||
ITEM "Filtro@4"
|
||||
ITEM "Descrizione@30"
|
||||
END
|
||||
|
||||
BUTTON F_MOVEUP 2 2
|
||||
BEGIN
|
||||
PROMPT -1 15 "Sposta in ~Alto"
|
||||
PICTURE 1662
|
||||
END
|
||||
|
||||
BUTTON F_MOVEDN 2 2
|
||||
BEGIN
|
||||
PROMPT -1 18 "Sposta in ~Basso"
|
||||
PICTURE 1663
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Tipologia Documento" -1 -1 50 4
|
||||
|
||||
STRING 101 4
|
||||
BEGIN
|
||||
PROMPT 1 0 "Filtro "
|
||||
END
|
||||
|
||||
STRING 102 30
|
||||
BEGIN
|
||||
PROMPT 1 1 "Descrizione "
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
@ -264,16 +264,9 @@ bool TImmissioneDocumenti_mask::is_date_void(int currpage, TDate& cdate)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Mains
|
||||
// Main
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
int ci0300(int argc, char* argv[])
|
||||
{
|
||||
TImmissioneDocumenti_app a ;
|
||||
a.run(argc, argv, TR("Immissione Documenti"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ci0400(int argc, char* argv[])
|
||||
{
|
||||
TImmissioneDocumenti_app a ;
|
||||
|
@ -17,6 +17,9 @@ public:
|
||||
// ereditato da TAlmanac_mask
|
||||
virtual bool is_date_void(int currpage, TDate& cdate);
|
||||
virtual void change_year(int newyear);
|
||||
|
||||
public:
|
||||
// metodi di accesso
|
||||
const TString_array & filters() const { return _filters;}
|
||||
const TArray & flags() const { return _flags;}
|
||||
const TBit_array & ordered() const { return _ordered;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user