Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : riportata la versione 98.01.05 patch 34


git-svn-id: svn://10.65.10.50/trunk@7409 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1998-11-04 18:04:26 +00:00
parent 956304d26c
commit d0ab8cc457
245 changed files with 18511 additions and 5392 deletions

173
ba/autorun.cpp Executable file
View File

@ -0,0 +1,173 @@
#include <windows.h>
#include <shellapi.h>
typedef unsigned char bool ;
HBITMAP _logoaga,_logoprassi;
/*
* MainWndProc
*
* Purpose:
* Window procedure for main window. The main window is a dialog.
*
*/
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_ERASEBKGND:
{
HDC hdc = (HDC) wParam;
HPEN hpen, hpenOld ;
RECT rect;
GetWindowRect(hwnd,&rect);
const int ysize=rect.bottom-rect.top;
for (int y=rect.bottom-1; y>=rect.top; y--)
{
const int blu=192-int(long(y)*192/ysize);
hpen = CreatePen(PS_SOLID,1,RGB(0,0,blu));
hpenOld = SelectObject(hdc, hpen);
MoveTo(hdc,rect.left,y);
LineTo(hdc,rect.right,y);
SelectObject(hdc, hpenOld);
DeleteObject(hpen);
}
HBITMAP hbmp=_logoaga;
HBRUSH hbr, hbrPrevious;
hbr = CreatePatternBrush(hbmp);
UnrealizeObject(hbr);
hbrPrevious = SelectObject(hdc, hbr);
//PatBlt(hdc, 0, 0,200 , 200, PATCOPY); // non funziona un cazzo
SelectObject(hdc, hbrPrevious);
DeleteObject(hbr);
}
break;
case WM_COMMAND:
if (wParam == 1000)
{
ShellExecute(hwnd,"open", "setup.exe","", "eurocamp\\disk1\\", SW_SHOWNORMAL);
}
else if (wParam == 1001)
{
ShellExecute(hwnd,"open", "setup.exe","", "eurodemo\\disk1\\", SW_SHOWNORMAL);
}
else if (wParam == 1002)
{
ShellExecute(hwnd,"open", "setup.exe","", "ce\\", SW_SHOWNORMAL);
}
else if (wParam != 2)
return 0;
PostQuitMessage(0);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefDlgProc(hwnd, msg, wParam, lParam);
}
return NULL;
}
/*
* InitApplication
*
* Purpose:
* Registers window class
*
* Parameters:
* hinst hInstance of application
*
* Return Value:
* TRUE if initialization succeeded, FALSE otherwise.
*/
BOOL InitApplication (HINSTANCE hinst)
{
WNDCLASS wc;
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hinst;
wc.hIcon = LoadIcon(hinst, MAKEINTRESOURCE(IDI_APPLICATION));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
wc.lpszMenuName = NULL;
wc.lpszClassName = "MainWndClass";
return RegisterClass(&wc);
}
/*
* WinMain
*
* Purpose:
* Main entry point of application.
*
*/
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hinstPrev, LPSTR pCmdLine, int nCmdShow)
{
MSG msg;
if (!hinstPrev)
if (!InitApplication(hInst)) // Register window class
return FALSE;
_logoaga=LoadBitmap(hInst, MAKEINTRESOURCE(104));
_logoprassi=LoadBitmap(hInst, MAKEINTRESOURCE(105));
RECT rect;
GetWindowRect(GetDesktopWindow(),&rect);
HWND hwndDlg=CreateWindow("MainWndClass","Scelta installazione",WS_VISIBLE| WS_CAPTION |WS_OVERLAPPEDWINDOW ,
rect.left,rect.top,rect.right,rect.bottom,NULL,NULL,hInst,NULL );
// SendMessage(hwndDlg, WM_SETFONT, 8, (long)"Arial");
const int offx=(rect.right - rect.left-570)/2;
const int offy=(rect.bottom - rect.top-260)/2;
CreateWindow("STATIC","",WS_CHILD| WS_VISIBLE,
offx+160,offy-10,410,220+10, hwndDlg ,NULL,hInst,NULL );
CreateWindow("BUTTON","Installa EuroCampo",
WS_CHILD| WS_VISIBLE,offx ,offy,150,30, hwndDlg ,1000,hInst,NULL );
CreateWindow("STATIC","Installa EuroCampo in versione commerciale protetta. E' necessario disporre di una chiave di protezione hardware. ",
WS_CHILD| WS_VISIBLE ,offx+170,offy,400,60, hwndDlg ,NULL,hInst,NULL );
CreateWindow("BUTTON","Installa EuroDemo",
WS_CHILD| WS_VISIBLE,offx ,offy+80,150,30, hwndDlg ,1001,hInst,NULL );
CreateWindow("STATIC","Installa EuroCampo in versione Demo. La versione Demo e' priva di protezione hardware ma e' soggetta ad alcune limitazioni.",
WS_CHILD| WS_VISIBLE,offx+170,offy+80,400,60, hwndDlg ,NULL,hInst,NULL );
CreateWindow("BUTTON","Installa Cespiti",
WS_CHILD| WS_VISIBLE,offx ,offy+160,150,30, hwndDlg ,1002,hInst,NULL );
CreateWindow("STATIC","Installazione pacchetto ""Cespiti"". E' necessario avere installato EuroCampo con il pacchetto ""Base"".",
WS_CHILD| WS_VISIBLE,offx+170,offy+160,400,60, hwndDlg ,NULL,hInst,NULL );
CreateWindow("BUTTON","Esci",
WS_CHILD| WS_VISIBLE,offx,offy+240,150,30, hwndDlg ,2,hInst,NULL );
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
DeleteObject(_logoaga);
DeleteObject(_logoprassi);
return (msg.wParam);
}

View File

@ -527,6 +527,8 @@ class TMenu : public TAssoc_array
TAssoc_array _images;
TAssoc_array _modules;
TToken_string _dangerous;
public: // TObject
virtual bool ok() const { return _current != NULL; }
@ -553,6 +555,10 @@ public:
void reload_images();
bool has_module(const char* mod);
bool is_dangerous(const char* mod);
void set_dangerous_modules(const TToken_string& mod)
{ _dangerous = mod; }
TMenu() : _current(NULL), _item(0) { }
TMenu(const char* name) { read(name); }
@ -602,6 +608,10 @@ void TMenuitem::create(const char* t)
// if (_enabled && is_program())
// _enabled = menu().has_module(_action);
// Controlla lo stato di aggiornamento
if (_enabled && is_program())
_enabled = !menu().is_dangerous(_action);
}
bool TMenuitem::enabled() const
@ -1044,6 +1054,14 @@ bool TMenu::has_module(const char* mod)
return main_app().has_module(module);
}
bool TMenu::is_dangerous(const char* mod)
{
TString code(mod);
code.cut(2);
return _dangerous.get_pos(code) >= 0;
}
///////////////////////////////////////////////////////////
// Menu application
///////////////////////////////////////////////////////////
@ -1084,6 +1102,8 @@ protected:
bool choose_editors();
bool choose_study();
bool test_programs();
public:
void reload_images() { _menu.reload_images(); }
@ -1374,6 +1394,99 @@ bool TMenu_application::check_user()
return ok;
}
HIDDEN int compare_version(const char* v1, int p1, const char* v2, int p2)
{
TString16 ver1(v1), ver2(v2);
ver1.trim();
if (ver1.len() == 4)
ver1.insert((v1[0] == '9') ? "19" : "20", 0);
ver2.trim();
if (ver2.len() == 4)
ver2.insert((v2[0] == '9') ? "19" : "20", 0);
int res = ver1.compare(ver2, -1, TRUE);
if (res == 0)
res = p1 - p2;
return res;
}
static int get_module_version(TConfig& cfg, void* jolly)
{
const TString& p = cfg.get_paragraph();
if (p.len() == 2)
{
TAssoc_array& map = *(TAssoc_array*)jolly;
TToken_string* tok = new TToken_string(15);
*tok = cfg.get("Versione");
tok->add(cfg.get("Patch"));
map.add(p, tok);
}
return FALSE;
}
bool TMenu_application::test_programs()
{
TToken_string dangerous;
bool test = FALSE;
{
TConfig prawin(CONFIG_INSTALL, "Main");
test = prawin.get_bool("TestPrograms");
}
if (test)
{
TConfig install("install.ini", "Main");
TFilename remote_name = install.get("DiskPath");
remote_name.add("install.ini");
if (remote_name.exist())
{
TProgind pi(3, "Controllo aggiornamento programmi", FALSE, TRUE);
TConfig remote_install(remote_name, "Main");
TAssoc_array my_modules, his_modules;
pi.addstatus(1);
install.for_each_paragraph(get_module_version, &my_modules);
pi.addstatus(1);
remote_install.for_each_paragraph(get_module_version, &his_modules);
pi.addstatus(1);
TScanner scan("prassi.aut");
for (int module = 0; scan.line().not_empty(); module++)
{
if (dongle().active(module))
{
const TString16 code = scan.token().left(2);
TToken_string* mytok = (TToken_string*)my_modules.objptr(code);
TToken_string* histok = (TToken_string*)his_modules.objptr(code);
const TString16 v1 = mytok ? mytok->get(0) : "";
const int p1 = mytok ? mytok->get_int() : 0;
const TString16 v2 = histok ? histok->get(0) : "";
const int p2 = histok ? histok->get_int() : 0;
if (compare_version(v1, p1, v2, p2) < 0)
{
dangerous.add(code);
const TString& name = scan.token().mid(3);
warning_box("ATTENZIONE: Il modulo %s\ndeve essere aggiornato prima di poterlo utilizzare.", (const char*)name);
}
}
}
}
}
if (dangerous.not_empty() && user() == "PRASSI")
{
TExternal_app app("ba1 -6");
app.run(TRUE, TRUE, FALSE);
return FALSE;
}
_menu.set_dangerous_modules(dangerous);
return TRUE;
}
bool TMenu_application::create()
{
TApplication::create();
@ -1402,6 +1515,11 @@ bool TMenu_application::create()
set_perms();
test_temp();
TWait_cursor hourglass;
if (!test_programs())
return FALSE;
if (!_menu.ok())
{
TWait_cursor hourglass;
@ -1425,6 +1543,13 @@ bool TMenu_application::destroy()
users.rewrite();
}
// ba0 / 1 substitute: serve per installare anche i file menu ed installatore che erano in esecuzione
TFilename ba0exfile("ba0.ex_"),ba1exfile("ba1.ex_");
if (ba0exfile.exist()||ba1exfile.exist())
{
TExternal_app ba0epilogue("ba0close.exe");
ba0epilogue.run(TRUE,TRUE,TRUE,FALSE); // run asynchronous...
}
return TRUE;
}
@ -2130,7 +2255,7 @@ int main(int argc, char** argv)
exit(1);
}
TMenu_application* ma = new TMenu_application(menu);
TMenu_application *ma = new TMenu_application(menu);
ma->run(argc, argv, "Menu Principale");
delete ma;

87
ba/ba0close.cpp Executable file
View File

@ -0,0 +1,87 @@
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <files.h>
#include <windows.h>
typedef unsigned char bool ;
#define FALSE 0
#define TRUE 1
int main(int argc, char** argv);
bool fcopy(const char* orig, const char* dest);
bool fexist(const char* file);
int update_file(const char *from, const char * to);
bool fexist(
const char* file) // @parm Nome del file di cui contrallarne l'esistenza
{
int err = access(file, 0);
return err == 0;
}
bool fcopy(
const char* orig, // @parm Nome del file di origine
const char* dest) // @parm Nome del file di destinazione
// file <p dest> in coda al file <p orig> (default FALSE)
// @comm Nel caso vengano ravvisati degli errori durante l'operazione vengono
// creati dei box di comunicazione che indicano la causa del problema
{
// Copia il file su se stesso?
if (stricmp(orig, dest) == 0)
return TRUE; // Or FALSE?
FILE* i = fopen(orig, "rb");
if (!i) return fprintf(stderr,"Impossibile leggere il file %s", orig);
FILE* o = fopen(dest, "wb");
if (!o)
{
fclose(i);
return fprintf(stderr,"Impossibile scrivere il file ", dest);
}
const word size = 16*1024;
unsigned char * buffer=new unsigned char[size];
bool ok = TRUE;
while (ok)
{
const word letti = fread(buffer, 1, size, i);
ok = fwrite(buffer, 1, letti, o) == letti;
if (letti < size) break;
}
if (!ok) fprintf(stderr,"Errore di scrittura: probabile disco pieno!");
fclose(o);
fclose(i);
delete buffer;
return ok;
}
int update_file(const char *from, const char * to)
{
int r=0;
if (fexist(from))
{
if (fcopy(from,to))
r=remove(from);
}
return r;
}
int PASCAL WinMain(HINSTANCE _this, HINSTANCE _prev , LPSTR _cmd,int _mode)
{
int r=0;
char ba1exe[]="ba1.exe",ba1ex[]="ba1.ex_";
char ba0exe[]="ba0.exe",ba0ex[]="ba0.ex_";
update_file(ba1ex,ba1exe);
update_file(ba0ex,ba0exe);
return 0;
}

View File

@ -30,6 +30,7 @@
///////////////////////////////////////////////////////////
TInformazione_moduli::TInformazione_moduli()
: _unassigned_modules(0)
{
int mod = 0;
TString s(256);
@ -452,7 +453,9 @@ int TAttivazione_moduli::build_sheet(bool on)
{
riga.add("X");
if (module != 0)
nmod++;
nmod++;
else
sf.disable_cell(i, -1); // Disabilita la riga della base
}
else
riga.add(" ");
@ -1298,7 +1301,9 @@ bool TAttivazione_moduli::create()
_msk->set_handler(F_PRINT, print_handler);
_msk->set_handler(F_PRINTLIST, printlist_handler);
_msk->set_handler(F_AGGLISTINO, aggiorna_listino_handler);
if (::dongle().type() == _aga_dongle)
const TDongleType mydongle = ::dongle().type();
if (mydongle == _aga_dongle)
{
_msk->show(F_AGA);
_msk->set_handler(F_AGA, aga_handler);
@ -1310,10 +1315,12 @@ bool TAttivazione_moduli::create()
sf.set_notify(k_notify);
//const int un = _im->unassigned();
const TDongleType mydongle = ::dongle().type();
switch (mydongle)
{
case _user_dongle:
_msk->enable(F_DT);
_msk->set_handler(F_DT, date_hnd);
case _developer_dongle:
{
if (::dongle().hardware() == _dongle_hardlock)
{
@ -1321,10 +1328,11 @@ bool TAttivazione_moduli::create()
_msk->disable(F_K2);
_msk->set_handler(F_K4, user_hnd);
}
_msk->enable(F_DT);
_msk->set_handler(F_DT, date_hnd);
init_mask();
_serno=_msk->get_int(F_SN);
sf.enable_column(F_ENABLE, serno() != 0);
sf.enable_column(F_KEY, serno() != 0);
}
break;
@ -1341,6 +1349,7 @@ bool TAttivazione_moduli::create()
_msk->set_handler(F_SN, serno_hnd);
_msk->enable(F_SN);
init_mask();
_serno=_msk->get_int(F_SN);
sf.sheet_mask().field(F_ENABLE).set_handler(activate_hnd);
build_sheet(FALSE);

View File

@ -794,8 +794,8 @@ class TModule_mask : public TMask
bool module_dependent(int row, TString_array &p_submodules, TString16 &sub_mod, TString16 &ver, int & patch) const ;
public:
bool check_needed() {return _dirty_composition;}
void need_check( bool val=TRUE ) {_dirty_composition=val;}
bool list_is_dirty() {return _dirty_composition;}
void dirty_composition( bool val=TRUE ) {_dirty_composition=val;}
bool check_patchlevels( TMod_composition_msk &mm);
~TModule_mask() {}
};
@ -807,7 +807,6 @@ public:
class TCreadischi_mask : public TMask
{
protected:
static bool confirm_handler(TMask_field& f, KEY k);
static bool list_handler(TMask_field& f, KEY k);
static bool confirm_handler(TMask_field& f, KEY k);
static bool creazip_handler(TMask_field& f, KEY k);
@ -841,6 +840,7 @@ class TFascicolator_mask : public TCreadischi_mask
protected:
static bool list_handler(TMask_field& f, KEY k);
static bool confirm_handler(TMask_field& f, KEY k);
static bool creazip_handler(TMask_field& f, KEY k);
static bool patchl_handler(TMask_field& f, KEY k);
@ -866,7 +866,7 @@ bool TCreadischi_mask::modules_notify(TSheet_field& f, int row, KEY k)
if (k == K_TAB)
{
TModule_mask &mm =(TModule_mask &)f.sheet_mask();
mm.need_check(FALSE);
mm.dirty_composition(FALSE);
}
return ok;
}
@ -978,8 +978,8 @@ bool TFascicolator_mask::patchl_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.focusdirty())
{
TModule_mask& m = (TModule_mask&)f.mask();
m.need_check();
// TModule_mask& m = (TModule_mask&)f.mask();
// m.dirty_composition();
}
return TRUE;
}
@ -1018,7 +1018,7 @@ bool TFascicolator_mask::list_handler(TMask_field& f, KEY k)
if (mm.run() == K_ENTER)
{
mm.save();
m.need_check();
m.dirty_composition();
}
}
}
@ -1041,7 +1041,15 @@ bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
TModule_mask& m = (TModule_mask& )f.mask();
const TString& module = m.get(S_MODULE);
const patchlevel=m.get_int(S_PATCHLEVEL);
const bool dirty_module= m.field(S_DATE).dirty() ||
m.field(S_PREPROCESS).dirty() ||
m.field(S_POSTPROCESS).dirty() ||
m.field(S_EXTERN).dirty();
const bool dirty_version= m.field(S_VERSION).dirty() ||
m.field(S_PATCHLEVEL).dirty();
if (dirty_version || dirty_module)
{
TIndwin infobar(60,"Salvataggio composizione modulo",FALSE,FALSE);
TInstall_ini ini;
ini.set_paragraph(module);
ini.set("Versione", m.get(S_VERSION));
@ -1051,21 +1059,25 @@ bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
ini.set("PreProcess", m.get(S_PREPROCESS));
ini.set("PostProcess", m.get(S_POSTPROCESS));
// sottomoduli
TString16 submodule=module;
submodule<<'0';
for (int i=0; i <=9; i++)
if (dirty_version)
{
submodule[2]='0'+i;
if (ini.set_paragraph(submodule))
TString16 submodule=module;
submodule<<'0';
for (int i=0; i <=9; i++)
{
ini.set("Versione", m.get(S_VERSION));
ini.set("Patch", m.get(S_PATCHLEVEL));
submodule[2]='0'+i;
if (ini.set_paragraph(submodule))
{
ini.set("Versione", m.get(S_VERSION));
ini.set("Patch", m.get(S_PATCHLEVEL));
}
}
}
}
if (patchlevel>0 && m.check_needed())
if (patchlevel>0 && (m.list_is_dirty() || dirty_version))
{
// controlla le consistenze tra patch di moduli diversi intrinsecamente correlati
TIndwin infobar(60,"Controllo dipendenze tra sottomoduli",FALSE,FALSE);
TMod_composition_msk mc;
mc.load(module);
m.check_patchlevels(mc);
@ -1075,15 +1087,27 @@ bool TFascicolator_mask::confirm_handler(TMask_field& f, KEY k)
}
bool TFascicolator_mask::creazip_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
TMask_field& fconfirm= m.field(DLG_OK);
confirm_handler(fconfirm, K_SPACE);
TCreadischi_mask::creazip_handler(f,k);
}
return TRUE;
}
bool TCreadischi_mask::creazip_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
confirm_handler(f, K_SPACE);
TMask& m = f.mask();
const TString& module = m.get(S_MODULE);
const bool agg = f.dlg() == S_CREATEPATCH;
TCreadischi_mask& fm = (TCreadischi_mask&)m.get_sheet()->mask();
if (fm.zip_module(module, agg, m.get_int(S_PATCHLEVEL)))
{
// creazione XXfconv.ini (esporta le info di conversione )
@ -1098,6 +1122,7 @@ bool TCreadischi_mask::creazip_handler(TMask_field& f, KEY k)
}
bool TCreadischi_mask::import_export_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
@ -1292,7 +1317,7 @@ void TFascicolator_mask::save()
bool TCreadischi_mask::zip_file(const char* archive, const char* listfile) const
{
TString msg;
msg << "Creazione del file " << archive << "...";
msg << "Creazione del file temporaneo " << archive << "...";
TIndwin waitw(100,msg,FALSE,FALSE);
TWait_cursor hourglass;
@ -1488,6 +1513,8 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
sommario.add(main_module);
if (agg)
{
if (patch_level <= 0)
return error_box("Il numero di patch deve essere superiore a zero");
TString16 name;
name.format("%04da.ini", patch_level);
sommario << name; // Nome del file sommario aggiornamento
@ -1502,65 +1529,73 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
return error_box("Nessun file da compattare");
}
const TFilename path = get(F_DISKPATH);
// *****************
// creazione ZIP
TFilename archivio(sommario);
archivio.ext("zip"); // Nome del file archivio completo
bool aborted = FALSE;
// ******************
// compilazione lista e relativa firma dei files
TString msg;
msg << "Preparazione dei file per " << archivio << " ...";
if (path.blank())
msg << "Controllo dei file per " << archivio << " ...";
else
msg << "Preparazione dei file per " << archivio << " ...";
TFilename filelist;
filelist.temp("", main_module);
ofstream fileh(filelist);
TProgind pi(arr.items(), msg, TRUE, TRUE);
TFilename cmd;
struct _stat info;
time_t lasttime=0;
FOR_EACH_ARRAY_ROW_BACK(arr, i, row)
{
pi.addstatus(1);
if (pi.iscancelled())
{
aborted = TRUE;
break;
}
cmd = row->get(0);
if (cmd.exist())
{
// Aggiungo il nome corrente alla lista dei files da compattare
fileh << cmd << '\n';
if (stricmp(cmd.ext(), "exe") == 0)
{
TString16 submod = row->get(2);
submod.cut(2);
set_version_info(cmd, ini, submod);
}
_stat(cmd,&info);
lasttime = max(lasttime,info.st_mtime);
}
else
{
// Se non trovo anche uno solo dei files nella lista, è un casino
TString msg(128);
msg << "Impossibile aprire il file " << cmd << ". Interrompere?";
if (yesno_box(msg))
unsigned long lasttime=0;
{ // blocco della prima Progind
ofstream fileh(filelist);
TProgind pi(arr.items(), msg, TRUE, TRUE);
TFilename cmd;
FOR_EACH_ARRAY_ROW_BACK(arr, i, row)
{
pi.addstatus(1);
if (pi.iscancelled())
{
aborted = TRUE;
break;
}
cmd = row->get(0);
if (cmd.exist())
{
// Aggiungo il nome corrente alla lista dei files da compattare
fileh << cmd << '\n';
if (stricmp(cmd.ext(), "exe") == 0)
{
TString16 submod = row->get(2);
submod.cut(2);
set_version_info(cmd, ini, submod);
}
_stat((const char *)cmd,&info);
lasttime = max(lasttime,info.st_mtime);
}
else
{
// Se non trovo anche uno solo dei files nella lista, è un casino
TString msg(128);
msg << "Impossibile aprire il file " << cmd << ". Interrompere?";
if (yesno_box(msg))
{
aborted = TRUE;
break;
}
}
}
}
fileh.close();
}
fileh.close();
// Se non specifico un path ho gia' finito
const TFilename path = get(F_DISKPATH);
if (path.blank())
return TRUE;
{
message_box("Nessun percorso specificato. Il pacchetto non verra' creato");
return FALSE;
}
TFilename zipfile = path;
zipfile.add(archivio.name());
zipfile.ext("");
@ -1572,15 +1607,17 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
if (lasttime <= info.st_mtime)
aborted = !yesno_box("Il file %s risulta già essere aggiornato. Vuoi rigenerarlo comunque?",(const char *)zipfile);
}
if (!aborted)
zip_file(archivio, filelist); // Compatto gli eventuali ultimi rimasti
if (aborted)
return FALSE;
zip_file(archivio, filelist); // Compatto gli eventuali ultimi rimasti
// ::remove(filelist); // elimina il file lista-file
msg.cut(0);
msg << "Separazione del file " << archivio << " ...";
pi.set_text(msg);
TIndwin pi(60, msg, FALSE, FALSE);
const long size = get_long(F_DISKSIZE) * 1024;
const int disks = split_file(archivio, size);
@ -1639,12 +1676,7 @@ TCreadischi_mask::TCreadischi_mask()
m.set_handler(S_CREATEPATCH, creazip_handler);
m.hide(S_IMPORT);
m.set_handler(S_EXPORT, import_export_handler);
s.enable_column(S_MODULE,FALSE);
s.enable_column(S_VERSION,FALSE);
s.enable_column(S_PATCHLEVEL,FALSE);
s.enable_column(S_EXTERN,FALSE);
s.enable_column(S_PREPROCESS,FALSE);
s.enable_column(S_POSTPROCESS,FALSE);
s.disable();
}
TFascicolator_mask::TFascicolator_mask()
@ -1657,9 +1689,12 @@ TFascicolator_mask::TFascicolator_mask()
m.set_handler(DLG_OK, confirm_handler);
m.set_handler(S_LIST, list_handler);
m.set_handler(S_CREATEZIP, creazip_handler);
m.set_handler(S_CREATEPATCH, creazip_handler);
m.set_handler(S_PATCHLEVEL, patchl_handler);
m.show(S_IMPORT);
m.set_handler(S_IMPORT, import_export_handler);
s.enable(TRUE);
s.enable_column(S_MODULE,TRUE);
s.enable_column(S_VERSION,TRUE);
s.enable_column(S_PATCHLEVEL,TRUE);

View File

@ -65,13 +65,13 @@ END
STRING S_VERSION 8
BEGIN
PROMPT 1 2 "Versione "
FLAGS "D"
// FLAGS "D"
END
STRING S_PATCHLEVEL 3
BEGIN
PROMPT 20 2 "Patch "
FLAGS "D"
// FLAGS "D"
END
DATE S_DATE
@ -83,19 +83,19 @@ END
STRING S_EXTERN 50 40
BEGIN
PROMPT 1 3 "Esterni "
FLAGS "D"
// FLAGS "D"
END
STRING S_PREPROCESS 50 33
BEGIN
PROMPT 1 4 "Pre-processing "
FLAGS "D"
// FLAGS "D"
END
STRING S_POSTPROCESS 50 33
BEGIN
PROMPT 1 5 "Post-processing "
FLAGS "D"
// FLAGS "D"
END
BUTTON DLG_CANCEL 14 2

View File

@ -8,6 +8,7 @@
#include <sheet.h>
#include <utility.h>
#include <prefix.h>
#include <urldefid.h>
#include "ba1.h"
#include "ba1500.h"
@ -30,7 +31,6 @@
#else
const char* const http_default_path = "/aga/euro/zip/";
#endif
HIDDEN int compare_version(const char* v1, int p1, const char* v2, int p2)
{
TString16 ver1(v1), ver2(v2);
@ -81,11 +81,12 @@ class TInstaller_mask : public TArray_sheet
static TInstaller_mask* _curr_mask;
word _year_assist;
bool _installed; // Flag per verificare se almeno un modulo e' stato installato
enum {NONE, NEW_MENU, NEW_MENUPRG, NEW_INSTALLER} _reboot_program;
protected: // TSheet
virtual bool on_key(KEY key);
static bool quit_handler(TMask_field& f, KEY k);
static bool tutti_handler(TMask_field& f, KEY k);
static bool update_handler(TMask_field& f, KEY k);
int get_module_number(const char * module) const;
protected:
static bool path_handler(TMask_field& fld, KEY key);
@ -95,7 +96,7 @@ protected:
bool add_module(TConfig& ini, const TString& module, bool patch, int pos=-1);
bool add_header(TConfig& ini, const TString& module, bool patch);
int sort_modules();
int precheck_modules(bool only_newer=TRUE);
void update_version();
bool move_file(const TFilename& fromdir, const TFilename& file, const char* dir) const;
@ -103,12 +104,14 @@ protected:
bool can_install(const char* module, TInstall_ini& ini);
void install_selection();
bool install_patches(const TString& module, const TString& lastrelease, int lastpatch);
bool install_patches(const TString& module, const TString& lastrelease, int lastpatch , bool onlynew=TRUE);
KEY askdisk(TString & path, TFilename & cmdline, int d, int dischi, const char * modulo);
bool do_process(TToken_string& commands) const;
bool pre_process(TInstall_ini& ini, const char* module) const;
bool post_process(TInstall_ini& ini, const char* module) const;
bool get_internet_path(TFilename &ininame );
void parse_internet_path(TString & http_server, TFilename &http_path );
public:
bool installed() { return _installed;}
@ -135,7 +138,7 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch
row.add(ini.get("Versione"));
row.add(ini.get("Patch"));
row.add(ini.get("Data"));
row.add(patch ? "X" : " ", 9);
row.add(patch ? "X" : " ", C_ISPATCH);
if (pos==-1)
add(row);
else
@ -175,39 +178,50 @@ static int compare_modules(const TObject** o1, const TObject** o2)
return res;
}
int TInstaller_mask::sort_modules()
int TInstaller_mask::precheck_modules(bool only_newer)
{
// sort
const int tot = int(items());
return tot;
// vecchio codice per bubblare
TString16 release,currrelease;
int patchlevel,modnumber;
for (int r = 0; r < tot; r++)
{
const bool patch = row(r).get_char(C_ISPATCH) > ' ';
const char* mod = row(r).get(C_CODE);
if (patch)
release = row(r).get(C_RELEASE);
patchlevel = row(r).get_int(C_PATCH);
currrelease = row(r).get(C_CURRRELEASE);
modnumber=get_module_number(row(r).get(C_CODE));
if (modnumber >= 0 &&
!release.blank() &&
((release > currrelease) ||
(release == currrelease
&& (only_newer ? patchlevel>row(r).get_int(C_CURRPATCH): patchlevel>=row(r).get_int(C_CURRPATCH)) ))
&& main_app().has_module(modnumber) )
{
TString16 dis=mod;
const int patchlevel = row(r).get_int(C_PATCH);
// pop the patch line up to the module one
int br=r-1;
while (br && !(dis==row(br).get(C_CODE) && row(br).get_int(C_PATCH)<patchlevel))
{
// Swap rows
rows_array().TArray::swap(br,br+1);
const bool enab=row_enabled(br);
const bool enab1=row_enabled(br+1);
enable_row(br+1,enab);
enable_row(br, enab1);
br--;
}
// checca il modulo o la patch se ho installata la stessa versione
const bool chk = row(r).get_char(C_ISPATCH) == ' ' || release == row(r).get(C_CURRRELEASE) ;
check(r,chk );
}
}
return tot;
}
int TInstaller_mask::get_module_number(const char * module) const
{
int aut = -1;
if (module && * module)
{
TScanner scanner("prassi.aut");
bool ok = FALSE;
for (aut = 0; scanner.line() != ""; aut++)
if (strncmp(scanner.token(), module, 2) == 0) { ok = TRUE; break; }
}
return ok ? aut : -1;
}
void TInstaller_mask::update_version()
{
TInstall_ini ini;
@ -250,34 +264,33 @@ bool is_internet_path(const TString& addr)
bool TInstaller_mask::autoload()
{
TString_array& mask_rows = rows_array();
TFilename path = get(F_PATH);
TString http_server;
TFilename http_path;
TFilename path ;
TFilename ininame;
const bool internet = is_internet_path(path);
const bool internet = get_internet_path(path);
if (internet)
{
http_server = path;
parse_internet_path(http_server,http_path );
/* http_server = get(F_PATH);
if (http_server.compare("http://", 7, TRUE) == 0)
http_server.ltrim(7);
const int slash = http_server.find('/');
if (slash > 0)
{
http_path = http_server.mid(slash);
if (http_path.right(1) != "/")
http_path << '/';
http_server.cut(slash);
http_path = http_server.mid(slash);
if (http_path.right(1) != "/")
http_path << '/';
http_server.cut(slash);
}
else
http_path = http_default_path;
path.tempdir();
path.add("www");
http_path = http_default_path;*/
make_dir(path);
ininame = path;
@ -288,23 +301,26 @@ bool TInstaller_mask::autoload()
TString_array list;
TFilename name = path; name.add("*.*");
::list_files(name, list);
FOR_EACH_ARRAY_ROW(list, i, row)
::remove(*row);
}
if (!ininame.exist())
{
bool httpresult;
TFilename remote_ini = http_path;
remote_ini << TInstall_ini::default_name();
if (!http_get(http_server, remote_ini, ininame))
return error_box("Impossibile trasferire %s da %s",
(const char*)remote_ini, (const char*)http_server);
{
TIndwin contacting(60,"Sto contattando il server HTTP...",FALSE,FALSE);
httpresult=http_get(http_server, remote_ini, ininame);
}
if (!httpresult)
return error_box("Impossibile trasferire %s da %s",
(const char*)remote_ini, (const char*)http_server);
}
}
if (fexist(path))
}
if (path.exist())
{
ininame = path;
ininame.add(TInstall_ini::default_name());
@ -347,7 +363,8 @@ bool TInstaller_mask::autoload()
}
else
{
ininame = path;
// Presenti i singoli file ini dei moduli
ininame = path;
ininame.add("??inst.ini");
list_files(ininame, modules);
FOR_EACH_ARRAY_ROW(modules, m, row)
@ -359,41 +376,42 @@ bool TInstaller_mask::autoload()
const TString16 module = ininame.mid(pos-2, 2);
TConfig ini(ininame, module);
add_module(ini, module, FALSE);
}
}
}
// add patches
modules.destroy();
if (internet)
{
http_dir(http_server, http_path, modules);
for (int i = modules.last(); i >= 0; i--)
{
TString& str = modules.row(i);
if (str.match("??0???A.INI") || str.match("??0???a.ini"))
{
TFilename remote = http_path;
remote << str;
ininame = path;
ininame.add(str);
if (!ininame.exist() && !http_get(http_server, remote, ininame))
{
error_box("Errore di trasferimento del file %s", (const char*)remote);
modules.destroy(i);
}
str = ininame;
}
else
modules.destroy(i);
}
modules.pack();
http_dir(http_server, http_path, modules);
for (int i = modules.last(); i >= 0; i--)
{
TString& str = modules.row(i);
if (str.match("??0???A.INI") || str.match("??0???a.ini"))
{
TFilename remote = http_path;
remote << str;
ininame = path;
ininame.add(str);
if (!ininame.exist() && !http_get(http_server, remote, ininame))
{
error_box("Errore di trasferimento del file %s", (const char*)remote);
modules.destroy(i);
}
str = ininame;
}
else
modules.destroy(i);
}
modules.pack();
}
else
{
ininame = path;
ininame = path;
ininame.add("??0???a.ini");
list_files(ininame, modules);
}
@ -421,17 +439,21 @@ bool TInstaller_mask::autoload()
&& patchlevel > atoi(mask_rows.row(r+1).get(C_PATCH)) ) // ..e il patchlevel è superiore
{
mask_rows.row(r+1).add(patchlevel, C_PATCH); // aggiorna il patchlevel mostrato per il modulo
if (*mask_rows.row(r+1).get(C_ISPATCH)==' ') // se era un modulo ...
mask_rows.row(r+1).add("+", C_ISPATCH); // .....setta la presenza di patches
force_update(r+1);
}
}
else
add_module(ini, module, TRUE);
}
const bool ok = sort_modules() > 0;
if (ok)
update_version();
else
update_version();
const bool ok = precheck_modules() > 0;
if (!ok)
error_box("Non e' stato trovato nessun modulo da installare\n"
"in %s", (const char*)path);
@ -528,16 +550,25 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
{
TFilename dest(todir);
dest.add(file.mid(from.len()+1));
if (!fexist(dest.path()))
const char *fname=file.mid(from.len()+1);
if (strcmp(fname,"ba0.exe")==0)
dest.add("BA0.EX_");
else if (strcmp(fname,"ba1.exe")==0)
dest.add("BA1.EX_");
else
dest.add(fname);
if (!dest.exist())
{
// file contains non existent subdir specification
TToken_string dirs((const char * )(dest.path()),'\\');
// file contains non existent subdir specification ?
TFilename subdir;
for (int c=0; c < dirs.items()-1; c++)
for (int c=0; c < dirs.items(); c++)
{
subdir.add(dirs.get(c));
if (!fexist(subdir) )
if (subdir.right(1) == ":" )
subdir << '\\';
if (!subdir.exist() )
// build destination directory
make_dir(subdir);
}
@ -587,6 +618,9 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
(const char*)file);
} while (!write_ok && user_retry);
if (write_ok && strcmp(dest.ext(),"men")==0)
((TInstaller_mask *)this)->_reboot_program=NEW_MENU;
return write_ok;
}
@ -595,9 +629,9 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
bool ok = TRUE;
TFilename src; src.tempdir();
const TFilename tempdir(src);
const TString& dst = get(F_CURPATH);
const TFilename tempdir(src);
TString_array list;
ini.build_list(module, list);
FOR_EACH_ARRAY_ROW(list, f, file)
@ -613,9 +647,6 @@ bool TInstaller_mask::move_module(const TString& module, TInstall_ini& ini, bool
if (!update)
::remove(src);
}
if (update)
ini.export_paragraph(module, ini.default_name());
return ok;
}
@ -654,23 +685,24 @@ KEY TInstaller_mask::askdisk(TString & path, TFilename & cmdline, int d, int dis
}
bool TInstaller_mask::install(const TString& module, int patchlevel)
{
TInstall_ini* ini = NULL;
{
bool ok = FALSE;
TString msg; // stringa per i messaggi
TString16 lastrelease; // release che sto installando
int lastpatch=patchlevel; // patchlevel che sto installando
TFilename path = get(F_PATH);
TFilename path ;
TString http_server;
TFilename http_path;
const bool internet = is_internet_path(path);
const bool internet = get_internet_path(path);
if (internet)
{
http_server = path;
parse_internet_path(http_server,http_path );
/* {
http_server = get(F_PATH);
if (http_server.compare("http://", 7, TRUE) == 0)
http_server.ltrim(7);
const int slash = http_server.find('/');
if (slash > 0)
{
@ -681,10 +713,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
}
else
http_path = http_default_path;
path.tempdir();
path.add("www");
}
}*/
const bool is_a_patch=(patchlevel > 0);
TFilename ininame = path;
@ -705,10 +734,13 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
remote.insert(http_path, 0);
http_get(http_server, remote, ininame);
}
if (ininame.exist())
{
ini = new TInstall_ini (ininame);
// esiste un particolare .ini con formato XXinst.ini (moduli) o con XX9999a.ini (patch)
// (installazione da directory con .zip)
TInstall_ini *ini;
ini = new TInstall_ini(ininame);
ini->write_protect();
lastpatch=ini->get_int("Patch",module);
lastrelease=ini->get("Versione",module);
@ -733,10 +765,10 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
return FALSE;
}
}
TString msg;
msg << "Decompressione";
if (patchlevel > 0 )
// ***************
// decompressione
msg="Decompressione";
if (is_a_patch)
msg << " della patch " << patchlevel ;
msg << " del modulo '" << module << "' in corso...";
@ -830,24 +862,28 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
TAuto_token_string altri(ini->get("Moduli", module));
FOR_EACH_TOKEN(altri, mod)
{
const TString16 submod = mod;
if (submod.len() > 2) // sposta sottomoduli esterni
TAuto_token_string altri(ini->get("Moduli", module));
FOR_EACH_TOKEN(altri, mod)
{
bool upd = ok;
if (ok)
const TString16 submod = mod;
if (submod.len() > 2) // sposta sottomoduli esterni
{
TInstall_ini curini;
const TString16 curver = curini.version(submod);
const int curpatch = curini.patch(submod);
const TString16 reqver = ini->version(submod);
const int reqpatch = ini->patch(submod);
int distance = compare_version(reqver, reqpatch, curver, curpatch);
upd = distance > 0;
bool upd = ok;
if (ok)
{
TInstall_ini curini;
const TString16 curver = curini.version(submod);
const int curpatch = curini.patch(submod);
const TString16 reqver = ini->version(submod);
const int reqpatch = ini->patch(submod);
int distance = compare_version(reqver, reqpatch, curver, curpatch);
upd = distance > 0;
}
ok &= move_module(submod, *ini, upd);
if (upd && ok) // marca sull'install.ini di destinazione l'avvenuta installazione del sottomodulo "esterno"
ini->export_paragraph(submod, ini->default_name(),!is_a_patch);
}
ok &= move_module(submod, *ini, upd);
if (upd && ok) // marca sull'install.ini di destinazione l'avvenuta installazione del sottomodulo "esterno"
ini->export_paragraph(submod, ini->default_name(),!is_a_patch);
}
}
}
@ -882,14 +918,21 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
if (ok)
{
TProgind pi(files, "Copia in corso...", FALSE, TRUE);
msg.cut(0);
msg << "Copia in corso del modulo '" << module << "'...";
TProgind pi(files, msg, FALSE, TRUE);
TFilename src, dst;
for (int f = 0; f < files && ok; f++)
{
pi.addstatus(1);
dst = list.row(f).get(0);
dst.lower();
src = path;
src.add(dst);
if (dst=="ba1.exe")
dst="ba1.ex_";
if (dst=="ba0.exe")
dst="ba0.ex_";
ok = fcopy(src, dst);
}
}
@ -925,16 +968,45 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
}
bool TInstaller_mask::install_patches(const TString& module, const TString& lastrelease, int lastpatch)
bool TInstaller_mask::get_internet_path(TFilename &ininame )
{
bool ok = FALSE;
TString_array modules;
TFilename ininame = get(F_PATH);
ininame = get(F_PATH);
if (is_internet_path(ininame))
{
ininame.tempdir();
ininame.add("www");
return TRUE;
}
return FALSE;
}
void TInstaller_mask::parse_internet_path(TString & http_server, TFilename &http_path )
{
http_server = get(F_PATH);
if (http_server.compare("http://", 7, TRUE) == 0)
http_server.ltrim(7);
const int slash = http_server.find('/');
if (slash > 0)
{
http_path = http_server.mid(slash);
if (http_path.right(1) != "/")
http_path << '/';
http_server.cut(slash);
}
else
http_path = http_default_path;
}
bool TInstaller_mask::install_patches(const TString& module, const TString& lastrelease, int lastpatch, bool only_newer)
{
bool ok = TRUE;
TString_array modules;
TFilename ininame;
get_internet_path(ininame);
ininame.add(module);
ininame << "0???a.ini";
@ -951,8 +1023,8 @@ bool TInstaller_mask::install_patches(const TString& module, const TString& last
TConfig ini(ininame, patchmodule);
const int patchlevel = ini.get_int("Patch");
const char * patchversion = ini.get("Versione");
if (lastrelease == patchversion // installa solo le patch della stessa ver..
&& lastpatch < patchlevel) // ... e patch superiore
if (ok && lastrelease == patchversion // installa solo le patch della stessa ver..
&& (only_newer ? lastpatch < patchlevel : lastpatch <= patchlevel)) // ... e patch superiore o uguale (reinstalla l'ultima patch)
ok = install(module, patchlevel);
}
return ok;
@ -980,15 +1052,16 @@ bool TInstaller_mask::path_handler(TMask_field& fld, KEY key)
{
path << SLASH;
fld.set(path);
}
}
if (path.exist() || ::is_internet_path(path))
_curr_mask->autoload();
else
ok = fld.error_box("Specificare un percorso valido");
}
}
return ok;
}
}
return ok;
}
void TInstaller_mask::install_selection()
{
@ -1015,7 +1088,8 @@ void TInstaller_mask::install_selection()
}
bool ok = TRUE;
bool is_patch = row->get_char(C_ISPATCH) > ' ';
bool is_patch = row->get_char(C_ISPATCH) == 'X';
bool has_patch = row->get_char(C_ISPATCH) == '+';
const int cmp = compare_version(oldver, oldpatch, newver, newpatch);
if (cmp == 0)
ok = noyes_box("Si desidera reinstallare la versione %s.%d del modulo '%s' ?", (const char*)newver, newpatch, (const char*)modulo);
@ -1041,11 +1115,11 @@ void TInstaller_mask::install_selection()
if (ok)
{
if (!is_patch)
if (has_patch)
{
if (newver == oldver && newpatch != oldpatch &&
!noyes_box("Si desidera reinstallare l'intero modulo?\n"
"Rispondendo NO verranno installate le sole patch"))
if (newver == oldver && newpatch >= oldpatch &&
!noyes_box("Si desidera reinstallare l'intero modulo '%s'?\n"
"Rispondendo NO verranno installate le sole patch",(const char *)modulo))
{
is_patch = TRUE;
}
@ -1053,9 +1127,7 @@ void TInstaller_mask::install_selection()
if (is_patch)
{
ok = install_patches(modulo, oldver, oldpatch); // installa tutte le patch
if (!ok)
ok = install(modulo, newpatch); // re-installa l'ultima per sicurezza ()
ok = install_patches(modulo, oldver, oldpatch, FALSE) ; // installa l'ultima patch
if (!ok)
message_box("Impossibile installare le patch del modulo '%s'",(const char *)modulo);
}
@ -1070,8 +1142,11 @@ void TInstaller_mask::install_selection()
if (ok)
check(r, FALSE);
}
check(r,FALSE); // uncheck
else
check(r,FALSE); // uncheck
}
if (installed())
message_box("Installazione conclusa");
}
bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
@ -1088,38 +1163,31 @@ bool TInstaller_mask::install_handler(TMask_field& fld, KEY key)
return TRUE;
}
bool TInstaller_mask::tutti_handler(TMask_field& f, KEY k)
bool TInstaller_mask::quit_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TSheet& s = (TSheet&)f.mask();
if (s.check_enabled())
{
if (s.one_checked())
s.uncheck(-1);
else
{
for (long i = s.items()-1; i >=0; i--)
{
TToken_string r = s.row(i);
const TString16 newver = r.get(C_RELEASE);
const int newpatch = r.get_int(C_PATCH);
const TString16 curver = r.get(C_CURRRELEASE);
const int curpatch = r.get_int(C_CURRPATCH);
s.check(i, compare_version(newver, newpatch, curver, curpatch) > 0);
}
}
}
TInstaller_mask & m=(TInstaller_mask &) f.mask();
if (m.one_checked())
return noyes_box("Alcuni moduli sono selezionati per l'installazione.\nConfermi l'uscita?");
}
return TRUE;
}
bool TInstaller_mask::update_handler(TMask_field& f, KEY k)
bool TInstaller_mask::tutti_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TInstaller_mask& m = (TInstaller_mask&)f.mask();
m.autoload();
TInstaller_mask & m=(TInstaller_mask &) f.mask();
if (m.check_enabled())
{
if (m.one_checked())
m.uncheck(-1);
else
m.precheck_modules(FALSE);
}
}
return TRUE;
}
@ -1143,15 +1211,20 @@ TInstaller_mask::TInstaller_mask()
{
_curr_mask = this;
_installed = FALSE;
_reboot_program= NONE;
add_string(F_PATH, 0, "Installa da ", 1, 1, 50);
add_string(F_CURPATH, 0, "Installa in ", 1, 2, 50, "D");
add_button(F_UPDATE, "Aggiorna", '\0');
//TMask::add_button(F_UPDATE, 0, "Rileggi", 60,1,9,1,""/*,BMP_LINK*/);
add_button(F_UPDATE, "Rileggi", '\0');
//TMask::add_button(F_INSTALL, 0, "Installa", 60,1,9,1,""/*,BMP_LINK*/);
add_button(F_INSTALL, "Installa", '\0'); // NON mettere 'I'
set_handler(F_PATH, path_handler);
set_handler(F_INSTALL, install_handler);
set_handler(F_UPDATE, update_handler);
set_handler(DLG_QUIT, quit_handler);
set_handler(DLG_USER, tutti_handler);
TDongle dongle; dongle.login(); dongle.logout();
@ -1176,6 +1249,38 @@ TInstaller_mask::TInstaller_mask()
TInstaller_mask::~TInstaller_mask()
{
_curr_mask = NULL;
TString msg;
TFilename ba0exfile("ba0.ex_"),ba1exfile("ba1.ex_");
switch (_reboot_program)
{
case NEW_MENU:
msg << "sono stati aggiornati i menu'";
default:
if (ba0exfile.exist())
{
if (!msg.blank())
msg << " e ";
else
msg << "e' stato ";
msg << "aggiornato il navigatore dei menu'";
}
if (ba1exfile.exist())
{
if (!msg.blank())
msg << " e ";
else
msg << "e' stato ";
msg << "aggiornato l'installatore";
}
}
if (!msg.empty())
{
msg.insert("Attenzione:");
msg << ".\nE' necessario uscire e rientrare dal programma";
warning_box(msg);
}
}
///////////////////////////////////////////////////////////
@ -1185,15 +1290,22 @@ TInstaller_mask::~TInstaller_mask()
class TInstaller : public TSkeleton_application
{
protected:
bool testdatabase() const ;
virtual bool use_files() const { return FALSE; }
virtual void main_loop();
};
bool TInstaller::testdatabase() const
{
TConfig ini(CONFIG_INSTALL);
return ini.get("TestDatabase","Main",-1,"Y") != "N";
}
void TInstaller::main_loop()
{
TInstaller_mask m;
m.run();
if (m.installed()) // Almeno 1 modulo installato ?
if (m.installed() && testdatabase()) // Almeno 1 modulo installato ?
{
// Lancia conversione: ba1 -0 -C -uPRASSI
TExternal_app conversion("ba1 -0 -C");

View File

@ -6,6 +6,7 @@
#include <mask.h>
#include <printapp.h>
#include <tabutil.h>
#include <utility.h>
#include <nditte.h>
@ -19,16 +20,22 @@ class BA3200_application : public TPrintapp
{
TString _tabname;
TFilename _rptname;
TRelation* _rel;
TScanner *_rpt;
TFilename _maskname;
TMask *_msk;
TRelation *_rel;
TCursor *_cur;
TMask* _msk;
TString _maskname;
int _logicnum;
TString_array _string_roman, _string_compound;
TString_array _field_roman, _field_compound;
bool _stampa_registri;
bool _stampa_ca7; //tabella causali 770
bool _tabella_comune;
protected:
TString& get_rpt_name(TString& t) const;
TString& get_mask_name(TString& t) const;
void destroy_objects();
public:
@ -45,11 +52,41 @@ public:
void set_footers();
void set_translations();
void set_relations();
BA3200_application() {}
BA3200_application(): _rel(NULL), _cur(NULL), _msk(NULL), _rpt(NULL) {}
virtual ~BA3200_application() {}
};
TString& BA3200_application::get_mask_name(TString& t) const
{
CHECK(_rel,"Can't use a NULL relation to retrieve table module");
TTable& tab = (TTable&) _rel->lfile(_tabname);
TString16 m = _tabname;
if (m[0] == '%') m.ltrim(1);
t = tab.module();
t << "st" << m;
t.upper();
return t;
}
TString& BA3200_application::get_rpt_name(TString& t) const
{
CHECK(_rel,"Can't use a NULL relation to retrieve table module");
TTable& tab = (TTable&) _rel->lfile(_tabname);
TString16 m = _tabname;
if (m[0] == '%') m.ltrim(1);
t = tab.module();
t << "tb" << m;
t.upper();
return t;
}
bool BA3200_application::set_print(int)
{
TRectype from(_rel->lfile().curr()); from.zero();
@ -166,18 +203,17 @@ void BA3200_application::set_headers()
reset_header ();
TScanner rpt(_rptname);
rpt.paragraph("Headers");
_rpt->paragraph("Headers");
// Leggo la lunghezza della riga (usata per centrare l'intestazione)
line = rpt.line();
line = _rpt->line();
LungRiga = line.get_int();
riga.spaces(LungRiga);
// Senno' nella stampa a 80 non ci sta ditta e data
// Leggo il nome della tabella
line = rpt.line();
line = _rpt->line();
NomeTabella = line.get();
// Sulla prima riga di intestazione metto la ditta, la data e la pagina
@ -223,7 +259,7 @@ void BA3200_application::set_headers()
//sep.fill ('-', LungRiga);
//set_header (last_riga, "%s", (const char *)sep);
line = rpt.line();
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
riga_intesta = atoi (line.get());
@ -232,7 +268,7 @@ void BA3200_application::set_headers()
if (riga_intesta)
set_header (last_riga+riga_intesta, (const char *)formato_intesta,
(const char *)testo_intesta);
line = rpt.line();
line = _rpt->line();
}
if (riga_intesta) last_riga += riga_intesta;
@ -252,10 +288,9 @@ void BA3200_application::set_rows()
TString formato_campo, picture;
const char * name;
TScanner rpt(_rptname);
rpt.paragraph("Rows");
_rpt->paragraph("Rows");
line = rpt.line();
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
riga_record = line.get_int();
@ -312,7 +347,7 @@ void BA3200_application::set_rows()
set_row (riga_record, formato_campo, _string_compound.objptr(last));
}
line = (const char *) rpt.line();
line = (const char *) _rpt->line();
}
}
@ -324,15 +359,14 @@ void BA3200_application::set_footers()
reset_footer();
TScanner rpt(_rptname);
rpt.paragraph("Footers");
_rpt->paragraph("Footers");
line = rpt.line();
line = _rpt->line();
footer_len = line.get_int();
if (footer_len != 0)
{
printer().footerlen(footer_len);
line = rpt.line();
line = _rpt->line();
}
while ( (line != "") && (line[0] != '[') )
{
@ -340,7 +374,7 @@ void BA3200_application::set_footers()
formato = line.get();
testo = line.get();
set_footer (riga, (const char *)formato, (const char*)testo);
line = rpt.line();
line = _rpt->line();
}
}
@ -350,10 +384,9 @@ void BA3200_application::set_translations()
TToken_string line;
int logicnum;
TScanner rpt(_rptname);
rpt.paragraph("Translations");
_rpt->paragraph("Translations");
line = rpt.line();
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
logicnum = line.get_int();
@ -361,7 +394,7 @@ void BA3200_application::set_translations()
from = line.get();
to = line.get();
set_translation (logicnum, (char*)(const char *)campo, (char*)(const char *)from, (char*)(const char *)to);
line = rpt.line();
line = _rpt->line();
}
}
@ -371,10 +404,9 @@ void BA3200_application::set_relations()
TString tab(16), expr(40);
int key, linkto, alias, logicnum;
TScanner rpt(_rptname);
rpt.paragraph("Relations");
_rpt->paragraph("Relations");
line = rpt.line();
line = _rpt->line();
while ( (line != "") && (line[0] != '[') )
{
tab = line.get();
@ -389,49 +421,62 @@ void BA3200_application::set_relations()
else
_rel->add(tab, expr, key, linkto, alias);
line = rpt.line();
line = _rpt->line();
}
}
bool BA3200_application::user_create()
{
_tabname = argv(2);
TString16 t(_tabname);
_tabella_comune = (t[0] == '%');
if (_tabella_comune)
t.ltrim(1);
bool ok=TRUE;
_rptname << "batb" << t << ".rpt" ;
if (!fexist(_rptname))
return error_box("Impossibile aprire il file '%s'", (const char*)_rptname);
// Flag per la stampa tabella registri
_tabname = argv(2);
_tabname.upper();
_tabella_comune = (_tabname[0] == '%');
// Flag per la stampa tabella registri
_stampa_registri = (_tabname == "REG");
_stampa_ca7 = (_tabname == "%CA7");
_rel = new TRelation (_tabname);
_cur = new TCursor (_rel);
_maskname << "bast" << t;
_msk = new TMask (_maskname) ;
add_cursor (_cur);
add_file (_tabname);
_logicnum = _cur->file().num();
reset_print ();
printer().footerlen (FOOTER_LEN);
for (int i=1; i <= FOOTER_LEN; i++) set_footer(i, "%s", " ");
TString16 t;
t = _tabname.right(3);
_maskname << get_mask_name(t) << ".msk";
if (!_maskname.exist())
ok = error_box("Impossibile aprire la maschera di stampa %s", (const char *)_maskname);
else
_msk = new TMask (_maskname) ;
if (ok)
{
t = _tabname.right(3);
_rptname << get_rpt_name(t) << ".rpt" ;
if (!_rptname.exist())
ok = error_box("Impossibile aprire il report di stampa %s", (const char *)_rptname);
else
{
_rpt = new TScanner(_rptname);
add_cursor (_cur);
add_file (_tabname);
_logicnum = _cur->file().num();
reset_print ();
printer().footerlen (FOOTER_LEN);
for (int i=1; i <= FOOTER_LEN; i++) set_footer(i, "%s", " ");
#ifdef DBG1
set_fillchar ('.');
set_fillchar ('.');
#endif
set_relations();
return TRUE;
set_relations();
}
}
if (!ok)
destroy_objects() ;
return ok;
}
bool BA3200_application::preprocess_print(int file, int counter)
@ -442,11 +487,16 @@ bool BA3200_application::preprocess_print(int file, int counter)
return TRUE;
}
void BA3200_application::destroy_objects()
{
if (_msk) delete _msk;
if (_cur) delete _cur;
if (_rel) delete _rel;
}
bool BA3200_application::user_destroy()
{
delete _msk;
delete _cur;
delete _rel;
destroy_objects() ;
return TRUE;
}

View File

@ -19,7 +19,7 @@ int main(int argc,char** argv)
case 1:
rt = ba5200(argc,argv) ; break; // Gestione registri
case 2:
rt = ba5300(argc,argv) ; break; // ricezione AB/CAB
rt = ba5300(argc,argv) ; break; // ricezione ABI/CAB
default:
error_box(usage, argv[0]) ; break;
}

View File

@ -253,3 +253,4 @@ int ba5300(int argc, char* argv[])
app.run(argc,argv,"Ricezione ABI e CAB");
return 0;
}

View File

@ -1,65 +0,0 @@
#include <applicat.h>
#include <mask.h>
#include <config.h>
#include <utility.h>
#include <execp.h>
#include "bainst04.h"
class TInstall_AT : public TSkeleton_application
{
TMask * _m;
protected:
virtual void main_loop() ;
virtual bool set_ditta() ; // setta i dati ditta
virtual bool set_environment() ; //
public:
virtual ~TInstall_AT () {}
};
// setta i dati ditta
bool TInstall_AT ::set_ditta()
{
return TRUE;
}
bool TInstall_AT ::set_environment()
{
bool ok=TRUE;
if (_m->get_bool(F_USAMENUAVIS))
ok=fcopy("agaat.men","baprassi.men");
if (_m->get_bool(F_LOADTAB))
{
TExternal_app rice("bacnv 1 5 attab.txt");
ok &= (rice.run()==0);
}
return ok;
}
void TInstall_AT::main_loop()
{
TConfig ini("install.ini","at");
const bool primainst=ini.get("Versione").blank();
_m = new TMask ("bainst04.msk");
if (!primainst)
_m->disable(-G_DITTA); // campi ditta
else
_m->set(F_LOADTAB,"X");
_m->field(F_USAMENUAVIS).set("X");
if (_m->run()!=K_QUIT)
{
if (primainst)
{
set_ditta();
}
set_environment();
}
}
int bainst04(int argc, char** argv)
{
TInstall_AT app;
app.run(argc, argv, "Installazione Avis Provinciale");
return 0;
}

View File

@ -1,3 +1,3 @@
#include "bainst.h"
#include "bainsta.h"
#define F_USAMENUAVIS 101
#define F_LOADTAB 102

View File

@ -3,6 +3,9 @@
#include <config.h>
#include <utility.h>
#include <execp.h>
#include <isam.h>
#include "bainst.h"
#include "bainst05.h"
class TInstall_VE : public TSkeleton_application
@ -29,8 +32,10 @@ bool TInstall_VE ::install_com()
bool ok=TRUE;
if (_m->get_bool(F_LOADTAB))
{
TExternal_app rice("bacnv 1 4 vetab.txt");
ok &= (rice.run()==0);
TStd_filename txtfile("vetabcom.txt");
TSystemisamfile tabcom(LF_TABCOM);
if (!txtfile.blank())
tabcom.load(txtfile);
}
return ok;
}

View File

@ -1,2 +1,2 @@
#include "bainst.h"
#include "bainsta.h"
#define F_LOADTAB 101

85
ba/bainst07.cpp Executable file
View File

@ -0,0 +1,85 @@
#include <windows.h>
#include <applicat.h>
#include <execp.h>
#include <mask.h>
#include <isam.h>
#include <config.h>
#include "bainst.h"
#include "bainst07.h"
bool all_ok;
class TInstall_CG : public TInstallmodule_app
{
private:
bool CreaExeIni(const char * exename);
protected:
virtual int module_number() const {return 7;}
virtual bool install_firm() {return TRUE;} // no firm installation
virtual bool install_com();
virtual bool post_installer();
public:
virtual ~TInstall_CG () {}
};
bool TInstall_CG ::install_com()
{
// modifica per morena da togliere appena c'e' tempo:
// installa fliva.txt che noin c'e' in STD dei programmi,
// quindi la cerca in area dati (come prima)
bool ok=TRUE;
TStd_filename txtfile;
if (txtfile.check(TRUE,"lfiva.txt"))
{
TSystemisamfile tabcom(LF_TABCOM);
tabcom.load((const char *)txtfile);
}
return ok;
}
// crea il .ini per i files exe copiati nella directory di EASYCAMPO
bool TInstall_CG ::CreaExeIni(const char * exename)
{
TFilename ininame(128);
GetWindowsDirectory(ininame.get_buffer(), 128);
ininame.add(exename);
TFilename dllname;
ininame.ext("ini");
TConfig ini(ininame);
dllname.currdir();
dllname.add("xbs200.dll");
ini.set_paragraph("Installable ISAMs");
ini.set("FoxPro 2.0" ,dllname );
ini.set("FoxPro 2.5" ,dllname );
ini.set("dBASE III" ,dllname );
ini.set("dBASE IV" ,dllname );
ini.set("Deleted","On","dBase ISAM");
ini.set("ParadoxNetStyle","3.x","Paradox ISAM" );
return TRUE;
}
bool TInstall_CG ::post_installer()
{
bool ok=TRUE;
// copia dll (ex file PRASSI.PR inst.exe
ok &= CreaExeIni("CB0000.EXE");
ok &= CreaExeIni("TRRICE.EXE");
ok &= CreaExeIni("VCOPIA.EXE");
return ok;
}
int bainst07(int argc, char** argv)
{
TInstall_CG app;
app.run(argc, argv);
return all_ok;
}

2
ba/bainst07.h Executable file
View File

@ -0,0 +1,2 @@
#include "bainsta.h"

21
ba/bainst07.uml Executable file
View File

@ -0,0 +1,21 @@
#include "bainst07.h"
PAGE "Installazione CG" -1 -1 78 8
// GROUP 1 = PRE-INSTALLATION
// GROUP 2 = POST-INSTALLATION
BOOL F_DEFAULTSDATA
BEGIN
PROMPT 2 2 "Installa dati IVA"
GROUP 1
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -11 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
PICTURE BMP_OK
END
ENDPAGE
ENDMASK

53
ba/bainst17.cpp Executable file
View File

@ -0,0 +1,53 @@
#include <applicat.h>
#include <mask.h>
#include <isam.h>
#include <utility.h>
#include "bainst.h"
#include "bainst17.h"
class TInstall_AT : public TInstallmodule_app
{
protected:
virtual int module_number() const {return 17;}
virtual bool preload_mask() ;
virtual bool install_firm() ; //
bool post_installer() ;
public:
virtual ~TInstall_AT () {}
};
bool TInstall_AT ::install_firm()
{
bool ok=TRUE;
set_firm(1); // provvisorio ....
TStd_filename txtfile("svtab.txt");
if (txtfile.check(TRUE))
{
TSystemisamfile tabditta(LF_TAB);
tabditta.load(txtfile);
}
return ok;
}
bool TInstall_AT ::post_installer()
{
bool ok=TRUE;
if (_m->get_bool(F_USAMENUAVIS))
ok=fcopy("agaat.men","baprassi.men");
return ok;
}
bool TInstall_AT::preload_mask()
{
_m->field(F_USAMENUAVIS).set("X");
return TInstallmodule_app::preload_mask();
}
int bainst17(int argc, char** argv)
{
TInstall_AT app;
app.run(argc, argv);
return 0;
}

2
ba/bainst17.h Executable file
View File

@ -0,0 +1,2 @@
#include "bainsta.h"
#define F_USAMENUAVIS 102

View File

@ -1,28 +1,20 @@
#include "bainst04.h"
#include "bainst17.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -11 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
PICTURE BMP_OK
END
ENDPAGE
PAGE "Installazione AT" -1 -1 78 8
// GROUP 1 = PRE-INSTALLATION
// GROUP 2 = POST-INSTALLATION
BOOL F_DEFAULTSDATA
BEGIN
PROMPT 2 2 "Carica dati standard"
END
BOOL F_USAMENUAVIS
BEGIN
FLAGS "D"
PROMPT 2 2 "Usa menu' AVIS"
END
BOOL F_LOADTAB
BEGIN
PROMPT 2 4 "Carica dati standard"
END
/*GROUPBOX DLG_NULL 60 4
BEGIN
FLAG "H"
@ -31,5 +23,12 @@ BEGIN
END
*/
BUTTON DLG_OK 10 2
BEGIN
PROMPT -11 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
PICTURE BMP_OK
END
ENDPAGE
ENDMASK

26
ba/bainst31.cpp Executable file
View File

@ -0,0 +1,26 @@
#include <config.h>
#include <utility.h>
#include <execp.h>
#include <isam.h>
#include "bainst.h"
#include "bainst31.h"
class TInstall_VE : public TInstallmodule_app
{
TMask * _m;
protected:
virtual int module_number() const {return 31;}
virtual bool install_firm() {return TRUE;} // no firm installation
public:
virtual ~TInstall_VE () {}
};
int bainst31(int argc, char** argv)
{
TInstall_VE app;
app.run(argc, argv);
return 0;
}

1
ba/bainst31.h Executable file
View File

@ -0,0 +1 @@
#include "bainsta.h"

View File

@ -1,21 +1,12 @@
#include "bainst05.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -11 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
PICTURE BMP_OK
END
ENDPAGE
#include "bainst31.h"
PAGE "Installazione VE" -1 -1 78 8
// GROUP 1 = PRE-INSTALLATION
// GROUP 2 = POST-INSTALLATION
BOOL F_LOADTAB
BOOL F_DEFAULTSDATA
BEGIN
PROMPT 2 4 "Carica le tabelle con i tipi documento"
PROMPT 2 2 "Carica le tabelle con i tipi documento"
END
/*GROUPBOX DLG_NULL 60 4
@ -26,5 +17,12 @@ BEGIN
END
*/
BUTTON DLG_OK 10 2
BEGIN
PROMPT -11 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
PICTURE BMP_OK
END
ENDPAGE
ENDMASK

26
ba/bainst32.cpp Executable file
View File

@ -0,0 +1,26 @@
#include <applicat.h>
#include <mask.h>
#include <config.h>
#include <utility.h>
#include <isam.h>
#include "bainst.h"
#include "bainst32.h"
class TInstall_MG : public TInstallmodule_app
{
TMask * _m;
protected:
virtual int module_number() const {return 32;}
virtual bool install_firm() {return TRUE;} // no firm installation
public:
virtual ~TInstall_MG () {}
};
int bainst32(int argc, char** argv)
{
TInstall_MG app;
app.run(argc, argv);
return 0;
}

1
ba/bainst32.h Executable file
View File

@ -0,0 +1 @@
#include "bainsta.h"

21
ba/bainst32.uml Executable file
View File

@ -0,0 +1,21 @@
#include "bainst32.h"
PAGE "Installazione MG" -1 -1 78 8
// GROUP 1 = PRE-INSTALLATION
// GROUP 2 = POST-INSTALLATION
BOOL F_DEFAULTSDATA
BEGIN
PROMPT 2 2 "Carica le tabelle con le causali"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -11 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
PICTURE BMP_OK
END
ENDPAGE
ENDMASK

24
ba/bainst38.cpp Executable file
View File

@ -0,0 +1,24 @@
#include <applicat.h>
#include <mask.h>
#include <utility.h>
#include <prefix.h>
#include <isam.h>
#include "bainst.h"
#include "bainst38.h"
class TInstall_SV : public TInstallmodule_app
{
protected:
virtual int module_number() const {return 38;}
virtual bool install_com() {return TRUE;} // no com installation
public:
virtual ~TInstall_SV () {}
};
int bainst38(int argc, char** argv)
{
TInstall_SV app;
app.run(argc, argv);
return 0;
}

2
ba/bainst38.h Executable file
View File

@ -0,0 +1,2 @@
#include "bainsta.h"
#define F_LOADTAB 101

20
ba/bainst38.uml Executable file
View File

@ -0,0 +1,20 @@
#include "bainst38.h"
PAGE "Installazione SV" -1 -1 78 8
// GROUP 1 = PRE-INSTALLATION
// GROUP 2 = POST-INSTALLATION
BOOL F_DEFAULTSDATA
BEGIN
PROMPT 2 2 "Carica la tabella con le statistiche predefinite"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -11 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
PICTURE BMP_OK
END
ENDPAGE
ENDMASK

4
ba/bainsta.h Executable file
View File

@ -0,0 +1,4 @@
#define G_PREINST 1
#define G_POSTINST 2
#define G_DITTA 3
#define F_DEFAULTSDATA 101

View File

@ -10,4 +10,5 @@
#define F_STD_CHANGE 108
#define F_STD_MULT 109
#define F_STD_CODE 110
#define F_DECIMALSPR 111

View File

@ -8,7 +8,7 @@ ENDPAGE
PAGE "Valute" -1 -1 78 12
GROUPBOX DLG_NULL 78 5
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 1 ""
FLAGS "R"
@ -26,7 +26,7 @@ BEGIN
DISPLAY "Valuta@50" S0
OUTPUT F_CODE CODTAB
OUTPUT F_DESC S0
MESSAGE COPY,F_CUR_CODE|COPY,F_STD_CODE
// MESSAGE COPY,F_CUR_CODE|COPY,F_STD_CODE
HELP "Codice della valuta"
CHECKTYPE REQUIRED
END
@ -48,10 +48,18 @@ END
NUMBER F_DECIMALS 1
BEGIN
PROMPT 2 4 "Decimali "
PROMPT 2 5 "Decimali per importi "
FIELD I0
NUM_EXPR (#THIS_FIELD>=0)&&(#THIS_FIELD<=5)
WARNING "Si possono specificare al massimo 5 cifre decimali"
NUM_EXPR (#THIS_FIELD>=0)&&(#THIS_FIELD<=3)
WARNING "Si possono specificare al massimo 3 cifre decimali"
END
NUMBER F_DECIMALSPR 1
BEGIN
PROMPT 2 6 "Decimali per prezzi "
FIELD I1
NUM_EXPR (#THIS_FIELD>=0)&&(#THIS_FIELD<=3)
WARNING "Si possono specificare al massimo 3 cifre decimali"
END
GROUPBOX DLG_NULL 78 3
@ -62,15 +70,16 @@ END
NUMBER F_CUR_CHANGE 15 5
BEGIN
PROMPT 2 8 "Cambio "
PROMPT 2 8 "Cambio "
FIELD R10
PICTURE ".5"
FLAGS "U"
END
/*
NUMBER F_CUR_MULT 7
BEGIN
PROMPT 32 8 "ogni "
PROMPT 40 8 "ogni "
FIELD I10
FLAGS "U"
NUM_CALC IF((#THIS_FIELD==0),1,#THIS_FIELD)
@ -78,17 +87,19 @@ END
STRING F_CUR_CODE 3
BEGIN
PROMPT 47 8 ""
PROMPT 55 8 ""
FLAGS "D"
END
*/
DATE F_LASTDATE
BEGIN
PROMPT 58 8 "Data "
PROMPT 62 8 "Data "
FIELD D0
HELP "Data di ultimo aggiornamento"
END
/*
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 11 "Cambio standard"
@ -97,7 +108,7 @@ END
NUMBER F_STD_CHANGE 15 5
BEGIN
PROMPT 2 12 "Cambio "
PROMPT 2 12 "Cambio "
FIELD R11
PICTURE ".5"
FLAGS "U"
@ -105,7 +116,7 @@ END
NUMBER F_STD_MULT 7
BEGIN
PROMPT 32 12 "ogni "
PROMPT 40 12 "ogni "
FIELD I11
FLAGS "U"
NUM_CALC IF((#THIS_FIELD==0),1,#THIS_FIELD)
@ -113,9 +124,10 @@ END
STRING F_STD_CODE 3
BEGIN
PROMPT 47 12 ""
PROMPT 55 12 ""
FLAGS "D"
END
*/
ENDPAGE

View File

@ -72,7 +72,7 @@ class CG1100_application : public TPrintapp
long _sottoc,_s_prec;
TString _classe_da_stampare,_classe_stampata,_codcbl_da_stamp,_codcbl_stamp;
bool _conto_classificato,_stampa_riga_vuota;
byte _sottoc_classificato;
int _sottoc_classificato;
bool _prima_volta, _stampa_g, _stampa_c;
TDate _data_stampa;

View File

@ -430,6 +430,17 @@ int TElimina_zoppi::kill_game(long numreg, int numrig)
update = TRUE;
}
}
// Elimina le righe sopravvissute
for (p = game->last(); p > 0; p = game->pred(p))
{
TRiga_partite& part = game->riga(p);
if (part.get_long(PART_NREG) == numreg)
{
game->rimuovi_riga(p);
update = TRUE;
}
}
}
if (update)
game->rewrite();

View File

@ -3506,7 +3506,7 @@ print_action TStampa_bilanci::postprocess_page(int file, int counter)
TDate TStampa_bilanci::UltimaData(int g, int c, long s, int anno)
{
TDate uldata;
TLocalisamfile saldi(LF_SALDI); //il parametro a false permette di usare un record corrente del file saldi differente a quello del file tmp
TLocalisamfile saldi(LF_SALDI);
saldi.zero();
if (_annoes != 0)
@ -3525,7 +3525,8 @@ TDate TStampa_bilanci::UltimaData(int g, int c, long s, int anno)
return uldata;
}
//Non ho potuto usare quella di TConto!!! Chiedere a me!
// Non ho potuto usare quella di TConto!!! Chiedere a me!
// Guy: E tu chi sei?
const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf)
{
TString80 ragsoc;

View File

@ -1164,7 +1164,7 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_scalare()
if (classe_conto)
{
sez_opp = pconti.get(PCN_SEZIVDOPP);
if (sez_opp != "0")
if (sez_opp.not_empty() && sez_opp != "0")
{
let_opp = pconti.get(PCN_LETTIVDOPP);
numr_opp = pconti.get(PCN_NUMRIVDOPP);
@ -1281,7 +1281,7 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_scalare()
else
{
sez_opp = pconti.get(PCN_SEZIVDOPP);
if (sez_opp != "0")
if (sez_opp.not_empty() && sez_opp != "0")
{
let_opp = pconti.get(PCN_LETTIVDOPP);
numr_opp = pconti.get(PCN_NUMRIVDOPP);

View File

@ -2428,8 +2428,8 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
if (key == K_ENTER)
{
const TString im(m.get(F_IMPONIBILI));
const char* cl = f.get();
const real im(m.get_real(F_IMPONIBILI));
const real cl(f.get());
if (im != cl)
warning_box("Il corrispettivo in lire e' diverso dal totale degli imponibili");
}

View File

@ -202,10 +202,10 @@ END
STRING FS_DESCAGENTE 50
BEGIN
PROMPT 25 10 ""
USE AGE KEY 2
INPUT S0 FS_DESCAGENTE
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
USE LF_AGENTI KEY 2
INPUT RAGSOC FS_DESCAGENTE
DISPLAY "Descrizione@50" RAGSOC
DISPLAY "Codice" CODAGE
COPY OUTPUT FS_AGENTE
CHECKTYPE NORMAL
END

View File

@ -28,6 +28,8 @@ public:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual bool check_autorization() const
{return FALSE;}
bool main_loop();
void stato_trasferimento(TString& std);

View File

@ -16,6 +16,8 @@ private:
TString _tabname;
public:
virtual bool check_autorization() const
{return FALSE;}
bool user_create();
virtual void init_query_mode(TMask&);
virtual void init_modify_mode(TMask&);

View File

@ -54,6 +54,8 @@ public:
virtual bool create();
virtual bool destroy();
virtual bool check_autorization() const
{return FALSE;}
virtual void main_loop();
bool leggi_marker();
bool leggi_marker_rep();

View File

@ -57,7 +57,9 @@ public:
virtual bool create();
virtual bool destroy();
virtual void main_loop();
virtual bool menu(MENU_TAG m);
virtual bool check_autorization() const
{return FALSE;}
virtual void on_config_change();
bool video();
bool leggi_trasfer();

View File

@ -107,6 +107,8 @@ class TRic_ListaMov : public TPrintapp
int _tipopag_pag;
public:
virtual bool check_autorization() const
{return FALSE;}
virtual bool set_print(int m);
virtual bool user_create() ;
virtual bool user_destroy();

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,8 @@ public:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual bool check_autorization() const
{return FALSE;}
bool set();

View File

@ -34,6 +34,8 @@ public:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual bool check_autorization() const
{return FALSE;}
bool set();

View File

@ -35,6 +35,8 @@ public:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual bool check_autorization() const
{return FALSE;}
bool video();
void setta_campi_video(TMask* m);

View File

@ -36,6 +36,8 @@ class TVar_sc : public TApplication
bool _dd_caus,_nd_caus,_movval;
public:
virtual bool check_autorization() const
{return FALSE;}
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
@ -123,4 +125,4 @@ public:
TVar_sc();
};
#endif //__CG6804_H
#endif //__CG6804_H

View File

@ -37,18 +37,16 @@ HIDDEN int EsePre(const int EseCorr)
// aep e' l'esercizio precedente
TSaldi_list::TSaldi_list(int gr, int co, int aec, int aep_par)
{
TLocalisamfile cf(LF_SALDI);
bool force;
TString16 key;
int aep = aep_par;
destroy();
cf.zero();
// Se non passo l'anno precedente lo devo comunque calcolare
if (aep_par == 0)
aep = EsePre(aec);
TLocalisamfile cf(LF_SALDI);
cf.setkey(2);
cf.put(SLD_GRUPPO,gr);
cf.put(SLD_CONTO,co);
@ -65,12 +63,12 @@ TSaldi_list::TSaldi_list(int gr, int co, int aec, int aep_par)
if (g != gr || c != co) break;
if (ae != aec && ae != aep) continue;
TRectype r(cf.curr());
const TRectype& r = cf.curr();
key.format("%3d%3d%6ld", g, c, s);
// Se avevo chiesto anche l'es. prec. puo' darsi che l'abbia gia' trovato
force = !aep_par;
add((const char*) key, r, force);
bool force = !aep_par;
add(key, r, force);
}
}
}
@ -89,7 +87,7 @@ TSaldo::TSaldo() : _saldi(LF_SALDI), _saldoiniziale(ZERO), _saldo_iniziale(ZERO)
_prg_dare(ZERO), _prg_avere(ZERO), _saldo(ZERO), _annoes(0),
_indbil(0), _prec(FALSE), _movimentato(FALSE), _significativo(FALSE),
_rec_presente_ec(FALSE), _rec_presente_ep(FALSE),
_causali_apertura(LF_CAUSALI, CAU_MOVAP)
_causali_apertura(LF_CAUSALI, CAU_MOVAP), _movimenti(LF_MOV)
{}
@ -175,16 +173,18 @@ const char* TSaldo::causale_apertura_es()
bool TSaldo::leggi_mov(long nr)
{
TLocalisamfile mov(LF_MOV);
// mov.zero();
mov.put (MOV_NUMREG, nr);
const bool ok = mov.read() == NOERR;
TString16 n;
n<<nr;
const TRectype& mov = _movimenti.get(n);
const bool ok = !mov.empty();
if (ok)
{
_codcaus = mov.get(MOV_CODCAUS);
_datareg = mov.get(MOV_DATAREG);
_provv = mov.get(MOV_PROVVIS); // _provv.trim();
_datacomp = mov.get(MOV_DATACOMP);
if (_movimenti.items() >= 2048)
_movimenti.destroy();
}
else
NFCHECK("Testata assente: %ld", nr);
@ -279,8 +279,8 @@ bool TSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDat
continue;
const char sezione = rmov.get_char(RMV_SEZIONE);
const real importo = rmov.get(RMV_IMPORTO);
const real importo = rmov.get_real(RMV_IMPORTO);
// I mov. di puro riferimento (= con importo = 0) vanno scartati
if (importo == ZERO)
continue;

View File

@ -82,7 +82,8 @@ class TSaldo : public TObject
bool _rec_presente_ep;
bool _prec;
TDecoder _causali_apertura;
TDecoder _causali_apertura;
TRecord_cache _movimenti;
protected:
void InFinEs(int);

View File

@ -23,7 +23,7 @@ int TInteressi_IVA_table::read(int anno, int mese)
zero();put("CODTAB",k);
if (TTable::read(_isgteq) == NOERR)
{
const TString& cod = TTable::get("CODTAB");
TString16 cod = TTable::get("CODTAB");
if (cod > k)
if (prev() != NOERR)

View File

@ -4053,16 +4053,18 @@ void TTransfer_file::write_piano_conti(TString& record)
int TTransfer_file::annoes_PC(TString& data)
{
TTable esc ("ESC");
int anno = 0;
//TTable esc ("ESC");
//int anno = 0;
TDate datacomp (data);
int ae = datacomp.year();
TString dep = format("%04d", ae);
esc.zero();
esc.put("CODTAB", dep);
if (esc.read() == NOERR)
anno = ae;
TEsercizi_contabili esc;
int anno = esc.date2esc(datacomp);
//int ae = datacomp.year();
//TString dep = format("%04d", ae);
//esc.zero();
//esc.put("CODTAB", dep);
//if (esc.read() == NOERR)
// anno = ae;
return anno;
}

View File

@ -22,8 +22,10 @@
#include <mask.h>
#include <progind.h>
#include <printapp.h>
#include <sheet.h>
#include <sort.h>
#include <tabutil.h>
#include <urldefid.h>
#include <utility.h>
#include <mov.h>
@ -219,7 +221,10 @@ class TStampaBilanciCDC_application : public TPrintapp
static bool mask_date (TMask_field& f, KEY k);
static bool mask_bilancio(TMask_field& f, KEY k);
static bool mask_tipost (TMask_field& f, KEY k);
static bool movcascdc_handler (TMask_field& f, KEY k);
static bool fr_cdc_handler (TMask_field& f, KEY k);
static bool to_cdc_handler (TMask_field& f, KEY k);
static bool select_button (TMask_field& f, KEY k);
static bool reset_button (TMask_field& f, KEY k);
struct cli_for
{
@ -239,15 +244,17 @@ class TStampaBilanciCDC_application : public TPrintapp
cli_for* _cf;
TSort * _sort;
const char* _buff;
TMask * _mask;
TRelation* _rel;
TCursor * _cur;
TProgind * _prog;
TSaldi_list* _listacf, * _lista;
TArray_sheet *_cdc_sheet;
TLocalisamfile* _com, * _pcn, * _mov, * _rmov, * _clifo, * _saldi, * _nditte,* _anag,* _caus;
TIsamtempfile * _tmp_saldi_att, * _tmp_saldi_pass, * _tmp_saldi_conti_uno;
TIsamtempfile * _tmp_saldi_costi, * _tmp_saldi_ricavi,* _tmp_saldi_conti_due;
TTable* _esc, *_cdc;
TTable* _esc, *_cdc_table;
TParagraph_string* _d;
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
@ -295,6 +302,10 @@ public:
int date2esc(const TDate& d, int* prevesc = NULL);
void reset_choices(TMask&);
void set_choice_limits(TMask&);
long select_cdc_range(long from, long to);
bool menu (MENU_TAG m) { return TPrintapp::menu(m) ; }
virtual bool user_create() ;
virtual bool user_destroy();
@ -673,6 +684,7 @@ bool TStampaBilanciCDC_application::my_handler(TMask_field& f, KEY k)
return TRUE;
}
/*
bool TStampaBilanciCDC_application::movcascdc_handler(TMask_field& f, KEY k)
{
if (k == K_ENTER)
@ -684,6 +696,131 @@ bool TStampaBilanciCDC_application::movcascdc_handler(TMask_field& f, KEY k)
}
return TRUE;
}
*/
long TStampaBilanciCDC_application::select_cdc_range(long from, long to)
{
if (to == 0l) to = 9999999L;
for (int i = 0; i < _cdc_sheet->items(); i++)
{
TToken_string& c = _cdc_sheet->row(i);
const long cod = c.get_long(1);
if (cod >= from && cod <= to)
_cdc_sheet->check(i);
else
_cdc_sheet->uncheck(i);
}
return _cdc_sheet->checked();
}
bool TStampaBilanciCDC_application::fr_cdc_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if (key == K_F9)
{
TMask& m = f.mask();
TArray_sheet* sh = app()._cdc_sheet;
sh->disable_check();
sh->disable(DLG_USER);
if (sh->run() == K_ENTER)
{
app().select_cdc_range(sh->row(sh->selected()).get_long(1), m.get_long(F_CDC_TO));
app().set_choice_limits(m);
}
sh->enable(DLG_USER);
}
else if (key == K_TAB && f.focusdirty())
{
const long l = app().select_cdc_range(m.get_long(F_CDC_FR),
m.get_long(F_CDC_TO));
app().set_choice_limits(m);
m.set(F_SELECTED, l);
}
else
if (key == K_ENTER)
{
const long selen = f.mask().get_long(F_SELECTED);
const bool movcas = f.mask().get_bool(F_MOVCAS);
if (selen == 0L && !movcas)
return f.error_box("Non e' stata selezionata ne' la stampa per cassa ne' per centro di costo. Eseguire la stampa bilanci standard.");
}
return TRUE;
}
bool TStampaBilanciCDC_application::to_cdc_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
if (key == K_F9)
{
TArray_sheet* sh = app()._cdc_sheet;
TMask& m = f.mask();
sh->disable_check();
sh->disable(DLG_USER);
if (sh->run() == K_ENTER)
{
app().select_cdc_range(m.get_long(F_CDC_FR),sh->row(sh->selected()).get_long(1));
app().set_choice_limits(m);
}
sh->enable(DLG_USER);
}
if (key == K_TAB && f.focusdirty())
{
const long l = app().select_cdc_range(m.get_long(F_CDC_FR),
m.get_long(F_CDC_TO));
app().set_choice_limits(m);
m.field(F_SELECTED).set(format("%ld", l));
}
return TRUE;
}
void TStampaBilanciCDC_application::set_choice_limits(TMask& m)
{
long first = -1l, last = -1l;
for (int i = 0; i < _cdc_sheet->items(); i++)
{
if (_cdc_sheet->checked(i))
{
const long cod = _cdc_sheet->row(i).get_long(1);
if (first == -1l) first = cod;
if (last < cod) last = cod;
}
}
if (first != -1) m.set(F_CDC_FR, first);
if (last != -1) m.set(F_CDC_TO, last);
m.set(F_SELECTED, _cdc_sheet->checked());
}
void TStampaBilanciCDC_application::reset_choices(TMask& m)
{
m.reset(F_SELECTED);
m.reset(F_CDC_FR);
m.reset(F_CDC_TO);
_cdc_sheet->check(-1, FALSE);
}
bool TStampaBilanciCDC_application::select_button(TMask_field& f, KEY key)
{
if (key == K_SPACE)
{
app()._cdc_sheet->enable_check();
if (app()._cdc_sheet->run() == K_ENTER)
app().set_choice_limits(f.mask());
}
return TRUE;
}
bool TStampaBilanciCDC_application::reset_button(TMask_field& f, KEY key)
{
if (key == K_SPACE)
app().reset_choices(f.mask());
return TRUE;
}
void TStampaBilanciCDC_application::scrivig_file_temp()
{
@ -972,17 +1109,17 @@ bool TStampaBilanciCDC_application::bil_sez_contr()
bool movimentato = FALSE;
CHECK(_tmp_saldi_att == NULL, "Non posso riaprire cg01");
_tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", 2);
_tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", TRUE, TRUE);
_prog->addstatus(1);
_tmp_saldi_pass = new TIsamtempfile(LF_SALDI, "cg02", 2);
_tmp_saldi_pass = new TIsamtempfile(LF_SALDI, "cg02", TRUE, TRUE);
_prog->addstatus(1);
_tmp_saldi_costi = new TIsamtempfile(LF_SALDI, "cg03", 2);
_tmp_saldi_costi = new TIsamtempfile(LF_SALDI, "cg03", TRUE, TRUE);
_prog->addstatus(1);
_tmp_saldi_ricavi = new TIsamtempfile(LF_SALDI, "cg04", 2);
_tmp_saldi_ricavi = new TIsamtempfile(LF_SALDI, "cg04", TRUE, TRUE);
_prog->addstatus(1);
_tmp_saldi_conti_uno = new TIsamtempfile(LF_SALDI, "cg05", 2);
_tmp_saldi_conti_uno = new TIsamtempfile(LF_SALDI, "cg05", TRUE, TRUE);
_prog->addstatus(1);
_tmp_saldi_conti_due = new TIsamtempfile(LF_SALDI, "cg06", 2);
_tmp_saldi_conti_due = new TIsamtempfile(LF_SALDI, "cg06", TRUE, TRUE);
_prog->addstatus(1);
_gp=-1;
@ -1384,7 +1521,7 @@ bool TStampaBilanciCDC_application::bil_verifica()
bool esiste_conto = FALSE, esiste_sc = FALSE, movimentato = FALSE;
CHECK(_tmp_saldi_att == NULL, "Non posso riaprire cg01");
_tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", 2);
_tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", TRUE, TRUE);
_gp=-1;
_cp=-1;
@ -3882,8 +4019,32 @@ bool TStampaBilanciCDC_application::user_create()
_anag = new TLocalisamfile(LF_ANAG);
_caus = new TLocalisamfile(LF_CAUSALI);
_esc = new TTable("ESC");
_cdc = new TTable("CDC");
_cdc_table = new TTable("CDC");
_d = new TParagraph_string("",30);
_mask = new TMask("cgp1200a");
_mask->set_handler (F_VERIFICA, my_handler);
_mask->set_handler (F_BILANCIO, mask_bilancio);
_mask->set_handler (F_DATALIM, mask_datalim);
_mask->set_handler (F_DATADA, mask_date);
_mask->set_handler (F_DATAA, mask_date);
_mask->set_handler (F_ANNO, mask_anno);
_mask->set_handler(F_CDC_FR, fr_cdc_handler);
_mask->set_handler(F_CDC_TO, to_cdc_handler);
_mask->set_handler(BUT_SEL, select_button);
_mask->set_handler(BUT_ANN, reset_button);
// Compone la lista dei centri di costo
_cdc_sheet = new TArray_sheet(-1, -1, -4, -4, "Selezione Centri di Costo",
"@1|Codice@7R|Descrizione@50");
for (_cdc_table->first(); !_cdc_table->eof(); _cdc_table->next())
{
TToken_string* tt = new TToken_string();
tt->add(""); tt->add(_cdc_table->get("CODTAB")); tt->add(_cdc_table->get("S0"));
_cdc_sheet->add(tt);
}
_tmp_saldi_att = NULL;
_tmp_saldi_pass = NULL;
_tmp_saldi_costi = NULL;
@ -3907,8 +4068,10 @@ bool TStampaBilanciCDC_application::user_destroy()
delete _anag;
delete _caus;
delete _esc;
delete _cdc;
delete _cdc_table;
delete _d;
delete _cdc_sheet;
delete _mask;
if (_tmp_saldi_att) delete _tmp_saldi_att;
if (_tmp_saldi_pass) delete _tmp_saldi_pass;
@ -3953,92 +4116,91 @@ void TStampaBilanciCDC_application::leggi_pcon()
bool TStampaBilanciCDC_application::set_print(int)
{
TMask m ("cgp1200a");
KEY tasto;
m.set_handler (F_VERIFICA, my_handler);
m.set_handler (F_BILANCIO, mask_bilancio);
m.set_handler (F_DATALIM, mask_datalim);
m.set_handler (F_DATADA, mask_date);
m.set_handler (F_DATAA, mask_date);
m.set_handler (F_ANNO, mask_anno);
m.set_handler (F_CDC, movcascdc_handler);
tasto = m.run();
if (tasto == K_ENTER)
TMask& m = *_mask;
while (m.run() == K_ENTER)
{
_annoes = atoi(m.get(F_ANNO));
_bilancio = atoi(m.get(F_BILANCIO));
_data = m.get(F_DATASTAMPA);
_stampa_mov_prov = m.get_int(F_STAMPAMPROV);
_quadratura = m.get_bool(F_QUADRATURA);
_cdc_cod = m.get_long(F_CDC);
_cdc_descr = "";
_cdc->put("CODTAB",_cdc_cod);
if (_cdc->read() == NOERR)
_cdc_descr = _cdc->get("S0");
_movcas_print = m.get_bool(F_MOVCAS);
if (_bilancio == 1)
const bool no_cdc = _cdc_sheet->checked() == 0; // Nessun CDC selezionato, stampa normale (con mov cassa...)
const long items = no_cdc ? 1 : _cdc_sheet->items();
for (long i=0L; i<items; i++)
{
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE);
_totali = (bool)(m.get(F_TOTALI) == "X");
_codici = (bool)(m.get(F_CODICI) == "X");
_saldo = (bool)(m.get(F_SALDO) == "X");
_tipo_stampa = 1;
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
_datalim = m.get(F_DATALIM);
bil_sez_contr();
}
else
{
printer().footerlen(5);
_stampa_width = atoi(m.get(F_MODULO));
if (_stampa_width == 1)
_stampa_width = 132;
else _stampa_width = 148; //perche' questo e' in realta' il margine dx (vedi es. di stampa AS/400)
_verifica = atoi(m.get(F_VERIFICA));
if ( (_verifica == 1)||(_verifica == 2) )
if (!no_cdc && !_cdc_sheet->checked(i)) // Se non e' selezionato, salta questo CDC
continue;
_cdc_cod = no_cdc ? 0 : _cdc_sheet->row(i).get_long(1);
_cdc_descr = no_cdc ? "" : _cdc_sheet->row(i).get(2);
if (_bilancio == 1)
{
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE);
_tipo_stampa1 = 1;
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
_datada = m.get(F_DATADA);
_dataa = m.get(F_DATAA);
if ((_verifica == 1)||(_verifica == 2))
{
_stampav = atoi(m.get(F_STAMPAV));
bil_verifica();
}
else
{
_situazione = m.get(F_SITUAZIONE);
_stampac = atoi(m.get(F_STAMPAC));
_ordinamento = atoi(m.get(F_ORDINAMENTO));
// _cur->setkey(3);
if (_situazione.not_empty())
_cur->setfilter(format("TIPOCF = \"%s\"",(const char*)_situazione));
_totali = (bool)(m.get(F_TOTALI) == "X");
_codici = (bool)(m.get(F_CODICI) == "X");
_saldo = (bool)(m.get(F_SALDO) == "X");
_tipo_stampa = 1;
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_cur->setfilter("");
//_prog = new TProgind(_cur->items(),"Elaborazione in corso... prego attendere",FALSE);
_clienti.destroy();
_fornitori.destroy();
leggi_pcon();
crea_sort_clifo();
_sort->endsort();
delete _cf;
_dataini = _inizioEs;
_datalim = m.get(F_DATALIM);
bil_sez_contr();
}
else
{
printer().footerlen(5);
_stampa_width = atoi(m.get(F_MODULO));
if (_stampa_width == 1)
_stampa_width = 132;
else _stampa_width = 148; //perche' questo e' in realta' il margine dx (vedi es. di stampa AS/400)
_verifica = atoi(m.get(F_VERIFICA));
if ( (_verifica == 1)||(_verifica == 2) )
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE);
_tipo_stampa1 = 1;
if (_annoes != 0)
_dataini = InizioEsercizio(_annoes);
else
_dataini = _inizioEs;
_datada = m.get(F_DATADA);
_dataa = m.get(F_DATAA);
if ((_verifica == 1)||(_verifica == 2))
{
_stampav = atoi(m.get(F_STAMPAV));
bil_verifica();
}
else
{
_situazione = m.get(F_SITUAZIONE);
_stampac = atoi(m.get(F_STAMPAC));
_ordinamento = atoi(m.get(F_ORDINAMENTO));
// _cur->setkey(3);
if (_situazione.not_empty())
_cur->setfilter(format("TIPOCF = \"%s\"",(const char*)_situazione));
else
_cur->setfilter("");
//_prog = new TProgind(_cur->items(),"Elaborazione in corso... prego attendere",FALSE);
_clienti.destroy();
_fornitori.destroy();
leggi_pcon();
crea_sort_clifo();
_sort->endsort();
delete _cf;
}
}
delete _prog;
//stampicchia
print();
//return TRUE;
}
delete _prog;
return TRUE;
}
return FALSE;
}
@ -4313,38 +4475,3 @@ int cgp1200 (int argc, char** argv)
return 0;
}
/*
if (!compensa)
{
if ( (indbil_conto==1)||(indbil_conto==3) )
if (saldo > ZERO) //saldo in dare
_indbil = indbil_conto;
else //saldo in avere
{
if (indbil_conto == 1)
_indbil = 2;
else _indbil = 4;
saldo = -saldo;
}
if ( (indbil_conto==2)||(indbil_conto==4) )
if (saldo < ZERO)
{
_indbil = indbil_conto;
saldo = -saldo;
}
else
if (indbil_conto == 2)
_indbil = 1;
else _indbil = 3;
}
else //e' richiesta la compensazione
{
if ( (indbil_conto==1)||(indbil_conto==3) )
_indbil = indbil_conto;
if ( (indbil_conto==2)||(indbil_conto==4) )
{
_indbil = indbil_conto;
saldo = -saldo;
}
}
*/

View File

@ -7,7 +7,6 @@
#define F_BILANCIO 105
#define F_ANNO 106
#define F_MOVCAS 107
#define F_CDC 108
#define F_DATALIM 109
#define F_TOTALI 110
#define F_CODICI 111
@ -21,7 +20,12 @@
#define F_ORDINAMENTO 120
#define F_MODULO 121
#define F_STAMPAMPROV 122
#define F_QUADRATURA 123
#define F_QUADRATURA 123
#define F_CDC_FR 124
#define F_CDC_TO 125
#define BUT_SEL 126
#define BUT_ANN 127
#define F_SELECTED 128
#endif // __CGP1200_H

View File

@ -1,6 +1,6 @@
#include "cgp1200.h"
PAGE "Stampa bilancio" -1 -1 76 17
PAGE "Stampa bilancio" -1 -1 80 17
NUMBER F_CODDITTA 5
BEGIN
@ -44,7 +44,7 @@ BEGIN
ADD RUN cg0 -5 esc
END
RADIOBUTTON F_BILANCIO 37
RADIOBUTTON F_BILANCIO 36
BEGIN
PROMPT 2 5 "Tipo bilancio "
HELP "Indicare il tipo di bilancio da stampare"
@ -63,22 +63,47 @@ BEGIN
MESSAGE SHOW,F_VERIFICA|K_SPACE,F_VERIFICA
END
GROUPBOX DLG_NULL 38 5
BEGIN
PROMPT 39 5 "Centri di costo"
END
NUMBER F_CDC_FR 7
BEGIN
PROMPT 40 6 "Da c. di costo "
FLAGS "B"
END
NUMBER F_CDC_TO 7
BEGIN
PROMPT 40 7 "A c. di costo "
FLAGS "B"
END
STRING F_SELECTED 5
BEGIN
PROMPT 40 8 "Scelte n. "
FLAGS "DR"
END
BUTTON BUT_SEL 10 2
BEGIN
PROMPT 65 6 "~Selezione"
PICTURE BMP_SELECT
HELP "Selezione ditte di cui fare la liquidazione"
END
BUTTON BUT_ANN 10
BEGIN
PROMPT 65 8 "A~zzera"
HELP "Azzerare la selezione delle ditte da fare la liquidazione"
END
BOOLEAN F_MOVCAS
BEGIN
PROMPT 2 9 "Stampa movimenti di cassa"
END
NUMBER F_CDC 7
BEGIN
PROMPT 33 9 "Centro di costo "
USE CDC
INPUT CODTAB F_CDC
DISPLAY "Codice@7" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CDC CODTAB
CHECKTYPE NORMAL
END
DATE F_DATALIM
BEGIN
PROMPT 2 10 "Data limite "

20
cg/cgp3.cpp Executable file
View File

@ -0,0 +1,20 @@
#include <xvt.h>
#include "cgp3.h"
int main(int argc,char** argv)
{
const int s = (argc > 1) ? argv[1][1] - '0' : 0;
switch (s)
{
case 0 :
default: cgp3100(argc,argv) ; break; // Stampa mastrini contini
}
exit(0);
return 0;
}

7
cg/cgp3.h Executable file
View File

@ -0,0 +1,7 @@
#ifndef __CGP3_H
#define __CGP3_H
int cgp3100(int argc, char* argv[]);
#endif // __CGP3_H

3752
cg/cgp3100.cpp Executable file

File diff suppressed because it is too large Load Diff

33
cg/cgp3100.h Executable file
View File

@ -0,0 +1,33 @@
#ifndef __CG3200_H
#define __CG3200_H
#define TAB_IVD "%IVD"
#define TAB_TPD "%TPD"
#define TAB_REG "REG"
#define TAB_ESC "ESC"
#define F_ANNO 101
#define F_GRUPPOINI 102
#define F_CONTOINI_CONTO 103
#define F_GRUPPOFINE 104
#define F_CONTOFINE_CONTO 105
#define F_DESCRINI_CONTO 125
#define F_DESCRFINE_CONTO 129
#define F_DATAINI 106
#define F_DATAFINE 107
#define F_STAMPANUM 108
#define F_STAMPAPROGRE 109
#define F_STAMPATOTIVA 110
#define F_TIPOSTAMPA 111
#define F_STAMPAMOVPROV 112
#define F_SEPARATOR 200
#define F_MEMORIZZA 500
#define F_NUMCARAT 501
#define F_NUMMAST 502
#define F_FORMATO 503
#define F_CODDITTA 504
#define F_RAGSOC 505
#define F_SCELTE 506
#endif // __CG3200_H

393
cg/cgp3100a.uml Executable file
View File

@ -0,0 +1,393 @@
#include "cgp3100.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_PRINT 18 2
BEGIN
PROMPT -13 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON F_MEMORIZZA 18 2
BEGIN
PROMPT -23 -11 "~Memorizza scelte"
END
BUTTON DLG_QUIT 18 2
BEGIN
PROMPT -33 -11 ""
END
ENDPAGE
PAGE "Stampa Mastrini" -1 -1 78 20
NUMBER F_CODDITTA 5
BEGIN
PROMPT 4 1 "Ditta "
FLAGS "FRD"
USE LF_NDITTE KEY 1
INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA
DISPLAY "Ragione sociale @50" RAGSOC
OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE REQUIRED
END
STRING F_RAGSOC 50
BEGIN
PROMPT 4 2 "Ragione sociale "
FLAGS "D"
END
TEXT 96
BEGIN
PROMPT 4 11 "Dalla data competenza"
END
TEXT 97
BEGIN
PROMPT 40 11 "Alla data competenza "
END
TEXT 98
BEGIN
PROMPT 4 11 "Dalla data operazione "
END
TEXT 99
BEGIN
PROMPT 40 11 "Alla data operazione "
END
NUMBER F_ANNO 4
BEGIN
PROMPT 47 1 "Codice esercizio "
USE ESC
INPUT CODTAB F_ANNO
DISPLAY "Codice Esercizio" CODTAB
DISPLAY "Data inizio esercizio" D0
DISPLAY "Data fine esercizio " D1
OUTPUT F_ANNO CODTAB
CHECKTYPE NORMAL
MESSAGE HIDE,98|HIDE,99|SHOW,96|SHOW,97
MESSAGE EMPTY HIDE,96|HIDE,97|SHOW,98|SHOW,99
FLAGS "RZ"
ADD NONE
END
NUMBER F_GRUPPOINI 3
BEGIN
PROMPT 4 5 "Da Gruppo - Conto "
GROUP 9
END
NUMBER F_CONTOINI_CONTO 3
BEGIN
PROMPT 41 5 ""
USE LF_PCON SELECT SOTTOCONTO==""
INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_CONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPOINI GRUPPO
OUTPUT F_CONTOINI_CONTO CONTO
OUTPUT F_DESCRINI_CONTO DESCR
CHECKTYPE SEARCH
WARNING "Conto inesistente o mancante"
GROUP 9
END
STRING F_DESCRINI_CONTO 50
BEGIN
PROMPT 4 6 "Descrizione "
USE LF_PCON KEY 2 SELECT SOTTOCONTO==""
CHECKTYPE SEARCH
INPUT DESCR F_DESCRINI_CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
COPY OUTPUT F_CONTOINI_CONTO
GROUP 9
END
NUMBER F_GRUPPOFINE 3
BEGIN
PROMPT 4 8 "A Gruppo - Conto "
GROUP 9
END
NUMBER F_CONTOFINE_CONTO 3
BEGIN
PROMPT 41 8 ""
USE LF_PCON SELECT SOTTOCONTO==""
INPUT GRUPPO F_GRUPPOFINE
INPUT CONTO F_CONTOFINE_CONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPOFINE GRUPPO
OUTPUT F_CONTOFINE_CONTO CONTO
OUTPUT F_DESCRFINE_CONTO DESCR
CHECKTYPE SEARCH
WARNING "Conto inesistente o mancante"
GROUP 4 9
END
STRING F_DESCRFINE_CONTO 50
BEGIN
PROMPT 4 9 "Descrizione "
USE LF_PCON KEY 2
CHECKTYPE SEARCH
INPUT DESCR F_DESCRINI_CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
COPY OUTPUT F_CONTOFINE_CONTO
GROUP 4 9
END
DATE F_DATAINI
BEGIN
PROMPT 26 11 ""
END
DATE F_DATAFINE
BEGIN
PROMPT 62 11 ""
END
BOOLEAN F_STAMPATOTIVA
BEGIN
PROMPT 4 12 "Stampa totali documenti IVA"
END
BOOLEAN F_STAMPAPROGRE
BEGIN
PROMPT 44 12 "Stampa progressivi attuali"
END
BOOLEAN F_STAMPAMOVPROV
BEGIN
PROMPT 4 13 "Stampa movimenti provvisori"
END
BOOLEAN F_SEPARATOR
BEGIN
PROMPT 4 14 "Non stampare il separatore delle migliaia"
END
LIST F_STAMPANUM 15
BEGIN
PROMPT 4 15 "Stampa numerazione "
ITEM "1|Operazione"
ITEM "2|Riga giornale"
ITEM "3|Nessuna"
END
LIST F_TIPOSTAMPA 34
BEGIN
PROMPT 4 16 "Tipo stampa "
ITEM "1|Mastrini movimentati nel periodo"
ITEM "2|Mastrini con saldi diversi da 0"
ITEM "3|Completa"
END
ENDPAGE
PAGE "Parametri" -1 -1 78 20
LIST F_NUMCARAT 10
BEGIN
PROMPT 4 2 "Numero caratteri "
ITEM "1|132 crt."
ITEM "2|198 crt."
END
LIST F_FORMATO 23
BEGIN
PROMPT 4 4 "Formato modulo di stampa "
ITEM "66|11 pollici (27,94 cm)"
ITEM "72|12 pollici (30,48 cm)"
END
LIST F_NUMMAST 10
BEGIN
PROMPT 4 6 "Numero mastrini per pagina "
ITEM "1|Uno"
ITEM "2|Due"
ITEM "3|Continua"
END
SPREADSHEET F_SCELTE
BEGIN
PROMPT 0 8 ""
ITEM "Anno"
ITEM "Gr."
ITEM "Co."
ITEM "Gr."
ITEM "Co."
ITEM "Dal@10"
ITEM "Al@10"
ITEM "Stampa numerazione"
ITEM "Progr."
ITEM "Totali IVA"
ITEM "Tipo stampa"
ITEM "Provv."
END
ENDPAGE
ENDMASK
PAGE "Scelte" -1 -1 68 13
NUMBER F_ANNO 4
BEGIN
PROMPT 1 1 "Esercizio "
USE ESC
INPUT CODTAB F_ANNO
DISPLAY "Codice Esercizio" CODTAB
DISPLAY "Data inizio esercizio" D0
DISPLAY "Data fine esercizio " D1
OUTPUT F_ANNO CODTAB
CHECKTYPE NORMAL
FLAGS "Z"
ADD NONE
END
NUMBER F_GRUPPOINI 3
BEGIN
PROMPT 44 2 ""
END
NUMBER F_CONTOINI_CONTO 3
BEGIN
PROMPT 50 2 ""
USE LF_PCON SELECT (SOTTOCONTO="")
INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_CONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPOINI GRUPPO
OUTPUT F_CONTOINI_CONTO CONTO
OUTPUT F_DESCRINI_CONTO DESCR
CHECKTYPE SEARCH
WARNING "Conto inesistente o mancante"
GROUP 1
END
STRING F_DESCRINI_CONTO 50
BEGIN
PROMPT 1 3 "Descrizione "
USE LF_PCON KEY 2 SELECT (SOTTOCONTO=="")
INPUT DESCR F_DESCRINI_CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT F_CONTOINI_CONTO
CHECKTYPE SEARCH
GROUP 1
END
NUMBER F_GRUPPOFINE 3
BEGIN
PROMPT 44 4 ""
END
NUMBER F_CONTOFINE_CONTO 3
BEGIN
PROMPT 50 4 ""
USE LF_PCON SELECT (SOTTOCONTO=="")
INPUT GRUPPO F_GRUPPOFINE
INPUT CONTO F_CONTOFINE_CONTO
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPOFINE GRUPPO
OUTPUT F_CONTOFINE_CONTO CONTO
CHECKTYPE SEARCH
WARNING "Conto inesistente o mancante"
GROUP 4
END
STRING F_DESCRFINE_CONTO 50
BEGIN
PROMPT 1 5 "Descrizione "
// FIELD LF_PCON->DESCR
USE LF_PCON KEY 2 SELECT (SOTTOCONTO=="")
INPUT DESCR F_DESCRINI_CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
COPY OUTPUT F_CONTOFINE_CONTO
CHECKTYPE SEARCH
GROUP 4
END
DATE F_DATAINI
BEGIN
PROMPT 1 6 "Dalla data "
END
DATE F_DATAFINE
BEGIN
PROMPT 44 6 "Alla data "
END
BOOLEAN F_STAMPATOTIVA
BEGIN
PROMPT 1 7 "Stampa totali documenti IVA"
END
BOOLEAN F_STAMPAPROGRE
BEGIN
PROMPT 38 7 "Stampa progressivi attuali"
END
BOOLEAN F_STAMPAMOVPROV
BEGIN
PROMPT 1 8 "Stampa movimenti provvisori"
END
LIST F_STAMPANUM 15
BEGIN
PROMPT 1 9 "Stampa numerazione "
ITEM "1|Operazione"
ITEM "2|Riga giornale"
ITEM "3|Nessuna"
END
LIST F_TIPOSTAMPA 34
BEGIN
PROMPT 1 10 "Tipo stampa "
ITEM "1|Mastrini movimentati nel periodo"
ITEM "2|Mastrini con saldi diversi da 0"
ITEM "3|Completa"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -53,7 +53,10 @@ const char* TPagamento::_rata_sfield(int n, int f) const
}
void TPagamento::set_inizio(const TDate& d, bool rispetta_date)
{
{
if (_rate.items() == 0)
return;
_datadoc = d;
_inizio = d;
_inited = TRUE;
@ -1601,9 +1604,9 @@ void TPagamento::set_rate_auto()
set_inizio(_datadoc);
for (int iv = 0; iv < (in_valuta() ? 2 : 1); iv++)
for (int va = 0; va < (in_valuta() ? 2 : 1); va++)
{
const bool v = iv ? TRUE : FALSE;
const bool v = va != 0;
real toslice = importo_da_dividere(v);
if (_tpr > 3)
set_imprata(0, importo_da_non_dividere(v), v);

767
db/db0500.cpp Executable file
View File

@ -0,0 +1,767 @@
#include "dblib.h"
#include <automask.h>
#include <relapp.h>
#include <sheet.h>
#include <tabutil.h>
#include "db0.h"
#include "../mg/mglib.h"
#include "../mg/anamag.h"
#include "db0500a.h"
///////////////////////////////////////////////////////////
// Funzione di richiesta stringa che andra' in libreria
///////////////////////////////////////////////////////////
#include <defmask.h>
bool query_string(const char* prompt, TString& str, int width = 50, const char* flags= "")
{
int maskwidth = width+2;
if (maskwidth < 26)
maskwidth = 26;
if (maskwidth > 78)
maskwidth = 78;
TMask m(prompt, 1, maskwidth, 5);
m.add_string(DLG_USER, 0, "", 1, 1, width, flags, width > 76 ? 76 : width);
m.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
m.set(DLG_USER, str);
bool ok = m.run() == K_ENTER;
if (ok)
str = m.get(DLG_USER);
return ok;
}
///////////////////////////////////////////////////////////
// TDistinta_sheet
///////////////////////////////////////////////////////////
class TDistinta_sheet : public TSheet
{
TArray _data;
protected:
virtual void get_row(long n, TToken_string& row);
virtual long get_items() const { return _data.items(); }
public:
TArray& rows_array() { return _data; }
TDistinta_sheet();
virtual ~TDistinta_sheet() { }
};
void TDistinta_sheet::get_row(long n, TToken_string& row)
{
const TRiga_esplosione& re = (const TRiga_esplosione&)_data[int(n)];
row.cut(0);
row.add(re.tipo());
row.add(re.articolo());
row.add(re.giacenza());
row.add(re.um());
row.add(re.val().string(0, 5));
row.add(re.livello());
row.add(re.ordinamento());
}
TDistinta_sheet::TDistinta_sheet()
: TSheet(-1, -1, 0, 20, "Esplosione", "Tipo|Codice@20|Liv. Giacenza@15|UM|Quantita'@18R|Liv.@R|Sort@8R")
{
}
///////////////////////////////////////////////////////////
// TQuery_mask
///////////////////////////////////////////////////////////
class TQuery_mask : public TAutomask
{
TDistinta_tree& _tree;
TToken_string _curr;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
const TToken_string& curr() const { return _curr; }
void restart_tree();
TQuery_mask(TDistinta_tree& tree);
virtual ~TQuery_mask() { }
};
void TQuery_mask::restart_tree()
{
_tree.restart();
while (!_tree.is_leaf())
{
_tree.expand();
_tree.goto_firstson();
if (_tree.has_rbrother())
break;
}
TTree_field& tf = tfield(F_TREE);
tf.win().update_thumb(0, 0);
tf.win().force_update();
}
bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_CODICE:
if (e == fe_modify)
{
TTree_field& tf = tfield(F_TREE);
const TCodice_articolo val = o.get();
if (val.not_empty() && _tree.has_root())
{
long pos = _tree.find_node(val);
if (pos <= 0)
{
if (_tree.set_root(val))
restart_tree();
}
else
{
tf.select_current();
do { _tree.expand(); } while (_tree.goto_father());
pos = _tree.find_node(val, SCAN_PRE_ORDER | SCAN_IGNORING_UNEXPANDED);
TField_window& win = tf.win();
const TPoint& range = win.range();
if (pos > range.y)
win.set_scroll_max(win.columns(), pos+win.rows());
win.update_thumb(-1, pos-1);
win.force_update();
tf.set_focus();
}
}
else
{
if (_tree.set_root(val))
restart_tree();
}
}
break;
case F_SORT:
if (e == fe_init || e == fe_modify)
{
int sk = atoi(o.get());
if (sk >= 0 && sk <= 5)
{
_tree.set_sort_key(sk);
if (e == fe_modify)
restart_tree();
}
else
error_box("Chiave di ordinamento errata: %d", sk);
}
break;
case F_TREE:
if (e == fe_modify)
{
_tree.curr_id(_curr);
TCodice_articolo code; _tree.curr_code(code);
set(F_CODICE, code);
}
break;
case DLG_SELECT:
if (e == fe_button)
{
const TString& str = get(F_CODICE);
if (str.not_empty())
set(F_CODICEQ, str);
else
return FALSE;
}
break;
case F_COPY:
if (e == fe_button)
{
const TString oldcode = get(F_CODICE);
TLocalisamfile dist(LF_DIST);
dist.put("CODDIST", oldcode);
if (dist.read() == NOERR)
{
TString newcode;
if (query_string("Nuovo codice", newcode, 20, "U"))
{
if (newcode.not_empty() && newcode != oldcode)
{
dist.put("CODDIST", newcode);
const int err = dist.write();
if (err == NOERR)
{
TRecord_array rdist(LF_RDIST, "NRIG");
rdist.renum_key("CODDIST", oldcode);
if (rdist.read(rdist.key()) == NOERR)
{
rdist.renum_key("CODDIST", newcode);
rdist.write();
}
}
else
{
if (err == _isreinsert)
error_box("La distinta '%s' e' gia' stata inserita", (const char*)newcode);
else
error_box("Errore %d durante la registrazione della distinta '%s'", err, (const char*)newcode);
}
}
}
}
else
error_box("Il codice '%s' non corrisponde ad una distinta valida", (const char*)oldcode);
}
break;
case F_EXPLODE:
if (e == fe_button)
{
TCodice_articolo art = get(F_CODICE);
if (art.not_empty())
{
_tree.set_root(art);
restart_tree();
}
if (_tree.goto_root())
{
_tree.curr_code(art);
TString80 caption;
caption << "Esplosione " << art;
TMask m("db0500c");
m.set_caption(caption);
m.set(F_SORT, get(F_SORT));
m.set(F_ARTICOLI, "X");
m.set(F_LAVORAZIONI, "X");
m.set(F_VIRTUALI, "X");
if (m.run() == K_ENTER)
{
TDistinta_sheet a;
a.set_caption(caption);
int sk = m.get_int(F_SORT);
int md = m.get_int(F_MAXDEPTH);
int gr = m.get_int(F_GROUPMODE);
bool mb = m.get_bool(F_MATBASE);
bool lq = m.get_bool(F_LASTQTA);
bool iv = m.get_bool(F_IGNOREVIRT);
TString16 fi;
if (m.get_bool(F_ARTICOLI)) fi << 'A';
if (m.get_bool(F_LAVORAZIONI)) fi << 'L';
if (m.get_bool(F_VIRTUALI)) fi << 'V';
if (fi.len() == 3) fi.cut(0);
_tree.explode(a.rows_array(), mb, gr, md, fi, sk, lq, iv);
a.run();
}
}
}
break;
default:
break;
}
return TRUE;
}
TQuery_mask::TQuery_mask(TDistinta_tree& dt)
: TAutomask("db0500a"), _tree(dt)
{
TTree_field& tree = tfield(F_TREE);
tree.set_tree(&_tree);
}
///////////////////////////////////////////////////////////
// TDistinta_mask
///////////////////////////////////////////////////////////
class TDistinta_mask : public TAutomask
{
TDistinta_tree& _tree;
TRecord_cache _ord;
bool on_distsheet_event(TOperable_field& o, TField_event e, long jolly);
bool on_parmsheet_event(TOperable_field& o, TField_event e, long jolly);
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
bool test_row(const TToken_string& row);
public:
TDistinta_mask(TDistinta_tree& dt);
virtual ~TDistinta_mask() { }
};
bool TDistinta_mask::test_row(const TToken_string& row)
{
const TCodice_articolo father = get(F_CODICE);
TCodice_articolo code; row.get(1, code);
bool ok = code != father;
if (ok && _tree.find_node(father) > 0)
{
TToken_string path; _tree.curr_id(path);
path.add(code);
ok = !_tree.is_cyclic(path);
}
if (!ok)
error_box("Il codice '%s' non puo' essere utilizzato\n"
"in quanto la distinta risulterebbe ciclica.", (const char*)code);
// Se e' una lavorazione
if (get(F_TIPO)[0] == 'L')
{
ok = row[0] == 'L' && _tree.is_lav(code);
if (!ok)
error_box("Il codice '%s' non e' una lavorazione", (const char*)code);
}
return ok;
}
bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long jolly)
{
const short id = o.dlg();
switch (id)
{
case F_SHEET:
if (e == se_notify_add || e == se_notify_modify || e == fe_close)
{
TSheet_field& sheet = (TSheet_field&)o;
const int nrig = int(jolly);
TToken_string& row = sheet.row(nrig);
switch(e)
{
case se_notify_add:
row.add("A", F_TIPOCOMP-FIRST_FIELD); // Forza il listbox ad articolo
row.add("1", F_EXPR-FIRST_FIELD); // Forza la quantita' ad 1
row.add(nrig+1, F_SORT0-FIRST_FIELD); // Inizializza numero riga
break;
case se_notify_modify:
return test_row(row);
case fe_close:
{
TString80 code;
for (int n = sheet.items()-1; n >= 0; n--)
{
const TToken_string& row = sheet.row(n);
row.get(F_CODART-FIRST_FIELD, code);
if (!code.blank())
{
if (!test_row(row))
return FALSE;
}
else
sheet.destroy(n);
}
}
if (sheet.items() == 0)
error_box("E' necessario inserire almeno una riga nella distinta");
break;
default:
break;
}
}
break;
case F_CODART:
case F_CODLAV:
case F_CODDIS:
case F_CODVAR:
if (e == fe_modify || e == fe_init)
{
TMask& m = o.mask();
const TEdit_field& ef = (const TEdit_field&)o;
const TRectype& rec = ef.browse()->cursor()->curr();
switch(rec.num())
{
case LF_ANAMAG:
m.set(F_DESCOMP, rec.get(ANAMAG_DESCR));
if (m.get(F_UMEXPR).empty())
{
const TCodice_articolo art = o.get();
if (art.not_empty() && _tree.is_mag(art))
{
const TQuantita qta(art);
m.set(F_UMEXPR, qta.um());
}
}
break;
case LF_DIST :
m.set(F_DESCOMP, rec.get("DESCR"));
m.set(F_UMEXPR, rec.get("UM"));
break;
default :
m.set(F_DESCOMP, rec.get("S0"));
m.set(F_UMEXPR, rec.get("S6"));
break;
}
}
break;
case F_EXPR:
if (e == fe_modify)
{
TAutomask& m = (TAutomask&)o.mask();
const TString& str = o.get();
if (str.not_empty())
{
TDistinta_expr expr;
if (expr.set(str))
{
if (expr.numvar() > 0)
{
TDecoder var("VAR");
for (int v = expr.numvar()-1; v >= 0; v--)
{
const char* name = expr.varname(v);
if (var.decode(name).empty())
return m.error_box("La variabile %s non e' definita in tabella", name);
}
}
else
o.set(expr.as_string());
}
else
return m.error_box("Errore di sintassi: %s", expr.last_token());
}
else
return m.error_box("L'espressione deve essere specificata");
}
break;
case F_SORT1:
case F_SORT2:
case F_SORT3:
case F_SORT4:
case F_SORT5:
if ((fe_modify || fe_close) && o.empty())
{
TString16 key; key << (o.dlg() - F_SORT1 + 1);
bool completo = _ord.get(key).get_bool("B0");
if (completo)
{
TAutomask& m = (TAutomask&)o.mask();
TSheet_field& s = *m.get_sheet();
return m.error_box("Specificare l'ordinamento %s alla riga %d",
(const char*)key, s.selected()+1);
}
}
break;
default:
break;
}
return TRUE;
}
bool TDistinta_mask::on_parmsheet_event(TOperable_field& o, TField_event e, long jolly)
{
const short id = o.dlg();
switch (id)
{
case F_PARAM:
if (e == fe_modify || e == fe_close)
{
const TString& str = o.get();
if (!isalpha(str[0]) && str[0] != '_')
return error_box("Il nome del parametro deve iniziare con un carattere alfabetico o con _");
for (const char* s = str; *s; s++)
{
if (!isalnum(*s) && *s != '_')
return error_box("Il nome del parametro puo' contenere solo caratteri alfanumerici o _");
}
}
break;
default:
break;
}
return TRUE;
}
static _sort_key = 0;
static int compare_sheet_rows(const TObject** o1, const TObject** o2)
{
TToken_string* s1 = (TToken_string*)*o1;
TToken_string* s2 = (TToken_string*)*o2;
const int key_pos = (_sort_key ? (F_SORT1+_sort_key-1) : F_SORT0) - FIRST_FIELD;
long k1 = s1->get_long(key_pos);
long k2 = s2->get_long(key_pos);
if (k1 == 0) k1 = 100000000L;
if (k2 == 0) k2 = 100000000L;
return k1 == k2 ? 0 : (k1 > k2 ? +1 : -1);
}
bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
const short id = o.dlg();
switch (id)
{
case F_CODICE:
if (e == fe_init)
{
const TString& code = o.get();
if (code.not_empty())
{
const char type = _tree.get_type(code);
switch(type)
{
case 'A':
{
set(F_TIPO, "A", TRUE);
TArticolo mag (code);
set(F_DESCR, mag.get(ANAMAG_DESCR));
const TQuantita qta(code);
set(F_UM, qta.um());
set(F_PREZZO, mag.get(ANAMAG_COSTSTD));
set(F_PESO, mag.get(ANAMAG_PESO));
set(F_UMP, mag.get(ANAMAG_UMP));
}
break;
case 'L':
{
set(F_TIPO, "L", TRUE);
TTable lav("LAV");
lav.put("CODTAB", code);
if (lav.read() == NOERR)
{
set(F_DESCR, lav.get("S0"));
set(F_UM, lav.get("S6"));
set(F_PREZZO, lav.get("R0"));
}
}
break;
default:
set(F_TIPO, "V", TRUE);
break;
}
}
}
break;
case F_SORT:
if (e == fe_modify || e == fe_close)
{
TSheet_field& sf = sfield(F_SHEET);
_sort_key = atoi(o.get());
if (e == fe_close && _sort_key > 0)
{
if (yesno_box("Attenzione, l'ordine di immissione verra' modificato:\n"
"Si desidera registrare secondo l'ordinamento %d?", _sort_key))
break;
else
_sort_key = 0;
o.reset();
}
TString_array& a = sf.rows_array();
a.TArray::sort(compare_sheet_rows);
sf.force_update();
}
break;
case F_SHEET:
return on_distsheet_event(o, e, jolly);
default:
if (id >= 101 && id < 500) // E' in uno sheet?
{
switch (jolly)
{
case 1 : return on_distsheet_event(o, e, jolly);
case 2 : return on_parmsheet_event(o, e, jolly);
default: break;
}
}
break;
}
return TRUE;
}
TDistinta_mask::TDistinta_mask(TDistinta_tree& dt)
: TAutomask("db0500b"), _tree(dt), _ord("ORD")
{
TSheet_field& sf = sfield(F_SHEET);
TMask& sm = sf.sheet_mask();
TString16 key;
int i;
for (i = 4; i >= 0; i--)
{
key.format("%d", i+1);
const bool kill = _ord.get(key).empty();
if (kill)
{
const short id = F_SORT1+i;
sm.hide(id);
sf.delete_column(id);
}
}
TCodgiac_livelli cgl;
for (i = 4; i > 0; i--)
{
const short id = F_LIV1+i-1;
cgl.set_sheetcolumn(sf,id,i);
/* const bool kill = !cgl.enabled(i);
if (kill)
{
sm.hide(id);
sf.delete_column(id);
}
else
{
const TString & header = cgl.name(i);
const int len = header.len() + 1;
const int f_len = cgl.code_length(i);
sf.set_column_header(id, header);
sf.set_column_width(id, (len > f_len ? len : f_len) * 8);
}*/
}
_ord.test_file_changes();
}
///////////////////////////////////////////////////////////
// TDistinta_app
///////////////////////////////////////////////////////////
class TDistinta_app : public TRelation_application
{
TDistinta_tree _tree;
TRelation* _therel;
TQuery_mask* _querymask;
TDistinta_mask* _themask;
int _mode;
void parms2rel(const TMask& m);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual TRelation* get_relation() const { return _therel; }
virtual bool changing_mask(int mode);
virtual TMask* get_mask(int mode);
virtual void init_query_mode(TMask& m);
virtual int read(TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
public:
};
bool TDistinta_app::user_create()
{
_therel = new TRelation(LF_DIST);
_querymask = new TQuery_mask(_tree);
_themask = new TDistinta_mask(_tree);
return TRUE;
}
bool TDistinta_app::user_destroy()
{
delete _themask;
delete _querymask;
delete _therel;
return TRUE;
}
bool TDistinta_app::changing_mask(int mode)
{
bool was_query = _mode == MODE_QUERY || _mode == MODE_QUERYINS;
bool is_query = mode == MODE_QUERY || mode == MODE_QUERYINS;
return was_query != is_query;
}
TMask* TDistinta_app::get_mask(int mode)
{
const bool is_query = mode == MODE_QUERY || mode == MODE_QUERYINS;
_mode = mode;
return is_query ? (TMask*)_querymask : (TMask*)_themask;
}
void TDistinta_app::init_query_mode(TMask& m)
{
((TQuery_mask&)m).restart_tree();
}
int TDistinta_app::read(TMask& m)
{
const int err = TRelation_application::read(m);
if (err == NOERR)
{
TSheet_field& sheet = m.sfield(F_SHEET);
FOR_EACH_SHEET_ROW(sheet, nrig, row)
{
sheet.check_row(nrig);
sheet.row(nrig).add(nrig+1, F_SORT0 - FIRST_FIELD);
}
TToken_string memo(1024, '\n');
memo = _therel->curr().get("PARAMETRI");
const int righe = memo.items();
TSheet_field& params = m.sfield(F_PARAMS);
params.destroy();
for (int i = 0; i < righe; i++)
{
TToken_string& row = params.row(i);
memo.get(i, row);
int equal = row.find('=');
if (equal > 0)
row[equal] = '|';
}
}
return err;
}
void TDistinta_app::parms2rel(const TMask& m)
{
TToken_string memo(1024, '\n');
TSheet_field& parms = m.sfield(F_PARAMS);
TString var;
FOR_EACH_SHEET_ROW(parms, r, row)
{
var = row->get(0);
if (!var.blank())
{
memo.add(var);
memo << '=';
memo << row->get();
}
}
_therel->curr().put("PARAMETRI", memo);
// Azzera albero per rispecchiare eventuali modifiche
_querymask->restart_tree();
}
int TDistinta_app::write(const TMask& m)
{
parms2rel(m);
return TRelation_application::write(m);
}
int TDistinta_app::rewrite(const TMask& m)
{
parms2rel(m);
return TRelation_application::rewrite(m);
}
///////////////////////////////////////////////////////////
// db0500 gestione distinte
///////////////////////////////////////////////////////////
int db0500(int argc, char* argv[])
{
TDistinta_app a;
a.run(argc, argv, "Distinta base");
return 0;
}

55
db/db0500a.h Executable file
View File

@ -0,0 +1,55 @@
#ifndef __DB0100_H
#define __DB0100_H
#define F_TREE 500
#define F_CODICE 501
#define F_CODICEQ 502
#define F_SORT 503
#define F_SORTDESC 504
#define F_TIPO 505
#define F_VIRTUALE 506
#define F_COPY 507
#define F_EXPLODE 508
#define F_DESCR 510
#define F_ARTPROD 511
#define F_PREZZO 512
#define F_UM 513
#define F_PESO 514
#define F_UMP 515
#define F_SHEET 520
#define F_PARAMS 521
#define F_TIPOCOMP 101
#define F_CODART 102
#define F_CODLAV 202
#define F_CODDIS 302
#define F_CODVAR 402
#define F_LIV1 103
#define F_LIV2 104
#define F_LIV3 105
#define F_LIV4 106
#define F_UMEXPR 107
#define F_EXPR 108
#define F_DESCOMP 109
#define F_SORT1 110
#define F_SORT2 111
#define F_SORT3 112
#define F_SORT4 113
#define F_SORT5 114
#define F_SORT0 115
#define F_PARAM 101
#define F_VALUE 102
#define F_MATBASE 101
#define F_MAXDEPTH 102
#define F_ARTICOLI 103
#define F_LAVORAZIONI 104
#define F_VIRTUALI 105
#define F_GROUPMODE 106
#define F_LASTQTA 107
#define F_IGNOREVIRT 108
#endif

115
db/db0500a.uml Executable file
View File

@ -0,0 +1,115 @@
#include "db0500a.h"
TOOLBAR "" 0 19 0 0
BUTTON DLG_SELECT 10 2
BEGIN
PROMPT -16 -11 "~Selezione"
MESSAGE EXIT,K_ENTER
PICTURE BMP_SELECT
END
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -26 -11 "~Nuovo"
MESSAGE EXIT,K_INS
PICTURE BMP_NEWREC
PICTURE BMP_NEWRECDN
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -36 -11 "~Elimina"
MESSAGE EXIT,K_DEL
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON F_COPY 10 2
BEGIN
PROMPT -46 -11 "~Copia"
END
BUTTON F_EXPLODE 10 2
BEGIN
PROMPT -56 -11 "E~splodi"
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -66 -11 "~Fine"
MESSAGE EXIT,K_QUIT
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Distinta base" -1 -1 80 20
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 1 "Distinta"
END
STRING F_CODICE 20
BEGIN
PROMPT 2 2 "Cerca "
FLAGS "GU"
USE LF_DIST
JOIN LF_ANAMAG INTO CODART==CODDIST
INPUT CODDIST F_CODICE
DISPLAY "Codice@20" CODDIST
DISPLAY "Descrizione@50" LF_ANAMAG->DESCR
OUTPUT F_CODICE CODDIST
CHECKTYPE REQUIRED
FIELD CODDIST
END
STRING F_CODICEQ 20
BEGIN
PROMPT 47 2 "Codice "
FIELD CODDIST
KEY 1
USE LF_ANAMAG
JOIN LF_UMART INTO CODART=CODART NRIGA=1
INPUT CODART F_CODICEQ
DISPLAY "Codice@20" CODART
DISPLAY "Descrizione@50" DESCR
OUTPUT F_CODICEQ CODART
CHECKTYPE REQUIRED
ADD RUN ve2 -3
MESSAGE COPY,F_CODICE
FLAGS "U"
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 3 "Ordinamento "
USE ORD
INPUT CODTAB F_SORT
DISPLAY "Codice ordinamento" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_SORT CODTAB
OUTPUT F_SORTDESC S0
CHECKTYPE NORMAL
FLAGS "U"
MESSAGE EMPTY "Immissione",F_SORTDESC
NUM_EXPR #F_SORT<=5
WARNING "L'ordinamento deve essere compreso tra 0 e 5"
END
STRING F_SORTDESC 50
BEGIN
PROMPT 24 3 ""
FLAGS "D"
END
TREE F_TREE -3 -1
BEGIN
PROMPT 0 5 ""
END
ENDPAGE
ENDMASK

488
db/db0500b.uml Executable file
View File

@ -0,0 +1,488 @@
#include "db0500a.h"
TOOLBAR "" 0 19 0 0
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -16 -11 "~Registra"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -26 -11 "~Nuovo"
MESSAGE EXIT,K_INS
PICTURE BMP_NEWREC
PICTURE BMP_NEWRECDN
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -36 -11 "~Elimina"
MESSAGE EXIT,K_DEL
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_FINDREC 10 2
BEGIN
PROMPT -46 -11 "Ri~cerca"
MESSAGE EXIT,K_F9
PICTURE 126
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -56 -11 "~Annulla"
MESSAGE EXIT,K_ESC
PICTURE 102
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -66 -11 "~Fine"
MESSAGE EXIT,K_QUIT
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Distinta" -1 -1 80 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 1 "Distinta"
END
STRING F_CODICE 20
BEGIN
PROMPT 2 2 "Codice "
FLAGS "GUD"
KEY 1
FIELD CODDIST
END
LIST F_TIPO 1 12
BEGIN
PROMPT 54 2 "Tipo "
ITEM "A|Articolo"
MESSAGE "",F_VIRTUALE
ITEM "L|Lavorazione"
MESSAGE "",F_VIRTUALE
ITEM "V|Virtuale"
MESSAGE "X",F_VIRTUALE
FLAGS "DG"
END
BOOLEAN F_VIRTUALE
BEGIN
PROMPT 50 50 "Virtuale"
MESSAGE FALSE DISABLE,1@
MESSAGE TRUE ENABLE,1@
FLAGS "DG"
FIELD VIRTUALE
END
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 3 ""
END
STRING F_DESCR 50
BEGIN
PROMPT 2 4 "Descrizione "
FIELD DESCR
GROUP 1
FLAGS "D"
END
BOOLEAN F_ARTPROD
BEGIN
PROMPT 2 5 "Articolo di produzione"
FIELD ARTPROD
GROUP 1
FLAGS "D"
END
NUMBER F_PREZZO 15
BEGIN
PROMPT 2 6 "Costo "
PICTURE "."
FIELD PREZZO
GROUP 1
FLAGS "D"
END
STRING F_UM 3
BEGIN
PROMPT 42 6 "Unita' di misura "
USE %UMS
INPUT CODTAB F_UM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@60" S0
OUTPUT F_UM CODTAB
FIELD UM
GROUP 1
FLAGS "D"
END
NUMBER F_PESO 15 5
BEGIN
PROMPT 2 7 "Peso "
FIELD PESO
GROUP 1
FLAGS "D"
END
STRING F_UMP 3
BEGIN
PROMPT 42 7 "Unita' di misura del peso "
COPY USE F_UM
INPUT CODTAB F_UMP
COPY DISPLAY F_UM
OUTPUT F_UMP CODTAB
FIELD UMP
GROUP 1
FLAGS "D"
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 9 "Cambia ordinamento "
USE ORD
INPUT CODTAB F_SORT
DISPLAY "Codice ordinamento" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_SORT CODTAB
OUTPUT F_SORTDESC S0
CHECKTYPE NORMAL
FLAGS "U"
MESSAGE EMPTY "Immissione",F_SORTDESC
END
STRING F_SORTDESC 50
BEGIN
PROMPT 28 9 ""
FLAGS "D"
END
SPREADSHEET F_SHEET
BEGIN
PROMPT 0 10 ""
ITEM "Tipo@4"
ITEM "Codice@20"
ITEM "Liv1"
ITEM "Liv2"
ITEM "Liv3"
ITEM "Liv4"
ITEM "UM@3"
ITEM "Espressione@30"
ITEM "Descrizione@50"
ITEM "Ord1"
ITEM "Ord2"
ITEM "Ord3"
ITEM "Ord4"
ITEM "Ord5"
ITEM "Immiss."
USE LF_RDIST KEY NRIG
INPUT CODDIST F_CODICE
FLAGS "A"
END
ENDPAGE
PAGE "Parametri" -1 -1 80 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 1 "Distinta"
END
STRING F_CODICEQ 20
BEGIN
PROMPT 2 2 "Codice "
FLAGS "D"
FIELD CODDIST
END
SPREADSHEET F_PARAMS
BEGIN
PROMPT 0 4 ""
ITEM "Variabile@20"
ITEM "Valore@70"
END
ENDPAGE
ENDMASK
PAGE "Distinta" -1 -1 68 14
GROUPBOX DLG_NULL 66 6
BEGIN
PROMPT 1 0 "Componente"
END
LIST F_TIPOCOMP 1 12
BEGIN
PROMPT 2 1 "Tipo "
ITEM "A|Articolo"
MESSAGE SHOW,F_CODART|HIDE,F_CODLAV|HIDE,F_CODDIS|HIDE,F_CODVAR|ENABLE,F_UMEXPR
ITEM "L|Lavorazione"
MESSAGE HIDE,F_CODART|SHOW,F_CODLAV|HIDE,F_CODDIS|HIDE,F_CODVAR|DISABLE,F_UMEXPR
ITEM "D|Distinta"
MESSAGE HIDE,F_CODART|HIDE,F_CODLAV|SHOW,F_CODDIS|HIDE,F_CODVAR|DISABLE,F_UMEXPR
ITEM "V|Variabile"
MESSAGE HIDE,F_CODART|HIDE,F_CODLAV|HIDE,F_CODDIS|SHOW,F_CODVAR|CLEAR,F_UMEXPR
FIELD TIPO
END
STRING F_CODART 20
BEGIN
PROMPT 35 1 "Codice "
USE LF_ANAMAG
INPUT CODART F_CODART
DISPLAY "Codice@20" CODART
DISPLAY "Descrizione@50" DESCR
OUTPUT F_CODART CODART
CHECKTYPE REQUIRED
ADD RUN ve2 -3
FIELD CODCOMP
FLAGS "U"
END
STRING F_CODLAV 20
BEGIN
PROMPT 35 1 "Codice "
USE LAV
INPUT CODTAB F_CODLAV
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODLAV CODTAB
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODART
FLAGS "U"
END
STRING F_CODDIS 20
BEGIN
PROMPT 35 1 "Codice "
USE LF_DIST SELECT VIRTUALE=="X"
INPUT CODDIST F_CODDIS
DISPLAY "Codice@20" CODDIST
DISPLAY "Desrizione@50" DESCR
OUTPUT F_CODDIS CODDIST
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODART
FLAGS "U"
END
STRING F_CODVAR 20
BEGIN
PROMPT 35 1 "Codice "
USE VAR
INPUT CODTAB F_CODVAR
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAR CODTAB
CHECKTYPE REQUIRED
MESSAGE COPY,F_CODART
FLAGS "U"
END
STRING F_LIV1 10
BEGIN
PROMPT 2 2 "Livello 1 "
FLAGS "U"
USE GCG
INPUT CODTAB[1,1] "1"
INPUT CODTAB[2,11] F_LIV1
DISPLAY "Gruppo@10" CODTAB[2,20]
DISPLAY "Descrizione@50" S0
OUTPUT F_LIV1 CODTAB[2,12]
CHECKTYPE NORMAL
MESSAGE EMPTY RESET,F_LIV2|RESET,F_LIV3|RESET,F_LIV4
END
STRING F_LIV2 6
BEGIN
FLAGS "U"
PROMPT 36 2 "Livello 2 "
USE GCG
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
INPUT CODTAB[1,1] "2"
INPUT CODTAB[2,12] F_LIV2
COPY DISPLAY F_LIV1
OUTPUT F_LIV2 CODTAB[2,12]
CHECKTYPE NORMAL
MESSAGE EMPTY RESET,F_LIV3|RESET,F_LIV4
END
STRING F_LIV3 6
BEGIN
FLAGS "U"
PROMPT 2 3 "Livello 3 "
USE GCG
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
INPUT CODTAB[1,1] "3"
INPUT CODTAB[2,12] F_LIV3
COPY DISPLAY F_LIV1
OUTPUT F_LIV3 CODTAB[2,12]
CHECKTYPE NORMAL
MESSAGE EMPTY RESET,F_LIV4
END
STRING F_LIV4 6
BEGIN
FLAGS "U"
PROMPT 36 3 "Livello 4 "
USE GCG
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
INPUT CODTAB[1,1] "4"
INPUT CODTAB[2,12] F_LIV4
COPY DISPLAY F_LIV1
OUTPUT F_LIV4 CODTAB[2,12]
CHECKTYPE NORMAL
END
STRING F_DESCOMP 50
BEGIN
PROMPT 2 4 "Descrizione "
FLAGS "D"
END
GROUPBOX DLG_NULL 66 4
BEGIN
PROMPT 1 6 "Formula"
END
STRING F_UMEXPR 2
BEGIN
PROMPT 2 7 "Unita' di misura "
USE LF_UMART KEY 2
JOIN LF_ANAMAG INTO CODART==CODART
INPUT CODART F_CODART SELECT
INPUT UM F_UMEXPR
DISPLAY "Unita'" UM
DISPLAY "Articolo@20" CODART
DISPLAY "Descrizione Articolo@50" LF_ANAMAG->DESCR
OUTPUT F_UMEXPR UM
CHECKTYPE NORMAL
ADD RUN ve2 -3
FIELD UM
FLAGS "U"
END
STRING F_EXPR 50 62
BEGIN
PROMPT 2 8 ""
FIELD EXPR
FLAGS "U"
END
GROUPBOX DLG_NULL 66 3
BEGIN
PROMPT 1 10 "Criteri d'ordinamento"
END
NUMBER F_SORT1 8
BEGIN
PROMPT 2 11 "1 "
FIELD SORT1
FLAGS "U"
END
NUMBER F_SORT2 8
BEGIN
PROMPT 15 11 "2 "
FIELD SORT2
FLAGS "U"
END
NUMBER F_SORT3 8
BEGIN
PROMPT 28 11 "3 "
FIELD SORT3
FLAGS "U"
END
NUMBER F_SORT4 8
BEGIN
PROMPT 41 11 "4 "
FIELD SORT4
FLAGS "U"
END
NUMBER F_SORT5 8
BEGIN
PROMPT 54 11 "5 "
FIELD SORT5
FLAGS "U"
END
NUMBER F_SORT0 8
BEGIN
PROMPT 80 11 "0 "
FLAGS "DU"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK
PAGE "Variabili" -1 -1 64 5
STRING F_PARAM 20
BEGIN
PROMPT 1 1 "Variabile "
USE VAR
INPUT CODTAB F_PARAM
DISPLAY "Codice@20" CODTAB
DISPLAY "Numerico@B" B0
DISPLAY "Descrizione@50" S0
OUTPUT F_PARAM CODTAB
CHECKTYPE REQUIRED
FLAGS "U"
END
STRING F_VALUE 70 50
BEGIN
PROMPT 1 2 "Valore "
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

89
db/db0500c.uml Executable file
View File

@ -0,0 +1,89 @@
#include "db0500a.h"
PAGE "Esplosione" -1 -1 66 12
RADIOBUTTON F_MATBASE 1 31
BEGIN
PROMPT 1 1 "Tipo"
ITEM " |Scalare"
MESSAGE ENABLE,F_LASTQTA
ITEM "X|Materiali di base"
MESSAGE CLEAR,F_LASTQTA
END
GROUPBOX DLG_NULL 32 5
BEGIN
PROMPT 33 1 "Visualizza"
END
BOOLEAN F_ARTICOLI
BEGIN
PROMPT 34 2 "Articoli"
END
BOOLEAN F_LAVORAZIONI
BEGIN
PROMPT 34 3 "Lavorazioni"
END
BOOLEAN F_VIRTUALI
BEGIN
PROMPT 34 4 "Distinte virtuali"
END
NUMBER F_MAXDEPTH 3
BEGIN
PROMPT 2 5 "Profondita' "
FLAGS "U"
END
BOOLEAN F_LASTQTA
BEGIN
PROMPT 2 6 "Disabilita ricalcolo quantita'"
END
BOOLEAN F_IGNOREVIRT
BEGIN
PROMPT 2 7 "Escludi distinte virtuali che non sono prodotti"
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 8 "Ordina "
USE ORD
INPUT CODTAB F_SORT
DISPLAY "Codice ordinamento" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_SORT CODTAB
OUTPUT F_SORTDESC S0
CHECKTYPE NORMAL
FLAGS "U"
MESSAGE EMPTY "Immissione",F_SORTDESC
END
STRING F_SORTDESC 50
BEGIN
PROMPT 14 8 ""
FLAGS "D"
END
LIST F_GROUPMODE 1 48
BEGIN
PROMPT 2 9 "Raggruppa "
ITEM "0|Nessun raggruppamento"
ITEM "1|Alla prima unita' di misura"
ITEM "2|All'unita' di misura di riferimento"
ITEM "3|Per unita' di misura"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDMASK

20
db/db1.cpp Executable file
View File

@ -0,0 +1,20 @@
#include <xvt.h>
#include "db1.h"
int main(int argc, char** argv)
{
int n = argc > 1 ? atoi(argv[1]+1) : 0;
switch(n)
{
case 1:
db1200(argc, argv);
break;
case 0:
default:
db1100(argc, argv);
break;
}
exit(0);
return 0;
}

7
db/db1.h Executable file
View File

@ -0,0 +1,7 @@
#ifndef __DB1_H
#define __DB1_H
int db1100(int argc, char* argv[]);
int db1200(int argc, char* argv[]);
#endif

15
db/db1.url Executable file
View File

@ -0,0 +1,15 @@
#define APPNAME campo
#define QAPPNAME "campo"
#define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url>
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"

1239
db/db1100.cpp Executable file

File diff suppressed because it is too large Load Diff

163
db/db1100a.frm Executable file
View File

@ -0,0 +1,163 @@
// Form per la stampa esplosione distinte
USE LF_DIST
JOIN LF_ANAMAG INTO CODART==CODDIST
JOIN LAV ALIAS 201 INTO CODTAB==CODDIST
END
DESCRIPTION
BEGIN
END
GENERAL
BEGIN
OFFSET 0 0
FONT "Courier New"
SIZE 10
END
SECTION HEADER ODD 7
STRINGA 1 40 1
BEGIN
KEY "nome ditta"
PROMPT 1 1 "Ditta "
MESSAGE _DITTA, !RAGSOC
END
STRINGA 2 10
BEGIN
KEY "Data"
PROMPT 106 1 "Data "
MESSAGE _TODAY
END
NUMERO 3 7
BEGIN
KEY "Nr. pagina"
PROMPT 122 1 "Pagina "
MESSAGE _PAGENO
END
STRINGA 4 40
BEGIN
KEY "Intestazione stampa"
PROMPT 60 2 "@BStampa esplosione distinte al "
END
END //HEADER
SECTION BODY ODD 2 COLUMNWISE
STRING 1 20
BEGIN
SPECIAL STRINGA INTESTAZIONE "Codice" "Codice"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "X " "Fincatura sinistra e destra"
KEY "Codice"
PROMPT 1 1 ""
MESSAGE _DISTINTA,_COD
END
STRING 2 40 2
BEGIN
SPECIAL STRINGA INTESTAZIONE "Descrizione" "Descrizione"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA " X" "Fincatura sinistra e destra"
KEY "Descrizione"
MESSAGE _DISTINTA,_DES
PROMPT 2 1 ""
END
DATA 3 10
BEGIN
SPECIAL STRINGA INTESTAZIONE "Data cons." "Data cons."
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Data consegna"
MESSAGE _DISTINTA,_DCO
PROMPT 3 1 ""
END
NUMERO 4 4
BEGIN
SPECIAL STRINGA INTESTAZIONE "Liv" "Liv."
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Livello riga distinta"
PROMPT 4 1 ""
MESSAGE _DISTINTA,_LIV
END
STRINGA 5 4
BEGIN
SPECIAL STRINGA INTESTAZIONE "UM" "UM"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Unita' di misura"
PROMPT 5 1 ""
MESSAGE _DISTINTA,_UM
END
NUMBER 6 14 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cFabbisogno" "Fabbisogno"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Fabbisogno"
PROMPT 6 1 ""
MESSAGE _DISTINTA,_FAB
PICTURE "########,@@@@@"
END
NUMBER 7 14 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cDisponibilita'" "Disponibilita'"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Disponibilita'"
PROMPT 7 1 ""
MESSAGE _DISTINTA,_DIS
PICTURE "########,@@@@@"
END
NUMBER 8 14 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cFabbisogno da ord./prod." "Fabbisogno da ordinare"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Fabbisogno da ordinare/produrre"
PROMPT 8 1 ""
MESSAGE _DISTINTA,_ORDPROD
PICTURE "########,@@@@@"
END
NUMBER 9 14 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cDisp. residua" "Disp. residua"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Disponibilita' residua"
PROMPT 9 1 ""
MESSAGE _DISTINTA,_RESIDUO
PICTURE "########,@@@@@"
END
NUMBER 10 14 3
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cValore" "Valore"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Valore"
PROMPT 10 1 ""
MESSAGE _DISTINTA,_VALORE
PICTURE "."
END
END // End of Body
END // End of form

49
db/db1100a.h Executable file
View File

@ -0,0 +1,49 @@
//db1100a.h
#define F_ANNO 101
#define F_PROVV 102
#define F_TIPOSEL 103
#define F_NUMFROM 104
#define F_NDOCFROM 105
#define F_EMISFROM 106
#define F_NUMTO 107
#define F_NDOCTO 108
#define F_EMISTO 109
#define F_DATAOBS 110
#define F_PERIODS 111
#define F_STAMPA 112
#define F_DETTAGLIO 113
#define F_VALORIZZAZIONE 114
#define F_LASTQTA 115
#define F_ARTICOLI 116
#define F_LAVORAZIONI 117
#define F_VIRTUALI 118
#define F_SORT 119
#define F_SORTDESC 120
#define F_GROUPMODE 121
#define F_FABBISOGNO 122
#define F_SLMAG 123
#define F_SLDEP 124
#define F_MBMAG 125
#define F_MBDEP 126
#define F_VALMAGMB 127
#define F_VALDEPMB 128
#define F_SCMIN 129
#define F_SEPARATE 130
#define F_SHEETART 131
#define F_CODDIS 101
#define F_LIV1 102
#define F_LIV2 103
#define F_LIV3 104
#define F_LIV4 105
#define F_MAG 106
#define F_DEP 107
#define F_UMEXPR 108
#define F_QTA 109
#define F_DESCR 110
#define F_DATACONS 111
#define F_ACQUISTO 112
#define GR_NUMDOC 1
#define GR_DATADOC 2

507
db/db1100a.uml Executable file
View File

@ -0,0 +1,507 @@
#include "db1100a.h"
TOOLBAR "" 0 20 0 3
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
PAGE "Stampa esplosione" -1 -1 78 20
GROUPBOX DLG_NULL 76 8
BEGIN
PROMPT 1 1 "Selezione documenti"
END
NUMBER F_ANNO 4
BEGIN
PROMPT 2 2 "Anno "
FLAGS "A"
END
LIST F_PROVV 12
BEGIN
PROMPT 2 3 "Tipo numerazione "
ITEM "D|Definitiva"
ITEM "P|Provvisoria"
FLAGS "D"
END
RADIOBUTTON F_TIPOSEL 30
BEGIN
PROMPT 2 4 "Tipo selezione"
ITEM "0|Per numero"
MESSAGE SHOW,GR_NUMDOC@|HIDE,GR_DATADOC@
ITEM "1|Per data"
MESSAGE HIDE,GR_NUMDOC@|SHOW,GR_DATADOC@
END
STRING F_NUMFROM 4
BEGIN
PROMPT 37 2 "Da numerazione "
FLAG "U"
USE %NUM
INPUT CODTAB F_NUMFROM
DISPLAY "Cod. Num." CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_NUMFROM CODTAB
CHECKTYPE NORMAL
END
NUMBER F_NDOCFROM 7
BEGIN
PROMPT 60 2 "Dal "
USE 33
JOIN 20 INTO CODCF=CODCF TIPOCF=TIPOCF
JOIN 13 TO 20 INTO COM=COMCF
INPUT PROVV F_PROVV SELECT
INPUT ANNO F_ANNO SELECT
INPUT CODNUM F_NUMFROM SELECT
INPUT NDOC F_NDOCFROM
DISPLAY "Data@10" DATADOC
DISPLAY "Numero@7" NDOC
DISPLAY "Cliente/Fornitore@40" 20->RAGSOC
DISPLAY "Comune@20" 13->DENCOM
OUTPUT F_NDOCFROM NDOC
CHECKTYPE NORMAL
GROUP GR_NUMDOC
END
DATE F_EMISFROM
BEGIN
PROMPT 60 2 "Dal "
GROUP GR_DATADOC
END
STRING F_NUMTO 4
BEGIN
PROMPT 37 3 "A numerazione "
FLAG "U"
USE %NUM
INPUT CODTAB F_NUMTO
DISPLAY "Cod. Num." CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_NUMTO CODTAB
CHECKTYPE NORMAL
END
NUMBER F_NDOCTO 7
BEGIN
PROMPT 60 3 "Al "
USE 33
JOIN 20 INTO CODCF=CODCF TIPOCF=TIPOCF
JOIN 13 TO 20 INTO COM=COMCF
INPUT PROVV F_PROVV SELECT
INPUT ANNO F_ANNO SELECT
INPUT CODNUM F_NUMTO SELECT
INPUT NDOC F_NDOCTO
DISPLAY "Data@10" DATADOC
DISPLAY "Numero@7" NDOC
DISPLAY "Cliente/Fornitore@40" 20->RAGSOC
DISPLAY "Comune@20" 13->DENCOM
OUTPUT F_NDOCTO NDOC
GROUP GR_NUMDOC
CHECKTYPE NORMAL
END
DATE F_EMISTO
BEGIN
PROMPT 60 3 "Al "
GROUP GR_DATADOC
END
DATE F_DATAOBS
BEGIN
PROMPT 37 5 "Data osservazione "
CHECKTYPE REQUIRED
END
LISTBOX F_PERIODS 1
BEGIN
PROMPT 37 6 "Numero periodi "
ITEM "1|1"
ITEM "2|2"
ITEM "3|3"
ITEM "4|4"
ITEM "5|5"
ITEM "6|6"
END
LISTBOX F_STAMPA 18
BEGIN
PROMPT 2 9 "Esplosione "
ITEM "0|Materiali di base"
MESSAGE ENABLE,F_LASTQTA|ENABLE,F_GROUPMODE
ITEM "1|Scalare"
MESSAGE CLEAR,F_LASTQTA|CLEAR,F_GROUPMODE
END
NUMBER F_DETTAGLIO 3
BEGIN
PROMPT 37 9 "Livello dettaglio "
FLAGS "U"
END
BOOLEAN F_LASTQTA
BEGIN
PROMPT 2 10 "Disabilita ricalcolo quantita'"
END
BOOLEAN F_FABBISOGNO
BEGIN
PROMPT 2 11 "Calcola disponibilita'"
MESSAGE TRUE ENABLE,4@
MESSAGE FALSE CLEAR,4@|CLEAR,6@
END
BOOLEAN F_SEPARATE
BEGIN
PROMPT 2 12 "Separa distinte"
END
BOOLEAN F_SCMIN
BEGIN
PROMPT 37 10 "Confronta su scorta minima"
GROUP 4
END
LISTBOX F_VALORIZZAZIONE 22
BEGIN
PROMPT 37 11 "Valorizzazione "
// FLAGS "D"
ITEM "0|Nessuna"
ITEM "1|Ultimo costo"
ITEM "2|Costo medio"
ITEM "3|Costo medio ponderato"
ITEM "4|Media ultimi 2 costi"
ITEM "5|Costo standard"
ITEM "6|LIFO annuale"
ITEM "7|LIFO storico"
ITEM "8|FIFO annuale"
ITEM "9|FIFO storico"
// GROUP 4
END
GROUPBOX DLG_NULL 40 6
BEGIN
PROMPT 37 12 "Disponibilita' & Valorizzazione"
END
STRING F_SLMAG 3
BEGIN
PROMPT 38 13 "Mag. semilavorati "
FLAGS "U"
USE MAG SELECT CODTAB[4,5]==""
INPUT CODTAB F_SLMAG
DISPLAY "Codice " CODTAB[1,3]
DISPLAY "Denominazione mag.@50 " S0
OUTPUT F_SLMAG CODTAB[1,3]
CHECKTYPE NORMAL
GROUP 4
END
STRING F_SLDEP 2
BEGIN
PROMPT 69 13 ""
FLAGS "U"
USE MAG SELECT (IF(#F_SLMAG!="";((CODTAB[1,3]==#F_SLMAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!="")))
INPUT CODTAB[1,3] F_SLMAG
INPUT CODTAB[4,5] F_SLDEP
DISPLAY "Cod. magazzino" CODTAB[1,3]
DISPLAY "Cod. deposito" CODTAB[4,5]
DISPLAY "Denominazione dep.@50" S0
OUTPUT F_SLDEP CODTAB[4,5]
OUTPUT F_SLMAG CODTAB[1,3]
CHECKTYPE NORMAL
GROUP 4 5
END
STRING F_MBMAG 3
BEGIN
PROMPT 38 14 "Mag. materiali base "
FLAGS "U"
USE MAG SELECT CODTAB[4,5]==""
INPUT CODTAB F_MBMAG
DISPLAY "Codice " CODTAB[1,3]
DISPLAY "Denominazione mag.@50 " S0
OUTPUT F_MBMAG CODTAB[1,3]
CHECKTYPE NORMAL
MESSAGE EMPTY CLEAR,6@
MESSAGE ENABLE, F_VALMAGMB
GROUP 4
END
STRING F_MBDEP 2
BEGIN
PROMPT 69 14 ""
FLAGS "U"
USE MAG SELECT (IF(#F_MBMAG!="";((CODTAB[1,3]==#F_MBMAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!="")))
INPUT CODTAB[1,3] F_MBMAG
INPUT CODTAB[4,5] F_MBDEP
DISPLAY "Cod. magazzino" CODTAB[1,3]
DISPLAY "Cod. deposito" CODTAB[4,5]
DISPLAY "Denominazione dep.@50" S0
OUTPUT F_MBDEP CODTAB[4,5]
OUTPUT F_MBMAG CODTAB[1,3]
CHECKTYPE NORMAL
GROUP 4 5
MESSAGE EMPTY CLEAR, F_VALDEPMB
MESSAGE ENABLE, F_VALDEPMB
END
BOOLEAN F_VALMAGMB
BEGIN
PROMPT 38 15 "Usa magazzino in valorizzazione"
GROUP 6
END
BOOLEAN F_VALDEPMB
BEGIN
PROMPT 38 16 "Usa deposito in valorizzazione"
GROUP 6
END
GROUPBOX DLG_NULL 30 5
BEGIN
PROMPT 1 13 "Visualizza"
END
BOOLEAN F_ARTICOLI
BEGIN
PROMPT 2 14 "Articoli"
END
BOOLEAN F_LAVORAZIONI
BEGIN
PROMPT 2 15 "Lavorazioni"
END
BOOLEAN F_VIRTUALI
BEGIN
PROMPT 2 16 "Distinte virtuali"
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 18 "Ordina "
USE ORD
INPUT CODTAB F_SORT
DISPLAY "Codice ordinamento" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_SORT CODTAB
OUTPUT F_SORTDESC S0
CHECKTYPE NORMAL
FLAGS "U"
MESSAGE EMPTY "Immissione",F_SORTDESC
END
STRING F_SORTDESC 50
BEGIN
PROMPT 17 18 ""
FLAGS "D"
END
LIST F_GROUPMODE 1 53
BEGIN
PROMPT 2 19 "Raggruppa "
ITEM "0|Nessun raggruppamento"
ITEM "1|Alla prima unita' di misura"
ITEM "2|All'unita' di misura di riferimento"
ITEM "3|Per unita' di misura"
END
ENDPAGE
PAGE "Articoli" -1 -1 78 20
SPREADSHEET F_SHEETART
BEGIN
PROMPT 2 2 ""
ITEM "Codice@20"
ITEM "Liv1"
ITEM "Liv2"
ITEM "Liv3"
ITEM "Liv4"
ITEM "Mag."
ITEM "Dep."
ITEM "UM@3"
ITEM "Qta@12"
ITEM "Descrizione@50"
ITEM "Data cons.@12"
ITEM "Acquisto"
END
ENDPAGE
ENDMASK
PAGE "Articoli" -1 -1 68 14
STRING F_CODDIS 20
BEGIN
PROMPT 2 2 "Codice "
USE LF_DIST SELECT VIRTUALE!="X"
INPUT CODDIST F_CODDIS
DISPLAY "Codice@20" CODDIST
DISPLAY "Desrizione@50" DESCR
OUTPUT F_CODDIS CODDIST
OUTPUT F_DESCR DESCR
CHECKTYPE NORMAL
MESSAGE EMPTY CLEAR,F_LIV1|CLEAR,F_LIV2|CLEAR,F_LIV3|CLEAR,F_LIV4
MESSAGE ENABLE, F_LIV1
FLAGS "U"
END
STRING F_LIV1 10
BEGIN
PROMPT 2 4 "Livello 1 "
FLAGS "U"
USE GCG
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
INPUT CODTAB[1,1] "1"
INPUT CODTAB[2,11] F_LIV1
DISPLAY "Livello@20" 500@->S0
DISPLAY "Gruppo@10" CODTAB[2,20]
DISPLAY "Descr.@30" S0
OUTPUT F_LIV1 CODTAB[2,12]
CHECKTYPE NORMAL
MESSAGE EMPTY CLEAR,F_LIV2|CLEAR,F_LIV3|CLEAR,F_LIV4
MESSAGE ENABLE,F_LIV2
END
STRING F_LIV2 10
BEGIN
PROMPT 40 4 "Livello 2 "
FLAGS "U"
USE GCG
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
INPUT CODTAB[1,1] "2"
INPUT CODTAB[2,12] F_LIV2
COPY DISPLAY F_LIV1
OUTPUT F_LIV2 CODTAB[2,12]
CHECKTYPE NORMAL
MESSAGE EMPTY CLEAR,F_LIV3|CLEAR,F_LIV4
MESSAGE ENABLE,F_LIV3
END
STRING F_LIV3 10
BEGIN
PROMPT 2 5 "Livello 3 "
FLAGS "U"
USE GCG
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
INPUT CODTAB[1,1] "3"
INPUT CODTAB[2,12] F_LIV3
COPY DISPLAY F_LIV1
OUTPUT F_LIV3 CODTAB[2,12]
CHECKTYPE NORMAL
MESSAGE EMPTY CLEAR,F_LIV4
MESSAGE ENABLE,F_LIV4
END
STRING F_LIV4 10
BEGIN
PROMPT 40 5 "Livello 4 "
FLAGS "U"
USE GCG
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
INPUT CODTAB[1,1] "4"
INPUT CODTAB[2,12] F_LIV4
COPY DISPLAY F_LIV1
OUTPUT F_LIV4 CODTAB[2,12]
CHECKTYPE NORMAL
END
STRING F_MAG 3
BEGIN
PROMPT 2 6 "Magazzino "
FLAGS "U"
USE MAG SELECT CODTAB[4,5]==""
INPUT CODTAB F_MAG
DISPLAY "Codice " CODTAB[1,3]
DISPLAY "Denominazione mag.@50 " S0
OUTPUT F_MAG CODTAB[1,3]
CHECKTYPE NORMAL
END
STRING F_DEP 2
BEGIN
PROMPT 20 6 ""
FLAGS "U"
USE MAG SELECT (IF(#F_MAG!="";((CODTAB[1,3]==#F_MAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!="")))
INPUT CODTAB[1,3] F_MAG
INPUT CODTAB[4,5] F_DEP
DISPLAY "Cod. magazzino" CODTAB[1,3]
DISPLAY "Cod. deposito" CODTAB[4,5]
DISPLAY "Denominazione dep.@50" S0
OUTPUT F_DEP CODTAB[4,5]
OUTPUT F_MAG CODTAB[1,3]
CHECKTYPE NORMAL
END
STRING F_UMEXPR 2
BEGIN
PROMPT 2 7 "Unita' di misura "
USE LF_UMART KEY 2
JOIN LF_ANAMAG INTO CODART==CODART
INPUT CODART F_CODDIS SELECT
INPUT UM F_UMEXPR
DISPLAY "Unita'" UM
DISPLAY "Articolo@20" CODART
DISPLAY "Descrizione Articolo@50" LF_ANAMAG->DESCR
OUTPUT F_UMEXPR UM
CHECKTYPE REQUIRED
ADD RUN ve2 -3
FLAGS "U"
END
NUMBER F_QTA 12 5
BEGIN
PROMPT 2 8 "Quantita' "
CHECKTYPE REQUIRED
END
STRING F_DESCR 50
BEGIN
PROMPT 2 3 "Descrizione "
FLAGS "D"
END
DATE F_DATACONS
BEGIN
PROMPT 2 9 "Data consegna "
CHECKTYPE REQUIRED
END
BOOLEAN F_ACQUISTO
BEGIN
PROMPT 2 10 "Acquisto"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

167
db/db1200.cpp Executable file
View File

@ -0,0 +1,167 @@
#include <applicat.h>
#include <mask.h>
#include <form.h>
#include <printer.h>
#include <tabutil.h>
#include <sheet.h>
#include "dblib.h"
#include "db1200a.h"
class TStampa_anagrafica : public TSkeleton_application
{
TForm * _form;
TMask * _msk;
TLocalisamfile * _rdist;
protected:
virtual void main_loop();
virtual bool create();
virtual bool destroy();
void configura_profilo();
public:
TStampa_anagrafica ();
virtual ~TStampa_anagrafica() {}
};
TStampa_anagrafica::TStampa_anagrafica()
{}
bool TStampa_anagrafica::create()
{
_rdist = new TLocalisamfile(LF_RDIST);
_msk = new TMask("db1200a");
_form = new TForm("db1200a");
return TSkeleton_application::create();
}
bool TStampa_anagrafica::destroy()
{
if (_form) delete _form;
if (_msk) delete _msk;
if (_rdist) delete _rdist;
return TSkeleton_application::destroy();
}
void TStampa_anagrafica::configura_profilo()
{
int ordinamento = _msk->get_int(F_SORT);
TRectype da(LF_DIST);
TRectype a(LF_DIST);
TString sda = _msk->get(F_DISTDA);
TString sa = _msk->get(F_DISTA);
TString stemp;
da.put("CODDIST", _msk->get(F_DISTDA));
a.put("CODDIST", _msk->get(F_DISTA));
TCursor * cur = _form->cursor();
TString filtrorighe,filtrodist;
TString or("||");
const bool r_lavorazioni = _msk->get_bool(F_RIGHE_LAVORAZIONI);
const bool r_articoli = _msk->get_bool(F_RIGHE_ARTICOLI);
const bool r_virtuali = _msk->get_bool(F_RIGHE_VIRTUALI);
const bool r_variabili = _msk->get_bool(F_RIGHE_VARIABILI);
const bool lavorazioni = _msk->get_bool(F_DIST_LAVORAZIONI);
const bool articoli = _msk->get_bool(F_DIST_ARTICOLI);
const bool virtuali = _msk->get_bool(F_DIST_VIRTUALI);
bool update=FALSE;
if (articoli)
{
filtrodist << "(CODDIST!=" << LF_ANAMAG << "->CODART)";
update=TRUE;
}
if (lavorazioni)
{
if (filtrodist.not_empty())
filtrodist << "&&";
filtrodist << "(CODDIST!=" << LF_TAB << "->CODTAB)";
update=TRUE;
}
if (virtuali)
{
if (filtrodist.not_empty())
filtrodist << "&&";
filtrodist << "(VIRTUALE==\" \")";
}
cur->setregion (da,a);
cur->setfilter ("");
if (filtrodist.not_empty())
cur->setfilter (filtrodist,update);
const bool righe = _msk->get_bool(F_DETT_RIGHE);
_form->find_field('S', odd_page, "RIGHE_SUB").enable(righe);
if (r_articoli)
{
filtrorighe << "(" << LF_RDIST << "->TIPO!=\"A\")";
}
if (r_lavorazioni)
{
if (filtrorighe.not_empty())
filtrorighe << "&&";
filtrorighe << "(" << LF_RDIST << "->TIPO!=\"L\")";
}
if (r_virtuali)
{
if (filtrorighe.not_empty())
filtrorighe << "&&";
filtrorighe << "(" << LF_RDIST << "->TIPO!=\"D\")";
}
if (r_variabili)
{
if (filtrorighe.not_empty())
filtrorighe << "&&";
filtrorighe << "(" << LF_RDIST << "->TIPO!=\"V\")";
}
if (ordinamento)
{
if (filtrorighe.not_empty())
filtrorighe << "&&";
filtrorighe.insert("(");
filtrorighe << "(" << LF_RDIST << "->SORT" << ordinamento << "!=0))";
}
// Sostituisce il file delle Righe distinte
if (righe)
{
TRelation* rel = _form->relation();
stemp= "CODDIST|NRIG";
if (ordinamento)
stemp << "|SORT" << ordinamento;
TSortedfile *sf = new TSortedfile(LF_RDIST, NULL,stemp);
sf->cursor().setfilter(filtrorighe, TRUE);
rel->replace(sf, 3);
}
}
void TStampa_anagrafica::main_loop()
{
while (_msk->run()!=K_QUIT)
{
configura_profilo();
// Fincature & altro
const int hh = 6;
const int fl = printer().formlen();
int rows[4]; // Righe orizzontali
rows[0] = hh-2;
rows[1] = hh;
rows[2] = fl-1;
rows[3] = 0;
_form->genera_intestazioni(odd_page, hh-1);
_form->genera_fincatura(odd_page, hh-2, fl-1, rows);
if (_form->cursor()->items() > 0)
_form->print();
}
}
int db1200(int argc, char* argv[])
{
TStampa_anagrafica app;
app.run(argc, argv, "Stampa anagrafica distinte");
return 0;
}

177
db/db1200a.frm Executable file
View File

@ -0,0 +1,177 @@
#include "db1200a.h"
USE LF_DIST
JOIN LF_ANAMAG TO LF_DIST INTO CODART==CODDIST
JOIN LAV TO LF_DIST INTO CODTAB==CODDIST
JOIN LF_RDIST TO LF_DIST INTO CODDIST==CODDIST
JOIN LF_ANAMAG TO LF_RDIST ALIAS ALIAS_ANAMAG_RIGHE INTO CODART==CODCOMP
JOIN LAV TO LF_RDIST ALIAS ALIAS_LAV_RIGHE INTO CODTAB==CODCOMP
JOIN VAR TO LF_DIST ALIAS ALIAS_VAR_RIGHE INTO CODTAB==CODDIST
END
DESCRIPTION
BEGIN
LF_DIST->* "Distinte"
LF_ANAMAG->* "Anagrafica di magazzino"
END
GENERAL
BEGIN
OFFSET 0 0
END
SECTION HEADER ODD 6
STRINGA 1 40 1
BEGIN
KEY "nome ditta"
PROMPT 2 1 "@BDitta "
MESSAGE _DITTA, !RAGSOC
END
STRINGA 2 10
BEGIN
KEY "Data"
PROMPT 80 1 "Data "
MESSAGE _TODAY
END
NUMERO 3 7
BEGIN
KEY "Nr. pagina"
PROMPT 100 1 "Pagina "
MESSAGE _PAGENO
END
STRINGA 4 40
BEGIN
KEY "Intestazione stampa"
PROMPT 30 2 "@BStampa Anagrafica Distinte"
END
END
SECTION BODY ODD 2 COLUMNWISE
NUMERO 1 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cRiga " "Riga "
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "X " "Fincatura sinistra e destra"
KEY "riga della distinta"
PROMPT 1 1 ""
MESSAGE RESET, FF_CONTATORE
END
STRINGA 10 20
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cCodice" "Codice"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX " "Fincatura sinistra e destra"
KEY "codice"
PROMPT 2 1 "@B"
FIELD CODDIST
END
STRINGA 11 50 2
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cDescrizione" "Descrizione"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Descrizione"
PROMPT 3 1 ""
FIELD DESCR
END
LISTA 12 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cTipo" "Tipo"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "tipo"
PROMPT 4 1 ""
FIELD LF_DIST->VIRTUALE
ITEM "| "
ITEM " | "
ITEM "X|Virt."
END
STRINGA 14 4
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cUM" "UM"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Unita di misura"
PROMPT 5 1 ""
FIELD UM
END
STRINGA OUTER_EXPR 30
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cEspressione" "Espressione"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "ESPRESSIONE"
PROMPT 6 1 ""
END
SECTION RIGHE_SUB 2 0 1 FILE LF_RDIST
NUMBER FF_CONTATORE 5
BEGIN
KEY "numero riga distinta sequenziale ed incondizionato"
PROMPT 1 1 "n. "
MESSAGE INC, FF_CONTATORE
END
STRINGA 1 20
BEGIN
KEY "codice componente"
PROMPT 2 1 " "
FIELD LF_RDIST->CODCOMP
END
STRINGA 2 50 2
BEGIN
KEY "Descrizione componente"
PROMPT 3 1 ""
FIELD ALIAS_ANAMAG_RIGHE@->DESCR
FIELD ALIAS_LAV_RIGHE@->S0
FIELD ALIAS_VAR_RIGHE@->S0
END
LISTA 3 5
BEGIN
KEY "indica il tipo di componente dell'articolo in distinta"
PROMPT 4 1 ""
FIELD LF_RDIST->TIPO
FIELD ALIAS_LAV_RIGHE@->TIPO
ITEM "| "
ITEM " | "
ITEM "D|Dist."
ITEM "L|Lav."
ITEM "A|Art."
ITEM "V|Var."
END
STRINGA 4 4
BEGIN
KEY "unità di misura"
PROMPT 5 1 ""
FIELD LF_RDIST->UM
END
// il numero due seguente permette di scrivere su 2 righe l'espressione
STRINGA 5 30 2
BEGIN
KEY "espressione"
PROMPT 6 1 ""
FIELD LF_RDIST->EXPR
END
END
END
END

30
db/db1200a.h Executable file
View File

@ -0,0 +1,30 @@
// FILE universalmasklangSuage
#define F_DISTDA 101
#define F_DISTA 102
#define F_DETT_RIGHE 103
#define F_DIST_LAVORAZIONI 104
#define F_DIST_ARTICOLI 105
#define F_DIST_VIRTUALI 106
#define F_RIGHE_LAVORAZIONI 107
#define F_RIGHE_ARTICOLI 108
#define F_RIGHE_VIRTUALI 109
#define F_RIGHE 110
#define F_LAVORAZIONI 111
#define F_ARTICOLI 112
#define F_VIRTUALI 113
#define F_SORT 114
#define F_SORTDESC 115
#define F_RIGHE_VARIABILI 116
#define F_OPZIONI 501
#define ALIAS_ANAMAG_RIGHE 547
#define ALIAS_LAV_RIGHE 501
#define ALIAS_VAR_RIGHE 502
// FILE FORM
#define FF_CONTATORE 201
#define OUTER_EXPR 202

122
db/db1200a.uml Executable file
View File

@ -0,0 +1,122 @@
#include "db1200a.h"
PAGE "Stampa anagrafica distinte" -1 -1 80 20
GROUPBOX DLG_NULL 68 5
BEGIN
PROMPT 1 1 "Gruppo selezione stampa"
END
STRING F_DISTDA 20
BEGIN
FLAGS "U"
PROMPT 2 2 "Dal codice "
USE LF_DIST
JOIN LF_ANAMAG INTO CODART==CODDIST
INPUT CODDIST F_DISTDA
DISPLAY "Codice@20" CODDIST
DISPLAY "Virtuale" VIRTUALE
DISPLAY "Descrizione@50" LF_ANAMAG->DESCR
OUTPUT F_DISTDA CODDIST
CHECKTYPE NORMAL
END
STRING F_DISTA 20
BEGIN
FLAGS "U"
PROMPT 2 4 "Al codice "
USE LF_DIST
JOIN LF_ANAMAG INTO CODART==CODDIST
INPUT CODDIST F_DISTA
DISPLAY "Codice@20" CODDIST
DISPLAY "Virtuale" VIRTUALE
DISPLAY "Descrizione@50" LF_ANAMAG->DESCR
OUTPUT F_DISTA CODDIST
CHECKTYPE NORMAL
END
BOOLEAN F_DIST_ARTICOLI
BEGIN
PROMPT 2 6 "Escludi le distinte articolo"
END
BOOLEAN F_DIST_LAVORAZIONI
BEGIN
PROMPT 2 7 "Escludi le distinte lavorazione"
END
BOOLEAN F_DIST_VIRTUALI
BEGIN
PROMPT 2 8 "Escludi le distinte virtuali"
END
BOOLEAN F_DETT_RIGHE
BEGIN
PROMPT 2 10 "Stampa il dettaglio delle righe"
MESSAGE TRUE ENABLE,1@
MESSAGE FALSE DISABLE,1@
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 11 "Ordina "
USE ORD
INPUT CODTAB F_SORT
DISPLAY "Codice ordinamento" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_SORT CODTAB
OUTPUT F_SORTDESC S0
CHECKTYPE NORMAL
FLAGS "U"
MESSAGE EMPTY "Immissione",F_SORTDESC
GROUP 1
END
STRING F_SORTDESC 50
BEGIN
PROMPT 14 11 ""
FLAGS "D"
END
BOOLEAN F_RIGHE_ARTICOLI
BEGIN
PROMPT 2 12 "Escludi le righe articolo"
GROUP 1,2
END
BOOLEAN F_RIGHE_LAVORAZIONI
BEGIN
PROMPT 2 13 "Escludi le righe lavorazione"
GROUP 1,2
END
BOOLEAN F_RIGHE_VIRTUALI
BEGIN
PROMPT 2 14 "Escludi le righe virtuali"
GROUP 1,2
END
BOOLEAN F_RIGHE_VARIABILI
BEGIN
PROMPT 2 15 "Escludi le righe variabili"
GROUP 1,2
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDMASK
ENDPAGE

15
db/db2.cpp Executable file
View File

@ -0,0 +1,15 @@
#include <xvt.h>
#include "db2.h"
int main(int argc, char** argv)
{
int n = argc > 1 ? (argv[1][1]-'0') : 0;
switch(n)
{
case 3 : db2400(argc, argv);
default: break;
}
exit(0);
return 0;
}

6
db/db2.h Executable file
View File

@ -0,0 +1,6 @@
#ifndef __DB2_H
#define __DB2_H
int db2400(int argc, char* argv[]);
#endif

10
db/db2.url Executable file
View File

@ -0,0 +1,10 @@
#define APPNAME campo
#define QAPPNAME "campo"
#define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url>
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"

331
db/db2400.cpp Executable file
View File

@ -0,0 +1,331 @@
#include <applicat.h>
#include <browfile.h>
#include <automask.h>
#include <defmask.h>
#include <execp.h>
#include <mailbox.h>
#include <progind.h>
#include <relation.h>
#include <tabutil.h>
#include <viswin.h>
#include "db2.h"
#include "dblib.h"
#include "../mg/mglib.h"
#include "db2400a.h"
///////////////////////////////////////////////////////////
// TValorizzazione_mask
///////////////////////////////////////////////////////////
class TValorizzazione_mask : public TAutomask
{
TAssoc_array _valori;
TAssoc_array _risultati;
TDistinta_tree _tree;
int _tipoval;
TString16 _annoes, _catven, _codlist, _codmag;
protected:
virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
public:
real valore(const TCodice_articolo& dis, const char* liv = NULL);
void elabora();
void salva();
TValorizzazione_mask();
virtual ~TValorizzazione_mask() { }
};
real TValorizzazione_mask::valore(const TCodice_articolo& dis, const char* liv)
{
real total;
if (dis.not_empty())
{
TString80 cod = dis;
if (liv && *liv)
cod << ',' << liv;
real* val = (real*)_valori.objptr(cod);
if (val == NULL)
{
if (_tree.set_root(dis))
{
TArray boom;
// Esplosione ai materiali di base
// raggruppati alla unita' di misura di riferimento
_tree.explode(boom, TRUE, 2);
for (int r = boom.last(); r >= 0; r--)
{
const TRiga_esplosione& esp = (const TRiga_esplosione&)boom[r];
const real value = esp.val() * valore(esp.articolo(), esp.giacenza());
total += value;
}
if (!total.is_zero())
_risultati.add(cod, total);
}
else
{
const char tipo = _tree.get_type(dis);
switch (tipo)
{
case 'A':
{
TArticolo_giacenza art(dis);
switch (_tipoval)
{
case 0: total = art.ultimo_costo(_annoes); break;
case 1: total = art.media_costi(_annoes); break;
case 2: total = art.prezzo_listino(_annoes, _catven, _codlist); break;
case 3: total = art.costo_standard(_annoes); break;
case 4: total = art.costo_medio(_annoes, _codmag, liv); break;
case 5: total = art.costo_mediopond(_annoes, _codmag, liv); break;
case 6: total = art.LIFO_annuale(_annoes, _codmag, liv); break;
case 7: total = art.FIFO_annuale(_annoes, _codmag, liv); break;
case 8: total = art.LIFO(_annoes, _codmag, liv); break;
case 9: total = art.FIFO(_annoes, _codmag, liv); break;
default: NFCHECK("Tipo valorizzazione errato: %d", _tipoval);
}
}
break;
case 'L':
{
TDecoder val("LAV", "R0");
total = real(val.decode(dis));
}
break;
case 'V':
{
TDecoder dist(LF_DIST, "PREZZO");
total = real(dist.decode(dis));
}
break;
default :
NFCHECK("L'articolo %s non esiste", (const char*)cod);
}
_valori.add(cod, total);
}
}
else
total = *val;
}
return total;
}
void TValorizzazione_mask::elabora()
{
TRectype rec_from(LF_DIST), rec_to(LF_DIST);
rec_from.put("CODDIST", get(F_DIST_FROM));
rec_to.put ("CODDIST", get(F_DIST_TO));
_annoes = get(F_ANNOES);
_tipoval = get_int(F_TIPO);
TRelation rel(LF_DIST);
TCursor cur(&rel, "", 1, &rec_from, &rec_to);
const long items = cur.items();
TProgind pi(items, "Valorizzazione in corso...", TRUE, TRUE);
TBrowsefile_field& bf = (TBrowsefile_field&)field(F_PREVIEW);
TViswin& vw = *bf.vis_win();
vw.destroy_lines();
_valori.destroy();
_risultati.destroy();
TString line, num;
line = "@bCodice distinta Valore";
bf.add_line(line);
cur.freeze(TRUE);
for (cur = 0; cur.pos() < items; ++cur)
{
pi.addstatus(1);
if (pi.iscancelled())
break;
TCodice_articolo art = cur.curr().get("CODDIST");
real value = valore(art);
switch(_tree.get_type(art))
{
case 'A': line = "$[r,w]"; break;
case 'L': line = "$[v,w]"; break;
case 'V': line = "$[b,w]"; break;
default : line = "$[n,w]"; break;
}
line << art << "$[n,w]";
line.left_just(30);
num = value.string(".3");
num.right_just(22);
line << num;
bf.add_line(line);
}
if (pi.isfinished())
enable(DLG_SAVEREC);
vw.goto_top();
}
void TValorizzazione_mask::salva()
{
const TDate oggi = get(F_DATA);
const bool ultimo = get(F_VALORIZZA) == "1";
TProgind pi(_risultati.items(), "Registrazione in corso...", TRUE, TRUE);
TLocalisamfile dis(LF_DIST);
TTable lav("LAV");
FOR_EACH_ASSOC_OBJECT(_risultati, obj, key, item)
{
pi.addstatus(1);
if (pi.iscancelled())
break;
const real& val = (const real&)*item;
if (!val.is_zero())
{
switch(_tree.get_type(key))
{
case 'A':
{
TArticolo_giacenza art(key);
if (ultimo)
art.put_ultimo_costo(val, oggi);
else
art.put_costo_standard(val);
art.rewrite();
}
break;
case 'L':
lav.put("CODTAB", key);
if (lav.read(_isequal, _lock) == NOERR)
{
lav.put("R0", val);
lav.rewrite();
}
break;
case 'V':
dis.put("CODDIST", key);
if (dis.read(_isequal, _lock) == NOERR)
{
dis.put("PREZZO", val);
dis.rewrite();
}
break;
default :break;
}
}
}
if (pi.isfinished())
{
_valori.destroy();
_risultati.destroy();
disable(DLG_SAVEREC);
}
}
bool TValorizzazione_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
switch (f.dlg())
{
case DLG_ELABORA:
if (e == fe_button)
elabora();
break;
case DLG_SAVEREC:
if (e == fe_button)
salva();
break;
case DLG_QUIT:
if (e == fe_button)
{
if (_risultati.items() > 0)
return yesno_box("I risultati dell'ultima elaborazione\n"
"non sono stati registrati:\n"
"Si desidera uscire ugualmente?");
}
break;
default:
break;
}
return TRUE;
}
static const char* link_handler(TMask&, int id, const char* str, bool)
{
const char* app = NULL;
switch(id)
{
case 0: app = "ve2 -2"; break;
case 1: app = "ba3 -0 LAV"; break;
case 2: app = "db0 -0"; break;
default: break;
}
if (app)
{
TString ss = "1|"; ss << str;
TMessage fs(app, MSG_LN, ss);
fs.send();
TExternal_app prg(app);
prg.run();
}
return "";
}
TValorizzazione_mask::TValorizzazione_mask()
: TAutomask("db2400a")
{
TBrowsefile_field& bf = (TBrowsefile_field&)field(F_PREVIEW);
bf.enable_link("Articolo ", 'r');
bf.enable_link("Lavorazione ", 'v');
bf.enable_link("Distinta ", 'b');
bf.set_link_handler(link_handler);
disable(DLG_SAVEREC);
}
///////////////////////////////////////////////////////////
// TValorizzazione
///////////////////////////////////////////////////////////
class TValorizzazione : public TSkeleton_application
{
protected:
virtual bool create();
public:
virtual void main_loop();
};
bool TValorizzazione::create()
{
open_files(LF_MAG,LF_STOMAG,0);
return TSkeleton_application::create();
}
void TValorizzazione::main_loop()
{
TValorizzazione_mask m;
m.run();
}
int db2400(int argc, char* argv[])
{
TValorizzazione app;
app.run(argc, argv, "Valorizzazione");
return 0;
}

8
db/db2400a.h Executable file
View File

@ -0,0 +1,8 @@
#define F_DIST_FROM 101
#define F_DIST_TO 102
#define F_TIPO 103
#define F_ANNOES 104
#define F_VALORIZZA 105
#define F_DATA 106
#define F_PREVIEW 110

119
db/db2400a.uml Executable file
View File

@ -0,0 +1,119 @@
#include "db2400a.h"
TOOLBAR "" 0 19 0 0
BUTTON DLG_ELABORA 10 2
BEGIN
PROMPT -13 -11 "~Elabora"
PICTURE BMP_ELABORA
END
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -23 -11 "~Registra"
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -11 "~Fine"
MESSAGE EXIT,K_ENTER
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Valorizzazione" 0 0 80 19
GROUPBOX DLG_NULL 34 4
BEGIN
PROMPT 1 1 "@bSelezione"
END
STRING F_DIST_FROM 20
BEGIN
PROMPT 2 2 "Da codice "
FLAGS "U"
USE LF_DIST
JOIN LF_ANAMAG INTO CODART==CODDIST
INPUT CODDIST F_DIST_FROM
DISPLAY "Codice@20" CODDIST
DISPLAY "Descrizione@50" LF_ANAMAG->DESCR
OUTPUT F_DIST_FROM CODDIST
CHECKTYPE SEARCH
ADD RUN DB0 -0
END
STRING F_DIST_TO 20
BEGIN
PROMPT 2 3 "A codice "
FLAGS "U"
USE LF_DIST
JOIN LF_ANAMAG INTO CODART==CODDIST
INPUT CODDIST F_DIST_TO
DISPLAY "Codice@20" CODDIST
DISPLAY "Descrizione@50" LF_ANAMAG->DESCR
OUTPUT F_DIST_TO CODDIST
CHECKTYPE SEARCH
ADD RUN DB0 -0
END
GROUPBOX DLG_NULL 34 4
BEGIN
PROMPT 1 6 "@bParametri in ingresso"
END
LIST F_TIPO 1 22
BEGIN
PROMPT 2 7 "Tipo "
ITEM "0|Ultimo costo"
ITEM "1|Media costi"
ITEM "2|Prezzo listino"
ITEM "3|Costo standard"
ITEM "4|Costo medio"
ITEM "5|Costo medio ponderato"
ITEM "6|LIFO annuale"
ITEM "7|FIFO annuale"
ITEM "8|LIFO"
ITEM "9|FIFO"
END
NUMBER F_ANNOES 4
BEGIN
PROMPT 2 8 "Anno esercizio "
FLAGS "Z"
USE ESC
INPUT CODTAB F_ANNOES
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Inizio esercizio" D0
DISPLAY "Fine esercizio" D1
OUTPUT F_ANNOES CODTAB
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 34 4
BEGIN
PROMPT 1 11 "@bParametri in uscita"
END
LIST F_VALORIZZA 1 16
BEGIN
PROMPT 2 12 "Valorizza "
ITEM "0|Costo standard"
ITEM "1|Ultimo costo"
END
DATE F_DATA
BEGIN
PROMPT 2 13 "Data elaborazione "
FLAGS "A"
END
BROWSEFILE F_PREVIEW 42 -1
BEGIN
PROMPT 36 1 ""
END
ENDMASK

47
db/dbprassi.men Executable file
View File

@ -0,0 +1,47 @@
[PRASSIDB_001]
Caption = "Gestione distinta base"
Picture = <db01.bmp>
Module = 35
Flags = ""
Item_01 = "Archivi", [PRASSIDB_010]
Item_02 = "Stampe archivi", [PRASSIDB_020]
Item_03 = "Stampe", [PRASSIDB_040]
Item_04 = "Servizi", [PRASSIDB_030]
Item_05 = "Configurazione distinta base", [PRASSIDB_080]
[PRASSIDB_010]
Caption = "Gestione archivi"
Picture = <db01.bmp>
Module = 35
Flags = ""
Item_01 = "Anagrafica distinte", "db0 -4", "F"
Item_01 = "Tabella lavorazioni", "db0 -0 LAV", "F"
Item_01 = "Tabella ordinamenti", "db0 -0 ORD", "F"
Item_01 = "Tabella variabili", "db0 -0 VAR", "F"
[PRASSIDB_020]
Caption = "Stampa archivi"
Picture = <ba03.bmp>
Module = 35
Flags = ""
Item_01 = "Anagrafica distinte", "db1 -1", "F"
Item_01 = "Tabella lavorazioni", "ba3 -1 LAV", "F"
Item_01 = "Tabella ordinamenti", "ba3 -1 ORD", "F"
Item_01 = "Tabella variabili", "ba3 -1 VAR", "F"
[PRASSIDB_040]
Caption = "Stampa"
Picture = <db01.bmp>
Module = 35
Flags = ""
Item_01 = "Esplosione distinte", "db1 -0", "F"
Item_02 = "Implosione", disabled
[PRASSIDB_030]
Caption = "Servizi"
Picture = <db01.bmp>
Module = 35
Flags = ""
Item_01 = "Valorizzazione distinte", "db2 -3", "F"

86
db/dbstlav.uml Executable file
View File

@ -0,0 +1,86 @@
#include "../ba/ba3200.h"
PAGE "Stampa tabella lavorazioni "-1 -1 76 15
GROUPBOX DLG_NULL 74 4
BEGIN
PROMPT 1 2 "Da"
END
STRING F_INIZIO1 20
BEGIN
PROMPT 2 3 "Codice "
USE LAV
INPUT CODTAB F_INIZIO1
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_INIZIO1 CODTAB
OUTPUT F_INIZIO2 S0
GROUP 1
FIELD CODTAB
FLAGS "U"
CHECKTYPE NORMAL
END
STRING F_INIZIO2 25 50
BEGIN
PROMPT 2 4 "Descrizione "
USE LAV KEY 2
INPUT S0 F_INIZIO2
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
OUTPUT F_INIZIO2 S0
OUTPUT F_INIZIO1 CODTAB
GROUP 1
FIELD S0
FLAGS "U"
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 74 4
BEGIN
PROMPT 1 7 "A"
END
STRING F_FINE1 20
BEGIN
PROMPT 2 8 "Codice "
USE LAV
INPUT CODTAB F_FINE1
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_FINE1 CODTAB
OUTPUT F_FINE2 S0
GROUP 2
FIELD CODTAB
FLAGS "U"
CHECKTYPE NORMAL
END
STRING F_FINE2 30 50
BEGIN
PROMPT 2 9 "Descrizione "
USE LAV KEY 2
INPUT S0 F_FINE2
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
OUTPUT F_FINE2 S0
OUTPUT F_FINE1 CODTAB
GROUP 2
FIELD S0
FLAGS "U"
CHECKTYPE NORMAL
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

86
db/dbstvar.uml Executable file
View File

@ -0,0 +1,86 @@
#include "../ba/ba3200.h"
PAGE "Stampa tabella variabili"-1 -1 76 15
GROUPBOX DLG_NULL 74 4
BEGIN
PROMPT 1 2 "Da"
END
STRING F_INIZIO1 20
BEGIN
PROMPT 2 3 "Codice "
USE VAR
INPUT CODTAB F_INIZIO1
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_INIZIO1 CODTAB
OUTPUT F_INIZIO2 S0
GROUP 1
FIELD CODTAB
FLAGS "U"
CHECKTYPE NORMAL
END
STRING F_INIZIO2 25 50
BEGIN
PROMPT 2 4 "Descrizione "
USE VAR KEY 2
INPUT S0 F_INIZIO2
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
OUTPUT F_INIZIO2 S0
OUTPUT F_INIZIO1 CODTAB
GROUP 1
FIELD S0
FLAGS "U"
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 74 4
BEGIN
PROMPT 1 7 "A"
END
STRING F_FINE1 20
BEGIN
PROMPT 2 8 "Codice "
USE VAR
INPUT CODTAB F_FINE1
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_FINE1 CODTAB
OUTPUT F_FINE2 S0
GROUP 2
FIELD CODTAB
FLAGS "U"
CHECKTYPE NORMAL
END
STRING F_FINE2 30 50
BEGIN
PROMPT 2 9 "Descrizione "
USE VAR KEY 2
INPUT S0 F_FINE2
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
OUTPUT F_FINE2 S0
OUTPUT F_FINE1 CODTAB
GROUP 2
FIELD S0
FLAGS "U"
CHECKTYPE NORMAL
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

20
db/dbtblav.rpt Executable file
View File

@ -0,0 +1,20 @@
[Relations]
%UMS;CODTAB=S6;1;0;200
[Headers]
80
Tabella Lavorazioni
1|@3g%s|Codice
1|@25g%s|Descrizione
2|@3g%s|Unita' di misura
2|@29g%s| Costo unitario
2|@47g%s|Stampata nelle esplosioni
[Rows]
1|CODTAB|@3g@20,ls
1|S0|@25g@50,ls
2|S6|@3g@2,ls
2|-200->S0|@6g@20,ls
2|R0|@29g@15,rpn|############,@@@
2|B0|@47g@5,ls
3|

16
db/dbtbvar.rpt Executable file
View File

@ -0,0 +1,16 @@
[Headers]
80
Tabella Variabili distinte base
1|@3g%s|Codice
1|@25g%s|Descrizione
1|@76g%s|Tipo
[Rows]
1|CODTAB|@3g@20,ls
1|S0|@24g@50,ls
1|B0|@77g@3t
[Translations]
0|B0| |STR
0|B0|X|NUM

View File

@ -80,6 +80,7 @@ BEGIN
DISPLAY "Nr. distinta" NDIST
DISPLAY "Tipo distinta" TIPODIST
COPY OUTPUT F_NPROGTR
OUTPUT F_DATASCAD DATASCAD
CHECKTYPE REQUIRED
MESSAGE COPY,13@
END

View File

@ -1,9 +1,11 @@
#include <currency.h>
#include <relapp.h>
#include <msksheet.h>
#include <sheet.h>
#include <utility.h>
#include <lffiles.h>
#include <clifo.h>
#include "ef0.h"
#include "ef0300.h"
#include "ef0301.h"
@ -42,6 +44,7 @@ protected:
static void calcola_totale();
static void calcola();
static void aggiungi();
static bool effetto_aggiunto(const long numero);
static void carica_riba(int tipopag);
static void ord_data();
static void ord_fatt();
@ -239,13 +242,19 @@ int TVariazione_distinte::read(TMask& m)
if (i == 0)
{
const bool valuta = (codval.not_empty() && codval != "LIT");
m.set(F_CODVAL, codval);
m.enable(F_CODVAL, valuta);
}
riga.add(codval);
riga.add(eff.get(EFF_IMPORTO));
riga.add(eff.get(EFF_IMPORTOVAL));
// riga.add(eff.get(EFF_IMPORTO));
// riga.add(eff.get(EFF_IMPORTOVAL));
TCurrency soldi;
soldi.read(eff, EFF_IMPORTO, NULL);
riga.add(soldi.string(TRUE));
soldi.read(eff, EFF_IMPORTOVAL, EFF_CODVAL);
if (!soldi.get_num().is_zero())
riga.add(soldi.string(TRUE));
shrighe.row(i) = riga;
}
}
@ -355,10 +364,10 @@ int TVariazione_distinte::write(const TMask& m)
// relativi.
bool TVariazione_distinte::remove()
{
TMask* m = app()._msk;
TMask* m = _msk;
char tipodist = m->get(F_TIPODIST)[0];
long ndist = m->get_long(F_NUMBER);
int err = _distinta->remove(tipodist, ndist) == NOERR;
bool err = _distinta->remove(tipodist, ndist) == NOERR;
return err;
}
@ -374,7 +383,7 @@ bool TVariazione_distinte::user_create()
_distinta = new TDistinta;
set_search_field(F_NUMBER);//setto il campo di ricerca della distinta
_msk->set_handler(F_TIPODIST, tipodist_handler);
_msk->set_handler(F_IMP, importo_handler);
_msk->set_handler(F_IMPBUTTON, importo_handler);
_m2->set_handler(F_TOTIMPDIST, imp_aut_handler);
_m2->set_handler(DLG_OK, conferma_handler);
_m2->set_handler(DLG_CANCEL, annulla_handler);
@ -399,6 +408,23 @@ bool TVariazione_distinte::user_destroy()
return TRUE;
}
// Cerca se la riba indicata da <numero> e' gia stato inserita nello spreadsheet principale
bool TVariazione_distinte::effetto_aggiunto(const long numero)
{
TMask* m = app()._msk;
TSheet_field& sf_riba = (TSheet_field&)m->field(F_SHEET_RIBA);
bool rt = FALSE;
const int items = sf_riba.items();
for (int i=0; i<items && !rt; i++)
{
TToken_string& row = sf_riba.row(i);
if (row.get_long(1) == numero)
rt = TRUE;
}
return rt;
}
// Permette di caricare lo sheet per la selezione delle riba da
// aggiungere alla distinta: vengono presi tutti gli effetti sul file
// LF_EFFETTI che non hanno ancora un riferimento ad una distinta;
@ -420,6 +446,10 @@ void TVariazione_distinte::carica_riba(int tipopag)
m2->reset();
TSheet_field& sf = (TSheet_field&)m2->field(F_SHEET);
sf.reset();
TString16 codval = app()._msk->get(F_CODVAL);
if (codval.empty()) codval = "LIT";
int err, i = 0;
err = eff.read(f, tipodist, ndist, nrigadist);
int tipop = eff.get_int(EFF_TIPOPAG);
@ -430,12 +460,17 @@ void TVariazione_distinte::carica_riba(int tipopag)
// seleziono
const bool to_select = (tipopag == 0) || (tipopag == tipop) ||
((tipopag == 2 || tipopag ==5 || tipopag == 7) &&
(tipop == 2 || tipop ==5 || tipop == 7));
if (to_select)
(tipop == 2 || tipop ==5 || tipop == 7));
TString16 valuta = eff.get(EFF_CODVAL);
if (valuta.empty()) valuta = "LIT";
const bool valuta_ok = valuta == codval;
const long numero = eff.get_long(EFF_NPROGTR);
if (to_select && valuta_ok && !effetto_aggiunto(numero))
{
riga.cut(0);
riga.add(' ');
const long numero = eff.get_long(EFF_NPROGTR);
riga = " "; // Campo selezione
riga.add(numero);
riga.add(eff.get(EFF_DATASCAD));
long codcf = eff.get_long(EFF_CODCF);
@ -462,9 +497,18 @@ void TVariazione_distinte::carica_riba(int tipopag)
riga.add(("Varie"));
riga.add(("Varie"));
}
riga.add(eff.get(EFF_CODVAL));
riga.add(eff.get(EFF_IMPORTO));
riga.add(eff.get(EFF_IMPORTOVAL));
riga.add(valuta);
// riga.add(eff.get(EFF_IMPORTO));
TCurrency soldi;
soldi.read(eff, EFF_IMPORTO, NULL);
riga.add(soldi.string(TRUE));
// riga.add(eff.get(EFF_IMPORTOVAL));
soldi.read(eff, EFF_IMPORTOVAL, EFF_CODVAL);
if (!soldi.get_num().is_zero())
riga.add(soldi.string(TRUE));
sf.row(i) = riga;
i++;
}
@ -496,39 +540,16 @@ bool TVariazione_distinte::tipodist_handler(TMask_field& f, KEY k)
// princiapale)
bool TVariazione_distinte::importo_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.to_check(k, TRUE))
{
TMask& m = f.mask();
const TString16 codval = m.get(F_CODVAL);
const bool valuta = codval.not_empty() && codval != "LIT";
TSheet_field& sf_riba = (TSheet_field&)m.field(F_SHEET_RIBA);
const int mode = m.mode();
if( mode == MODE_INS || mode == MODE_MOD)
{
TMask* m2 = app()._m2;
real impdist = m.get_real(F_IMP) - m.get_real(F_TOTIMP);
const int tipopag = m.get_int(F_TIPOPAG);
// se importo distinta maggiore importo presentato si devono andare a
// caricare effetti in automatico per un valore minore uguale alla
// differenza dei suddetti importi
if (impdist > ZERO)
{
app().begin_wait();
carica_riba(tipopag);
app().end_wait();
m2->reset(F_TOTIMPDIST);
m2->reset(F_IMPSEL);
m2->set(F_TOTIMPDIST, impdist);
m2->run();
calcola_totale();
}
else
if (impdist < ZERO)
error_box("Il valore di presentazione non può superare l'importo della distinta");
}
if (f.focusdirty())
sf_riba.force_update();
}
if (k == K_SPACE)
{
aggiungi();
TSheet_field& sf_riba = (TSheet_field&)f.mask().field(F_SHEET_RIBA);
sf_riba.force_update();
}
return TRUE;
}
@ -546,9 +567,8 @@ bool TVariazione_distinte::imp_aut_handler(TMask_field& f, KEY k)
TMask* m = app()._msk;
TSheet_field& sf = (TSheet_field&)m2.field(F_SHEET);
TSheet_field& sf_riba = (TSheet_field&)m->field(F_SHEET_RIBA);
const real impdist = m->get_real(F_IMP) - m->get_real(F_TOTIMP);
real res = m2.get_real(F_TOTIMPDIST);
if (res > ZERO && impdist > ZERO)
if (res > ZERO)
{ // se i due importi sono diversi da zero
TString val = m->get(F_CODVAL);
if (val == "LIT")
@ -565,7 +585,7 @@ bool TVariazione_distinte::imp_aut_handler(TMask_field& f, KEY k)
if (codval == " " || codval == "LIT")
codval.cut(0);
const bool valuta = codval.not_empty();
const real imp(row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO)));
const real imp(real::ita2eng(row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO))));
if (imp == res && codval == val)
{
row.add('X', 0);
@ -581,7 +601,7 @@ bool TVariazione_distinte::imp_aut_handler(TMask_field& f, KEY k)
if (codval == " " || codval == "LIT")
codval.cut(0);
const bool valuta = codval.not_empty();
const real imp = (row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO)));
const real imp(real::ita2eng(row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO))));
// se l'importo, della riga corrente dello sheet, è minore
// dell 'importo che si deve caricare e se lo rimane anche
// sommato all'importo già selezionato, si procede a rendere
@ -806,12 +826,11 @@ void TVariazione_distinte::calcola_totale()
if (*row.get(0) != 'X') // valido (not to delete)
{
const real imp = row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO));
const real imp(real::ita2eng(row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO))));
impdist += imp;
}
}
m->set(F_TOTIMP, impdist);
m->set(F_IMP, impdist);
}
// Metodo che calcola i totali relativi alla selezione effetti per la
@ -823,9 +842,7 @@ void TVariazione_distinte::calcola()
TSheet_field& sf = (TSheet_field&)m2->field(F_SHEET);
const int items = sf.items();
real impsel;
const real imp_pres = m->get_long(F_TOTIMP);
const real importo = m->get_long(F_IMP);
const real impdist = importo - imp_pres;
const real imp_pres = m->get_real(F_TOTIMP);
const TString16 codval = m->get(F_CODVAL);
const bool valuta = codval.not_empty() && codval != "LIT";
for (int i = 0; i < items; i++)
@ -835,18 +852,12 @@ void TVariazione_distinte::calcola()
// selezionato
if (*row.get(0) == 'X')
{
const real imp(row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO)));
const real imp(real::ita2eng(row.get(sf.cid2index(valuta ? F_IMPORTOVAL : F_IMPORTO))));
impsel += imp;
}
}
m2->set(F_IMPSEL, impsel);
if (impdist == ZERO)
{
if (imp_pres == ZERO)
m2->set(F_TOTIMPDIST, impsel);
else
m2->set(F_TOTIMPDIST, importo);
}
m2->set(F_TOTIMPDIST, impsel);
}
// Notify per il calcolo dei totali relativi alla selezione effetti

View File

@ -11,8 +11,8 @@
#define F_DENBANP 105
#define F_CODABIP 106
#define F_CODCABP 107
#define F_TOTIMP 108
#define F_IMP 109
#define F_TOTIMP 108
#define F_IMPBUTTON 109
#define F_CODVAL 111
#define F_TIPOPAG 112
#define F_SHEET_RIBA 113

View File

@ -138,24 +138,22 @@ BEGIN
OUTPUT F_CODVAL CODTAB
END
NUMBER F_IMP 18 2
BEGIN
PROMPT 2 8 "Importo Distinta "
PICTURE "###.###.###.###,@@"
NUM_EXPR #F_IMP>=#F_TOTIMP
WARNING "Il valore di presentazione non puo' superare l'importo della distinta"
END
NUMBER F_TOTIMP 18 2
BEGIN
PROMPT 2 9 "Valore di presentazione "
PROMPT 2 8 "Valore di presentazione "
FLAGS "D"
PICTURE "###.###.###.###,@@"
END
SPREADSHEET F_SHEET_RIBA 78 6
BUTTON F_IMPBUTTON 9 2
BEGIN
PROMPT 1 12 "RIGHE DISTINTA"
PROMPT 50 8 "~Selezione"
PICTURE BMP_SELECT
END
SPREADSHEET F_SHEET_RIBA 78 8
BEGIN
PROMPT 1 10 "RIGHE DISTINTA"
ITEM "Da elim."
ITEM "Nr. Ri.Ba."
ITEM "Scadenza"

View File

@ -56,20 +56,18 @@ BEGIN
FLAGS "D"
END
NUMBER F_IMPORTO 18 2
STRING F_IMPORTO 18
BEGIN
PROMPT 2 9 "Importo "
FIELD LF_EFFETTI->IMPORTO
PICTURE "###.###.###.###,@@"
FLAGS "D"
FLAGS "DR"
END
NUMBER F_IMPORTOVAL 18 3
STRING F_IMPORTOVAL 18
BEGIN
PROMPT 2 10 "Importo Val. "
FIELD LF_EFFETTI->IMPORTOVAL
PICTURE "###.###.###.###,@@@"
FLAGS "D"
FLAGS "DR"
END
BUTTON DLG_OK 9 2

View File

@ -56,20 +56,18 @@ BEGIN
FLAGS "D"
END
NUMBER F_IMPORTO 18 2
STRING F_IMPORTO 18
BEGIN
PROMPT 2 9 "Importo "
FIELD LF_EFFETTI->IMPORTO
PICTURE "###.###.###.###,@@"
FLAGS "D"
FLAGS "DR"
END
NUMBER F_IMPORTOVAL 18 3
STRING F_IMPORTOVAL 18
BEGIN
PROMPT 2 10 "Importo Val. "
FIELD LF_EFFETTI->IMPORTOVAL
PICTURE "###.###.###.###,@@@"
FLAGS "D"
FLAGS "DR"
END
BUTTON DLG_OK 9 2

View File

@ -1,18 +1,16 @@
#include <applicat.h>
#include <urldefid.h>
#include <filetext.h>
#include <form.h>
#include <mask.h>
#include <mask.h>
#include <os_dep.h>
#include <relation.h>
#include <printer.h>
#include <progind.h>
#include <lffiles.h>
#include <dos.h>
#include <errno.h>
#include "ef0.h"
//#include <utility.h>
#include "ef0.h"
#include "ef0301.h"
#include "ef0500.h"
#include <filetext.h>
#include <utility.h>
class TRiba_form;
class TDistinta_form;
@ -23,7 +21,7 @@ enum fo{kb360 = 1, kb720 = 2, kb1200 = 3, kb1440 = 4};
///////////////////////////////////////////////////////////////////////
// Classe per l'emissione di effetti e distinte su carta o su floppy //
///////////////////////////////////////////////////////////////////////
class TEmissione: public TApplication
class TEmissione: public TSkeleton_application
{
fo _foutput;
TMask* _msk;
@ -35,15 +33,15 @@ class TEmissione: public TApplication
TRiba_file* _trasfile;
int _base_page_no;
protected:
virtual bool create(void);
virtual bool destroy(void) ;
virtual void on_firm_change(void);
virtual bool menu(MENU_TAG);
void conferma(void);
virtual void print_rb(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
virtual void print_dse(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
virtual void print(void);
void floppy(void);
virtual bool create(void);
virtual void main_loop();
virtual bool destroy(void) ;
virtual void on_firm_change(void);
void conferma(void);
virtual void print_rb(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
virtual void print_dse(char tipost, int ndist, char tipodist, int ncopie, const bool is_vis);
virtual void print(void);
void floppy(void);
void save_data_emis(void);
void header_rb(void);
void footer_ef(void);
@ -114,10 +112,9 @@ public:
// creazione dell'applicazione
bool TEmissione::create()
{
TApplication::create();
_formrb = NULL;
_formdse = NULL;
_msk = new TMask("ef0500a");
_formrb = NULL;
_formdse = NULL;
_msk = new TMask("ef0500a");
_firmrel= new TRelation(LF_NDITTE);
_firmrel->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR");
_firmrel->add(LF_UNLOC,"CODDITTA=CODDITTA");
@ -132,9 +129,8 @@ bool TEmissione::create()
_msk->set(F_NOMEFILE,RIBAFILENAME);
_trasfile = new TRiba_file(RIBAFILENAME, "riba.ini");
_trasfile->set_ditta(get_firm());
_msk->set_handler(DLG_CANCEL, annulla_handler);
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
_msk->set_handler(DLG_CANCEL, annulla_handler);
return TSkeleton_application::create();
}
// distruzione dell'applicazione
@ -150,8 +146,7 @@ bool TEmissione::destroy()
{
_trasfile->close();
delete _trasfile;
}
return TApplication::destroy();
return TSkeleton_application::destroy();
}
// carica la ditta corrente
@ -162,8 +157,8 @@ void TEmissione::on_firm_change()
_firmrel->read();
}
// carica la maschera per emissione effetti e distinte
bool TEmissione::menu(MENU_TAG)
// carica la maschera per emissione effetti e distinte
void TEmissione::main_loop()
{
KEY key = K_ENTER;
while (key != K_QUIT)
@ -172,8 +167,7 @@ bool TEmissione::menu(MENU_TAG)
if (key == K_ENTER)
conferma();
}
return FALSE;
}
}
// gestisce la scelta fra le due possibili emissioni
void TEmissione::conferma()
@ -301,9 +295,10 @@ bool TEmissione::ok_write()
{
long elem = _cur->items();
int dim = _trasfile->recordsize();
long nbyte = (elem*7+2)*dim;
struct _diskfree_t diskspace;
char unita = _msk->get(F_UNITA)[0];
unsigned long nbyte = (elem*7+2)*dim;
/*
char unita = toupper(_msk->get(F_UNITA)[0]);
unsigned drive;
switch(unita)
{
@ -314,29 +309,21 @@ bool TEmissione::ok_write()
drive = 2;
break;
}
// routine uses system call 0x36 to obtain information on the disk drive
// specified by drive
// specified by drive
struct _diskfree_t diskspace;
_dos_getdiskfree(drive, &diskspace);
unsigned long available_clusters = (unsigned long) diskspace.avail_clusters;
unsigned long sectors_per_cluster = (unsigned long) diskspace.sectors_per_cluster;
unsigned long bytes_per_sector = (unsigned long) diskspace.bytes_per_sector;
unsigned long free_space = available_clusters * sectors_per_cluster * bytes_per_sector;
switch (_foutput)
{
case kb360 :
return free_space + nbyte < 360000L;
break;
case kb720 :
return free_space + nbyte < 720000L;
break;
case kb1200 :
return free_space + nbyte < 1200000L;
break;
case kb1440 :
return free_space + nbyte < 1440000L;
break;
}
return TRUE;
return nbyte < free_space;
*/
TString16 unita; unita << _msk->get(F_UNITA)[0] << ":\\";
return os_test_disk_free_space(unita, nbyte);
}
// aggiorna numero e data di emissione ed il flag di stampa
@ -466,22 +453,22 @@ void TEmissione::print()
long codabi = _rel->lfile().get_long(EFF_CODABIP);
char tipost = _msk->get(F_TIPOST)[0];
char tipord = _msk->get(F_TIPORD)[0];
// se emetto riba istanzio il form per le riba
// se emetto distinta istanzio il form per le distinte
if (emis == 1)
{
TString16 nomeform;
// se emetto riba istanzio il form per le riba
// se emetto distinta istanzio il form per le distinte
if (emis == 1)
{
TFilename nomeform;
nomeform.format("rb%05ld.frm",codabi);// compongo il nome del form
if (!fexist(nomeform)) // ne controllo l'esistenza se non
if (!nomeform.exist()) // ne controllo l'esistenza se non
nomeform = "rb.frm"; // esiste utilizzo quello generico
_formrb = new TRiba_form(nomeform);
print_rb(tipost,ndist,tipodist,ncopie,is_vis);
}
else
{
TString16 nomeform;
else
{
TFilename nomeform;
nomeform.format("dse%05ld.frm",codabi);// compongo il nome del form
if (!fexist(nomeform)) // ne controllo l'esistenza
if (!nomeform.exist()) // ne controllo l'esistenza
nomeform = "dse.frm"; // se non esiste utilizzo quello generico
_formdse = new TDistinta_form(nomeform, _firmrel);
_formdse->set_order(tipord);
@ -753,7 +740,10 @@ bool TDistinta_form::validate(TForm_item &cf, TToken_string &s)
//"!NDOC" prende il numero riba nella distinta guardando quanti
// elementi ha il cursore di stampa
if (in == "NDOC")
cf.set(format("%ld",i));
{
TString16 num; num << i;
cf.set(num);
}
//"!TOTALE" calcola il totale presentato prendendo i totale degli
// effetti nel cursore di stampa
if (in == "TOTALE")

View File

@ -367,6 +367,7 @@ void TApplication::stop_run()
}
#endif
terminate();
xvt_app_destroy();
}
@ -518,6 +519,18 @@ void TApplication::set_perms()
}
}
void TApplication::open_files(int logicnum, ...)
{
va_list marker;
va_start(marker, logicnum);
while (logicnum > 0)
{
CHECKD(_used_files.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
_used_files.add(new TLocalisamfile(logicnum), logicnum);
logicnum = va_arg(marker, int);
}
}
// @doc EXTERNAL
// @mfunc Legge il parametro /uUTENTE e lo toglie dalla lista

View File

@ -54,6 +54,8 @@ class TApplication
// @cmember:(INTERNAL) Indica se l'applicazione e' stata creata con successo
bool _create_ok;
// @cmember:(INTERNAL) array dei files usati
TArray _used_files;
// @cmember:(INTERNAL) Termine dell'applicazione
void terminate();
// @cmember:(INTERNAL) Cambia il cursore del mouse
@ -98,6 +100,8 @@ protected:
// @cmember Setta i permessi di utilizzo dei moduli
void set_perms();
// @cmember apre i files necessari
void open_files(int logicnum, ...);
// @access Public Member
public:
// @cmember Modifca la barra dei menu' inserendo la <p menubar>

View File

@ -213,7 +213,7 @@ bool TArchive::fsplit(
if (!os_test_disk_free_space(work, tot))
{
TString16 dev("A:/*.*"); dev[0] = floppy; //
TString16 dev("A:\\*.*"); dev[0] = floppy;
TString_array dir;
if (list_files(dev, dir) > 0)
{
@ -409,9 +409,13 @@ bool TArchive::backup(
{
const TString16 old(prefix().name());
prefix().set(NULL);
DIRECTORY curdir; xvt_fsys_get_dir(&curdir);
if (pr_set)
prefix().set(NULL);
DIRECTORY curdir;
xvt_fsys_get_dir(&curdir);
if (dir[1] == ':')
_chdrive(toupper(dir[0]) - '@');
chdir(dir);
const TFilename d(dir);
@ -496,6 +500,8 @@ bool TArchive::restore(
return FALSE;
xvt_fsys_save_dir();
if (work[1] == ':')
_chdrive(toupper(work[0]) - '@');
bool ok = chdir(work) == 0;
if (!ok)
{

View File

@ -61,11 +61,12 @@ bool TConfig_application::user_destroy()
void TConfig_application::save_mask(bool tosave)
{
if (_m==NULL) return;
const int max = _m->dirty() ? _m->fields() : 0;
TMask* mask = get_mask();
if (mask==NULL) return;
const int max = mask->dirty() ? mask->fields() : 0;
for (int i = 0; i < max; i++)
{
TMask_field& f = _m->fld(i);
TMask_field& f = mask->fld(i);
if (f.dirty() && f.field())
{
const char* fname = f.field()->name();
@ -87,11 +88,12 @@ void TConfig_application::save_mask(bool tosave)
void TConfig_application::load_mask()
{
if (_m==NULL) return;
const int max = _m->fields();
TMask* mask = get_mask();
if (mask==NULL) return;
const int max = mask->fields();
for (int i = 0; i < max; i++)
{
TMask_field& f = _m->fld(i);
TMask_field& f = mask->fld(i);
if (f.field() != NULL)
{
const TFieldref* fr = f.field();
@ -123,17 +125,19 @@ void TConfig_application::do_config(int m)
const TFilename maskname(_cnf->get("EdMask"));
if (maskname.not_empty() && maskname.exist())
{
if (_m) delete _m;
_m= new TMask(maskname);
TMask* mask = get_mask();
if (mask)
destroy_mask();
mask = create_mask(maskname);
// carica campi
load_mask();
// run mask
if (!preprocess_config(*_m,*_cnf))
if (!preprocess_config(*mask,*_cnf))
break;
int k = _m->run();
if (postprocess_config(*_m,*_cnf))
int k = mask->run();
if (postprocess_config(*mask,*_cnf))
{
bool tosave = k == K_ENTER || k == K_SAVE;

View File

@ -89,6 +89,12 @@ protected:
virtual bool postprocess_config_changed (const char* par, const char* var, const char* oldv, const char* newv);
virtual void on_firm_change();
// funzione di settaggio maschere (per uso di maschere derivate)
virtual TMask* create_mask(const TFilename& f) { return _m = new TMask(f); }
// anche queste funzioni vanno derivata quando viene derivata la precedente; faranno uso di un puntatore a maschera diverso
virtual TMask* get_mask() { return _m; }
virtual void destroy_mask() { delete _m; }
// @access Public Member
public:
// @cmember Setta il tipo di file di configurazione al quale e' associata l'applicazione

Some files were not shown because too many files have changed in this diff Show More