Patch level : XX.282

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Riportata la versione 01.05 patch 282


git-svn-id: svn://10.65.10.50/trunk@8019 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1999-04-06 15:34:39 +00:00
parent 1ec0fe70d1
commit a0a36d6b33
429 changed files with 40189 additions and 12586 deletions

View File

@ -1,3 +1,3 @@
78
1
%abpcon|0|0|107|20|Piano dei conti analisi di bilancio|||
$abpcon|0|0|110|0|Piano dei conti analisi di bilancio|||

View File

@ -449,10 +449,10 @@ class TMenuitem : public TObject
TString _caption, _action;
char _type;
COLOR _color;
bool _enabled : 1;
bool _firm : 1;
bool _password : 1;
bool _reloadmenu : 1;
int _exist : 2;
bool _firm : 2;
bool _password : 2;
bool _reloadmenu : 2;
protected:
bool perform_submenu() const;
@ -488,8 +488,8 @@ class TSubmenu : public TObject
TString _caption;
TFilename _picture;
TArray _items;
bool _enabled : 1;
bool _firm : 1;
bool _enabled : 2;
bool _firm : 2;
public:
void read(TScanner& scanner);
@ -567,7 +567,7 @@ public:
TMenuitem::TMenuitem(TSubmenu* sm)
: _submenu(sm),
_enabled(TRUE), _firm(FALSE), _password(FALSE), _reloadmenu(FALSE),
_exist(-1), _firm(FALSE), _password(FALSE), _reloadmenu(FALSE),
_color(NORMAL_COLOR)
{ }
@ -587,7 +587,7 @@ void TMenuitem::create(const char* t)
{
switch(toupper(flags[i]))
{
case 'D': _enabled = FALSE; break;
case 'D': _exist = FALSE; break;
case 'F': _firm = TRUE; break;
case 'P': _password = TRUE; break;
case 'R': _reloadmenu = TRUE; break;
@ -604,11 +604,11 @@ void TMenuitem::create(const char* t)
}
if (_action.empty())
{
_exist = FALSE;
_enabled = FALSE;
}
// if (_enabled && is_program())
// _enabled = menu().has_module(_action);
// Controlla lo stato di aggiornamento
if (_enabled && is_program())
_enabled = !menu().is_dangerous(_action);
@ -616,29 +616,41 @@ void TMenuitem::create(const char* t)
bool TMenuitem::enabled() const
{
bool yes = _enabled;
if (yes)
{
bool yes = FALSE;
if (_exist)
{
if (is_submenu())
{
TSubmenu* mnu = menu().find(_action);
yes = mnu && mnu->enabled();
}
else
{
const int endname = _action.find(' ');
TFilename name(endname > 0 ? _action.left(endname) : _action);
const char* ext[] = { "exe", "pif", "com", "bat", NULL };
yes = FALSE;
for (int e = 0; ext[e]; e++)
{
if (_exist < 0)
{
name.ext(ext[e]);
if (name.exist())
if (menu().is_dangerous(_action))
{
yes = TRUE;
break;
yes = FALSE;
}
else
{
const int endname = _action.find(' ');
TFilename name(endname > 0 ? _action.left(endname) : _action);
const char* ext[] = { "exe", "pif", "com", "bat", NULL };
for (int e = 0; ext[e]; e++)
{
name.ext(ext[e]);
if (fexist(name))
break;
}
yes = ext[e] != NULL;
}
((TMenuitem*)this)->_exist = yes;
}
if (_exist)
{
TExternal_app app(_action);
yes = app.can_run();
}
if (!yes)
((TMenuitem*)this)->_enabled = FALSE;
@ -1394,7 +1406,6 @@ 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);

View File

@ -1,12 +1,21 @@
#define F_USER 101
#define F_PASSWORD 102
#define F_USERDESC 103
#define F_MODULI 104
#define F_GROUP 104
#define F_GROUPNAME 105
#define F_TEST 106
#define F_APPLICAT 107
#define F_NOWRITE 108
#define F_MODULI 150
#define F_PERMESSI 151
#define F_PROPERTIES 152
#define F_BASE 200
#define F_74 201
#define F_75 202
#define F_76 203
#define F_77 204
#define F_74 201
#define F_75 202
#define F_76 203
#define F_77 204
#define F_GI 205
#define F_SE 206
#define F_CG 207

View File

@ -5,20 +5,20 @@ PAGE "Selezione utente" -1 -1 30 7
STRING F_USER 8
BEGIN
PROMPT 4 1 "Utente "
HELP "Nome dell'utente"
FLAGS "U"
USE LF_USER
INPUT USERNAME F_USER
USE LF_USER SELECT ISGROUP=""
INPUT USERNAME F_USER
DISPLAY "Utente@8" USERNAME
DISPLAY "Gruppo@8" GROUPNAME
DISPLAY "Descrizione@50" USERDESC
OUTPUT F_USER USERNAME
CHECKTYPE SEARCH
END
STRING F_PASSWORD 8 10
BEGIN
PROMPT 4 3 "Password "
FLAGS "*"
HELP "Password dell'utente selezionato"
END
BUTTON DLG_OK 10 2

View File

@ -352,7 +352,7 @@ bool TManutenzione_app::create() // initvar e arrmask
_browse->add_button(DLG_ADDFILE, "~Aggiungi", K_F8);
TButton_field& butt = ((TMask*)_browse)->add_button(DLG_OTHERFILE, 0, "A~ltri", 0, -1, 9, 2, "", 0, 0);
butt.set_hot_key(K_F5);
butt.set_exit_key(K_F5);
_mask->enable(-1); // Abilita campi privilegiati
}
@ -635,11 +635,8 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga)
f.build(eox);
_browse->dir()->get(logicnum, _nolock, _nordir, _sysdirop);
}
switch (tasto)
if (tasto == K_F5 && logicnum > 1)
{
case K_F5:
if (logicnum > 1)
{
TSystemisamfile f(logicnum);
f.pack();
//Pack supplementare tramite FOXPRO (da togliere con CodeBase 6)
@ -1079,8 +1076,9 @@ void TManutenzione_app::convert_dir()
// I files LF_PCON, LF_CAUS, LF_RCAUS, LF_CLIFO, LF_CFVEN, LF_INDSPED
// vanno creati comunque nel direttorio COM, vuoti, (se non esistono gia').
if (is_com && !to_create && movable_file(i))
to_create = TRUE;
if (is_com && !to_create)
if (movable_file(i))
to_create = TRUE;
if (to_create && has_module(module, CHK_DONGLE))
{
@ -1241,7 +1239,7 @@ void TManutenzione_app::load_des(const int maxfdir)
if (prefix().is_com()) s << "comuni";
else s << " della ditta " << atol (pref);
TProgind p(items ? items : 1, s, TRUE, TRUE, 70);
TProgind p(items ? items : 1, s, FALSE, TRUE, 70);
p.setstatus(1);
for (int i = 2; i <= items; i++)
@ -1359,7 +1357,7 @@ void TManutenzione_app::update()
TString80 s("Conversione archivi ditte.");
TProgind p(ditte.items() ? ditte.items() : 1, s, TRUE, TRUE, 70);
TProgind p(ditte.items() ? ditte.items() : 1, s, FALSE, TRUE, 70);
p.setstatus(1);
TString mxs;

View File

@ -1,7 +1,7 @@
#include <defmask.h>
#include <relation.h>
#include <prefix.h>
#include <progind.h>
#include <relation.h>
#include <sheet.h>
#include "ba1100.h"
@ -14,7 +14,6 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
TToken_string head(256);
TToken_string trac(256);
const char* n;
trac.add("");
head.add("@1");
@ -106,19 +105,15 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
svrec = curr;
if (edit_record(curr, FALSE) == K_ENTER)
{
TString s(svrec.key(1));
const TString s(svrec.key(1));
if (s != curr.key(1))
{
cursor.file().write();
if (cursor.file().good())
{
curr = svrec;
cursor.file().remove();
}
const int err = curr.write(cursor.file());
if (err == NOERR)
svrec.remove(cursor.file());
}
else
cursor.file().rewrite();
curr.rewrite(cursor.file());
}
break;
case K_DEL: // delete record

View File

@ -2,6 +2,7 @@
#include <execp.h>
#include <isam.h>
#include <prefix.h>
#include <progind.h>
#include <sheet.h>
#include <urldefid.h>
#include <utility.h>
@ -19,6 +20,7 @@ protected:
virtual bool destroy();
virtual bool extended_firm() const { return TRUE; }
void build_sheet();
void search_blanks(TSystemisamfile & f);
public:
TPackFiles_application() : _selsheet(NULL), _firm(0) {}
~TPackFiles_application() {};
@ -73,6 +75,29 @@ void TPackFiles_application::build_sheet()
}
}
void TPackFiles_application::search_blanks(TSystemisamfile& f)
{
// Scorre il file corrente per record cancellando eventuali record vuoti/blank
f.open(_excllock, TRUE);
const long records = f.items();
TProgind p(records, "Ricerca records vuoti in corso...", TRUE, TRUE, 70);
TString k;
for (long i = 0; f.status() == NOERR && i < records; i++)
{
f.readat(i + 1); // Legge per numero di record, evitando falli di indice...
p.setstatus(i + 1);
k = f.curr().key(); // Chiave 1; non puo' essere vuota (anche perche' no si puo' scrivere un record vuoto)
if (f.curr().empty() || k.trim().empty()) // Teoricamente ce ne sarebbe uno solo...
{ // ma se l'indice e' rovinato possono esserci piu' records vuoti
f.curr().discard(); // che vanno cmq eliminati; le pack() successive completano l'opera.
f.rewriteat(i + 1);
}
}
f.close();
}
bool TPackFiles_application::menu(MENU_TAG m)
{
KEY tasto;
@ -110,7 +135,8 @@ bool TPackFiles_application::menu(MENU_TAG m)
{
status = NOERR;
if (present) // Se il file c'e' prova a compattarlo
{
{
search_blanks(f);
if (f.packfile() == NOERR)
f.packindex();
status = f.status();
@ -143,7 +169,7 @@ bool TPackFiles_application::menu(MENU_TAG m)
d.put(i, is_com ? _comdir : _nordir);
if (f.pack() == NOERR)
if (f.load(d_name) == NOERR) // Reload
unlink(f_name);
unlink(d_name);
else
error_box("Impossibile ricaricare %s. Errore %d",(const char*) d_name, f.status());
else

View File

@ -1,43 +1,387 @@
#include <colors.h>
#include <modaut.h>
#include <msksheet.h>
#include <prefix.h>
#include <relapp.h>
#include <utility.h>
#include <tree.h>
#include <urldefid.h>
#include "ba1.h"
#include "ba1500.h"
#include "ba0100a.h"
class TSet_users : public TRelation_application
///////////////////////////////////////////////////////////
// Menu item
///////////////////////////////////////////////////////////
class TMenu_item : public TString
{
TString _cmd;
public:
TObject* dup() const { return new TMenu_item(*this); }
const TString& cmd() const { return _cmd; }
TString& cmd() { return _cmd; }
TMenu_item(const char* line);
virtual ~TMenu_item() { }
};
TMenu_item::TMenu_item(const char* line)
{
TToken_string ts(line, ',');
set(ts.get(0)); trim();
if (operator[](0) == '"')
{ ltrim(1); rtrim(1); }
_cmd = ts.get(); _cmd.trim();
if (_cmd[0] == '"')
{ _cmd.ltrim(1); _cmd.rtrim(1); }
}
///////////////////////////////////////////////////////////
// Sottomenu (lista di menu items)
///////////////////////////////////////////////////////////
class TSubmenu : public TString
{
TArray _child;
int _module;
public:
TMenu_item& operator[](int c) { return (TMenu_item&)*_child.objptr(c); }
TMenu_item& add_child(const char* line);
int items() const { return _child.items(); }
int module() const { return _module; }
void set_module(int m) { _module = m; }
TSubmenu& operator=(const char* str) { set(str); return *this; }
TSubmenu& operator=(const TSubmenu& str) { set(str); _module = str._module; return *this; }
TSubmenu() : _module(0) { }
virtual ~TSubmenu() { }
};
TMenu_item& TSubmenu::add_child(const char* line)
{
TMenu_item* item = new TMenu_item(line);
_child.add(item, -1);
return *item;
}
///////////////////////////////////////////////////////////
// Nodo dell'albero del menu principale
///////////////////////////////////////////////////////////
class TMenu_node : public TString
{
TMenu_item* _item;
int _module;
public:
const TString& command() const;
int module() const { return _module; }
TMenu_node(TMenu_item* i, int module = 0);
TMenu_node(const char* str);
};
const TString& TMenu_node::command() const
{
if (_item)
return _item->cmd();
return EMPTY_STRING;
}
TMenu_node::TMenu_node(TMenu_item* i, int module)
: _item(i), _module(module)
{
set(*i);
}
TMenu_node::TMenu_node(const char* str)
: _item(NULL), _module(0)
{
set(str);
}
///////////////////////////////////////////////////////////
// Menu tree (albero di menu nodes)
///////////////////////////////////////////////////////////
class TMenu : public TObject_tree
{
TAssoc_array _submenu; // Insieme dei sottomenu
TAssoc_array _prop; // Proprieta' dei singoli programmi
protected:
virtual bool add_son(TObject* son);
virtual bool get_description(TString& desc) const;
virtual TImage* image(bool selected) const;
protected:
TSubmenu& get_submenu(const char* name);
TSubmenu& add_submenu(const char* para, int parent_module);
void import(const char* filename, TString& first);
public:
virtual bool enabled() const;
TAssoc_array& properties() { return _prop; }
TString_array& properties(const char* cmd);
const TString_array* find_properties(const char* cmd) const;
TMenu();
virtual ~TMenu() { }
};
///////////////////////////////////////////////////////////
// Main app
///////////////////////////////////////////////////////////
class TSet_user_passwd : public TRelation_application
{
protected:
TMask* _msk;
// TMenu* _tree;
TRelation* _rel;
TInformazione_moduli* _im;
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual TMask* get_mask(int mode) { return _msk;}
virtual bool changing_mask(int mode) { return FALSE;}
virtual TRelation* get_relation() const { return _rel;}
virtual int read(TMask& m);
void put_in_record(const TMask& m);
virtual void init_query_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual void init_insert_mode(TMask& m) {
build_sheet(NULL);
}
protected:
virtual void put_in_record(const TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
TSheet_field& sheet_field() { return _msk->sfield(F_MODULI); }
void build_sheet(const TRectype* r);
void enable_aut();
static bool password_handler(TMask_field& f, KEY key);
public:
bool user_has_module(int mod);
TSet_user_passwd() : _msk(NULL), _rel(NULL) , _im(NULL) {}
};
class TSet_users : public TSet_user_passwd
{
TMenu* _tree;
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual TMask* get_mask(int mode) { return _msk;}
virtual bool changing_mask(int mode) { return FALSE;}
virtual TRelation* get_relation() const { return _rel;}
virtual int read(TMask& m);
virtual bool remove();
void enable_aut(TMask& m);
virtual void init_query_mode(TMask& m) { enable_aut();}
virtual void init_insert_mode(TMask& m) { build_sheet(NULL); }
virtual void init_modify_mode(TMask& m) { enable_aut();}
protected:
// TSheet_field& sheet_field() { return _msk->sfield(F_MODULI); }
// void build_sheet(const TRectype* r);
void build_tree(const TRectype* r);
// void enable_aut();
virtual void put_in_record(const TMask& m);
static bool user_handler(TMask_field& f, KEY key);
static bool password_handler(TMask_field& f, KEY key);
static bool group_handler(TMask_field& f, KEY key);
// static bool password_handler(TMask_field& f, KEY key);
static bool k_notify(TSheet_field & f, int r, KEY k);
virtual void init_query_mode(TMask& m) { enable_aut(m);}
virtual void init_insert_mode(TMask& m) { build_sheet(m,NULL); enable_aut(m);}
virtual void init_modify_mode(TMask& m) { enable_aut(m);}
TSheet_field& sheet_field() { return (TSheet_field&) _msk->field(F_MODULI);}
void build_sheet(TMask& m, const TRelation* r);
static bool tree_handler(TMask_field& f, KEY key);
static bool p_notify(TSheet_field & f, int r, KEY k);
public:
TSet_users() : _msk(NULL), _rel(NULL) {}
};
// bool user_has_module(int mod);
TSet_users() : TSet_user_passwd() , _tree(NULL) {}
};
inline TSet_users& app() { return (TSet_users&)main_app(); }
///////////////////////////////////////////////////////////
// Menu tree implementation
///////////////////////////////////////////////////////////
const TString_array* TMenu::find_properties(const char* cmd) const
{
const TString_array* arr = (const TString_array*)_prop.objptr(cmd);
return arr;
}
TString_array& TMenu::properties(const char* cmd)
{
TString_array* arr = (TString_array*)_prop.objptr(cmd);
if (arr == NULL)
{
arr = new TString_array;
_prop.add(cmd, arr);
}
return *arr;
}
bool TMenu::add_son(TObject* son)
{
if (goto_firstson())
{
while (goto_rbrother());
return add_rbrother(son);
}
return TObject_tree::add_son(son);
}
bool TMenu::get_description(TString& desc) const
{
TMenu_node* node = (TMenu_node*)curr_node();
if (node) desc = *node;
return node != NULL;
}
bool TMenu::enabled() const
{
TMenu_node* node = (TMenu_node*)curr_node();
const int mod = node->module();
return app().user_has_module(mod);
}
TImage* TMenu::image(bool selected) const
{
TMenu_node* node = (TMenu_node*)curr_node();
if (!has_son())
{
const TString& cmd = node->command();
if (cmd.not_empty())
{
const TString_array* prop = find_properties(cmd);
if (prop)
{
TString80 action;
FOR_EACH_ARRAY_ROW_BACK(*prop, r, row)
{
row->get(1, action);
if (action == "Negato")
return get_res_image(BMP_STOP);
}
}
}
}
return TObject_tree::image(selected);
}
TSubmenu& TMenu::get_submenu(const char* name)
{
TSubmenu* sub = (TSubmenu*)_submenu.objptr(name);
if (sub == NULL)
{
sub = new TSubmenu;
_submenu.add(name, sub);
}
return *sub;
}
void TMenu::import(const char* filename, TString& first)
{
TSubmenu* sub;
TScanner scan(filename);
first.cut(0);
while (scan.good())
{
TString& line = scan.line();
if (line[0] == '[')
{
if (first.empty())
first = line;
sub = &get_submenu(line);
} else
if (line.compare("Caption", 7, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Caption");
line.ltrim(equal+1);
line.strip("\"");
*sub = line;
} else
if (line.compare("Module", 6, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Module");
sub->set_module(atoi(line.mid(equal+1)));
} else
if (line.compare("Item", 4, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Item");
line.ltrim(equal+1);
line.trim();
TMenu_item& child = sub->add_child(line);
const int bracket = line.rfind('<');
if (bracket > 0)
{
TString16 name = line.mid(bracket+1);
name.strip("< >");
import(name, name);
child.cmd() = name;
}
}
}
}
TSubmenu& TMenu::add_submenu(const char* para, int parent_module)
{
TSubmenu& sub = get_submenu(para);
int module = sub.module();
if (module == 0)
module = parent_module;
TString id; curr_id(id);
for (int i = 0; i < sub.items(); i++)
{
goto_node(id);
add_son(new TMenu_node(&sub[i], module));
if (sub[i].cmd()[0] == '[')
add_submenu(sub[i].cmd(), module);
}
return sub;
}
TMenu::TMenu()
{
TString root;
import("baprassi.men", root);
add_son(new TMenu_node("Menu Principale"));
add_submenu(root, 0);
goto_root();
expand();
}
///////////////////////////////////////////////////////////
// Main application
///////////////////////////////////////////////////////////
bool TSet_users::user_handler(TMask_field& f, KEY key)
{
@ -49,8 +393,25 @@ bool TSet_users::user_handler(TMask_field& f, KEY key)
return ok;
}
bool TSet_users::password_handler(TMask_field& f, KEY key)
bool TSet_users::group_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty())
{
TMask& m = f.mask();
const TString& gruppo = m.get(F_GROUPNAME);
TEdit_field& ef = (TEdit_field&)f;
TRectype& rec = ef.browse()->cursor()->curr();
if (rec.get("USERNAME") != gruppo)
{
rec.put("USERNAME", gruppo);
ef.browse()->cursor()->read();
}
app().build_sheet(&rec);
}
return TRUE;
}
bool TSet_user_passwd::password_handler(TMask_field& f, KEY key)
{
if (f.mask().query_mode() || key != K_ENTER) return TRUE;
const bool ok = f.get().len() > 3 && f.get().find(' ') < 0;
@ -59,32 +420,144 @@ bool TSet_users::password_handler(TMask_field& f, KEY key)
return ok;
}
void TSet_users::build_sheet(TMask& m, const TRelation* r)
bool TSet_users::tree_handler(TMask_field& f, KEY key)
{
TTree_field& tf = (TTree_field&)f;
TMenu* menu = (TMenu*)tf.tree();
const TMenu_node* node = (const TMenu_node*)(menu ? menu->curr_node() : NULL);
if (node)
{
if (key == K_SPACE || key == K_ENTER)
{
TMask& m = f.mask();
TSheet_field& sf = m.sfield(F_PROPERTIES);
const TString& old = m.get(F_APPLICAT);
if (old.not_empty())
{
menu->properties(old) = sf.rows_array();
const TString16 mod = old.left(2);
TString_array& mprop = menu->properties(mod);
if (m.get_bool(F_NOWRITE))
{
if (mprop.items() == 0)
{
TToken_string* ts = new TToken_string("S|Scrittura|0", sf.separator());
ts->replace('|', sf.separator());
mprop.add(ts);
}
}
else
mprop.destroy();
sf.destroy();
m.reset(F_APPLICAT);
m.reset(F_NOWRITE); m.disable(F_NOWRITE);
}
if (menu->enabled())
{
const TString& cmd = node->command();
if (cmd[0] != '[')
{
m.set(F_APPLICAT, cmd);
const TString_array* prop = menu->find_properties(cmd);
if (prop)
{
sf.rows_array() = *prop;
sf.force_update();
}
const TString16 mod = cmd.left(2);
const TString_array* mprop = menu->find_properties(mod);
m.enable(F_NOWRITE);
m.set(F_NOWRITE, mprop && mprop->items() ? "X" : "");
}
}
}
}
return TRUE;
}
bool TSet_users::p_notify(TSheet_field& f, int r, KEY k)
{
switch(k)
{
case K_INS:
{
TMask& m = f.mask();
if (m.get(F_APPLICAT).empty())
return error_box("Nessun programma selezionato");
}
default:
break;
}
return TRUE;
}
void TSet_user_passwd::build_sheet(const TRectype* r)
{
TString autstr;
TSheet_field& sf = sheet_field();
if (r != NULL)
autstr = r->lfile().get("AUTSTR");
{
autstr = r->get("AUTSTR");
}
const int l = autstr.len();
sf.destroy();
TString d;
for (int i = 0; i < ENDAUT; i++)
{
TString d( _im->get_description_by_order(i));
if (d.trim().empty()) continue;
d = _im->get_description_by_order(i);
if (d.trim().empty())
continue;
TToken_string& riga = sf.row(i);
riga = d;
const int module = _im->get_module_by_order(i);
if (r!= NULL && module<l && autstr[module]=='X')
riga.add("X");
else riga.add(" ");
else
{
riga.add(" ");
}
riga.add(module);
}
enable_aut();
sf.force_update();
}
void TSet_users::build_tree(const TRectype* r)
{
_tree->properties().destroy();
if (r)
{
TToken_string prop_field(r->get("PERMISSION"), '\n');
TAuto_token_string pro, row;
TString app;
FOR_EACH_TOKEN(prop_field, tok)
{
pro = tok;
pro.get(0, app);
app.trim();
if (!app.empty())
{
TString_array& prop = _tree->properties(app);
row.separator(pro.separator());
row = " ";
row.add(pro.get(1));
row.add(pro.get());
prop.add(row);
}
}
}
}
void TSet_users::enable_aut(TMask& m)
// mostra le abilitazioni
void TSet_user_passwd::enable_aut()
{
const bool prassi = (m.get(F_USER) == "PRASSI");
const bool prassi = _msk->get(F_USER) == "PRASSI";
const int uns = _im->unassigned();
TSheet_field& sf = sheet_field();
const int itms = sf.items();
@ -105,6 +578,21 @@ void TSet_users::enable_aut(TMask& m)
}
}
bool TSet_user_passwd::user_has_module(int mod)
{
bool yes = mod <= 0;
if (!yes)
{
const int idx = _im->get_index(mod);
if (idx >= 0)
{
TSheet_field& sf = sheet_field();
yes = *sf.cell(idx, 1) > ' ';
}
}
return yes;
}
bool TSet_users::k_notify(TSheet_field& f, int r, KEY k)
{
if (k == K_INS)
@ -112,17 +600,36 @@ bool TSet_users::k_notify(TSheet_field& f, int r, KEY k)
return TRUE;
}
bool TSet_user_passwd::user_create()
{
bool superuser = user() == "PRASSI";
_rel = new TRelation(LF_USER);
_im = new TInformazione_moduli;
_msk = new TMask("ba1400a") ;
_msk->set_handler(F_PASSWORD, password_handler);
sheet_field().enable(superuser);
_msk->enable_page(1, superuser);
_msk->enable(F_GROUPNAME, superuser);
return TRUE;
}
bool TSet_users::user_create()
{
if (user() != "PRASSI")
return error_box("Utente non abilitato all'uso di questo programma");
_msk = new TMask("ba1400a") ;
_rel = new TRelation(LF_USER);
TSet_user_passwd::user_create();
_msk->set_handler(F_USER, user_handler);
_msk->set_handler(F_PASSWORD, password_handler);
_msk->set_handler(F_GROUPNAME, group_handler);
TSheet_field& sf = sheet_field();
sf.set_notify(k_notify);
_im = new TInformazione_moduli;
_tree = new TMenu;
_msk->set_handler(F_PERMESSI, tree_handler);
_msk->tfield(F_PERMESSI).set_tree(_tree);
_msk->sfield(F_PROPERTIES).set_notify(p_notify);
return TRUE;
}
@ -130,42 +637,64 @@ bool TSet_users::user_create()
int TSet_users::read(TMask& m)
{
TRelation_application::read(m);
const TRelation *r = get_relation();
build_sheet(m,r);
m.set(F_PASSWORD, decode(r->lfile().get("PASSWORD")));
const TRectype& r = get_relation()->curr();
build_sheet(&r);
const TString16 pwd = decode(r.get("PASSWORD"));
m.set(F_PASSWORD, pwd);
m.set(F_TEST, pwd);
build_tree(&r);
return NOERR;
}
void TSet_user_passwd::put_in_record(const TMask& m)
{
const TString16 s = encode(m.get(F_PASSWORD));
TRectype& r = get_relation()->curr();
r.put("PASSWORD", s);
}
void TSet_users::put_in_record(const TMask& m)
{
TRelation *r = get_relation();
TString16 s(encode(m.get(F_PASSWORD)));
TString autstr(ENDAUT);
TSet_user_passwd::put_in_record(m) ;
TString autstr(ENDAUT, ' ');
TSheet_field& sf = sheet_field();
const int itms = sf.items();
autstr.fill(' ');
for (int i=0; i<itms; i++)
FOR_EACH_SHEET_ROW(sf, i, riga)
{
TToken_string& riga = sf.row(i);
const int module = atoi(riga.get(2));
const char c = riga.get(1)[0];
if ( c == 'X')
const char c = riga->get(1)[0];
const int module = riga->get_int();
if (c == 'X')
autstr[module] = c;
}
r->lfile().put("AUTSTR", (const char *) autstr);
r->lfile().put("PASSWORD", (const char *) s);
TRectype& r = get_relation()->curr();
r.put("AUTSTR", autstr);
TToken_string prop_field(256, '\n');
TAssoc_array& prop = _tree->properties();
FOR_EACH_ASSOC_OBJECT(prop, hash, key, obj)
{
TString_array& arr = *(TString_array*)obj;
FOR_EACH_ARRAY_ROW(arr, r, row)
{
row->add(key, 0);
prop_field.add(*row);
}
}
r.put("PERMISSION", prop_field);
}
int TSet_users::write(const TMask& m)
int TSet_user_passwd::write(const TMask& m)
{
put_in_record(m);
return TRelation_application::write(m);
}
int TSet_users::rewrite(const TMask& m)
int TSet_user_passwd::rewrite(const TMask& m)
{
put_in_record(m);
return TRelation_application::rewrite(m);
@ -186,17 +715,93 @@ bool TSet_users::remove()
return ok;
}
bool TSet_user_passwd::user_destroy()
{
if (_msk != NULL) delete _msk;
if (_rel != NULL) delete _rel;
if (_im != NULL) delete _im;
return TRUE;
}
bool TSet_users::user_destroy()
{
if (_msk != NULL) delete _msk;
if (_rel != NULL) delete _rel;
if (_im != NULL) delete _im;
TSet_user_passwd::user_destroy();
if (_tree != NULL) delete _tree;
return TRUE;
}
int TSet_user_passwd::read(TMask& m)
{
TRelation_application::read(m);
const TRectype& r = get_relation()->curr();
build_sheet(&r);
const TString16 pwd =decode(r.get("PASSWORD"));
m.set(F_PASSWORD, pwd);
m.set(F_TEST, pwd);
return NOERR;
}
void TSet_user_passwd::init_query_mode(TMask& m)
{
enable_aut();
_msk->set(F_USER,user());
_msk->send_key(K_AUTO_ENTER,0);
_msk->disable(DLG_FINDREC);
_msk->disable(DLG_DELREC);
}
void TSet_user_passwd::init_modify_mode(TMask& m)
{
enable_aut();
_msk->disable(DLG_FINDREC);
_msk->disable(DLG_DELREC);
}
class TSet_user_password : public TSkeleton_application
{
protected:
virtual void main_loop();
public:
TSet_user_password () {}
};
void TSet_user_password::main_loop()
{
TMask msk("ba1400b");
TRelation rel(LF_USER);
TLocalisamfile &users=rel.lfile();
users.put("USERNAME",user());
users.read();
msk.autoload(rel);
TString16 pwd(users.get("PASSWORD"));
msk.set(F_PASSWORD, pwd);
msk.set(F_TEST, pwd);
int key=0;
while (key != K_QUIT)
{
key = msk.run() ;
if (key == K_SAVE)
{
users.put("PASSWORD",msk.get(F_PASSWORD));
users.rewrite();
}
}
}
int ba1400(int argc, char** argv)
{
TSet_users a ;
a.run(argc, argv, "Configurazione utenti");
if (user() == "PRASSI")
{
TSet_users a ;
a.run(argc, argv, "Configurazione utenti");
} else {
TSet_user_passwd a ;
a.run(argc, argv, "Modifica password");
}
return 0;
}

View File

@ -4,34 +4,66 @@ TOOLBAR "" 0 20 0 2
#include <toolbar.h>
ENDPAGE
PAGE "Gestione moduli" -1 -1 35 7
PAGE "Gestione utenti" -1 -1 35 7
LIST F_GROUP 1 8
BEGIN
PROMPT 1 1 ""
ITEM " |Utente"
MESSAGE SHOW,3@
ITEM "X|Gruppo"
MESSAGE HIDE,3@
FIELD ISGROUP
END
STRING F_USER 8
BEGIN
PROMPT 1 1 "Utente "
HELP "Inserire il nome dell'utente"
PROMPT 15 1 ""
FLAGS "U"
USE LF_USER
CHECKTYPE NORMAL
INPUT USERNAME F_USER
DISPLAY "Utente@8" USERNAME
DISPLAY "Gruppo@8" GROUPNAME
DISPLAY "Descrizione@50" USERDESC
OUTPUT F_USER USERNAME
KEY 1
CHECHTYPE REQUIRED
CHECKTYPE REQUIRED
FIELD USERNAME
END
STRING F_GROUPNAME 8
BEGIN
PROMPT 32 1 "Gruppo di appartenenza "
FLAGS "U"
USE LF_USER SELECT ISGROUP="X"
INPUT USERNAME F_GROUP
DISPLAY "Gruppo@8" USERNAME
DISPLAY "Descrizione@50" USERDESC
OUTPUT F_GROUP USERNAME
CHECKTYPE NORMAL
FIELD GROUPNAME
END
STRING F_USERDESC 50
BEGIN
PROMPT 1 2 "Descrizione "
PROMPT 1 2 "Descrizione "
FIELD USERDESC
END
STRING F_PASSWORD 8
BEGIN
PROMPT 1 3 "Password "
HELP "Inserire la password"
PROMPT 1 3 "Password "
FLAGS "*"
GROUP 3
END
STRING F_TEST 8
BEGIN
PROMPT 32 3 "Prova "
FLAGS "*"
STR_EXPR #F_TEST=#F_PASSWORD
WARNING "La password ed la sua prova devono coincidere"
GROUP 3
END
SPREADSHEET F_MODULI 78
@ -44,6 +76,35 @@ END
ENDPAGE
PAGE "Permessi" -1 -1 78 20
TREE F_PERMESSI -3 -7
BEGIN
PROMPT 0 1 ""
END
STRING F_APPLICAT 80 16
BEGIN
PROMPT 1 -7 "Programma "
FLAGS "D"
END
BOOLEAN F_NOWRITE
BEGIN
PROMPT 32 -7 "Disabilita registrazioni nell'intero modulo"
END
SPREADSHEET F_PROPERTIES
BEGIN
PROMPT 1 -6 ""
FLAGS "|"
ITEM "Uso"
ITEM "Azione"
ITEM "Espressione"
END
ENDPAGE
ENDMASK
PAGE "Campo" -1 -1 60 11
@ -65,12 +126,12 @@ BEGIN
FLAGS "D"
END
BUTTON DLG_OK 9 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_CANCEL 9 2
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 -1 ""
END
@ -78,3 +139,50 @@ END
ENDPAGE
ENDMASK
PAGE "Proprieta'" -1 -1 70 10
LIST 101 1 10
BEGIN
PROMPT 1 1 ""
ITEM " |Azione"
MESSAGE ENABLE,102|ENABLE,103
ITEM "N|Negato"
MESSAGE DISABLE,102|DISABLE,103|"Negato",102|"1",103
ITEM "L|Lettura"
MESSAGE DISABLE,102|ENABLE,103|"Lettura",102
ITEM "S|Scrittura"
MESSAGE DISABLE,102|ENABLE,103|"Scrittura",102
END
STRING 102 16
BEGIN
PROMPT 21 1 "Azione "
CHECKTYPE REQUIRED
END
MEMO 103 0 -3
BEGIN
PROMPT 1 2 "Espressione"
CHECKTYPE REQUIRED
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

View File

@ -83,6 +83,16 @@ const char* TInformazione_moduli::get_description_by_order(int index)
return "";
}
const char* TInformazione_moduli::get_description_by_name(const char* code) const
{
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
{
if (stricmp(info->get(1), code) == 0)
return info->get(0);
}
return "{MODULO SCONOSCIUTO}";
}
const char* TInformazione_moduli::get_name_by_order(int index)
{
if (index >= 0 && index < _infos.items())
@ -129,9 +139,20 @@ const char* TInformazione_moduli::get_description(int module)
const char* TInformazione_moduli::get_name(int module)
{ return get_name_by_order(_index[module]); }
int TInformazione_moduli::get_index(int module)
int TInformazione_moduli::get_index(int module) const
{ return _index[module]; }
int TInformazione_moduli::get_index_by_name(const char* code) const
{
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
{
if (stricmp(info->get(1), code) == 0)
break;
}
return i >= 0 ? get_index(i) : i;
}
///////////////////////////////////////////////////////////
// TForm richiesta attivazione
@ -815,6 +836,7 @@ bool TAttivazione_moduli::user_hnd(TMask_field & f, KEY k)
const TString16 k4(f.get());
if (!f.to_check(k) || k4.empty())
return TRUE;
TMask & m = f.mask();
word ud1[4], ud2[4];
const TString16 k3(m.get(F_K3));
@ -828,14 +850,23 @@ bool TAttivazione_moduli::user_hnd(TMask_field & f, KEY k)
d.addmonth(3);
if (d < d1)
return f.error_box("data non valida");
{
f.error_box("Data non valida");
return k != K_ENTER;
}
if ((ud1[2] & UBYTEMASK) != K1 || ud1[3] != app().serno())
return f.error_box("primo codice errato");
{
f.error_box("Primo codice errato");
return k != K_ENTER;
}
app().garble(ud2);
for (int i = 0; i < 4; i++) ud2[i] ^= app().serno();
if (ud2[3] != 0)
return f.error_box("secondo codice errato");
{
f.error_box("Secondo codice errato");
return k != K_ENTER;
}
TSheet_field& sf = (TSheet_field&) m.field(F_MODULI);
const int un = app()._im->unassigned();
for (i = un; i < MAX_AUT; i++)
@ -848,7 +879,8 @@ bool TAttivazione_moduli::user_hnd(TMask_field & f, KEY k)
if (k == K_ENTER)
{
keyext(k4, ud2);
::dongle().write_words(48, 4, ud2);
if (::dongle().write_words(48, 4, ud2))
message_box("Programmazione effettuata con successo");
}
else
sf.force_update();
@ -1143,7 +1175,7 @@ void TAttivazione_moduli::print_answer()
TForm_item& num = form.find_field('B', odd_page, 101);
TForm_item& descr = form.find_field('B', odd_page, 102);
TForm_item& codice = form.find_field('B', odd_page, 103);
TSheet_field& sheet = _msk->sfield(F_MODULI);
FOR_EACH_SHEET_ROW(sheet, r, row) if (*row->get(1) > ' ')
{
@ -1153,6 +1185,8 @@ void TAttivazione_moduli::print_answer()
if (found == 0)
{
printer().open();
form.update_serno(_msk->get(F_SN));
form.update_dongle(::dongle());
}
str.format("%3d", ++found);
@ -1174,6 +1208,7 @@ void TAttivazione_moduli::print_answer()
{
printer().open();
form.update_serno(_msk->get(F_SN));
form.update_dongle(::dongle());
}
if (_wanted_users != 0)
{

View File

@ -15,11 +15,16 @@ class TInformazione_moduli : public TObject
public:
const char* get_description_by_order(int index);
const char* get_description_by_name(const char* name) const;
const char* get_name_by_order(int index);
int get_module_by_order(int index);
const char* get_description(int module);
const char* get_name(int module);
int get_index(int module);
int get_index(int module) const;
int get_index_by_name(const char* name) const;
TDongleType get_owner(int module) const;
bool test_owner(int module, TDongleType owner) const;
int unassigned() const { return _unassigned_modules; }

View File

@ -3,6 +3,7 @@
#include <execp.h>
#include <files.h>
#include <golem.h>
#include <lffiles.h>
#include <msksheet.h>
#include <os_dep.h>
#include <prefix.h>
@ -33,7 +34,7 @@ public:
class TFascicolator : public TCreazione_dischi
{
protected:
virtual bool use_files() const { return FALSE; }
virtual bool use_files() const { return TRUE; }
virtual void main_loop();
public:
virtual bool modify_mode() { return TRUE;}
@ -52,16 +53,18 @@ public:
// costruisce la lista del modulo e dei suoi sottomoduli interni
// vengono creati solo i sottomoduli che contengono almeno
// una variabile di tipo File
int TInstall_ini::build_list(const TString& module, TString_array& a,
const char* sommario, bool agg)
{
CHECKS(module.len() >= 2 || module[0]=='_', "Bad module ", (const char*)module);
TConfig* sum = NULL;
if (sommario && *sommario)
sum = new TConfig(sommario, module);
TAssoc_array vars;
TAuto_token_string tmp;
TString paragraph;
for (int sub = 0; sub <= 9; sub++)
@ -70,12 +73,9 @@ int TInstall_ini::build_list(const TString& module, TString_array& a,
if (module[2] == '\0') // Ho specificato un modulo principale
paragraph << sub;
if (sum)
{
sum->set_paragraph(paragraph);
sum->remove_all();
}
bool reset_par=TRUE;
vars.destroy();
TAssoc_array& varlist = list_variables(paragraph);
FOR_EACH_ASSOC_STRING(varlist, obj, key, str)
{
@ -86,8 +86,23 @@ int TInstall_ini::build_list(const TString& module, TString_array& a,
if (agg && is_file && tmp.get_char(1) != 'X')
continue;
if (sum)
sum->set(key, tmp);
{
if (!is_file && reset_par)
vars.add(key,tmp);
else
{
if (reset_par)
{
reset_par=FALSE;
sum->set_paragraph(paragraph);
sum->remove_all();
FOR_EACH_ASSOC_STRING(vars, obj, key, str)
sum->set(key, str);
}
sum->set(key, tmp);
}
}
if (is_file)
{
tmp.add(paragraph, 2); // Sottomodulo
@ -127,6 +142,36 @@ int TInstall_ini::build_complete_list(const TString& module, TString_array& a,
return a.items();
}
// costruisce la lista di programmi di gestione del modulo
int TInstall_ini::build_app_list(const TString& module, TString_array& a)
{
TString paragraph;
TToken_string row;
for (int sub = 0; sub <= 9; sub++)
{
paragraph = module;
if (module[2] == '\0') // Ho specificato un modulo principale
paragraph << sub;
TAssoc_array& varlist = list_variables(paragraph);
FOR_EACH_ASSOC_STRING(varlist, obj, key, str)
{
int num;
if (sscanf(key, "Edit_%d", &num) == 1)
{
row = "Edit";
row.add(num);
row.add(str);
a.add(row);
}
}
if (module[2] != '\0')
break;
}
return a.items();
}
void TInstall_ini::export_paragraph(const char* module, const char* summary,const bool remove_old)
{
CHECK(module && *module > ' ', "Can't export NULL module");
@ -190,7 +235,9 @@ void TInstall_ini::export_paragraph(const char* module, const char* summary,cons
newkey << '(' << last_file_num++ << ')';
}
sum.set(newkey, str);
} else {
}
else
{
sum.set(key, str);
}
}
@ -405,6 +452,7 @@ protected:
static bool edit_handler(TMask_field& f, KEY k);
static bool link_handler(TMask_field& f, KEY k);
static bool deselect_handler(TMask_field& f, KEY k);
static bool isam_handler(TMask_field& f, KEY k);
bool kill_missing(const char* name, bool update);
@ -534,7 +582,7 @@ bool TMod_composition_msk::missing_notify(TSheet_field& sf, int r, KEY key)
TToken_string& newrow = sheet.row(-1);
newrow = *riga;
TString16 submod = newrow.left(2);
submod << '0';
submod << '1';
newrow.add(submod, 2);
}
@ -648,6 +696,32 @@ bool TMod_composition_msk::deselect_handler(TMask_field& f, KEY k)
return TRUE;
}
bool TMod_composition_msk::isam_handler(TMask_field& f, KEY k)
{
if (k == K_F9)
{
TMask& m = f.mask();
TArray_sheet sht(-1,-1,-4,-4,"Selezione archivio", "Codice@6R|Descrizione archivio@70");
const TPrefix& pref = prefix();
const int total = pref.items();
if (total > 0)
{
TWait_cursor hourglass;
for (int i = LF_USER; i < total; i++)
{
TToken_string* row = new TToken_string;
*row << i;
row->add(pref.description(*row));
sht.rows_array().add(row);
}
sht.select(m.get_int(f.dlg()) - LF_USER);
}
if (sht.run() == K_ENTER)
m.set(f.dlg(), sht.selected() + LF_USER);
}
return TRUE;
}
static int file_compare(const TObject** o1, const TObject** o2)
{
TToken_string* r1 = (TToken_string*)*o1;
@ -668,6 +742,9 @@ void TMod_composition_msk::load(const TString& module)
TSheet_field& s = sfield(F_SHEET);
ini.build_list(module, s.rows_array());
s.rows_array().TArray::sort(file_compare);
TSheet_field& p = sfield(F_PROGRAMS);
ini.build_app_list(module, p.rows_array());
TFilename mask;
mask << module << "*.*";
@ -758,14 +835,38 @@ void TMod_composition_msk::save()
ini.set("Patch", patch);
}
}
TSheet_field& sp = sfield(F_PROGRAMS);
FOR_EACH_SHEET_ROW(sp, pr, prow)
{
TString16 var = prow->get(0);
var << '_' << prow->get(1);
TFilename n(prow->get(2));
const int spc = n.find(' ');
if (spc >= 0) n.cut(spc);
n.ext("exe");
TString16 sub = module;
FOR_EACH_SHEET_ROW(sheet, sr, srow)
{
if (n == srow->get(0))
{
sub = srow->get(2);
break;
}
}
ini.set(var, prow->get(2), sub);
}
}
TMod_composition_msk::TMod_composition_msk(const bool modify_mode)
: TMask("ba1600b")
: TMask("ba1600b")
{
TSheet_field& s = sfield(F_SHEET);
TSheet_field& miss = sfield(F_MISSING);
TSheet_field& prog = sfield(F_PROGRAMS);
set_handler(F_DESELECT, deselect_handler);
if (modify_mode)
{
@ -775,12 +876,14 @@ TMod_composition_msk::TMod_composition_msk(const bool modify_mode)
miss.disable(); // Read-only sheet
miss.set_notify(missing_notify);
miss.sheet_mask().set_handler(100, link_handler);
prog.sheet_mask().set_handler(102, isam_handler);
} else {
s.disable(); // Read-only sheet
//hide(DLG_OK);
// hide(F_DESELECT);
//hide(DLG_CANCEL);
miss.hide();
disable_page(1);
}
}
@ -812,8 +915,10 @@ protected:
static bool creazip_handler(TMask_field& f, KEY k);
static bool modules_notify(TSheet_field& f, int row, KEY k);
static bool import_export_handler(TMask_field& f, KEY k);
<<<<<<< ba1600.cpp
static bool patchl_handler(TMask_field& f, KEY k);
virtual const TFilename& build_export_path(TFilename& path) const;
virtual bool zip_file(const char* archive, const char* file) const;
@ -855,9 +960,8 @@ public:
TFascicolator_mask();
virtual ~TFascicolator_mask() { }
};
bool TCreadischi_mask::modules_notify(TSheet_field& f, int row, KEY k)
{
bool ok = TRUE;
@ -1017,6 +1121,7 @@ bool TFascicolator_mask::list_handler(TMask_field& f, KEY k)
mm.load(module);
if (mm.run() == K_ENTER)
{
// Salvo nel .ini
mm.save();
m.dirty_composition();
}
@ -1548,7 +1653,9 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
filelist.temp("", main_module);
struct _stat info;
unsigned long lasttime=0;
{ // blocco della prima Progind
// blocco della prima Progind
{
ofstream fileh(filelist);
TProgind pi(arr.items(), msg, TRUE, TRUE);
TFilename cmd;
@ -1605,14 +1712,32 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
{
_stat((const char *)zipfile,&info);
if (lasttime <= info.st_mtime)
{
aborted = !yesno_box("Il file %s risulta già essere aggiornato. Vuoi rigenerarlo comunque?",(const char *)zipfile);
}
if (!aborted && !agg)
{
// main zip updated; are there some patches?
TFilename patchfile = zipfile.path();
TString16 modpatch;
modpatch.format("%s%04da.ini",(const char *)main_module,patch_level);
patchfile.add(modpatch);
if (patchfile.exist())
{
_stat((const char *)patchfile,&info);
if (lasttime <= info.st_mtime)
aborted = !yesno_box("Il file di patch %s \nrisulta già aggiornato;\nprocedo comunque alla generazione di %s ?",(const char *)patchfile,(const char *)zipfile);
}
}
}
if (aborted)
return FALSE;
{
::remove(sommario);
::remove(filelist); // elimina il file lista-file
return TRUE;
}
zip_file(archivio, filelist); // Compatto gli eventuali ultimi rimasti
// ::remove(filelist); // elimina il file lista-file
::remove(filelist); // elimina il file lista-file
msg.cut(0);
msg << "Separazione del file " << archivio << " ...";
@ -1625,7 +1750,8 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
ini.set("Dischi", disks, main_module); // Aggiorna install.ini
ini.export_paragraph(main_module, sommario,TRUE); // Aggiorna sommario
const bool floppy = ::os_is_removable_drive(path);
const char drive = toupper(path[0]);
const bool floppy = os_is_removable_drive(path);
for (int d = 1; d <= disks && !aborted; d++)
{
@ -1759,7 +1885,9 @@ int ba1600(int argc, char* argv[])
{
TFascicolator app;
app.run(argc, argv, "Megascicolator");
} else {
}
else
{
TCreazione_dischi app;
app.run(argc, argv, "Creazione dischetti");
}

View File

@ -12,6 +12,7 @@ public:
const char* s = NULL, bool agg = FALSE);
int build_complete_list(const TString& m, TString_array& a,
const char* s = NULL, bool agg = FALSE);
int build_app_list(const TString& m, TString_array& a);
void export_paragraph(const char* module, const char* summary,const bool remove);
void export_module_paragraphs(const char* module, const char* summary,const bool remove);
@ -32,20 +33,4 @@ public:
virtual ~TInstall_ini() { }
};
// Mitica token string che sceglie da sola il separatore
class TAuto_token_string : public TToken_string
{
protected:
TAuto_token_string& create(const char* ts);
public:
TAuto_token_string& operator=(const char* ts) { return create(ts); }
TAuto_token_string& operator=(const TString& ts) { return create(ts); }
TAuto_token_string& operator=(const TToken_string& ts) { return create(ts); }
TAuto_token_string& operator=(const TAuto_token_string& ts) { return create(ts); }
TAuto_token_string() : TToken_string(50) { }
TAuto_token_string(const char* ts) { create(ts); }
virtual ~TAuto_token_string() { }
};
#endif

View File

@ -6,6 +6,7 @@
#define F_SHEET 203
#define F_MISSING 204
#define F_MODULE 205
#define F_PROGRAMS 206
#define F_DESELECT 251
#define S_FILE 101

View File

@ -44,6 +44,18 @@ END
ENDPAGE
PAGE "Programmi" -1 -1 78 20
SPREADSHEET F_PROGRAMS 78
BEGIN
PROMPT 1 1 ""
ITEM "Operazione"
ITEM "File"
ITEM "Programma@50"
END
ENDPAGE
ENDMASK
PAGE "File" -1 -1 52 5
@ -111,4 +123,46 @@ END
ENDPAGE
ENDMASK
PAGE "Programmi" -1 -1 64 5
LIST 101 4 10
BEGIN
PROMPT 1 1 "Operazione "
ITEM "Edit|Edit"
ITEM "Open|Open"
ITEM "Print|Print"
END
NUMBER 102 4
BEGIN
PROMPT 51 1 "File "
FLAGS "BU"
CHECKTYPE REQUIRED
END
STRING 103 50
BEGIN
PROMPT 1 2 "Programma "
CHECKTYPE REQUIRED
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

View File

@ -31,6 +31,7 @@
#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);
@ -332,8 +333,7 @@ bool TInstaller_mask::autoload()
// !?!?!? modifica per correggere il bug di libreria su _parked dei TSheet:
// !?!?!? (uso della stringa _park e dell'indice _parked )
// !?!?!? rimuovere appena si è corretto l'errore
for (short pisellone =0; pisellone<100; pisellone++)
add("");
// for (short pisellone =0; pisellone<100; pisellone++) add("");
// !?!?! fine modifica
destroy();
force_update();
@ -345,6 +345,7 @@ bool TInstaller_mask::autoload()
if (fexist(ininame))
{
// Presente il file ini generale "install.ini"
TInstall_ini ini(ininame);
ini.list_paragraphs(modules);
@ -377,10 +378,9 @@ bool TInstaller_mask::autoload()
TConfig ini(ininame, module);
add_module(ini, module, FALSE);
}
}
// add patches
modules.destroy();
if (internet)
@ -443,8 +443,7 @@ bool TInstaller_mask::autoload()
mask_rows.row(r+1).add("+", C_ISPATCH); // .....setta la presenza di patches
force_update(r+1);
}
}
else
} else
add_module(ini, module, TRUE);
}
@ -573,20 +572,25 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
make_dir(subdir);
}
}
const long filesize = fsize(file);
bool space_ok = FALSE;
while (!space_ok)
{
{
/*
int disk = 0;
if (dest[1] == ':')
{
const char letter = toupper(dest[0]);
disk = 'A' - letter + 1;
}
}
struct _diskfree_t drive;
_dos_getdiskfree(disk, &drive);
space_ok = ::os_test_disk_free_space(todir, filesize);
const unsigned requested_clusters = unsigned(filesize / drive.sectors_per_cluster / drive.bytes_per_sector) + 1;
space_ok = requested_clusters <= drive.avail_clusters;
*/
space_ok = os_test_disk_free_space(dest, filesize);
if (!space_ok)
{
TString msg;
@ -598,13 +602,9 @@ bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, co
return FALSE;
}
else
{
msg << "Si desidera proseguire ugualmente?";
if (!noyes_box(msg))
return FALSE;
}
}
}
return error_box(msg);
}
}
bool write_ok = TRUE;
bool user_retry = FALSE;
@ -771,7 +771,6 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
if (is_a_patch)
msg << " della patch " << patchlevel ;
msg << " del modulo '" << module << "' in corso...";
TProgind pi(dischi, msg, FALSE, TRUE);
TFilename tempdir; tempdir.tempdir();
@ -810,8 +809,13 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
if (ok)
{
const long required = fsize(cmdline) * (dischi-d+1) * 4;
const TString& dest = get(F_CURPATH);
if (!::os_test_disk_free_space(dest, required))
/*
struct _diskfree_t drive;
_dos_getdiskfree(0, &drive);
const unsigned requested_clusters = unsigned(required / drive.sectors_per_cluster / drive.bytes_per_sector) + 1;
if (requested_clusters >= drive.avail_clusters)
*/
if (!os_test_disk_free_space(tempdir, required))
{
ok = yesno_box("Lo spazio su disco potrebbe essere insufficiente:\n"
"Si desidera continuare ugualmente?");
@ -1068,6 +1072,7 @@ void TInstaller_mask::install_selection()
TString_array& arr = rows_array();
FOR_EACH_ARRAY_ROW(arr, r, row) if (checked(r))
{
const TString newver = row->get(C_RELEASE);
if (newver.blank())
@ -1101,18 +1106,16 @@ void TInstaller_mask::install_selection()
"funzionamento di tutti i programmi!", (const char*)newver, newpatch, (const char*)modulo);
ok = noyes_box(msg);
}
bool is_patch = row->get_char(C_ISPATCH) > ' ';
if (is_patch)
if (ok && is_patch)
{
// installo le patch solo se esiste già un modulo installato della stessa versione
if (!oldver.blank() )
{
if (oldver != newver)
ok =error_box("Il modulo '%s' installato ha versione %s:\nimpossibile installare le patch della versione %s",(const char *)modulo,(const char *)oldver,(const char *)newver);
} else
ok =FALSE;//error_box("Impossibile installare le patch perche' il modulo '%s' non e' installato",(const char *)modulo);
}
if (ok)
{
if (has_patch)
@ -1132,11 +1135,7 @@ void TInstaller_mask::install_selection()
message_box("Impossibile installare le patch del modulo '%s'",(const char *)modulo);
}
else
{
ok = install(modulo, 0); // installa il modulo
}
if (ok)
_installed = TRUE; // Setta il flag di almeno un modulo installato
if (ok)
@ -1234,9 +1233,7 @@ TInstaller_mask::TInstaller_mask()
TFilename path = ini.get("DiskPath");
set(F_PATH, path);
const char lettera = toupper(path[0]);
const bool floppy = (path.len() > 1) && path[1] == ':' &&
GetDriveType(lettera - 'A') == DRIVE_REMOVABLE;
const bool floppy = os_is_removable_drive(path);
if (path.not_empty() && !floppy && !is_internet_path(path))
autoload();

View File

@ -18,7 +18,7 @@ protected:
virtual bool create();
virtual void main_loop();
static bool test_firm(TMask_field& f, KEY k);
KEY query(long& firm, char& floppy, TString& desc, bool& tmp, bool& zip) const;
KEY query(long& firm, char& floppy, TString& desc, bool& tmp) const;
public:
void stop_job();

View File

@ -6,12 +6,17 @@
#include "batbreg.h"
#include "batbcam.h"
#include "batbdel.h"
#include "batbval.h"
#include "batbver.h"
#define REG_JOURNAL 5
#define TAB_CAMBI "CAM"
#define TAB_DELEGHE "%DEL"
#define TAB_REGISTRI "REG"
#define TAB_VALUTE "%VAL"
#define TAB_VERSAMENTI "%VER"
class TGeneric_table_app : public Tab_application
class TGeneric_table_app : public TTable_application
{
long _oldditta;
int _oldanno;
@ -19,7 +24,6 @@ class TGeneric_table_app : public Tab_application
bool _stampa_intest;
// ------------- specifiche tabella versamenti ed interessi IVA
TTable* _ver;
void load_rec_in_disabled_fields(TMask& m);
void copy_rec_in_insert_fields(TMask& m);
// ------------------------------------------------------------
@ -32,6 +36,10 @@ protected: // TRelation_application
virtual void init_modify_mode(TMask& m);
virtual void init_query_mode (TMask&);
virtual int rewrite(const TMask& m);
protected:
static bool valute_decimals_handler(TMask_field& f, KEY k);
static bool change_decimals_handler(TMask_field& f, KEY k);
public:
bool exist_journal() { return _exist_journal; }
@ -44,7 +52,7 @@ public:
HIDDEN inline TGeneric_table_app& app() { return (TGeneric_table_app&)main_app(); }
TGeneric_table_app::TGeneric_table_app()
: _exist_journal(FALSE), _stampa_intest(FALSE), _ver(NULL)
: _exist_journal(FALSE), _stampa_intest(FALSE)
{
}
@ -53,30 +61,31 @@ void TGeneric_table_app::load_rec_in_disabled_fields(TMask& m)
// carica il record del periodo precedente a quello immesso
// nei campi disabilitati relativi.
{
CHECK(_ver, "Null table");
TString key(m.get(F_ANNOES));
TTable ver(TAB_VERSAMENTI);
TString16 key(m.get(F_ANNOES));
key << m.get(F_MESEES);
_ver->put("CODTAB",key);
if (_ver->read(_isgteq) == _iseof) // Se non lo trova si posiziona sull'ultimo
_ver->last();
ver.put("CODTAB",key);
if (ver.read(_isgteq) == _iseof) // Se non lo trova si posiziona sull'ultimo
ver.last();
else
_ver->prev(); // altrimenti legge il periodo precedente.
if (_ver->good()) // se si e' immesso un periodo precedente al primo , non copiera' nulla
ver.prev(); // altrimenti legge il periodo precedente.
if (ver.good()) // se si e' immesso un periodo precedente al primo , non copiera' nulla
{
m.set(F_1_TRIMESTRE_P,_ver->get("R0"));
m.set(F_2_TRIMESTRE_P,_ver->get("R1"));
m.set(F_3_TRIMESTRE_P,_ver->get("R2"));
m.set(F_4_TRIMESTRE_P,_ver->get("R3"));
m.set(F_ANNUALE_P,_ver->get("R4"));
m.set(F_I_PERIODO_P,_ver->get("R5"));
m.set(F_I_ANNUALE_P,_ver->get("R6"));
m.set(F_I_ACCONTO_P,_ver->get("R7"));
m.set(F_I_INTEGRATIVO_P,_ver->get("R8"));
m.set(F_I_CESSAZIONE_P,_ver->get("R9"));
m.set(F_I_ART74_P,_ver->get("R10"));
m.set(F_P_LIQ_NORMALE_P,_ver->get("R11"));
m.set(F_P_LIQ_DIFFERI_P,_ver->get("R12"));
m.set(F_1_TRIMESTRE_P,ver.get("R0"));
m.set(F_2_TRIMESTRE_P,ver.get("R1"));
m.set(F_3_TRIMESTRE_P,ver.get("R2"));
m.set(F_4_TRIMESTRE_P,ver.get("R3"));
m.set(F_ANNUALE_P,ver.get("R4"));
m.set(F_I_PERIODO_P,ver.get("R5"));
m.set(F_I_ANNUALE_P,ver.get("R6"));
m.set(F_I_ACCONTO_P,ver.get("R7"));
m.set(F_I_INTEGRATIVO_P,ver.get("R8"));
m.set(F_I_CESSAZIONE_P,ver.get("R9"));
m.set(F_I_ART74_P,ver.get("R10"));
m.set(F_P_LIQ_NORMALE_P,ver.get("R11"));
m.set(F_P_LIQ_DIFFERI_P,ver.get("R12"));
}
}
@ -103,10 +112,10 @@ void TGeneric_table_app::copy_rec_in_insert_fields(TMask& m)
void TGeneric_table_app::init_insert_mode(TMask& m)
{
const TString& n = get_tabname();
if (n == "REG")
if (n == TAB_REGISTRI)
{
const long ditta = get_firm();
const int anno = atoi(m.get(F_ANNO));
const int anno = m.get_int(F_ANNO);
m.set(F_STAMPA_INTESTAZIONE, _stampa_intest ? "X" : "");
@ -115,10 +124,10 @@ void TGeneric_table_app::init_insert_mode(TMask& m)
_oldditta = ditta;
_oldanno = anno;
TTable reg("REG");
TTable reg(TAB_REGISTRI);
reg.put("CODTAB", m.get(F_ANNO));
TRectype to(reg.curr());
const TRectype to(reg.curr());
_exist_journal = FALSE;
for (reg.read(_isgteq); !_exist_journal && reg.good() && reg.curr() <= to; reg.next())
@ -133,14 +142,13 @@ void TGeneric_table_app::init_insert_mode(TMask& m)
// poi copia il contenuto nei campi di input, come valori predefiniti
copy_rec_in_insert_fields(m);
}
}
void TGeneric_table_app::init_modify_mode(TMask& m)
{
Tab_application::init_modify_mode(m);
const TString& n = get_tabname();
if (n == "REG")
if (n == TAB_REGISTRI)
{
TString16 config;
config.format("REG%05ld", m.get_long(F_CODDITTA));
@ -158,7 +166,7 @@ void TGeneric_table_app::init_modify_mode(TMask& m)
void TGeneric_table_app::init_query_mode(TMask& m)
{
Tab_application::init_query_mode(m);
if (get_tabname() == "%DEL")
if (get_tabname() == TAB_DELEGHE)
{
m.show(F_BANCA1);
m.show(F_BANCA2);
@ -171,7 +179,7 @@ bool TGeneric_table_app::protected_record(TRectype& rec)
bool prot = rec.get_bool(FPC);
if (!prot)
{
if (get_tabname() == "%IVD") // Impedisce la cancellazione di una classe se ha sottoclassi
if (get_tabname() == "%IVD") // Impedisce la cancellazione di una classe se ha sottoclassi
{
TLocalisamfile& f = get_relation()->lfile();
const TRecnotype pos = f.recno();
@ -415,23 +423,76 @@ HIDDEN bool mese_handler(TMask_field& f, KEY k)
return TRUE;
}
bool TGeneric_table_app::valute_decimals_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
const int dec = atoi(f.get());
TReal_field& exc = (TReal_field&)m.efield(VAL_CHANGE);
if (dec != exc.decimals())
{
exc.set_decimals(dec);
exc.set(exc.get());
}
if (!m.is_running() && exc.empty())
exc.set(m.get(VAL_CHANGE_OLD));
}
if (k == K_ENTER)
{
TMask& m = f.mask();
real cambio = m.get(VAL_CHANGE);
if (cambio > ZERO && m.get_bool(VAL_INEURO))
{
// Se il cambio e' espresso in EURO metto in R10 il valore in lire
cambio = 1936.27 / cambio;
cambio.round(2);
}
m.set(VAL_CHANGE_OLD, cambio);
}
return TRUE;
}
bool TGeneric_table_app::change_decimals_handler(TMask_field& f, KEY k)
{
if (k == K_TAB && f.to_check(k, TRUE))
{
TMask& m = f.mask();
const int dec = m.get_int(FLD_TABCAM_I2);
TReal_field& exc = (TReal_field&)f;
if (dec != exc.decimals())
{
exc.set_decimals(dec);
exc.set(exc.get());
}
if (!m.is_running() && exc.empty())
exc.set(m.get(FLD_TABCAM_R10));
}
if (k == K_ENTER)
{
TMask& m = f.mask();
real cambio = f.get();
if (cambio > ZERO && m.get_bool(FLD_TABCAM_B1))
{
// Se il cambio e' espresso in EURO metto in R10 il valore in lire
cambio = 1936.27 / cambio;
cambio.round(2);
}
m.set(FLD_TABCAM_R10, cambio);
}
return TRUE;
}
bool TGeneric_table_app::user_create()
{
bool ok = Tab_application::user_create();
bool ok = TTable_application::user_create();
if (ok)
{
const TString& name = get_tabname();
TMask& mask = *get_mask();
if (name == "REG")
{
mask.set_handler(F_TIPO, tiporeg_handler);
mask.set_handler(F_PRINTER, printer_handler);
TConfig st(CONFIG_STUDIO, "cg");
_stampa_intest = st.get_bool("StiReg");
}
if (name == "%DEL")
if (name == TAB_DELEGHE)
{
mask.set_handler(F_MESEDEL, mese_handler);
mask.set_handler(F_IMPORTO, impdel_handler);
@ -439,23 +500,39 @@ bool TGeneric_table_app::user_create()
mask.set_handler(F_BANCA1, coddel_handler);
mask.set_handler(F_CONCESSIONE, coddel_handler);
}
if (name == "CAM")
set_search_field(FLD_TABCAM_D0);
if (name == TAB_REGISTRI)
{
mask.set_handler(F_TIPO, tiporeg_handler);
mask.set_handler(F_PRINTER, printer_handler);
TConfig st(CONFIG_STUDIO, "cg");
_stampa_intest = st.get_bool("StiReg");
}
if (name == TAB_VALUTE)
{
mask.set_handler(VAL_DECIMALS_CHANGE, valute_decimals_handler);
}
if (name == TAB_CAMBI)
{
mask.set_handler(FLD_TABCAM_S4, change_decimals_handler);
}
if (name == TAB_VERSAMENTI)
{
_ver = new TTable(TAB_VERSAMENTI);
_ver->put("CODTAB","199301");
if (_ver->read() != NOERR) // Se %VER non esiste la crea
TLocalisamfile& ver = get_relation()->lfile();
ver.put("CODTAB","199301");
if (ver.read() != NOERR) // Se %VER non esiste la crea
{
_ver->put("CODTAB","199301");
_ver->put("R0","1.5"); _ver->put("R1","1.5");
_ver->put("R2","1.5"); _ver->put("R3","1.5"); _ver->put("R4","1.5");
_ver->put("R5","50500"); _ver->put("R7","200000");
_ver->put("R11","88"); _ver->put("R12","88");
if (_ver->write() != NOERR)
error_box("Errore %d in scrittura sulla tabella versamenti",_ver->status());
ver.put("CODTAB","199301");
ver.put("R0","1.5"); ver.put("R1","1.5");
ver.put("R2","1.5"); ver.put("R3","1.5"); ver.put("R4","1.5");
ver.put("R5","50500"); ver.put("R7","200000");
ver.put("R11","88"); ver.put("R12","88");
if (ver.write() != NOERR)
error_box("Errore %d in scrittura sulla tabella versamenti",ver.status());
}
}
if (name == TAB_CAMBI)
set_search_field(FLD_TABCAM_D0);
}
return ok;
@ -463,15 +540,12 @@ bool TGeneric_table_app::user_create()
bool TGeneric_table_app::user_destroy()
{
const TString& n = get_tabname();
if (n == TAB_VERSAMENTI)
delete _ver;
return Tab_application::user_destroy();
}
int TGeneric_table_app::rewrite(const TMask& m)
{
if (get_tabname() == "REG" && !m.get_bool(F_CONFIG))
if (get_tabname() == TAB_REGISTRI && !m.get_bool(F_CONFIG))
{
TString16 config;
config.format("REG%05ld", m.get_long(F_CODDITTA));

View File

@ -5,7 +5,7 @@
#include <relapp.h>
#include <tabutil.h>
#include <modaut.h>
#include <urldefid.h>
#include <defmask.h>
#include "ba4.h"
#include "ba4300.h"
@ -348,6 +348,7 @@ void TDitte_application::init_query_mode(TMask& m)
m.hide(FLD_GD1_RAGSOCH);
}
init_insert_mode(m);
m.disable(FLD_GD1_VALUTA); // La valuta si decide solo in creazione
}
void TDitte_application::init_insert_mode(TMask& m)
@ -374,7 +375,9 @@ void TDitte_application::init_insert_mode(TMask& m)
m.disable(DLG_SOC);
m.disable(DLG_REG);
m.disable(DLG_REG1);
_oldattprev = "";
_oldattprev = "";
m.enable(FLD_GD1_VALUTA); // La valuta si decide solo in creazione
}
void TDitte_application::enable_reg(TMask& m)

View File

@ -126,5 +126,14 @@
#define F_ISCRCAF 189
#define FLD_GD1_RAGSOCH 190
#define DLG_REG1 191
#define FLD_GD1_VALUTA 192
#define CHK_IN_PRESELEN 195
#define CHK_IN_CESSIVA 196
#define LST_IN_FREQCES 197
#define LST_IN_FREQACQ 198
#define LST_IN_TIPOSOGDEL 199
#define FLD_IN_CODSOGDEL 200
#define FLD_IN_DESSOGDEL 201
#endif // __BA4300_H

View File

@ -235,6 +235,19 @@ BEGIN
HELP "Numero telefonico del fax della ditta"
END
STRING FLD_GD1_VALUTA 3
BEGIN
PROMPT 1 17 "Codice valuta di riferimento "
FIELD VALUTA
USE %VAL
INPUT CODTAB FLD_GD1_VALUTA
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT FLD_GD1_VALUTA CODTAB
CHECKTYPE NORMAL
FLAGS "D"
END
ENDPAGE
PAGE "Pag. 2" -1 -1 77 18
@ -756,4 +769,106 @@ END
ENDPAGE
PAGE "Pag. 5" -1 -1 77 18
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 0 ""
FLAGS "R"
END
NUMBER DLG_NULL 5
BEGIN
PROMPT 2 1 "Codice "
FLAGS "RD"
GROUP 1
END
STRING DLG_NULL 50
BEGIN
PROMPT 2 2 "Ragione sociale "
FLAGS "D"
GROUP 2
END
GROUPBOX DLG_NULL 76 6
BEGIN
PROMPT 1 4 "Soggetto Obbligato INTRA"
FLAGS "R"
END
BOOLEAN CHK_IN_PRESELEN
BEGIN
PROMPT 2 5 "Presentati elenchi in precedenza"
FIELD PRESELEN
END
BOOLEAN CHK_IN_CESSIVA
BEGIN
PROMPT 2 6 "Cessata attivita' o variata partita IVA"
FIELD CESSIVA
END
LIST LST_IN_FREQCES 1 12
BEGIN
PROMPT 2 7 "Frequenza dei riepiloghi cessioni INTRA "
ITEM "M|Mensile"
ITEM "T|Trimestrale"
ITEM "A|Annuale"
FIELD FREQCES
END
LIST LST_IN_FREQACQ 1 12
BEGIN
PROMPT 2 8 "Frequenza dei riepiloghi acquisti INTRA "
ITEM "M|Mensile"
ITEM "T|Trimestrale"
ITEM "A|Annuale"
FIELD FREQACQ
END
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 10 "Soggetto Delegato INTRA"
FLAGS "R"
END
LIST LST_IN_TIPOSOGDEL 1 10
BEGIN
PROMPT 1 11 "Tipo persona "
ITEM "F|Fisica"
ITEM "G|Giuridica"
FIELD TIPOSOGDEL
END
NUMBER FLD_IN_CODSOGDEL 6
BEGIN
PROMPT 35 11 "Codice "
USE LF_ANAG
INPUT TIPOA LST_IN_TIPOSOGDEL SELECT
INPUT CODANAGR FLD_IN_CODSOGDEL
DISPLAY "Tipo" TIPOA
DISPLAY "Codice" CODANAGR
DISPLAY "Denominazione@50" RAGSOC
OUTPUT FLD_IN_CODSOGDEL CODANAGR
OUTPUT FLD_IN_DESSOGDEL RAGSOC
FIELD CODSOGDEL
CHECKTYPE NORMAL
END
STRING FLD_IN_DESSOGDEL 50
BEGIN
PROMPT 1 12 "Denominazione "
USE LF_ANAG KEY 2
INPUT TIPOA LST_IN_TIPOSOGDEL SELECT
INPUT RAGSOC FLD_IN_DESSOGDEL
DISPLAY "Denominazione@50" RAGSOC
DISPLAY "Tipo" TIPOA
DISPLAY "Codice" CODANAGR
COPY OUTPUT FLD_IN_CODSOGDEL
CHECKTYPE NORMAL
END
ENDPAGE
ENDMASK

16
ba/ba7.cpp Executable file
View File

@ -0,0 +1,16 @@
#include <xvt.h>
#include "ba7.h"
int main(int argc, char** argv)
{
const int r = (argc > 1) ? (argv[1][1]-'0') : 0;
switch (r)
{
default:
ba7100(argc, argv) ; break;
}
exit(0);
return 0;
}

7
ba/ba7.h Executable file
View File

@ -0,0 +1,7 @@
#ifndef __BA7_H
#define __BA7_H
int ba7100(int argc, char* argv[]);
int ba7200(int argc, char* argv[]);
#endif

776
ba/ba7100.cpp Executable file
View File

@ -0,0 +1,776 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <defmask.h>
#include <execp.h>
#include <expr.h>
#include <golem.h>
#include <tabutil.h>
#include <prefix.h>
#include <recarray.h>
#include <relation.h>
#include <sheet.h>
#include <utility.h>
#define NO_MFC
#include <netsock.h>
#include "ba7.h"
#include "ba7100a.h"
///////////////////////////////////////////////////////////
// TConfig utilities
///////////////////////////////////////////////////////////
TString& set_ini_var(int cfg, const char* para,
const char* var, const char* val)
{
static TString80 prev;
TConfig ini(cfg, para);
prev = ini.get(var);
if (val != NULL)
ini.set(var, val);
return prev;
}
inline TString& get_ini_var(int cfg, const char* para, const char* var)
{ return set_ini_var(cfg, para, var, NULL); }
///////////////////////////////////////////////////////////
// TMail_box
///////////////////////////////////////////////////////////
class TMail_box : public TSocketClient
{
unsigned long _connection;
public:
bool default_params(TString& server, TString& user,TString& password);
bool logon(const char* server = NULL,
const char* usr = NULL, const char* pwd = NULL);
virtual bool ok() const { return _connection != NULL; }
bool list(TString_array& a);
int get(TMail_messages& m);
bool remove(const char* id);
void logoff();
TMail_box();
~TMail_box();
};
bool TMail_box::default_params(TString& server, TString& user,TString& password)
{
bool ok = TRUE;
if (server.empty())
{
server = get_ini_var(CONFIG_INSTALL, "Server", "POP3");
if (server.empty())
ok = FALSE;
}
if (user.empty())
user = ::user();
if (password.empty())
{
TDecoder users(LF_USER, "PASSWORD");
password = ::decode(users.decode(user));
}
return ok;
}
bool TMail_box::logon(const char* ser, const char* usr, const char* pwd)
{
if (_connection)
logoff();
if (!IsOk())
return error_box("Impossibile inizializzare il client POP3");
TString server(ser);
TString user(usr);
TString password(pwd);
if (!default_params(server, user, password))
return error_box("E' necessario specificare un server POP3, un utente ed una password");
_connection = QueryConnection("110", server);
if (_connection != 0)
{
TString buf;
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box("Il server POP3 %s non risponde",
(const char*)server);
buf = "USER "; buf << user << '\n';
WriteLine(_connection, buf);
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box("Il server POP3 %s non accetta l'utente %s",
(const char*)server, (const char*)user);
buf = "PASS "; buf << password << '\n';
WriteLine(_connection, buf);
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box("Il server POP3 %s non accetta l'utente %s",
(const char*)server, (const char*)user);
}
else
return error_box("Impossibile contattare il server POP3 %s",
(const char*)server);
return TRUE;
}
void TMail_box::logoff()
{
if (_connection)
{
WriteLine(_connection, "QUIT\n");
RemoveConnection(_connection);
_connection = NULL;
}
}
bool TMail_box::list(TString_array& a)
{
bool ok = _connection != NULL;
if (ok)
{
TString buf;
buf = "LIST\n";
WriteLine(_connection, buf);
ReadLine(_connection, buf);
ok = buf[0] == '+';
while (ok)
{
if (!ReadLine(_connection, buf))
break; // Unexpected EOF
if (buf[0] == '.')
break;
int pos = buf.find(' ');
if (pos > 0)
buf.cut(pos);
a.add(buf);
}
}
return ok;
}
HIDDEN int str2month(const char* str)
{
const char* const mese[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
int m;
for (m = 11; m > 0; m--)
{
if (stricmp(str, mese[m]) == 0)
break;
}
return m+1;
}
int TMail_box::get(TMail_messages& m)
{
// Lista dei caratteri validi
const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+*";
// Lista per decodifica dei caratteri validi
char Deco64[256];
memset(Deco64, ' ', sizeof(Deco64));
for (int i = 0; Base64[i]; i++)
Deco64[Base64[i]] = i;
TString_array a;
list(a);
TString buf;
FOR_EACH_ARRAY_ROW(a, r, row)
{
TMail_message* msgptr = new TMail_message(user());
m.add(msgptr);
TMail_message& msg = *msgptr;
buf = "RETR "; buf << *row << '\n';
WriteLine(_connection, buf);
ReadLine(_connection, buf);
bool ok = buf[0] == '+';
bool base64 = FALSE;
bool in_body = FALSE;
while (ok)
{
if (!ReadLine(_connection, buf))
{
ok = FALSE;
break; // Unexpected EOF
}
if (buf[0] == '.')
{
buf.ltrim(1);
if (buf.blank())
break;
}
if (in_body)
{
if (base64)
{
unsigned val = 0;
int bits = 0;
for (const char* s = buf; *s && *s != '='; s++)
{
if (*s==0x0A || *s==0x0D || *s==0x20 || *s==0x09)
continue; // Salta eventuali blanks
val <<= 6;
val |= Deco64[*s];
bits += 6;
if (bits >= 8)
{
const char c = char((val >> (bits - 8)) & 0xFF);
msg << c;
bits -= 8;
}
}
}
else
{
const char last = buf.right(1)[0];
if (last > '\0' && last < ' ')
buf.rtrim(1);
msg << buf << '\n';
}
}
else
{
if (buf.blank())
in_body = TRUE; else
if (buf.compare("From:", 5, TRUE) == 0)
{
buf.ltrim(6);
msg.set_sender(buf);
} else
if (buf.compare("To:", 3, TRUE) == 0)
{
buf.ltrim(4);
msg.add_recipient(buf);
} else
if (buf.compare("Cc:", 3, TRUE) == 0)
{
buf.ltrim(4);
msg.add_copy_recipient(buf);
} else
if (buf.compare("Subject:", 8, TRUE) == 0)
{
buf.ltrim(9);
msg.set_subject(buf);
} else
if (buf.compare("Date:", 5, TRUE) == 0)
{
TToken_string d(buf.mid(6), ' ');
int giorno = d.get_int(1);
int mese = str2month(d.get());
int anno = d.get_int();
if (anno < 1000) anno += anno >= 98 ? 1900 : 2000;
TString16 ora = d.get();
buf.cut(0);
buf << anno << '/' << mese << '/' << giorno << ' ' << ora;
msg.set_date_time(buf);
} else
if (buf.compare("Content-Transfer-Encoding:", 26, TRUE) == 0)
{
base64 = buf.find("base64") > 0;
}
}
}
}
return m.items();
}
bool TMail_box::remove(const char* id)
{
bool ok = _connection != NULL;
if (ok)
{
TString buf;
buf << "DELE " << id << '\n';
WriteLine(_connection, buf);
ReadLine(_connection, buf);
ok = buf[0] == '+';
}
return ok;
}
TMail_box::TMail_box() : _connection(NULL)
{
}
TMail_box::~TMail_box()
{
logoff();
}
///////////////////////////////////////////////////////////
// TFilter_expr
///////////////////////////////////////////////////////////
class TFilter_expr : public TExpression
{
TAutomask& _mask;
protected:
virtual bool print_error(const char* msg) const;
public:
TFilter_expr(TAutomask& m, int logicnum, const char* expr);
virtual ~TFilter_expr() { }
};
bool TFilter_expr::print_error(const char* msg) const
{
return _mask.error_box(msg);
}
TFilter_expr::TFilter_expr(TAutomask& m, int logicnum, const char* expr)
: _mask(m)
{
bool ok = set(expr, _strexpr);
if (ok)
{
if (logicnum < LF_USER || logicnum >= prefix().items())
logicnum = LF_TABCOM;
TLocalisamfile isf(logicnum);
TRectype& rec = isf.curr();
for (int i = 0; i < numvar(); i++) if (rec.exist(varname(i)))
{
_error = 883;
TString msg;
msg << "Il campo " << varname(i)
<< " non appartiene al file " << logicnum;
print_error(msg);
break;
}
}
}
///////////////////////////////////////////////////////////
// TMailer_mask
///////////////////////////////////////////////////////////
class TMailer_mask : public TAutomask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
bool file2app(const TString& file, TString& app) const;
void expand_tabs(TString& str, const int tab = 8) const;
void save_sheet(TConfig& ini, short dlg, const char* var) const;
void load_sheet(TConfig& ini, short dlg, const char* var);
public:
void test_delete();
int fill_messages();
bool save_curr_line();
void save_all_lines();
void save() const;
void load();
TMailer_mask();
virtual ~TMailer_mask();
};
void TMailer_mask::test_delete()
{
TWait_cursor hourglass;
xvt_statbar_set("Eliminazione messaggi POP3...");
do_events();
TSheet_field& sf = sfield(F_MESSAGES);
TString16 mailer, id;
TMail_messages mapidel; // Lista dei messaggi MAPI da cancellare
TMail_box mailbox;
FOR_EACH_SHEET_ROW_BACK(sf, nrow, row) if (*row->get(0) == 'X')
{
row->get(sf.cid2index(F_MAILER), mailer);
row->get(sf.cid2index(F_ID), id);
if (mailer == "POP3")
{
if (!mailbox.ok())
{
if (!mailbox.logon(get(F_SERVER), get(F_USER), get(F_PASSWORD)))
break;
}
if (!mailbox.remove(id))
error_box("Impossibile cancellare il messagio POP3 %s", (const char*)id);
}
else
{
TMail_message* msg = new TMail_message("");
msg->set_id(id);
mapidel.add(msg);
}
sf.destroy(nrow);
}
mailbox.logoff();
if (mapidel.items() > 0)
{
xvt_statbar_set("Eliminazione messaggi MAPI...");
do_events();
mapidel.remove();
}
xvt_statbar_set("Pronto");
do_events();
}
void TMailer_mask::expand_tabs(TString& str, const int tab) const
{
int start = 0;
for (int i = 0; str[i]; i++)
{
switch(str[i])
{
case '\n':
case '\r':
start = i+1;
break;
case '\t':
{
const int t = tab - ((i-start) % tab) - 1;
str[i] = ' ';
if (t > 0)
{
TString80 spac; spac.spaces(t);
str.insert(spac, i+1);
i += t;
}
}
break;
default:
break;
}
}
}
int TMailer_mask::fill_messages()
{
TWait_cursor hourglass;
TMail_messages box;
TString server(get(F_SERVER));
TString user(get(F_USER));
TString password(get(F_PASSWORD));
TMail_box mailbox;
if (mailbox.default_params(server, user, password))
{
set(F_SERVER, server);
set(F_USER, user);
set(F_PASSWORD, password);
}
int totmapi = 0;
if (get_bool(F_MAPI))
{
xvt_statbar_set("Ricezione messaggi MAPI...");
do_events();
totmapi = box.get();
}
xvt_statbar_set("Ricezione messaggi POP3...");
do_events();
mailbox.logon(server, user, password);
mailbox.get(box);
mailbox.logoff();
TSheet_field& sf = sfield(F_MESSAGES);
sf.destroy();
for (int m = 0; m < box.items(); m++)
{
TMail_message& msg = box.msg(m);
TToken_string& row = sf.row(m);
row.add(msg.sender(), sf.cid2index(F_SENDER));
row.add(msg.date(), sf.cid2index(F_DATE));
const real t = msg.time();
row.add(t.string("@@:@@:@@"), sf.cid2index(F_TIME));
row.add(msg.subject(), sf.cid2index(F_SUBJECT));
expand_tabs(msg);
row.add(msg, sf.cid2index(F_BODY));
row.add(m<totmapi?"MAPI":"POP3", sf.cid2index(F_MAILER));
if (m < totmapi)
{
row.add("MAPI", sf.cid2index(F_MAILER));
row.add(msg.id(), sf.cid2index(F_ID));
}
else
{
row.add("POP3", sf.cid2index(F_MAILER));
row.add(m-totmapi+1, sf.cid2index(F_ID));
}
}
sf.force_update();
xvt_statbar_set("Pronto");
return sf.items();
}
bool TMailer_mask::file2app(const TString& file, TString& app) const
{
bool ok = FALSE;
if (isdigit(file[0]))
{
const int filenum = atoi(file);
if (filenum >= LF_USER && filenum < prefix().items())
{
TLocalisamfile isf(filenum);
ok = isf.get_relapp(app);
}
}
else
{
const int len = file.len();
if (len == 3 || (len == 4 && file[0] == '%'))
{
TTable table(file);
ok = table.get_relapp(app);
}
}
return ok;
}
bool TMailer_mask::save_curr_line()
{
TSheet_field& sf = sfield(F_MESSAGES);
TMask& m = sf.sheet_mask();
const int nrow = sf.selected();
TToken_string& row = sf.row(nrow);
const TString& msg = m.get(F_BODY);
if (msg.find("[Transaction]") < 0)
return FALSE; // It's not a transaction
TFilename appname;
if (!file2app(m.get(F_SUBJECT), appname))
return FALSE; // It hasn't a valid application
TFilename tmp; tmp.temp();
ofstream outf(tmp);
outf << msg;
outf.close();
const TString old_mailto = set_ini_var(CONFIG_INSTALL, "Main", "MailTo", "");
appname << " /i" << tmp;
TExternal_app app(appname);
bool ok = app.run() == NOERR;
if (ok)
{
TConfig ini(tmp, "Transaction");
ok = ini.get("Result") == "OK";
}
::remove(tmp);
if (ok)
{
if (m.is_running())
{
m.set(F_CHECKED, "X");
m.stop_run(K_AUTO_ENTER);
}
else
{
row.add("X", 0);
sf.force_update(nrow);
}
}
// Restore mail recipient
if (old_mailto.not_empty())
set_ini_var(CONFIG_INSTALL, "Main", "MailTo", old_mailto);
return TRUE;
}
void TMailer_mask::save_all_lines()
{
TWait_cursor hourglass;
TSheet_field& sf = sfield(F_MESSAGES);
TString body;
bool one_saved = FALSE;
FOR_EACH_SHEET_ROW(sf, nrow, row) if (*row->get(0) != 'X')
{
row->get(sf.cid2index(F_BODY), body);
if (body.find("[Transaction]") >= 0)
{
sf.select(nrow);
one_saved |= save_curr_line();
}
}
if (one_saved && yesno_box("Si desidera eliminare i messaggi processati?"))
{
test_delete();
fill_messages();
}
}
bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_MESSAGES:
if (e == fe_init)
{
if (!field(F_SERVER).empty() &&
!field(F_USER).empty() &&
!field(F_PASSWORD).empty())
fill_messages();
} else
if (e == se_query_add)
{
test_delete();
fill_messages();
return FALSE;
}
break;
case DLG_USER:
if (e == fe_button)
save_curr_line();
break;
case DLG_SAVEREC:
if (e == fe_button)
save_all_lines();
break;
case DLG_DELREC:
if (e == fe_button)
{
test_delete();
fill_messages();
return FALSE;
}
break;
case F_FILE:
if (jolly == 3)
{
if (e == fe_button)
{
TMask& m = o.mask();
TArray_sheet sht(-1,-1,-4,-4,"Selezione archivio", "Codice@6R|Descrizione archivio@70");
const TPrefix& pref = prefix();
const int total = pref.items();
if (total > 0)
{
TWait_cursor hourglass;
for (int i = LF_USER; i < total; i++)
{
TToken_string* row = new TToken_string;
*row << i;
row->add(pref.description(*row));
sht.rows_array().add(row);
}
sht.select(m.get_int(o.dlg()) - LF_USER);
}
if (sht.run() == K_ENTER)
m.set(o.dlg(), sht.selected() + LF_USER);
}
}
break;
case F_EXPR:
if (jolly == 3)
{
if (e == fe_modify || e == fe_close)
{
TAutomask& m = (TAutomask&)o.mask();
const int num = m.get_int(F_FILE);
TFilter_expr expr(m, num, o.get());
return expr.error() == 0;
}
}
break;
default:
break;
}
return TRUE;
}
void TMailer_mask::save_sheet(TConfig& ini, short dlg, const char* var) const
{
TSheet_field& sf = sfield(dlg);
FOR_EACH_SHEET_ROW(sf, r, row)
ini.set(var, *row, NULL, TRUE, r);
}
void TMailer_mask::load_sheet(TConfig& ini, short dlg, const char* var)
{
TSheet_field& sf = sfield(dlg);
sf.destroy();
for (int r = 0; ini.exist(var, r); r++)
sf.row(r) = ini.get(var, NULL, r);
}
void TMailer_mask::save() const
{
TConfig ini(CONFIG_DITTA, "MailTransactions");
ini.remove_all();
ini.set("Server", get(F_SERVER));
ini.set("User", get(F_USER));
ini.set("Password", encode(get(F_PASSWORD)));
save_sheet(ini, F_ADDRESSES, "Recipient");
save_sheet(ini, F_PARAMS, "Filter");
}
void TMailer_mask::load()
{
TConfig ini(CONFIG_DITTA, "MailTransactions");
set(F_SERVER, ini.get("Server"));
set(F_USER, ini.get("User"));
set(F_PASSWORD, decode(ini.get("Password")));
load_sheet(ini, F_ADDRESSES, "Recipient");
load_sheet(ini, F_PARAMS, "Filter");
}
TMailer_mask::TMailer_mask() : TAutomask("ba7100a")
{
load();
}
TMailer_mask::~TMailer_mask()
{
save();
}
///////////////////////////////////////////////////////////
// TMailer
///////////////////////////////////////////////////////////
class TMailer : public TSkeleton_application
{
public:
virtual void main_loop();
};
void TMailer::main_loop()
{
open_files(LF_USER, 0);
TMailer_mask mm;
mm.run();
}
int ba7100(int argc, char* argv[])
{
TMailer app;
app.run(argc, argv, "Postino");
return 0;
}

25
ba/ba7100a.h Executable file
View File

@ -0,0 +1,25 @@
#define F_SERVER 201
#define F_USER 202
#define F_PASSWORD 203
#define F_MAPI 204
#define F_MESSAGES 205
#define F_ADDRESSES 206
#define F_PARAMS 207
#define F_CHECKED 101
#define F_SENDER 102
#define F_DATE 103
#define F_TIME 104
#define F_SUBJECT 105
#define F_BODY 106
#define F_MAILER 107
#define F_ID 108
#define F_DEST 101
#define F_GROUP 102
#define F_FILE 102
#define F_OPERATOR 103
#define F_EXPR 104

230
ba/ba7100a.uml Executable file
View File

@ -0,0 +1,230 @@
#include "ba7100a.h"
TOOLBAR "Toolbar" 0 19 78 3
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -13 -11 ""
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -11 ""
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -11 ""
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Transazioni" -1 -1 78 20
BOOLEAN F_MAPI
BEGIN
PROMPT 1 0 "Preleva messaggi MAPI"
END
STRING F_SERVER 80 28
BEGIN
PROMPT 1 1 "Server "
END
STRING F_USER 32 8
BEGIN
PROMPT 41 1 "Utente "
END
STRING F_PASSWORD 32 8
BEGIN
PROMPT 61 1 "Password "
FLAGS "*"
END
SPREADSHEET F_MESSAGES
BEGIN
PROMPT 0 2 ""
ITEM "@1"
ITEM "Da@40"
ITEM "Data@10"
ITEM "Ora@8"
ITEM "Soggetto@50"
ITEM "Messaggio@50"
ITEM "Mailer@4"
ITEM "Id@64"
END
ENDPAGE
PAGE "Parametri" -1 -1 78 20
SPREADSHEET F_ADDRESSES 0 6
BEGIN
PROMPT 0 1 ""
ITEM "Indirizzo@50"
ITEM "Gruppo@50"
END
SPREADSHEET F_PARAMS
BEGIN
PROMPT 0 8 ""
ITEM "Indirizzo@40"
ITEM "File"
ITEM "OP@2"
ITEM "Filtro@64"
END
ENDPAGE
ENDMASK
PAGE "Message" -1 -1 62 19
BOOLEAN F_CHECKED
BEGIN
PROMPT 48 0 "Trasferito"
END
STRING F_SENDER 80 50
BEGIN
PROMPT 1 2 "Da "
FLAGS "D"
END
DATE F_DATE
BEGIN
PROMPT 1 3 "Data "
FLAGS "D"
END
STRING F_TIME 8
BEGIN
PROMPT 28 3 "Ora "
FLAGS "D"
END
STRING F_SUBJECT 256 50
BEGIN
PROMPT 1 4 "Soggetto "
END
MEMO F_BODY 60 12
BEGIN
PROMPT 1 5 "Messaggio"
END
STRING F_MAILER 4
BEGIN
PROMPT 1 0 "Mailer "
FLAGS "D"
END
STRING F_ID 512 50
BEGIN
PROMPT 1 1 "Numero "
FLAGS "D"
END
BUTTON DLG_USER 10 2
BEGIN
PROMPT -12 -1 ""
PICTURE BMP_SAVEREC
PICTURE BMP_SAVERECDN
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK
PAGE "Indirizzi" -1 -1 62 6
STRING F_DEST 50
BEGIN
PROMPT 1 1 "Indirizzo "
CHECKTYPE REQUIRED
END
STRING F_GROUP 50
BEGIN
PROMPT 1 2 "Gruppo "
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK
PAGE "Parametri" -1 -1 62 12
STRING F_DEST 50
BEGIN
PROMPT 1 1 "Indirizzo "
END
NUMBER F_FILE 3
BEGIN
PROMPT 1 2 "File "
FLAGS "B"
CHECKTYPE REQUIRED
END
LIST F_OPERATOR 1 3
BEGIN
PROMPT 46 3 "Operatore "
ITEM "A|And"
ITEM "O|Or"
END
MEMO F_EXPR 60 -3
BEGIN
PROMPT 1 3 "Espressione "
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -369,8 +369,7 @@ bool TTab_application::user_create()
TString16 m; m << "BATB" << t;
_msk = new TMask(m) ;
TString tit;
_msk->get_caption(tit);
TString tit; _msk->get_caption(tit);
set_title(tit);
return TRUE;

537
ba/bainst.cpp Executable file
View File

@ -0,0 +1,537 @@
#include <applicat.h>
#include <isam.h>
#include <progind.h>
#include <prefix.h>
// prototipi
#include "bainsta.h"
#include "bainst.h"
// ********************************
// classe TSystemtempfile
// ********************************
// classe provvisoria per i system file temporanei, ovvero file temporanei con
// caricamento/scaricamento
// @doc EXTERNAL
// @mfunc Importa un file ascii
//
// @rdesc Ritorna NOERR se l'operazione di lettura e' riuscita, altrimenti il codice di
// di errore generato (vedi <t TIsamerr>).
int TSystemtempfile::load(
const char* from, // @parm Nome del file da importare
char fs, // @parm Carattere separatore di campo (default <pipe>)
char fd, // @parm Carattere delimitatore di campi (default '\\0')
char rs, // @parm Carattere separatore di record (default '\\n')
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (default TRUE)
bool extended) // @parm Indica se interpretare alcune stringhe come macro (default FALSE)
// @comm Se <p extended> e' TRUE e trova alcune stringhe col formato %stringa% (es. %frm%)
// ne sostituisce i valori (es. ditta corrente).
// @xref <mf TSystemisamfile::dump>
{
FILE* fl = fopen(from, "r");
int err=NOERR;
if (fl == NULL)
{
error_box("Non riesco ad aprire il file %s",from);
return 2;
}
TRecnotype r = 0, e = 0, nitems = 0, nread = 0;
TString16 firm, year, attprev("00000");
if (extended)
{
TDate d(TODAY);
TLocalisamfile ditte(LF_NDITTE);
firm.format("%05ld", prefix().get_codditta());
year.format("%04d", d.year());
ditte.zero();
ditte.put("CODDITTA", firm);
if (ditte.read() == NOERR)
attprev = ditte.get("CODATTPREV");
}
if (fl == NULL)
{
clearerr(fl);
setstatus(err);
return err;
}
char w[80];
while ((fgets(w, 80, fl) != NULL))
{
if (strncmp(w, "[Data]", 6) == 0)
{
nitems = ftell(fl);
break;
}
}
fseek(fl, 0L, SEEK_END);
nitems = ftell(fl) - nitems;
fclose(fl);
TScanner f(from);
//open();
TToken_string s(1024, fs);
bool fixedlen = (fs == '\0');
int nflds = curr().items();
TArray fld(nflds);
int len[MaxFields];
TString sfd(3);
TString s1(64);
//bool lcf = FALSE;
if (f.paragraph("Header"))
{
f.equal();
const long level = atol(f.line());
if (level > get_std_level())
error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.",
from, level/100, level%100, get_std_level()/100, get_std_level()%100);
//lcf = getlcf(level);
nflds = 0;
TToken_string s2(f.line());
int p = s2.find('=');
if (p > 0)
{
s1 = s2.left(p);
s2.ltrim(p+1);
}
else s1.cut(0);
while (s1 == "Fields")
{
for (const char * fd = s2.get(); fd != NULL; fd = s2.get())
{
TToken_string wfd(fd, ',');
fld.add(new TString(wfd.get()));
len[nflds] = wfd.get_int();
nflds++;
}
s2 = f.line();
p = s2.find('=');
if (p > 0)
{
s1 = s2.left(p);
s2.ltrim(p+1);
}
else s1.cut(0);
}
}
else
{
for (int j = 0; j < nflds; j++)
{
fld.add(TString(curr().fieldname(j)), j);
const TString & wfld = (const TString & ) fld[j];
len[j] = (curr().type(wfld) == _datefld) ? 10 : curr().length(wfld);
}
}
if (!f.paragraph("Data"))
{
error_box("Formato dei dati non valido");
//close();
err = 1;
setstatus(err);
return err;
}
if (fd) sfd << fd;
int last = NOERR;
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
TProgind p(nitems, s1, TRUE, TRUE, 70);
s = f.line();
while (s.not_empty() && !p.iscancelled())
{
if (extended)
{
int p, i;
while ((p = s.find("%yr%")) >= 0)
for (i = 0; i < 4; i++) s[p + i] = year[i];
while ((p = s.find("%frm%")) >= 0)
for (i = 0; i < 5; i++) s[p + i] = firm[i];
while ((p = s.find("%att%")) >= 0)
for (i = 0; i < 5; i++) s[p + i] = attprev[i];
}
if ((r + e) % 50 == 0)
{
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
p.set_text(s1);
}
p.setstatus(nread + 1);
nread += s.len() + 1;
zero();
if (fixedlen)
{
int pos = 0;
for (int j = 0; j < nflds; j++)
{
s1 = s.mid(pos,len[j]);
s1.rtrim();
put((const TString&) fld[j], s1);
pos += len[j];
}
}
else
{
s.restart();
for (int j = 0; j < nflds; j++)
{
char* s2 = (char*) s.get();
if (fd)
{
s2++;
s2[strlen(s2) - 1] = '\0';
}
put((const TString&) fld[j], s2);
}
}
if (write() == NOERR) r++;
else
{
#ifdef DBG
yesnofatal_box("Numero linea relativa all'errore: %ld",r+e+1);
#endif
e++;
last = status();
}
s = f.line();
}
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
p.set_text(s1);
//close();
setstatus(err);
return err;
}
// @doc EXTERNAL
// @mfunc Esporta VERSO un file ascii.
//
// @rdesc Ritorna NOERR se l'operazione di esportazione e' riuscita, altrimenti il codice di
// di errore generato (vedi <t TIsamerr>).
int TSystemtempfile::dump(
const char* to, // @parm Nome del file verso quale esportare
int nkey, // @parm Numero della chiave di ordinamento con cui scaricare i dati (defualt 1)
char fs, // @parm Carattere seperatore di campo (defualt <pipe>)
char fd, // @parm Carattere delimitatore di campo (default '\\0')
char rs, // @parm Carattere separatore di record (default '\\n')
bool vis, // @parm Indica se visualizzare lo stato dell'operazione (defualt TRUE)
bool withdeleted) // @parm Indica se scaricare anche i record cancellati (dafault FALSE)
// @xref <mf TSystemisamfile::load>
{
FILE* f = fopen(to, "w");
if (f == NULL)
{
setstatus(2);
return 2;
}
if (withdeleted) nkey = 0;
int err = ferror(f);
//open(FALSE, nkey ? TRUE : FALSE);
TString s(512);
bool fixedlen = (fs == '\0');
int nflds = curr().items();
TArray fld(nflds);
TBit_array rjust(nflds);
int len[MaxFields];
for (int j = 0; j < nflds; j++)
{
fld.add(TString(curr().fieldname(j)), j);
const TString & wfld = (const TString&) fld[j];
const TFieldtypes t = curr().type(wfld);
rjust.set(j, t == _intfld || t == _longfld || t == _realfld ||
t == _wordfld || t == _intzerofld || t == _longzerofld);
len[j] = (t == _datefld) ? 10 : curr().length(wfld);
}
TRecnotype i = 0;
const TRecnotype nitems = nkey ? items() : filehnd()->d->EOD;
s.format("Esportazione archivio %s", filename());
TProgind p(nitems, s, TRUE, TRUE, 70);
TString s1;
fprintf(f, "[Header]\nVersion=%ld", prefix().filelevel());
for (int k = 0; k < nflds; k++)
{
if ((k % 10) == 0) fprintf(f, "\nFields=");
else fprintf(f, "|");
fprintf(f, "%s,%d", (const char *) (const TString&) fld[k], len[k]);
}
fprintf(f, "\n\n[Data]\n");
if (nkey)
{
setkey(nkey);
for ( first(); status() == NOERR && !p.iscancelled(); next(), i++)
{
p.setstatus(i + 1);
s = "";
for (j = 0; j < nflds; j++)
{
if (fixedlen)
{
s1 = get((const TString&)fld[j]);
if (rjust[j]) s1.right_just(len[j]);
else s1.left_just(len[j]);
}
else
{
s1 = "";
if (j && fs) s1 << fs;
if (fd) s1 << fd;
s1 << get((const TString&)fld[j]);
if (fd) s1 << fd;
}
s << s1;
}
fprintf(f, "%s%c", (const char*) s, rs);
}
}
else
{
for (i = 0; i < nitems && !p.iscancelled(); i++)
{
zero();
p.setstatus(i + 1);
readat(i + 1);
s="";
if (withdeleted || curr().valid())
{
for (j = 0; j < nflds; j++)
{
if (fixedlen)
{
s1 = get((const TString&)fld[j]);
if (rjust[j]) s1.right_just(len[j]);
else s1.left_just(len[j]);
}
else
{
s1 = "";
if (j && fs) s1 << fs;
if (fd) s1 << fd;
s1 << get((const TString&)fld[j]);
if (fd) s1 << fd;
}
s << s1;
}
fprintf(f, "%s%c", (const char*) s, rs);
}
}
}
p.setstatus(nitems);
//close();
fclose(f);
setstatus(err);
return err;
}
// ********************************
// classe TStd_filename
// ********************************
bool TStd_filename::check(bool verbose,const char * n)
{
if (n && *n)
set(n);
insert("STD\\");
if (!exist())
{
*this = name();
if (!exist())
{
insert("STD\\");
insert(prefix().get_studio());
if (!exist())
{
if (verbose)
error_box("Non riesco a trovare il file: %s", (const char *)name());
cut(0);
return FALSE;
}
}
}
return TRUE;
}
bool TInstallmodule_app::create()
{
TScanner scanner("prassi.aut");
bool ok = FALSE;
for (int aut = 0; aut<=module_number(); aut++)
{
scanner.line();
}
_modcode=scanner.token().left(2);
_modname=scanner.token().mid(3);
if (modal())
{
TString16 maskname;
maskname.format("bainst%02d",module_number());
_m = new TMask(maskname);
}
else
_m = NULL;
TConfig ini("install.ini");
TConfig praw(CONFIG_INSTALL);
_test_database = praw.get("TestDatabase","Main",-1,"Y") != "N";
return TSkeleton_application::create();
}
bool TInstallmodule_app::destroy()
{
if (_m) delete _m;
return TSkeleton_application::destroy();
}
bool TInstallmodule_app::preload_mask()
{
if (!test_database())
{
_m->set(F_DEFAULTSDATA," ");
_m->disable(F_DEFAULTSDATA);
}
else
{
if (load_default_data())
_m->set(F_DEFAULTSDATA,"X");
}
return TRUE;
}
void TInstallmodule_app::main_loop()
{
bool ok =TRUE;
if (modal())
{
preload_mask();
if (_m->run()!=K_QUIT)
{
if (_m->get_bool(F_DEFAULTSDATA))
{
install_firm();
install_com();
}
}
else
ok =FALSE;
}
if (ok)
post_installer();
}
bool TInstallmodule_app::install_firm()
{
// ciclo su ogni ditta
TStd_filename txtfile(module_code());
txtfile << "tab.txt";
if (txtfile.check())
{
TLocalisamfile ditte(LF_NDITTE);
for (ditte.first(); !ditte.eof() ; ditte.next())
{
const int newditta=ditte.get_int("CODDITTA");
if (prefix().exist(newditta))
{
set_firm(newditta);
TSystemisamfile tab(LF_TAB);
tab.load(txtfile);
}
}
// carica le tabelle nei file di default
TLocalisamfile tampone(LF_TAB);
TSystemtempfile tabstd(LF_TAB);
TFilename stdtabname(prefix().get_studio());
stdtabname << "STD\\lf0005.txt";
tabstd.load(txtfile);
tabstd.load(stdtabname);
tabstd.set_autodel();
TFilename tempfile;
tempfile.temp();
// riconverte le macro delle date
tabstd.dump(tempfile);
TScanner scan(tempfile);
FILE *dest=fopen((const char *)stdtabname,"w");
while (TRUE) {
TString &line=scan.line();
if (line.empty()) break;
int pos=(line.find("-0000"));
while (pos >= 0 )
{
line.overwrite("%yr%",pos+1);
pos=(line.find("-0000"));
}
line << '\n' ;
fputs((const char * )line,dest);
}
fclose(dest);
}
return TRUE;
}
bool TInstallmodule_app::install_com()
{
bool ok=TRUE;
TStd_filename txtfile(module_code());
txtfile << "tabcom.txt";
if (txtfile.check())
{
TSystemisamfile tabcom(LF_TABCOM);
tabcom.load(txtfile);
}
return ok;
}
void TInstallmodule_app::run(int argc, char* argv[])
{
TString title("Installazione ");
title << module_name();
TSkeleton_application::run(argc, argv,(const char* )title);
}
int main(int argc,char** argv)
{
TApplication::check_parameters(argc, argv);
int r=0;
if (argc < 2) return 0;
TFixed_string mod(argv[2]);
mod.lower();
if (mod == "cg")
r=bainst07(argc,argv); // pre/post installazione contabilità generale:
else if (mod == "at")
r=bainst17(argc, argv);// pre/post installazione avis
else if (mod == "ve")
r=bainst31(argc, argv);// pre/post installazione vendite:
else if (mod == "mg")
r=bainst32(argc, argv);// pre/post installazione magazzino:
else if (mod == "sv")
r=bainst38(argc, argv);// pre/post installazione statistiche:
else
r=bainst00(argc, argv);// pre/post installazione base
exit(r);
return 0;
}

66
ba/bainst.h Executable file
View File

@ -0,0 +1,66 @@
#include <applicat.h>
#include <mask.h>
#define G_PREINST 1
int bainst00(int argc, char** argv);
int bainst07(int argc, char** argv);
int bainst17(int argc, char** argv);
int bainst31(int argc, char** argv);
int bainst32(int argc, char** argv);
int bainst38(int argc, char** argv);
// classe provvisoria per i system file temporanei, ovvero file temporanei con
// caricamento/scaricamento
class TSystemtempfile : public TIsamtempfile
{
public:
//bool getlcf( long flev); // @parm livello archivi di partenza della convesione
int load(const char* from, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool extended = FALSE) ;
int dump(const char* to, int nkey = 1, char fs = '|', char fd = '\0', char rs = '\n', bool vis = TRUE, bool withdeleted = FALSE);
TSystemtempfile(int logicnum) :
TIsamtempfile(logicnum,NULL) {}
};
class TStd_filename : public TFilename
{
public:
bool check(bool verbose=FALSE,const char * name=NULL);
~TStd_filename () {}
TStd_filename () : TFilename(){}
TStd_filename (const char * n) : TFilename(n){}
};
class TInstallmodule_app: public TSkeleton_application
{
bool _is_first_inst , _test_database ;
protected:
TMask * _m ;
TString _modcode,_modname;
protected:
bool test_database() {return _test_database;}
const char * module_name() const {return _modname;}
const char * module_code() const {return _modcode;}
virtual bool load_default_data() const { return TRUE;}
virtual bool modal() const {return TRUE;}
virtual int module_number() const pure;
virtual bool preload_mask();
virtual bool post_installer() {return TRUE;}
virtual bool install_com() ; // setta i dati comuni
virtual bool install_firm() ; // setta i dati ditta
virtual void main_loop() ;
virtual bool create();
virtual bool destroy();
public:
void run(int argc, char* argv[]);
};

21
ba/bainst.url Executable file
View File

@ -0,0 +1,21 @@
#include <default.url>
/* ba1 -0 */
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
/* ba1 -1 */
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"
/* ba1 -1 */
MENUBAR MENU_BAR(2)
MENU MENU_BAR(2)
SUBMENU MENU_FILE "~File"

62
ba/bainst00.cpp Executable file
View File

@ -0,0 +1,62 @@
#include <windows.h>
#include <applicat.h>
#include <execp.h>
#include <mask.h>
#include <isam.h>
#include <config.h>
#include "bainst.h"
#include "bainst07.h"
class TInstall_BA : public TInstallmodule_app
{
private:
protected:
virtual bool modal() const {return FALSE;}
virtual int module_number() const {return 0;}
virtual bool install_firm() {return TRUE;} // no firm installation
virtual bool install_com() {return TRUE;} // no com installation
virtual bool post_installer();
public:
virtual ~TInstall_BA () {}
};
bool TInstall_BA::post_installer()
{
// configurazione provvisoria dei programmi gestori di tabelle
if (!test_database())
{
TConfig prassis(CONFIG_STUDIO);
const char *confapp="EdApp";
const char *tabapp="TabPrg";
// magazzino
prassis.set_paragraph("mg");
prassis.set(tabapp,"mg0 -0");
prassis.set(confapp,"mg0 -2 -1");
// distinta base
prassis.set_paragraph("db");
prassis.set(tabapp,"db0 -0");
prassis.set(confapp,"");
// statistiche
prassis.set_paragraph("sv");
prassis.set(tabapp,"sv0 -0");
prassis.set(confapp,"sv0 -3");
// provvigioni
prassis.set_paragraph("pr");
prassis.set(tabapp,"pr0 -4");
// MRP
prassis.set_paragraph("mr");
prassis.set(tabapp,"mr0 -0");
}
return TRUE;
}
int bainst00(int argc, char** argv)
{
TInstall_BA app;
app.run(argc, argv);
return 0;
}

3
ba/bainst01.h Executable file
View File

@ -0,0 +1,3 @@
#include "bainsta.h"
#define F_DATISTD 101

2
ba/bainst02.h Executable file
View File

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

View File

@ -42,6 +42,7 @@ Item_08 = "Cariche sociali", "ba3 -0 %crs", ""
Item_09 = "Vecchi cod.Attivita'", "ba3 -0 %ois", ""
Item_10 = "Stati esteri", "ba3 -0 %sta", ""
Item_11 = "Gestione profili deleghe e distinte", "ba2 -0", ""
Item_12 = "Nomenclatura combinata", "ba3 -0 %noc", ""
[PRASSI_003]
Caption = "Stampa tabelle"

View File

@ -1,9 +1,8 @@
#define FLD_TABCAM_CODVAL 100
#define FLD_TABCAM_S0 101
#define FLD_TABCAM_R0 102
#define FLD_TABCAM_S7 103
#define FLD_TABCAM_D0 104
#define FLD_DECSCAM_I0 105
#define FLD_TABCAM_I0 106
#define FLD_CODVAL_COPY 200
#define FLD_DATACAM_COPY 204
#define FLD_TABCAM_CODVAL 101
#define FLD_TABCAM_B1 102
#define FLD_TABCAM_S0 103
#define FLD_TABCAM_S4 104
#define FLD_TABCAM_S7 105
#define FLD_TABCAM_R10 106
#define FLD_TABCAM_D0 107
#define FLD_TABCAM_I2 108

View File

@ -1,6 +1,6 @@
#include "batbcam.h"
TOOLBAR "" 0 20 0 2
TOOLBAR "" 0 19 0 3
#include <toolbar.h>
@ -8,23 +8,26 @@ ENDPAGE
PAGE "Cambi giornalieri" -1 -1 78 12
GROUPBOX DLG_NULL 78 4
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 1 ""
PROMPT 1 1 "@bValuta"
END
STRING FLD_TABCAM_CODVAL 3
BEGIN
PROMPT 3 2 "Codice valuta "
PROMPT 2 3 "Codice "
FLAGS "UZ"
KEY 1
FIELD CODTAB[1,3]
USE %VAL
INPUT CODTAB FLD_TABCAM_CODVAL
DISPLAY "Codice" CODTAB
DISPLAY "Contro EURO" B1
DISPLAY "Valuta@50" S0
OUTPUT FLD_TABCAM_CODVAL CODTAB[1,3]
OUTPUT FLD_TABCAM_S0 S0
OUTPUT FLD_TABCAM_I2 I2
OUTPUT FLD_TABCAM_B1 B1
CHECKTYPE FORCED
MESSAGE COPY,FLD_CODVAL_COPY
WARNING "Valuta assente"
@ -32,25 +35,26 @@ END
DATE FLD_DATACAM_COPY
BEGIN
PROMPT 30 2 ""
PROMPT 9 5 ""
FLAGS "D"
FIELD D0
END
DATE FLD_TABCAM_D0
BEGIN
PROMPT 25 2 "Data "
PROMPT 2 5 "Data "
FIELD CODTAB[4,11]
FLAGS "R"
KEY 1
USE CAM SELECT CODTAB?(#FLD_TABCAM_CODVAL+"*")
JOIN %VAL TO CAM KEY 1 ALIAS 50 INTO CODTAB=CODTAB[1,3]
// USE CAM SELECT CODTAB?(#FLD_TABCAM_CODVAL+"*")
// JOIN %VAL TO CAM KEY 1 ALIAS 50 INTO CODTAB=CODTAB[1,3]
USE CAM SELECT TRIM(CODTAB[1,3])==#FLD_TABCAM_CODVAL
JOIN %VAL TO CAM KEY 1 ALIAS 50 INTO CODTAB==(TRIM(CODTAB[1,3]))
INPUT CODTAB[1,3] FLD_TABCAM_CODVAL SELECT // PER INPUT
INPUT CODTAB[4,11] FLD_TABCAM_D0
DISPLAY "Valuta" CODTAB[1,3]
DISPLAY "Data@10" D0
DISPLAY "Cambio@15R" R10
DISPLAY "Descrizione@50" -50->S0
DISPLAY "Descrizione@50" 50@->S0
OUTPUT FLD_TABCAM_CODVAL CODTAB[1,3]
OUTPUT FLD_TABCAM_D0 D0
OUTPUT FLD_DATACAM_COPY D0
@ -61,38 +65,51 @@ END
STRING FLD_TABCAM_S0 50
BEGIN
PROMPT 3 3 "Descrizione "
PROMPT 20 3 ""
USE %VAL KEY 2
INPUT S0 FLD_TABCAM_S0
DISPLAY "Valuta@50" S0
DISPLAY "Codice" CODTAB
DISPLAY "Contro EURO" B1
COPY OUTPUT FLD_TABCAM_CODVAL
CHECKTYPE REQUIRED
KEY 1
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 8 "@bCambio"
END
NUMBER FLD_TABCAM_I2 1
BEGIN
PROMPT 2 10 "Decimali "
FLAGS "D"
END
GROUPBOX DLG_NULL 78 3
NUMBER FLD_TABCAM_S4 15 5
BEGIN
PROMPT 1 5 ""
END
NUMBER FLD_TABCAM_R0 15 5
BEGIN
PROMPT 3 6 "Cambio "
FIELD R10
PROMPT 20 10 "Cambio "
FIELD S4
PICTURE ".5"
FLAGS "U"
END
NUMBER FLD_TABCAM_I0 7
NUMBER FLD_TABCAM_R10 15 5
BEGIN
PROMPT 32 6 "ogni "
FIELD I10
FLAGS "U"
NUM_CALC IF(#THIS_FIELD==0,1,#THIS_FIELD)
PROMPT 20 10 "Cambio "
FIELD R10
PICTURE ".5"
FLAGS "HU"
END
STRING FLD_CODVAL_COPY 3
BOOLEAN FLD_TABCAM_B1
BEGIN
PROMPT 46 6 ""
PROMPT 50 10 "Contro EURO"
FIELD B1
FLAGS "D"
END
ENDPAGE
ENDMASK

View File

@ -167,6 +167,7 @@ BEGIN
ITEM "B1|Ammontare op. es. escluse da nr. 1 a 9 e 11 art. 10"
ITEM "B2|Ammontare op. es. di cui al nr. 11 art. 10"
ITEM "B3|Ammontare op. es. di cui ai nr. 1 a 9 art. 10"
ITEM "B4|Ammontare op. es. di cui all'art 10 nr. 27 quinquies"
ITEM "G7A|Cessioni intracomunitarie non imponibili"
ITEM "G7B|Prestazioni di servizi non soggette all'imposta"
END

9
ba/batbnoc.h Executable file
View File

@ -0,0 +1,9 @@
#define NOC_CODICE1 101
#define NOC_CODICE2 102
#define NOC_CODICE3 103
#define NOC_DESCR 104
#define NOC_UMS_OBB 201
#define NOC_UMS_CODICE 202
#define NOC_UMS_DESCR 203

109
ba/batbnoc.uml Executable file
View File

@ -0,0 +1,109 @@
#include "batbnoc.h"
TOOLBAR "Toolbar" 0 19 0 3
#include <toolbar.h>
ENDPAGE
PAGE "Nomenclatura Combinata" -1 -1 78 18
GROUPBOX DLG_NULL 78 7
BEGIN
PROMPT 1 1 "@bCodice Nomenclatura"
END
STRING NOC_CODICE1 4
BEGIN
PROMPT 2 3 "Codice "
FLAGS "U"
USE %NOC
INPUT CODTAB[1,4] NOC_CODICE1
INPUT CODTAB[5,6] NOC_CODICE2
INPUT CODTAB[7,8] NOC_CODICE3
DISPLAY "Codice@8" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT NOC_CODICE1 CODTAB[1,4]
OUTPUT NOC_CODICE2 CODTAB[5,6]
OUTPUT NOC_CODICE3 CODTAB[7,8]
OUTPUT NOC_DESCR S0
CHECKTYPE REQUIRED
FIELD CODTAB[1,4]
KEY 1
END
STRING NOC_CODICE2 2
BEGIN
PROMPT 24 3 ""
FLAGS "U"
COPY ALL NOC_CODICE1
CHECKTYPE REQUIRED
FIELD CODTAB[5,6]
KEY 1
END
STRING NOC_CODICE3 2
BEGIN
PROMPT 32 3 ""
FLAGS "U"
COPY ALL NOC_CODICE1
CHECKTYPE REQUIRED
FIELD CODTAB[7,8]
KEY 1
END
STRING NOC_DESCR 50
BEGIN
PROMPT 2 5 "Descrizione "
USE %NOC KEY 2
INPUT S0 NOC_DESCR
DISPLAY "Descrizione@60" S0
DISPLAY "Codice@8" CODTAB
COPY OUTPUT NOC_CODICE1
CHECKTYPE REQUIRED
FIELD S0
KEY 2
ENDPAGE
GROUPBOX DLG_NULL 78 7
BEGIN
PROMPT 1 8 "@bUnita' di misura supplementare"
FLAGS "R"
END
LIST NOC_UMS_OBB 1 50
BEGIN
PROMPT 2 10 "Obbligatorieta' "
ITEM " |Non obbligatoria"
ITEM "A|Obbligatoria per acquisti"
ITEM "C|Obbligatoria per cessioni"
ITEM "E|Obbligatoria per acquisti e cessioni"
FIELD S4
END
STRING NOC_UMS_CODICE 2
BEGIN
PROMPT 2 12 "Descrizione "
USE %UMS
FLAGS "U"
INPUT CODTAB NOC_UMS_CODICE
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT NOC_UMS_CODICE CODTAB
OUTPUT NOC_UMS_DESCR S0
CHECKTYPE NORMAL
FIELD S5
END
STRING NOC_UMS_DESCR 50
BEGIN
PROMPT 20 12 ""
USE %UMS KEY 2
INPUT S0 NOC_UMS_DESCR
DISPLAY "Descrizione@60" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT NOC_UMS_CODICE
CHECKTYPE NORMAL
END
ENDMASK

View File

@ -4,7 +4,8 @@
#define F_CODICE 101
#define F_DESCR 102
#define F_CONSEGNA 103
#define F_TRASPORTO 104

View File

@ -46,5 +46,41 @@ OUTPUT F_DESCR S0
CHECKTYPE REQUIRED
END
LIST F_TRASPORTO 1 20
BEGIN
PROMPT 4 7 "Modo di trasporto "
ITEM "1|Marittimo"
ITEM "2|Ferroviario"
ITEM "3|Stradale"
ITEM "4|Aereo"
ITEM "5|Spedizione postale"
ITEM "7|Installazioni fisse"
ITEM "8|Via acqua"
ITEM "9|Propulsione propria"
FIELD I0
END
STRING F_CONSEGNA 3
BEGIN
PROMPT 4 9 "Condizioni consegna "
SHEET "Codice|Descrizione@45"
INPUT F_CONSEGNA
ITEM "EXW|Franco fabbrica"
ITEM "FCA|Franco vettore"
ITEM "FAS|Franco sotto bordo"
ITEM "FOB|Franco a bordo"
ITEM "CFR|Costo e nolo"
ITEM "CIF|Costo, assicurazione, nolo"
ITEM "CPT|Nolo/porto pagato fino a ..."
ITEM "CIP|Nolo/porto e assicurazione pagati fino a ..."
ITEM "DAF|Reso frontiera"
ITEM "DES|Reso franco bordo nave a destino"
ITEM "DEQ|Reso franco banchina"
ITEM "DDU|Reso non sdoganato"
ITEM "DDP|Reso sdoganato"
OUTPUT F_CONSEGNA
FIELD S3
END
ENDPAGE
ENDMASK

View File

@ -44,6 +44,8 @@
#define F_CODULC 163
#define F_CODLBU 164
#define F_RAGSOC 165
#define F_REGSOSPEXT 166
#define F_STAMPA_PLAFONDS 167
#define F_PRINTER 201
#define F_CONFIG 202

View File

@ -305,11 +305,24 @@ BEGIN
FIELD B1
GROUP GRP_VENDITE GRP_ACQUISTI GRP_NOGIORNMAG
HELP "Indicare se il registro e' in sospensione d'imposta"
MESSAGE TRUE ENABLE,F_REGSOSPEXT
MESSAGE FALSE CLEAR,F_REGSOSPEXT
END
LIST F_REGSOSPEXT 15
BEGIN
PROMPT 29 5 ""
GROUP GRP_VENDITE GRP_ACQUISTI GRP_NOGIORNMAG
FLAGS "D"
FIELD I9
ITEM "1|Normale"
ITEM "2|Volume d'affari"
ITEM "3|Liquidazione"
END
BOOLEAN F_STAMPA_CREDITO_ANNO_PREC
BEGIN
PROMPT 46 5 "Stampa credito anno precedente"
PROMPT 48 5 "Stampa credito anno precedente"
HELP "Indicare se si vuole la stampa del credito IVA dell'anno precedente"
FIELD B4
GROUP GRP_ACQUISTI GRP_NOGIORNMAG
@ -317,7 +330,7 @@ END
BOOLEAN F_CORRISP
BEGIN
PROMPT 46 5 "Registro corrispettivi"
PROMPT 48 5 "Registro corrispettivi"
HELP "Indicare se si tratta di registro dei corrispettivi"
FIELD B0
GROUP GRP_VENDITE
@ -382,7 +395,7 @@ END
BOOLEAN F_STAMPA_RIEPIL_SUL_REGISTRO
BEGIN
PROMPT 46 7 "Stampa riepilogo liquidazione"
PROMPT 48 7 "Stampa riepilogo liquidazione"
FIELD B6
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
HELP "Indicare se stampare il riepilogo IVA delle aliquote utilizzate"
@ -408,6 +421,13 @@ BEGIN
HELP "Indicare se stampare a fine periodo la liquidazione"
END
BOOLEAN F_STAMPA_PLAFONDS
BEGIN
PROMPT 48 9 "Stampa plafonds "
FIELD S10
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
END
NUMBER F_PROG_AVERE 18
BEGIN
PROMPT 1 9 "Progressivo avere "
@ -425,14 +445,6 @@ BEGIN
GROUP GRP_INCASSI GRP_NOGIORNMAG
END
BOOLEAN F_VENTIL
BEGIN
PROMPT 46 9 "Attivita' con ventilazione"
HELP "Indicare se vengono registrate operazioni con ventilazione IVA"
FIELD B3
GROUP GRP_ACQUISTI GRP_NOGIORNMAG
END
LIST F_MESE_STAMPA_ULTIMA_LIQ 10
BEGIN
PROMPT 1 11 "Mese stampa ultima liquidazione "
@ -444,6 +456,14 @@ BEGIN
GROUP GRP_VENDITE GRP_ACQUISTI GRP_RIEPIVA
END
BOOLEAN F_VENTIL
BEGIN
PROMPT 48 11 "Attivita' con ventilazione"
HELP "Indicare se vengono registrate operazioni con ventilazione IVA"
FIELD B3
GROUP GRP_ACQUISTI GRP_NOGIORNMAG
END
BOOLEAN F_STAMPA_SULLO_STESSO_REGISTRO
BEGIN
PROMPT 1 11 "Stampa sullo stesso registro"

View File

@ -1,14 +1,10 @@
#define F_CODE 101
#define F_DESC 102
#define F_DECIMALS 103
#define F_LASTDATE 104
#define F_CUR_CHANGE 105
#define F_CUR_MULT 106
#define F_CUR_CODE 107
#define F_STD_CHANGE 108
#define F_STD_MULT 109
#define F_STD_CODE 110
#define F_DECIMALSPR 111
#define VAL_CODE 101
#define VAL_DESC 102
#define VAL_DECIMALS 110
#define VAL_DECIMALS_PRICES 111
#define VAL_DECIMALS_CHANGE 112
#define VAL_CHANGE 121
#define VAL_CHANGE_OLD 122
#define VAL_LASTDATE 130
#define VAL_EURO 131
#define VAL_INEURO 133

View File

@ -1,6 +1,6 @@
#include "batbval.h"
TOOLBAR "" 0 20 0 2
TOOLBAR "" 0 -3 0 0
#include <toolbar.h>
@ -10,125 +10,121 @@ PAGE "Valute" -1 -1 78 12
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 1 ""
PROMPT 1 1 "@bCodice"
FLAGS "R"
END
STRING F_CODE 3
STRING VAL_CODE 3
BEGIN
PROMPT 2 2 "Codice "
FIELD CODTAB
FLAGS "UZ"
KEY 1
USE %VAL
INPUT CODTAB F_CODE
INPUT CODTAB VAL_CODE
DISPLAY "Codice" CODTAB
DISPLAY "Valuta@50" S0
OUTPUT F_CODE CODTAB
OUTPUT F_DESC S0
// MESSAGE COPY,F_CUR_CODE|COPY,F_STD_CODE
OUTPUT VAL_CODE CODTAB
OUTPUT VAL_DESC S0
HELP "Codice della valuta"
CHECKTYPE REQUIRED
END
STRING F_DESC 50
BOOLEAN VAL_EURO
BEGIN
PROMPT 40 2 "Codice valuta dell'EURO"
FIELD B0
MESSAGE FALSE ENABLE,VAL_INEURO|ENABLE,VAL_DECIMALS
MESSAGE TRUE CLEAR,VAL_INEURO|CLEAR,VAL_DECIMALS|"2",VAL_DECIMALS
END
STRING VAL_DESC 50
BEGIN
PROMPT 2 3 "Descrizione "
FIELD S0
KEY 2
USE %VAL KEY 2
INPUT S0 F_DESC
INPUT S0 VAL_DESC
DISPLAY "Valuta@60" S0
DISPLAY "Codice@10" CODTAB
COPY OUTPUT F_CODE
COPY OUTPUT VAL_CODE
HELP "Descrizione della valuta"
CHECKTYPE REQUIRED
WARNING "Manca la descrizione"
END
NUMBER F_DECIMALS 1
BEGIN
PROMPT 2 5 "Decimali per importi "
FIELD I0
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
BEGIN
PROMPT 1 7 "Cambio attuale"
PROMPT 1 6 "@bDecimali"
FLAGS "R"
END
NUMBER F_CUR_CHANGE 15 5
LIST VAL_DECIMALS 1 10
BEGIN
PROMPT 2 8 "Cambio "
PROMPT 2 7 "Decimali per importi "
ITEM "0|Nessuno"
ITEM "1|1 decimale"
ITEM "2|2 decimali"
ITEM "3|3 decimali"
FIELD I0
END
LIST VAL_DECIMALS_PRICES 1 10
BEGIN
PROMPT 40 7 "Decimali per prezzi "
ITEM "0|Nessuno"
ITEM "1|1 decimale"
ITEM "2|2 decimali"
ITEM "3|3 decimali"
FIELD I1
NUM_EXPR #THIS_FIELD>=#VAL_DECIMALS
WARNING "Si devono specificare almeno tanti decimali quanti quelli degli importi"
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 10 "@bCambio standard"
FLAGS "R"
END
LIST VAL_DECIMALS_CHANGE 1 10
BEGIN
PROMPT 2 11 "Decimali per cambio "
ITEM "2|2 decimali"
ITEM "3|3 decimali"
ITEM "4|4 decimali"
ITEM "5|5 decimali"
ITEM "6|6 decimali"
FIELD I2
END
BOOLEAN VAL_INEURO
BEGIN
PROMPT 40 11 "Espresso in EURO"
FIELD B1
END
NUMBER VAL_CHANGE 15 5
BEGIN
PROMPT 2 12 "Cambio "
FIELD S4
FLAGS "U"
END
NUMBER VAL_CHANGE_OLD 15 5
BEGIN
PROMPT 2 12 "Cambio "
FIELD R10
PICTURE ".5"
FLAGS "U"
END
/*
NUMBER F_CUR_MULT 7
BEGIN
PROMPT 40 8 "ogni "
FIELD I10
FLAGS "U"
NUM_CALC IF((#THIS_FIELD==0),1,#THIS_FIELD)
FLAGS "HU"
END
STRING F_CUR_CODE 3
DATE VAL_LASTDATE
BEGIN
PROMPT 55 8 ""
FLAGS "D"
END
*/
DATE F_LASTDATE
BEGIN
PROMPT 62 8 "Data "
PROMPT 40 12 "Data "
FIELD D0
HELP "Data di ultimo aggiornamento"
END
/*
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 11 "Cambio standard"
FLAGS "R"
END
NUMBER F_STD_CHANGE 15 5
BEGIN
PROMPT 2 12 "Cambio "
FIELD R11
PICTURE ".5"
FLAGS "U"
END
NUMBER F_STD_MULT 7
BEGIN
PROMPT 40 12 "ogni "
FIELD I11
FLAGS "U"
NUM_CALC IF((#THIS_FIELD==0),1,#THIS_FIELD)
END
STRING F_STD_CODE 3
BEGIN
PROMPT 55 12 ""
FLAGS "D"
END
*/
ENDPAGE
ENDMASK

View File

@ -12,7 +12,7 @@ BEGIN
FLAGS "R"
END
STRING F_CODVETT 5
STRING F_CODVETT 6
BEGIN
PROMPT 2 2 "Codice vettore "
FIELD CODTAB

152
ba/cgdll.cpp Executable file
View File

@ -0,0 +1,152 @@
#include <applicat.h>
#include <execp.h>
#include <config.h>
#include <utility.h>
#include "cgdll.h"
class TInstall_dll : public TSkeleton_application
{
private:
bool _copy_dll, _makeini, _del_dll;
bool CopiaDll(const char * dllname);
bool CreaExeIni(const char * exename);
protected:
virtual void main_loop() ;
virtual bool create();
bool CopiaDlls();
bool InstallaExeIni();
bool RemoveDlls();
public:
virtual ~TInstall_dll () {}
virtual const char * extra_modules() const
{return "BA";}
virtual bool check_autorization() const
{return FALSE;}
};
bool TInstall_dll ::CopiaDll(const char * dllname)
{
bool ok;
TFilename from("C:\\windows\\system"),to(".");
from.add(dllname);
to.add(dllname);
if (fexist(from))
ok = fcopy(from, to);
else
warning_box("Copia impossibile : %s non è presente in %s", dllname, from.path());
return ok;
}
// crea il .ini in \WINDOWS per i files exe copiati nella directory di EASYCAMPO
bool TInstall_dll ::CreaExeIni(const char * exename)
{
TFilename ininame("C:\\WINDOWS");
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_dll ::CopiaDlls()
{
bool ok=TRUE;
ok &= CopiaDll("MSAES110.DLL" );
ok &= CopiaDll("MSAJT112.DLL");
ok &= CopiaDll("MSAJT200.DLL");
ok &= CopiaDll("VBDB300.DLL");
ok &= CopiaDll("VBRUN300.DLL");
ok &= CopiaDll("XBS200.DLL");
return ok;
}
// cancella le dll dal WINDOws
bool TInstall_dll ::RemoveDlls()
{
bool ok=TRUE;
ok &= (remove("c:\\windows\\system\\MSAES110.DLL" ) == 0);
ok &= (remove("c:\\windows\\system\\MSAJT112.DLL")== 0);
ok &= (remove("c:\\windows\\system\\MSAJT200.DLL")== 0);
ok &= (remove("c:\\windows\\system\\VBDB300.DLL")== 0);
ok &= (remove("c:\\windows\\system\\VBRUN300.DLL")== 0);
ok &= (remove("c:\\windows\\system\\XBS200.DLL")== 0);
return ok;
}
bool TInstall_dll ::InstallaExeIni()
{
bool ok;
ok = fexist("MSAES110.DLL" );
ok &= fexist("MSAJT112.DLL");
ok &= fexist("MSAJT200.DLL");
ok &= fexist("VBDB300.DLL");
ok &= fexist("VBRUN300.DLL");
ok &= fexist("XBS200.DLL");
if (!ok)
error_box("Le DLL non sono presenti nel direttorio corrente");
else
{
// copia dll (ex file PRASSI.PR inst.exe
ok &= CreaExeIni("CB0000.EXE");
ok &= CreaExeIni("TRRICE.EXE");
ok &= CreaExeIni("VCOPIA.EXE");
}
return ok;
}
bool TInstall_dll ::create()
{
_copy_dll=TRUE,
_makeini=TRUE,
_del_dll=TRUE;
int c = argc();
while (c>1) {
c--;
if (strcmp(argv(c),"-d")==0)
_del_dll=FALSE;
else if (strcmp(argv(c),"-c")==0)
_copy_dll=FALSE;
else if (strcmp(argv(c),"-i")==0)
_makeini=FALSE;
else if (strcmp(argv(c),"-h")==0)
warning_box("Parametri di lancio: \n -i non crea i .ini per i programmi di CG \n -c non copia le DLL nella directory corrente \n -d non cancella le DLL su windows\\system ");
}
return TSkeleton_application::create();
}
void TInstall_dll ::main_loop()
{
if (_copy_dll)
CopiaDlls();
if (_makeini)
InstallaExeIni();
if (_del_dll)
RemoveDlls();
}
int main(int argc,char** argv)
{
TInstall_dll app;
app.run(argc, argv, "Installazione DLL per contabilita' generale");
return TRUE;
}

3
ba/cgdll.h Executable file
View File

@ -0,0 +1,3 @@
#define F_DELDLL 101
#define F_MAKEINI 102
#define F_COPYDLL 103

45
ba/cgdll.uml Executable file
View File

@ -0,0 +1,45 @@
#include "cgdll.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 -1 ""
MESSAGE EXIT,K_QUIT
END
ENDPAGE
PAGE "DLL Contabilita' Generale" -1 -1 78 8
// GROUP 1 = PRE-INSTALLATION
// GROUP 2 = POST-INSTALLATION
GROUPBOX DLG_NULL 70 9
BEGIN
PROMPT 2 2 "@bGestione DLL di VisualBasic"
GROUP 1
END
BOOL F_COPYDLL
BEGIN
PROMPT 3 4 "Copia le DLL da C:\WINDOWS\SYSTEM nella directory corrente"
GROUP 1
END
BOOL F_MAKEINI
BEGIN
PROMPT 3 6 "Imposta i file di CG per l'uso delle DLL nella directory corrente"
GROUP 1
END
BOOL F_DELDLL
BEGIN
PROMPT 3 8 "Cancella le DLL su C:\WINDOWS\SYSTEM"
GROUP 1
END
ENDPAGE
ENDMASK

13
ba/cgdll.url Executable file
View File

@ -0,0 +1,13 @@
#include <default.url>
/* ba1 -0 */
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
/* ba1 -1 */
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"

View File

@ -1,3 +1,3 @@
2
1
%user|0|0|260|0|Utenti|10||
%user|0|0|279|0|Utenti|10||

View File

@ -1,12 +1,15 @@
2
8
USERNAME|1|8|0|
USERDESC|1|50|0|
PASSWORD|1|8|0|
AUTSTR|1|48|0|
AUTSTR1|1|48|0|
AUTSTR2|1|48|0|
AUTSTR3|1|48|0|
CONNECTED|8|1|0|
11
USERNAME|1|8|0|Nome dell'utente/gruppo
USERDESC|1|50|0|Descrizione dell'utente/gruppo
PASSWORD|1|8|0|Password dell'utente
GROUPNAME|1|8|0|Gruppo di appartenenza
ISGROUP|8|1|0|E' un gruppo o un utente
AUTSTR|1|48|0|Autorizzazioni 1
AUTSTR1|1|48|0|Autorizzazioni 2
AUTSTR2|1|48|0|Autorizzazioni 3
AUTSTR3|1|48|0|Autorizzazioni 4
CONNECTED|8|1|0|Utente connesso
PERMISSION|11|10|0|File di configurazione permessi per gruppi/utenti
1
USERNAME|

View File

@ -1,3 +1,3 @@
9
1
%nditte|0|0|545|0|Ditte|#6||
%nditte|0|0|559|0|Ditte|#6||

View File

@ -1,5 +1,5 @@
9
45
52
CODDITTA|3|5|0|
TIPOA|1|1|0|
CODANAGR|3|5|0|
@ -45,6 +45,13 @@ DENEST1|1|70|0|
DENEST2|1|70|0|
DENEST3|1|70|0|
AUTSTR|1|50|0|
VALUTA|1|3|0|Codice valuta di riferimento per i dati
PRESELEN|8|1|0|Presentati elenchi in precedenza
CESSIVA|8|1|0|Cessata attivita' o variata partita IVA
FREQCES|1|1|0|Frequenza riepiloghi cessioni INTRA
FREQACQ|1|1|0|Frequenza riepiloghi acquisti INTRA
TIPOSOGDEL|1|1|0|Tipo anagrafico del soggetto delegato
CODSOGDEL|3|6|0|Codice del soggetto delegato
4
CODDITTA|
UPPER(RAGSOC)|X

View File

@ -33,15 +33,6 @@ PostProcess =
PreProcess =
Versione =
[mu]
Data =
Descrizione = Multiutenza
Moduli =
Patch =
PostProcess =
PreProcess =
Versione =
[cm]
Data =
Descrizione = Gestione Commesse
@ -163,9 +154,9 @@ PostProcess =
PreProcess =
Versione =
[ab]
[iv]
Data =
Descrizione = Analisi di bilancio
Descrizione = IVA
Moduli = ba
Patch =
PostProcess =
@ -311,15 +302,6 @@ Versione =
[_area_AVIS]
Descrizione = AREA AVIS
[ac]
Data =
Descrizione = Accettazione AVIS
Moduli = ba
Patch =
PostProcess =
PreProcess =
Versione =
[av]
Data =
Descrizione = AVIS Assist
@ -338,10 +320,10 @@ PostProcess =
PreProcess =
Versione =
[mb]
[ac]
Data =
Descrizione = Medi-Base
Moduli =
Descrizione = Accettazione AVIS
Moduli = ba
Patch =
PostProcess =
PreProcess =

View File

@ -53,6 +53,8 @@ protected:
////////////
static bool indsp_notify(TSheet_field& s, int r, KEY key);
static void indsp_sheet_rebuilder();
static bool effetti_notify(TSheet_field& s, int r, KEY key);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
virtual int read(TMask& m);
@ -494,6 +496,23 @@ int TClifo_application::read(TMask& m)
field_sheet(F_CODINDSP).add(riga);
field_sheet(F_CODINDEFF).add(riga);
}
TSheet_field& pnae = m.sfield(F_NONACCEFF);
pnae.destroy();
const TRectype& cfven = get_relation()->curr(LF_CFVEN);
TToken_string nonacc(cfven.get(CFV_NONACCEFF), ';');
TToken_string nonscd(cfven.get(CFV_NONSCADEFF), ';');
TToken_string periodo(12, ',');
int per = 0;
for (bool good = nonacc.get(per, periodo); good; good = nonacc.get(++per, periodo))
{
TToken_string& row = pnae.row(-1);
row = periodo << '|' << nonscd.get(per);
row.replace(';', '|');
row.replace(',', '|');
row.replace('-', '|');
}
pnae.force_update();
}
return _rel->status();
}
@ -584,6 +603,26 @@ void TClifo_application::common_f(const TMask& m)
rec.put(IND_IVARID,row.get());
rec.put(IND_CODIND,i+1);
}
TSheet_field& pnae = m.sfield(F_NONACCEFF);
TToken_string nonacceff(30, ';'), nonscadeff(30, ';');
FOR_EACH_SHEET_ROW(pnae, re, row) if (!row->empty_items())
{
TString16 p;
p << row->get(0) << '-'; p << row->get(1) << ',';
p << row->get(2) << '-'; p << row->get(3);
nonacceff.add(p);
p = row->get(4); p << '-' << row->get(5);
nonscadeff.add(p);
}
TRectype& cfven = get_relation()->curr(LF_CFVEN);
int mass = cfven.length(CFV_NONACCEFF);
if (nonacceff.len() > mass) nonacceff.cut(mass);
cfven.put(CFV_NONACCEFF, nonacceff);
mass = cfven.length(CFV_NONSCADEFF);
if (nonscadeff.len() > mass) nonscadeff.cut(mass);
cfven.put(CFV_NONSCADEFF, nonscadeff);
}
}
@ -632,6 +671,19 @@ default:
return TRUE;
}
bool TClifo_application::effetti_notify(TSheet_field& pnae, int r, KEY key)
{
if (key == K_INS)
{
TClifo_application& a = app();
TRectype& cfven = a.get_relation()->curr(LF_CFVEN);
int mass_len = cfven.length(CFV_NONACCEFF); // Lunghezza campo
int mass_rig = mass_len / 11; // Numero di periodi ivi salvabili
return pnae.items() < mass_rig; // Non accettare righe che non si possono salvare
}
return TRUE;
}
bool TClifo_application::user_create() // initvar e arrmask
{
_has_cg = has_module(CGAUT, CHK_DONGLE);
@ -660,9 +712,12 @@ bool TClifo_application::user_create() // initvar e arrmask
_msk->set_handler(DLG_EMAIL, email_handler);
_msk->set_handler(F_RAGSOC, rsoc_handler);
TSheet_field& ind = (TSheet_field&) _msk->field(F_SHEET_G_VEN);
TSheet_field& ind = _msk->sfield(F_SHEET_G_VEN);
ind.set_notify(indsp_notify);
TSheet_field& pnae = _msk->sfield(F_NONACCEFF);
pnae.set_notify(effetti_notify);
TConfig config(CONFIG_STUDIO);
_savenew = !config.get_bool("Cg02SN");

View File

@ -134,6 +134,15 @@
#define F_RAGGEFF 232
#define F_NUMCC 233
#define F_CODLIST1 234
#define F_ESACC 235
#define F_ESALL 236
#define F_ESCAR 237
#define F_ESPLA 238
#define F_ESLEG 239
#define F_ESVET 240
#define F_ADDCONAI 241
#define F_CONAIASS 242
#define F_REFERENTE 243
#define DLG_RIC 300
#define DLG_CST 301

File diff suppressed because it is too large Load Diff

View File

@ -245,31 +245,26 @@ BEGIN
PROMPT 2 9 "Operazioni imponibili "
END
NUMBER F_IMPESC 15
CURRENCY F_IMPESC 15
BEGIN
PROMPT 25 9 ""
HELP "Totale operazioni imponibili anno corrente"
FIELD LF_ALLEG->IMPESC
FLAGS "R"
PICTURE "."
MESSAGE K_TAB,F_TOTALE1|K_TAB,F_TOTALE5
END
NUMBER F_IMPESP 15
CURRENCY F_IMPESP 15
BEGIN
PROMPT 42 9 ""
HELP "Totale operazioni imponibili anno corrente"
FIELD LF_ALLEG->IMPESP
FLAGS "R"
PICTURE "."
MESSAGE K_TAB,F_TOTALE1|K_TAB,F_TOTALE6
END
NUMBER F_TOTALE1 15
CURRENCY F_TOTALE1 15
BEGIN
PROMPT 60 9 ""
FLAGS "RD"
PICTURE "."
FLAGS "D"
NUM_CALC {#F_IMPESP+#F_IMPESC}
END
@ -278,31 +273,26 @@ BEGIN
PROMPT 2 10 "Imposte addebitate "
END
NUMBER F_IVAESC 15
CURRENCY F_IVAESC 15
BEGIN
PROMPT 25 10 ""
HELP "Totale imposte addebitate dell'anno corrente"
FIELD LF_ALLEG->IVAESC
FLAGS "R"
PICTURE "."
MESSAGE K_TAB,F_TOTALE2|K_TAB,F_TOTALE5
END
NUMBER F_IVAESP 15
CURRENCY F_IVAESP 15
BEGIN
PROMPT 42 10 ""
HELP "Totale imposte addebitate dell'anno precedente"
FIELD LF_ALLEG->IVAESP
FLAGS "R"
PICTURE "."
MESSAGE K_TAB,F_TOTALE2|K_TAB,F_TOTALE6
END
NUMBER F_TOTALE2 15
CURRENCY F_TOTALE2 15
BEGIN
PROMPT 60 10 ""
FLAGS "RD"
PICTURE "."
FLAGS "D"
NUM_CALC {#F_IVAESP+#F_IVAESC}
END
@ -324,31 +314,26 @@ BEGIN
FLAGS "H"
END
NUMBER F_NIESC 15
CURRENCY F_NIESC 15
BEGIN
PROMPT 25 11 ""
FIELD LF_ALLEG->NIESC
FLAGS "R"
PICTURE "."
HELP "Totale operazioni non imponibili ed esenti dell'anno corrente"
MESSAGE K_TAB,F_TOTALE3|K_TAB,F_TOTALE5
END
NUMBER F_NIESP 15
CURRENCY F_NIESP 15
BEGIN
PROMPT 42 11 ""
FIELD LF_ALLEG->NIESP
FLAGS "R"
PICTURE "."
HELP "Totale operazioni non imponibili ed esenti dell'anno precedente"
MESSAGE K_TAB,F_TOTALE3|K_TAB,F_TOTALE6
END
NUMBER F_TOTALE3 15
CURRENCY F_TOTALE3 15
BEGIN
PROMPT 60 11 ""
FLAGS "RD"
PICTURE "."
FLAGS "D"
NUM_CALC {#F_NIESP+#F_NIESC}
END
@ -358,34 +343,29 @@ BEGIN
GROUP 6
END
NUMBER F_E8ESC 15
CURRENCY F_E8ESC 15
BEGIN
PROMPT 25 12 ""
FIELD LF_ALLEG->E8ESC
FLAGS "R"
GROUP 6
PICTURE "."
HELP "Totale operazioni non imponibili (Art. 8 2^c) dell'anno corrente"
MESSAGE K_TAB,F_TOTALE4|K_TAB,F_TOTALE5
END
NUMBER F_E8ESP 15
CURRENCY F_E8ESP 15
BEGIN
PROMPT 42 12 ""
FIELD LF_ALLEG->E8ESP
FLAGS "R"
GROUP 6
PICTURE "."
HELP "Totale operazioni non imponibili (Art. 8 2^c) dell'anno precedente"
MESSAGE K_TAB,F_TOTALE4|K_TAB,F_TOTALE6
END
NUMBER F_TOTALE4 15
CURRENCY F_TOTALE4 15
BEGIN
PROMPT 60 12 ""
FLAGS "RD"
FLAGS "D"
GROUP 6
PICTURE "."
NUM_CALC {#F_E8ESP+#F_E8ESC}
END
@ -394,19 +374,17 @@ BEGIN
PROMPT 2 13 "Totale "
END
NUMBER F_TOTALE5 15
CURRENCY F_TOTALE5 15
BEGIN
PROMPT 25 13 ""
FLAGS "RD"
PICTURE "."
FLAGS "D"
NUM_CALC {#F_IMPESC+#F_IVAESC+#F_NIESC+#F_E8ESC}
END
NUMBER F_TOTALE6 15
CURRENCY F_TOTALE6 15
BEGIN
PROMPT 42 13 ""
FLAGS "RD"
PICTURE "."
FLAGS "D"
NUM_CALC {#F_IMPESP+#F_IVAESP+#F_NIESP+#F_E8ESP}
END
@ -456,13 +434,13 @@ BEGIN
FLAGS "H"
END
NUMBER F_PROG101102 15
CURRENCY F_PROG101102 15
BEGIN
PROMPT 42 17 ""
FIELD LF_ALLEG->PROG101102
FLAGS "R"
PICTURE "."
HELP "Totale operazioni non imponibili Art. 8 1^c, Artt. 8 bis, 9 e 72"
END
ENDPAGE
ENDMASK

View File

@ -25,6 +25,8 @@ enum liste {
stampa=2,
};
enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione };
struct Importi {
real imponibile;
real imposta;
@ -122,6 +124,7 @@ class TProgressivi_iva : public TPrintapp
int _sospmsk, _tipoprog, _livelloprog, _tipo_aliq, _tipo_attiv, _annoiva, _i;
int _mese, _anno;
long _codditta;
char _tipo_prog_reg;
bool _st_inizio_anno, _prima_pagina;
TIva_array _iva_array,_iva1_array;
TGen_array _gen_array,_gen1_array;
@ -134,6 +137,8 @@ class TProgressivi_iva : public TPrintapp
protected:
static bool tipo_handler(TMask_field& f, KEY k);
static bool selection_handler(TMask_field& f, KEY k);
static bool period_handler(TMask_field& f, KEY k);
static void check_period(TMask& m);
public:
@ -144,6 +149,7 @@ public:
virtual bool preprocess_page(int,int);
virtual print_action postprocess_page(int,int);
bool is_month_plain(int x, int m, const char f);
void lordo2netto(const real& totale, real& imponibile, real& imposta, const real& aliquota);
void cerca_i_pim();
void azzera_mesi();
@ -161,6 +167,8 @@ public:
TProgressivi_iva(){};
};
inline TProgressivi_iva& app() { return (TProgressivi_iva&) main_app(); }
HIDDEN int compare_rows(const TObject** o1, const TObject** o2)
{
TRiga_gen* r1 = (TRiga_gen*)*o1;
@ -169,6 +177,21 @@ HIDDEN int compare_rows(const TObject** o1, const TObject** o2)
return (strcmp((const char*)r1->_codiva, (const char*)r2->_codiva));
}
bool TProgressivi_iva::is_month_plain(int x, int m, const char f)
// la piu' semplice: vero se mese == _month o se fa parte del
// trimestre indicato da month
{
bool ok = x == m;
if (!ok && f == 'T')
{
// aggiusta al trimestre il mese da calcolare
int mto = m;
mto += 2 - ((mto-1) % 3);
ok = x > (mto - 3) && x <= mto;
}
return ok;
}
const char* TProgressivi_iva::desc_attivita(const char* codatt)
{
TTable attiv ("%AIS");
@ -276,6 +299,7 @@ void TProgressivi_iva::look_pim()
real imponibile, imposta,afi,afv,va7i,va7v;
real corr_item,*cp,aliquota;
bool is_key;
const char freq = look_lia(_codditta);
_corr_array.destroy();
@ -301,7 +325,8 @@ void TProgressivi_iva::look_pim()
continue;
if (!_st_inizio_anno)
if (mese != _mese)
//if (mese != _mese)
if (!is_month_plain(mese, _mese, freq))
continue;
if (codatt != _cod_att) continue;
@ -313,6 +338,18 @@ void TProgressivi_iva::look_pim()
reg.put("CODTAB",codreg);
if (reg.read() != NOERR) reg.zero();
const bool corrisp = reg.get_bool("B0");
const tipo_sospensione sosp_imp = reg.get_bool("B1") ? (tipo_sospensione) reg.get_int("I9") : nessuna;
// Se si decide di stampare i progressivi validi per la liquidazione
// i PIM validi solo per il volume d'affari vanno scartati
if (_tipo_prog_reg == 'L' && sosp_imp == vol_affari)
continue;
// Se si decide di stampare i progressivi validi per il vol. d'affari
// i PIM validi solo per la liquidazione vanno scartati
if (_tipo_prog_reg == 'V' && sosp_imp == liquidazione)
continue;
is_key = _corr_array.is_key(codiva);
corr_item = ZERO;
@ -328,7 +365,7 @@ void TProgressivi_iva::look_pim()
case acq_norm:
if (_mese != 13)
_gen_array.add_riga(codiva,ZERO,ZERO,imponibile,imposta,ZERO,ZERO);
if ((_st_inizio_anno && mese == _mese) || _mese == 13) //lo metto in un array a parte
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) //lo metto in un array a parte
_gen1_array.add_riga(codiva,ZERO,ZERO,imponibile,imposta,ZERO,ZERO);
break;
case vend_norm:
@ -353,13 +390,13 @@ void TProgressivi_iva::look_pim()
if (_mese != 13)
_gen_array.add_riga(codiva,imponibile,imposta,ZERO,ZERO,ZERO,ZERO);
if ((_st_inizio_anno && mese == _mese) || _mese == 13) //lo metto in un array a parte
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) //lo metto in un array a parte
_gen1_array.add_riga(codiva,imponibile,imposta,ZERO,ZERO,ZERO,ZERO);
break;
case bolle_doganali:
if (_mese != 13)
_gen_array.add_riga(codiva,ZERO,ZERO,ZERO,ZERO,imponibile,imposta);
if ((_st_inizio_anno && mese == _mese) || _mese == 13)
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
_gen1_array.add_riga(codiva,ZERO,ZERO,ZERO,ZERO,imponibile,imposta);
break;
case acq_amm_ultdetr:
@ -367,7 +404,7 @@ void TProgressivi_iva::look_pim()
real detr = imponibile * real(0.06);
if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,detr);
if ((_st_inizio_anno && mese == _mese) || _mese == 13)
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
_iva1_array.add_riga(tipo,imponibile,imposta,detr);
}
break;
@ -379,15 +416,18 @@ void TProgressivi_iva::look_pim()
{
if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,ZERO);
if ((_st_inizio_anno && mese == _mese) || _mese == 13)
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
_iva1_array.add_riga(tipo,imponibile,imposta,ZERO);
}
break;
default:
if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,ZERO);
if ((_st_inizio_anno && mese == _mese) || _mese == 13)
_iva1_array.add_riga(tipo,imponibile,imposta,ZERO);
default:
if (sosp_imp == normale || sosp_imp == nessuna) // Esclude quelli valevoli solo liq o solo vol.aff. dai riepiloghi altri dati
{
if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,ZERO);
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
_iva1_array.add_riga(tipo,imponibile,imposta,ZERO);
}
break;
}
}
@ -623,27 +663,57 @@ bool TProgressivi_iva::tipo_handler(TMask_field& f, KEY k)
return TRUE;
}
void TProgressivi_iva::check_period(TMask& m)
{
app()._anno = m.get_int(F_ANNO);
const char f = app().look_lia(m.get_long(F_CODDITTA));
m.show(-2);
m.show(F_MESE, f == 'M');
m.show(F_TRIMESTRE, f == 'T');
}
bool TProgressivi_iva::selection_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
const int sel = atoi(f.get());
if (sel == 1)
switch (sel)
{
const bool b = atoi(m.field(F_LIVELLO).get()) == 1 ? TRUE : FALSE;
m.show(F_CODIVA,b);
m.show(F_ATTIVITA,!b);
tipo_handler(m.field(F_TIPO),K_SPACE);
case 1:
{
const bool b = atoi(m.field(F_LIVELLO).get()) == 1 ? TRUE : FALSE;
m.show(F_CODIVA,b);
m.show(F_ATTIVITA,!b);
tipo_handler(m.field(F_TIPO),K_SPACE);
}
break;
case 2:
check_period(m);
break;
default: break;
}
}
return TRUE;
}
bool TProgressivi_iva::period_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
{
TMask& m = f.mask();
if (m.get_int(F_SELECTION) == 2)
check_period(m);
}
return TRUE;
}
bool TProgressivi_iva::set_print(int m)
{
TMask msk("cg0400a");
msk.set_handler(F_CODDITTA, period_handler);
msk.set_handler(F_ANNO, period_handler);
msk.set_handler(F_TIPO, tipo_handler);
msk.set_handler(F_SELECTION, selection_handler);
@ -680,8 +750,9 @@ bool TProgressivi_iva::set_print(int m)
_codditta = msk.get_long(F_CODDITTA);
_anno = msk.get_int(F_ANNO);
_datast = msk.get(F_DATASTAMPA);
_mese = msk.get_int(F_MESE);
_mese = msk.get_int(look_lia(_codditta) == 'M' ? F_MESE : F_TRIMESTRE);
_st_inizio_anno = msk.get_bool(F_STAMPA);
_tipo_prog_reg = *msk.get(F_TIPOPROGREG); // L <=> Solo liquidazione, V <=> Solo volume d'affari
prefix().set_codditta(_codditta);
TLocalisamfile attiv(LF_ATTIV);
@ -1164,20 +1235,30 @@ void TProgressivi_iva::preprocess_header()
set_header (soh++, (const char*)sep);
sep.fill('-');
set_header (soh++, (const char *) sep);
const char* pro_des = _tipo_prog_reg == 'L' ? "liquidazione IVA" : "Volume Affari";
/*
set_header (soh++, "Riepilogo progressivi IVA del periodo %s %d Cod. Att. %s %s", itom(_mese), _anno, (const char*) _cod_att, (const char*) descr);
set_header (soh++, (const char *) sep);
*/
*/
TString periodo;
if (f == 'M')
periodo = itom(_mese);
else
periodo.format("%d trimestre", ((_mese-1)/3) +1);
if (_st_inizio_anno)
{
if (_mese == 13 || (_mese == 12 && !_prima_pagina))
set_header(soh++, "Riepilogo progressivi IVA annuale %d Cod. Att. %s %s", _anno, (const char*) _cod_att, (const char*) descr);
set_header(soh++, "Riepilogo progressivi %s annuale %d Cod. Att. %s %s", pro_des, _anno, (const char*) _cod_att, (const char*) descr);
else
if (_prima_pagina)
set_header(soh++, "Riepilogo progressivi IVA del periodo %s %d Cod. Att. %s %s", itom(_mese), _anno, (const char*) _cod_att, (const char*) descr);
else set_header(soh++, "Riepilogo progressivi IVA al Mese di: %s %d Cod. Att. %s %s", itom(_mese), _anno, (const char*) _cod_att, (const char*) descr);
set_header(soh++, "Riepilogo progressivi %s del periodo %s %d Cod. Att. %s %s", pro_des, (const char*) periodo, _anno, (const char*) _cod_att, (const char*) descr);
else set_header(soh++, "Riepilogo progressivi %s al%s: %s %d Cod. Att. %s %s", pro_des, f == 'M' ? " Mese di" : "", (const char*) periodo, _anno, (const char*) _cod_att, (const char*) descr);
}
else set_header (soh++, "Riepilogo progressivi IVA del periodo %s %d Cod. Att. %s %s", itom(_mese), _anno, (const char*) _cod_att, (const char*) descr);
else set_header (soh++, "Riepilogo progressivi %s del periodo %s %d Cod. Att. %s %s", pro_des, (const char*) periodo, _anno, (const char*) _cod_att, (const char*) descr);
set_header (soh, (const char *) sep);
}
}

View File

@ -18,6 +18,8 @@
#define F_MESE 113
#define F_STAMPA 114
#define F_SELECTION 115
#define F_TIPOPROGREG 116
#define F_TRIMESTRE 117
#endif // __CG0400_H

View File

@ -47,8 +47,8 @@ BEGIN
PROMPT 2 5 "Tipo di stampa "
ITEM "1|Riepilogo progressivi per aliquota"
MESSAGE HIDE,2@|SHOW,3@
ITEM "2|Riepilogo progressivi per mese"
MESSAGE SHOW,2@|HIDE,1@
ITEM "2|Riepilogo progressivi per periodo"
MESSAGE HIDE,1@
END
RADIOBUTTON F_LIVELLO 24
@ -154,9 +154,9 @@ BEGIN
GROUP 2
END
LISTBOX F_MESE 11
LISTBOX F_MESE 12
BEGIN
PROMPT 2 11 "Mese riepilogo "
PROMPT 2 11 "Periodo riepilogo "
ITEM "1|Gennaio" MESSAGE ENABLE,F_STAMPA
ITEM "2|Febbraio" MESSAGE ENABLE,F_STAMPA
ITEM "3|Marzo" MESSAGE ENABLE,F_STAMPA
@ -173,6 +173,25 @@ BEGIN
GROUP 2
END
LISTBOX F_TRIMESTRE 12
BEGIN
PROMPT 2 11 "Periodo riepilogo "
ITEM "3|1 Trimestre" MESSAGE ENABLE,F_STAMPA
ITEM "6|2 Trimestre" MESSAGE ENABLE,F_STAMPA
ITEM "9|3 Trimestre" MESSAGE ENABLE,F_STAMPA
ITEM "12|4 Trimestre" MESSAGE ENABLE,F_STAMPA
ITEM "13|Annuale" MESSAGE "X", F_STAMPA|DISABLE,F_STAMPA
GROUP 2
END
LISTBOX F_TIPOPROGREG 18
BEGIN
PROMPT 35 11 "Tipo progressivi "
ITEM "L|Solo Liquidazione"
ITEM "V|Solo Volume Affari"
GROUP 2
END
BOOLEAN F_STAMPA
BEGIN
PROMPT 2 13 "Stampa progressivi da inizio anno "

View File

@ -12,7 +12,7 @@ int main(int argc,char** argv)
case 2:
cg1300(argc,argv); break; // Aggiornamenti
case 3:
cg1400(argc,argv); break; // Stampa versamenti
cg1400(argc,argv); break; // Stampa deleghe iva
case 4:
cg1500(argc,argv); break; // Stampa bilanci
case 5:

View File

@ -37,6 +37,7 @@ class TPrintclifo_app : public TPrintapp
int _sort;
int _interline;
bool _mov_only;
int _ges_ven;
TLocalisamfile* _mov;
TLocalisamfile* _comuni;
@ -58,6 +59,7 @@ public:
virtual bool check_autorization() const
{return FALSE;}
virtual void on_firm_change();
virtual bool preprocess_page(int file, int counter);
virtual bool preprocess_print(int file, int counter);
virtual print_action postprocess_print(int file, int counter);
@ -74,6 +76,8 @@ public:
{ return current_cursor()->curr(ln).get(fn); }
virtual void set_page (int file, int counter);
bool ges_ven();
void set_elenco();
void set_rubriche();
void set_etichette();
@ -88,7 +92,7 @@ public:
const char* descrizione_allegato(char,long);
TPrintclifo_app() : TPrintapp(),_piva(18), _cpercip(10), _fax(50), _telex(50),
_name(60), _telefono(90), _indir(70), _localita(90)
_name(60), _telefono(90), _indir(70), _localita(90), _ges_ven(-1)
{
_rel = NULL; _pr_type = undefined; _startrow = 2; _startcol = 3;
_rows_et = 9; _cols_et = 40;
@ -359,18 +363,13 @@ print_action TPrintclifo_app::postprocess_print(int file, int counter)
return NEXT_PAGE;
}
bool gest_vend()
{
TConfig c(CONFIG_DITTA,"cg");
return c.get_bool("GesVen");
}
bool rdbtype_handler(TMask_field& f, KEY k)
{
if (k == K_TAB)
//every time that change focus or value, check flag to enable button
{
if (gest_vend())
TPrintclifo_app& a = (TPrintclifo_app&)main_app();
if (a.ges_ven())
f.mask().enable(BUT_CG12_VENDITE);
else
f.mask().disable(BUT_CG12_VENDITE);
@ -785,7 +784,7 @@ void TPrintclifo_app::set_vendite(int f, int c)
FLD(LF_CFVEN,CFV_CODVETT2,"@@@"),
FLD(LF_CFVEN,CFV_CODVETT3,"@@@"));
set_row(8,"@9g@s @25g@pn @46g@pn @63g@n @76g@2s",
set_row(8,"@9g@s @25g@15,rpn @46g@15,rpn @63g@n @76g@2s",
FLD(LF_CFVEN,CFV_RAGGOR),FLD(LF_CFVEN,CFV_MINORD,"."),
FLD(LF_CFVEN,CFV_MAXORD,"."),FLD(LF_CFVEN,CFV_PREVORD),
FLD(LF_CFVEN,CFV_TIPOEVORD));
@ -973,13 +972,26 @@ bool TPrintclifo_app::preprocess_print(int file, int counter)
return TRUE;
}
void TPrintclifo_app::on_firm_change()
{
TConfig c(CONFIG_DITTA, "cg");
_ges_ven = c.get_bool("GesVen");
}
bool TPrintclifo_app::ges_ven()
{
if (_ges_ven < 0)
on_firm_change();
return _ges_ven != 0;
}
bool TPrintclifo_app::user_create()
{
// set relation and cursors
_rel = new TRelation(LF_CLIFO);
_rel->add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1, 0, COMRF_ALIAS);
_rel->add(LF_COMUNI, "STATO==STATONASC|COM==COMNASC", 1, 0, COMNASC_ALIAS);
if (gest_vend())
if (ges_ven())
{
_rel->add(LF_CFVEN,"TIPOCF=TIPOCF|CODCF=CODCF");
_rel->add(LF_INDSP,"TIPOCF=TIPOCF|CODCF=CODCF");
@ -990,11 +1002,12 @@ bool TPrintclifo_app::user_create()
_cur_1 = add_cursor(new TCursor(_rel,"",1));
_cur_2 = add_cursor(new TCursor(_rel,"",2));
add_file(LF_CLIFO);
if (gest_vend())
if (ges_ven())
{
add_file(LF_CFVEN,LF_CLIFO);
add_file(LF_INDSP,LF_CLIFO);
}
set_magic_currency(TRUE);
enable_print_menu();
return TRUE;
}

View File

@ -1,12 +1,12 @@
#include <applicat.h>
#include <config.h>
#include <urldefid.h>
#include <form.h>
#include <mask.h>
#include <printer.h>
#include <relation.h>
#include <sheet.h>
#include <tabutil.h>
#include <urldefid.h>
#include <utility.h>
#include "cg1400.h"
@ -53,7 +53,7 @@ bool TStampa_deleghe_IVA::create()
_banche = new TTable("%BAN");
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Deleghe da stampare",
_ditte = new TArray_sheet(3, 3, -3, -3, "Selezione Deleghe da stampare",
"@1|Cod.@5|Ragione Sociale@30|Importo@15R|Interessi@15R|ABI@5|CAB@5|Concessione|Tit. Conto Fis.");
_azienda = "" ;

View File

@ -2016,8 +2016,9 @@ bool TStampa_IVdirettiva::calcola(int g, int c, long s,
continue;
const TString& codcaus = mov.get(MOV_CODCAUS);
const char movap = toupper(causali.decode(codcaus)[0]);
char movap = causali.decode(codcaus)[0];
movap = toupper(movap);
if (movap == 'C' && // la causale e' di chiusura
!_quadratura) // Non e' richiesta la quadratura con il Libro Giornale (Modifica
continue; // del 18-06-96 richiesta da Patrizia in seguito alla modifica dei SALDI

View File

@ -183,18 +183,6 @@ TMask* TPrimanota_application::load_mask(int n)
return m;
}
void TPrimanota_application::open_files(int logicnum, ...)
{
va_list marker;
va_start(marker, logicnum);
while (logicnum > 0)
{
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
_file.add(new TLocalisamfile(logicnum), logicnum);
logicnum = va_arg(marker, int);
}
}
bool TPrimanota_application::user_create()
{
open_files(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_RCAUSALI, LF_CLIFO, LF_PCON, 0);
@ -241,8 +229,6 @@ bool TPrimanota_application::user_destroy()
delete _incasso;
close_files();
return TRUE;
}
@ -724,14 +710,14 @@ void TPrimanota_application::init_modify_mode(TMask& m)
bool TPrimanota_application::test_swap(bool ritsoc)
{
const char sez = ritsoc ? causale().sezione_ritsoc() : causale().sezione_clifo();
const bool s = (iva() == iva_vendite) ^ sez == 'D';
const bool s = (iva() == iva_vendite) ^ (sez == 'D');
return s;
}
int TPrimanota_application::read(TMask& m)
{
m.reset(); // Azzera campi e relativi dirty = 3
m.autoload(*_rel); // Carica testata
m.autoload(*_rel); // Carica testata
const long numreg = _rel->curr().get_long(MOV_NUMREG);
@ -746,12 +732,12 @@ int TPrimanota_application::read(TMask& m)
ivas().reset(); // Azzera tutte le righe iva
occas_mask().reset();
const TString16 occode(_rel->lfile().get("OCFPI"));
const TString16 occode(_rel->curr().get("OCFPI"));
occas_mask().set(O_CODICE, occode, TRUE);
}
_saldi.reset(); // Azzera saldi
_saldi.set_movprovv(_rel->lfile().get_char(MOV_PROVVIS) > ' ');
_saldi.set_movprovv(_rel->curr().get_char(MOV_PROVVIS) > ' ');
tiposal tsal = causale().apertura() ? apertura :
(causale().chiusura() ? chiusura : normale);
_saldi.set_tipo_saldo(tsal);
@ -806,7 +792,7 @@ int TPrimanota_application::read(TMask& m)
{
real totdoc(m.get(F_TOTALE));
totdoc = -totdoc;
m.set(F_TOTALE, totdoc.string());
m.set(F_TOTALE, totdoc);
}
for (i = 0; i < _rel->iva_items(); i++)
{
@ -1111,6 +1097,7 @@ int TPrimanota_application::write(const TMask& m)
link_m770();
link_cesp(m, "Insert");
link_intra(m, "Insert");
}
lasterr = err;
@ -1154,6 +1141,7 @@ int TPrimanota_application::rewrite(const TMask& m)
link_m770();
link_cesp(m, "Modify");
link_intra(m, "Modify");
}
return err;
@ -1184,6 +1172,7 @@ bool TPrimanota_application::remove()
}
}
link_cesp(m, "Remove");
link_intra(m, "Remove");
if (easydoc_connected())
run_easydoc("Elimina");
@ -1689,25 +1678,83 @@ bool TPrimanota_application::link_cesp(const TMask& msk, const char* action)
return ok;
}
bool TPrimanota_application::link_intra(const TMask& m, const char* action)
{
// Controlla autorizzazione
if (!has_module(INAUT))
return FALSE;
// Controlla flag sulla causale
if (!causale().intra())
return FALSE;
// Controlla l'esistenza del programma cespiti
if (!fexist("in0.exe"))
return FALSE;
TFilename intrini;
intrini.tempdir();
intrini.add("ActIntra.ini");
TConfig intro(intrini, "Transaction");
intro.set("Action", action);
TString str; // Stringa jolly di lavoro
str.format("%d", LF_INTRA);
intro.set_paragraph(str);
intro.set("NUMREG", m.get(F_NUMREG));
if (m.field(F_CLIENTE).shown())
{
intro.set("TIPOMOV", "C");
intro.set("TIPOCF", "C");
intro.set("CODCF", m.get(F_CLIENTE));
}
else
{
intro.set("TIPOMOV", "A");
intro.set("TIPOCF", "F");
intro.set("CODCF", m.get(F_FORNITORE));
}
intro.set("TOTDOC", m.get(F_CORRLIRE));
intro.set("CODVAL", m.get(F_VALUTAINTRA));
intro.set("CAMBIO", m.get(F_CAMBIOINTRA));
intro.set_paragraph(""); // Flush
str = "in0 -4 /i"; str << intrini;
TExternal_app app(str);
bool ok = app.run() == 0;
::remove(intrini);
return ok;
}
bool TPrimanota_application::protected_record(TRectype& mov)
{
bool ok = !TRelation_application::protected_record(mov);
if (ok && autodeleting() == 0x3)
{
if (mov.get_bool(MOV_STAMPATO))
{
{
static long last_checked_numreg = 0L;
const long numreg = mov.get_long(MOV_NUMREG);
ok = yesno_box("Il movimento %ld e' gia' stato stampato sul libro giornale:\n"
"si desidera eliminarlo ugualmente?", numreg);
if (ok && mov.get_bool(MOV_REGST))
if (last_checked_numreg != numreg)
{
ok = yesno_box("Il movimento %ld e' gia' stato stampato sul bollato:\n"
"si desidera eliminarlo ugualmente?", numreg);
}
if (ok && mov.get_bool(MOV_INVIATO))
{
ok = yesno_box("Il movimento %ld e' stato inviato ad un'altra contabilita':\n"
ok = yesno_box("Il movimento %ld e' gia' stato stampato sul libro giornale:\n"
"si desidera eliminarlo ugualmente?", numreg);
if (ok && mov.get_bool(MOV_REGST))
{
ok = yesno_box("Il movimento %ld e' gia' stato stampato sul bollato:\n"
"si desidera eliminarlo ugualmente?", numreg);
}
if (ok && mov.get_bool(MOV_INVIATO))
{
ok = yesno_box("Il movimento %ld e' stato inviato ad un'altra contabilita':\n"
"si desidera eliminarlo ugualmente?", numreg);
}
if (ok)
last_checked_numreg = numreg;
}
}
}

View File

@ -213,22 +213,21 @@ BEGIN
WARNING "E' stata specificata una valuta senza il cambio relativo"
END
NUMBER F_TOTALE 18
CURRENCY F_TOTALE 18
BEGIN
PROMPT 2 12 "Importo movimento "
PICTURE "."
GROUP 5
FIELD TOTDOC
VALIDATE REQIF_FUNC 1 SK_TOTDOCVAL
MESSAGE COPY,K_TOTALE
END
NUMBER SK_TOTDOCVAL 18 3
CURRENCY SK_TOTDOCVAL 18
BEGIN
PROMPT 44 12 "Totale in valuta "
PICTURE ".3"
PROMPT 41 12 "Totale in valuta "
GROUP 3 5
VALIDATE REQIF_FUNC 1 F_TOTALE
DRIVENBY SK_VALUTA
FIELD TOTDOCVAL
END
@ -307,18 +306,16 @@ BEGIN
FLAGS "D"
END
NUMBER K_TOTALE 18
CURRENCY K_TOTALE 18
BEGIN
PROMPT 1 7 "Imp. mov. "
PICTURE "."
FLAGS "D"
GROUP 5
END
NUMBER K_RESIDUO 18
CURRENCY K_RESIDUO 18
BEGIN
PROMPT 32 7 "Residuo "
PICTURE "."
FLAGS "D"
GROUP 5
END
@ -352,18 +349,16 @@ BEGIN
ITEM "Tipo@4"
END
NUMBER F_DARE 18
CURRENCY F_DARE 18
BEGIN
PROMPT 1 -1 "Sbilancio Dare "
FLAGS "DRV"
PICTURE "."
END
NUMBER F_AVERE 18
CURRENCY F_AVERE 18
BEGIN
PROMPT 41 -1 "Sbilancio Avere "
FLAGS "DRV"
PICTURE "."
END
ENDPAGE

View File

@ -436,7 +436,7 @@ BEGIN
DISPLAY "Cod" CODTAB[1,3]
DISPLAY "Data@10" D0
DISPLAY "Cambio@18" R10
DISPLAY "Valuta@60" 104@->S0
DISPLAY "Valuta@50" 104@->S0
OUTPUT SK_DATACAMBIO D0
OUTPUT SK_CAMBIO R10
GROUP 3
@ -454,20 +454,19 @@ BEGIN
WARNING "Inserire il cambio o eliminare il codice valuta"
END
NUMBER F_TOTALE 18
CURRENCY F_TOTALE 18
BEGIN
PROMPT 1 14 "Totale documento "
FIELD TOTDOC
PICTURE "."
END
NUMBER SK_TOTDOCVAL 18 3
CURRENCY SK_TOTDOCVAL 18
BEGIN
PROMPT 38 14 "in valuta "
FIELD TOTDOCVAL
GROUP 3
PICTURE ".3"
VALIDATE REQIF_FUNC 1 F_TOTALE
DRIVENBY SK_VALUTA
END
STRING F_CODIVA 4
@ -486,20 +485,16 @@ BEGIN
WARNING "Codice IVA assente"
END
NUMBER F_RITFIS 18
CURRENCY F_RITFIS 18
BEGIN
PROMPT 1 15 "Ritenute fiscali "
FIELD RITFIS
FLAGS "RV"
PICTURE "."
END
NUMBER F_RITSOC 18
CURRENCY F_RITSOC 18
BEGIN
PROMPT 1 16 "Ritenute sociali "
FIELD RITSOC
FLAGS "RV"
PICTURE "."
END
DATE F_DATA74TER
@ -551,21 +546,20 @@ BEGIN
PICTURE ".5"
END
NUMBER F_CORRLIRE 18
CURRENCY F_CORRLIRE 18
BEGIN
PROMPT 1 18 "Corrispett. Lire "
PROMPT 1 18 "Corrispettivo "
FIELD CORRLIRE
PICTURE "."
GROUP 4
END
NUMBER F_CORRVALUTA 18 3
CURRENCY F_CORRVALUTA 18
BEGIN
PROMPT 39 18 "Corrispet. valuta "
FIELD CORRVALUTA
PICTURE ".3"
GROUP 4
VALIDATE REQIF_FUNC 1 F_VALUTAINTRA
DRIVENBY F_VALUTAINTRA
END
ENDPAGE
@ -622,18 +616,16 @@ BEGIN
ITEM "Descrizione Conto@50"
END
NUMBER F_IMPONIBILI 18
CURRENCY F_IMPONIBILI 18
BEGIN
PROMPT 1 11 "Totale imponibili "
FLAGS "DV"
PICTURE "."
FLAGS "D"
END
NUMBER F_IMPOSTE 18
CURRENCY F_IMPOSTE 18
BEGIN
PROMPT 41 11 "Totale imposte "
FLAGS "DV"
PICTURE "."
FLAGS "D"
END
SPREADSHEET F_SHEETCG 0 -2
@ -657,18 +649,16 @@ BEGIN
ITEM "Tipo@4"
END
NUMBER F_DARE 18
CURRENCY F_DARE 18
BEGIN
PROMPT 1 -1 "Sbilancio Dare "
FLAGS "DRV"
PICTURE "."
FLAGS "D"
END
NUMBER F_AVERE 18
CURRENCY F_AVERE 18
BEGIN
PROMPT 41 -1 "Sbilancio Avere "
FLAGS "DRV"
PICTURE "."
FLAGS "D"
END
ENDPAGE

View File

@ -94,13 +94,11 @@ BEGIN
ITEM "A|Avere"
END
NUMBER F_TOTALE 15
CURRENCY F_TOTALE 15
BEGIN
PROMPT 18 7 ""
HELP "Importo del conto di prima riga"
FIELD LF_MOV->TOTDOC
FLAGS "R"
PICTURE "."
CHECKTYPE REQUIRED
MESSAGE COPY,I_IMPORTO2
END
@ -198,12 +196,10 @@ BEGIN
ITEM "A|Avere"
END
NUMBER I_IMPORTO2 15
CURRENCY I_IMPORTO2 15
BEGIN
PROMPT 18 8 ""
HELP "Importo del conto di seconda riga"
PICTURE "."
FLAGS "R"
END
LIST DLG_NULL 1 10
@ -252,12 +248,10 @@ BEGIN
ITEM "A|Avere"
END
NUMBER I_IMPORTO3 15
CURRENCY I_IMPORTO3 15
BEGIN
PROMPT 18 9 ""
HELP "Importo del conto di terza riga"
PICTURE "."
FLAGS "R"
END
LIST DLG_NULL 1 10
@ -304,12 +298,10 @@ BEGIN
ITEM "A|Avere"
END
NUMBER I_IMPORTO4 15
CURRENCY I_IMPORTO4 15
BEGIN
PROMPT 18 10 ""
HELP "Importo del conto di quarta riga"
PICTURE "."
FLAGS "R"
END
LIST DLG_NULL 1 10

View File

@ -51,5 +51,3 @@ END
ENDPAGE
ENDMASK

View File

@ -60,6 +60,10 @@
#define S_VALUTA 138
#define S_DATACAMBIO 139
#define S_CAMBIO 140
#define S_CODVAL 327
#define S_DESCVSABID 141
#define S_DESCNSABID 142
#endif

View File

@ -69,18 +69,17 @@ BEGIN
FLAGS "U"
END
NUMBER P_RESIDUO 18
CURRENCY P_RESIDUO 18
BEGIN
PROMPT 25 3 "Residuo "
FLAGS "D"
PICTURE "."
END
NUMBER P_RESIDUOVAL 18 3
CURRENCY P_RESIDUOVAL 18
BEGIN
PROMPT 53 3 ""
FLAGS "D"
PICTURE ".3"
DRIVENBY P_VALUTA
END
SPREADSHEET P_PARTITE 0 7

View File

@ -49,12 +49,12 @@ END
NUMBER S_NUMPROT 5
BEGIN
PROMPT 56 2 "Protocollo IVA "
FLAGS "DR"
FLAGS "D"
END
STRING S_DESCR 50
STRING S_DESCR 51
BEGIN
PROMPT 2 3 "Descrizione "
PROMPT 2 3 "Descrizione "
FLAGS "D"
END
@ -66,61 +66,62 @@ BEGIN
FLAGS "D"
END
NUMBER S_IMPORTO_SCAD 18
CURRENCY S_IMPORTO_SCAD 18
BEGIN
PROMPT 18 4 "Importo "
PICTURE "."
FLAGS "DR"
PROMPT 17 4 "Importo "
FLAGS "D"
END
NUMBER S_IMPORTOVAL_SCAD 18 3
STRING S_CODVAL 3
BEGIN
PROMPT 43 4 "Importo in valuta "
PICTURE ".3"
FLAGS "DRV"
PROMPT 41 9 "Codice valuta "
FLAGS "DU"
END
CURRENCY S_IMPORTOVAL_SCAD 18
BEGIN
PROMPT 45 4 "in valuta "
FLAGS "D"
DRIVENBY S_CODVAL
GROUP 3
END
NUMBER S_RESIDUOPAG 18
CURRENCY S_RESIDUOPAG 18
BEGIN
PROMPT 2 5 "Residuo pagamento "
PICTURE "."
FLAGS "DR"
PROMPT 2 5 "Residuo pagamento "
FLAGS "D"
END
NUMBER S_RESIDUORATA 18
CURRRENCY S_RESIDUORATA 18
BEGIN
PROMPT 46 5 "Residuo rata "
PICTURE "."
FLAGS "DRV"
PROMPT 45 5 "Residuo rata "
FLAGS "D"
END
GROUPBOX DLG_NULL 78 12
GROUPBOX DLG_NULL 78 14
BEGIN
PROMPT 1 7 "@BPagamento"
END
NUMBER S_IMPORTO 18
CURRENCY S_IMPORTO 18
BEGIN
PROMPT 2 8 "Importo pagamento "
PICTURE "."
FIELD IMPORTO
VALIDATE REQIF_FUNC 1 S_IMPORTOVAL
WARNING "L'importo deve essere specificato"
END
NUMBER S_RITENUTE 18
CURRENCY S_RITENUTE 18
BEGIN
PROMPT 41 8 "Ritenute profess. "
PICTURE "."
FIELD RITENUTE
MESSAGE DIRTY,S_IMPORTO|K_TAB,S_IMPORTO
END
NUMBER S_IMPORTOVAL 18 3
CURRENCY S_IMPORTOVAL 18
BEGIN
PROMPT 2 9 "Importo in valuta "
PICTURE ".3"
DRIVENBY S_CODVAL
FIELD IMPORTOVAL
GROUP 3
VALIDATE REQIF_FUNC 1 S_IMPORTO
@ -251,6 +252,20 @@ NUMBER S_VSABI 5
BEGIN
PROMPT 2 15 "Vs. Banca ABI "
FLAGS "Z"
USE %BAN SELECT CODTAB ? "?????"
INPUT CODTAB[1,5] S_VSABI
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "Denominazione@50" S0
OUTPUT S_VSABI CODTAB[1,5]
OUTPUT S_DESCVSABID S0
CHECKTYPE NORMAL
FIELD CODABI
END
NUMBER S_VSCAB 5
BEGIN
PROMPT 25 15 "CAB "
FLAGS "Z"
USE %BAN
INPUT CODTAB[1,5] S_VSABI
INPUT CODTAB[6,10] S_VSCAB
@ -261,15 +276,6 @@ BEGIN
OUTPUT S_VSCAB CODTAB[6,10]
OUTPUT S_DESCVSABI S0
CHECKTYPE NORMAL
FIELD CODABI
END
NUMBER S_VSCAB 5
BEGIN
PROMPT 25 15 "CAB "
FLAGS "Z"
COPY ALL S_VSABI
CHECKTYPE NORMAL
FIELD CODCAB
END
@ -281,13 +287,20 @@ BEGIN
DISPLAY "Denominazione@50" S0
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
COPY OUTPUT S_VSABI
COPY OUTPUT S_VSCAB
CHECKTYPE NORMAL
END
STRING S_DESCVSABID 50 37
BEGIN
PROMPT 37 16 ""
CHECKTYPE NORMAL
FLAGS "D"
END
STRING S_AGENTE 5
BEGIN
PROMPT 2 16 "Agente "
PROMPT 2 17 "Agente "
FLAGS "UZ"
USE LF_AGENTI
INPUT CODAGE S_AGENTE
@ -301,7 +314,7 @@ END
STRING S_DESCAGENTE 50
BEGIN
PROMPT 24 16 ""
PROMPT 24 17 ""
USE LF_AGENTI KEY 2
INPUT RAGSOC S_DESCAGENTE
DISPLAY "Descrizione @50" RAGSOC
@ -312,38 +325,49 @@ END
NUMBER S_NSABI 5
BEGIN
PROMPT 2 17 "Ns. Banca ABI "
PROMPT 2 18 "Ns. Banca ABI "
FLAGS "Z"
COPY USE S_VSABI
INPUT CODTAB[1,5] S_NSABI
INPUT CODTAB[6,10] S_NSCAB
COPY DISPLAY S_VSABI
OUTPUT S_NSABI CODTAB[1,5]
OUTPUT S_NSCAB CODTAB[6,10]
OUTPUT S_DESCNSABI S0
OUTPUT S_DESCNSABID S0
FIELD CODABIPR
CHECKTYPE NORMAL
END
NUMBER S_NSCAB 5
BEGIN
PROMPT 25 17 "CAB "
PROMPT 25 18 "CAB "
FLAGS "Z"
COPY ALL S_NSABI
COPY USE S_VSCAB
INPUT CODTAB[1,5] S_NSABI
INPUT CODTAB[6,10] S_NSCAB
COPY DISPLAY S_VSCAB
OUTPUT S_NSABI CODTAB[1,5]
OUTPUT S_NSCAB CODTAB[6,10]
OUTPUT S_DESCNSABI S0
FIELD CODCABPR
CHECKTYPE NORMAL
END
STRING S_DESCNSABI 50 37
BEGIN
PROMPT 37 17 ""
PROMPT 37 18 ""
COPY USE S_DESCVSABI
INPUT S0 S_DESCNSABI
COPY DISPLAY S_DESCVSABI
COPY OUTPUT S_NSABI
COPY OUTPUT S_NSCAB
CHECKTYPE NORMAL
END
STRING S_DESCNSABID 50 37
BEGIN
PROMPT 37 19 ""
CHECKTYPE NORMAL
FLAGS "D"
END
ENDPAGE
ENDMASK

View File

@ -1,4 +1,5 @@
#include <colors.h>
#include <currency.h>
#include <msksheet.h>
#include <progind.h>
#include <urldefid.h>
@ -55,7 +56,8 @@ const real& TPrimanota_application::cod2IVA(const TMask& m)
// Certified 99% Non sono sicurissimo degli imponibili negativi
real TPrimanota_application::scorpora(real& imponibile, const real& percent)
{
real imposta = abs(imponibile) * percent / (percent + 100.0); imposta.ceil();
real imposta = abs(imponibile) * percent / (percent + 100.0);
imposta.ceil(TCurrency::get_firm_dec());
if (imponibile.sign() < 0) imposta = -imposta;
imponibile -= imposta;
return imposta;
@ -532,23 +534,28 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
{
TImporto cassa(impsal); cassa.swap_section();
TImporto residuo(imptot); residuo -= cassa; residuo.normalize(imptot.sezione());
bool ok = residuo.is_zero();
if (!ok)
{
const char* const pic = val ? ".3" : ".";
if (!residuo.is_zero())
{
TPrimanota_application& a = app();
const TMask& m = a.curr_mask();
TString16 codval; if (val) codval = m.get(SK_VALUTA);
TCurrency euro(imptot.valore(), codval);
TString msg(255);
msg << "Il totale documento ";
if (val)
msg << "in valuta " << m.get(SK_VALUTA);
if (codval.not_empty())
msg << "in valuta " << codval;
else
msg << "inserito";
msg << " e' " << imptot.valore().string(pic) << ' ' << imptot.sezione() << ",\n";
msg << "inserito";
msg << " e' " << euro.string(TRUE) << ' ' << imptot.sezione() << ",\n";
euro.set_num(cassa.valore());
msg << "i pagamenti e le spese ammontano a "
<< cassa.valore().string(pic) << ' ' << cassa.sezione() << ",\n";
msg << "per cui il residuo e' " << residuo.valore().string(pic) << '.';
<< euro.string(TRUE) << ' ' << cassa.sezione() << ",\n";
euro.set_num(residuo.valore());
msg << "per cui il residuo e' " << euro.string(TRUE) << '.';
if (m.edit_mode() && impsal.is_zero())
{
@ -569,11 +576,11 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
if (k == K_ENTER)
{
TPrimanota_application& a = app();
const real saldo = a.calcola_saldo();
const TCurrency saldo(a.calcola_saldo());
if (saldo != ZERO)
if (!saldo.get_num().is_zero())
{
const char* ss = saldo.string(".");
const char* ss = saldo.string(TRUE);
if (*ss == '-') ss++;
return f.error_box("Il movimento e' sbilanciato di %s lire.", ss);
}
@ -624,8 +631,9 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
if (errato)
{
TString msg(128);
const TCurrency euro(speso.valore());
msg << "L'importo sul saldaconto della riga " << currig << " e' "
<< speso.valore().string(".");
<< euro.string(TRUE);
if (!speso.is_zero())
msg << (speso.sezione() == 'A' ? " Avere" : " Dare");
@ -819,7 +827,6 @@ void TPrimanota_application::generazione_righe_cg(int r)
}
}
int TPrimanota_application::crea_somma_spese(TImporto& imp)
{
TBill cassa; causale().bill(2, cassa);
@ -876,9 +883,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
else
{
if (tipo == 'K')
{
a.notify_cgline_deletion(r+1);
}
break;
}
case K_ENTER:
@ -973,7 +978,7 @@ bool TPrimanota_application::descr_handler(TMask_field& f, KEY k)
if (k == K_ENTER && f.get().empty())
{
if (f.mask().get(F_CODCAUS).empty())
return f.error_box("La descrizione del documento e' necessaria in mancanza della causale");
return f.error_box("La descrizione del documento e' necessaria in assenza della causale");
}
return TRUE;
}
@ -1139,13 +1144,14 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
const real imponibile(f.mask().get(101));
const real percent = app().causale().corrispettivi() ? ZERO : cod2IVA(f.mask());
real imposta = abs(imponibile) * percent / 100.0;
imposta.ceil();
imposta.ceil(TCurrency::get_firm_dec());
if (imponibile.sign() < 0) imposta = -imposta;
const real val(f.get());
if (val != imposta)
{
f.warning_box("L'imposta dovrebbe essere %s", (const char*)imposta.string("."));
{
const TCurrency euro(imposta);
f.warning_box("L'imposta dovrebbe essere %s", euro.string(TRUE));
}
} else
if (key == K_F8)
@ -1153,10 +1159,11 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key)
real imposta(f.get());
if (imposta.is_zero())
{
real imponibile(f.mask().get(101));
TMask& m = f.mask();
real imponibile(m.get(101));
const real& percent = cod2IVA(f.mask());
imposta = scorpora(imponibile, percent);
f.mask().set(101, imponibile.string());
m.set(101, imponibile);
f.set(imposta.string());
}
else
@ -1261,7 +1268,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
if (ri == 4) // Se non esiste il conto IVA indetraibile ...
{ // ... somma imponibile e imposta
oldimp += oldiva;
oldiva.set('D', 0.0);
oldiva.set('D', ZERO);
}
}
@ -1432,16 +1439,17 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
{
if ((k == K_TAB && !f.mask().is_running()) || k == K_ENTER)
{
const real imp = app().calcola_imp();
const TCurrency imp(app().calcola_imp());
if (k == K_ENTER)
{
const real tot = app().totale_documento();
const TCurrency tot(app().totale_documento());
if (imp != tot)
{
const TString t(tot.string("."));
const TString i(imp.string("."));
const TString t(tot.string(TRUE));
const TString i(imp.string(TRUE));
return error_box("La somma del totale documento e delle ritenute (%s) e' diverso dalla "
"somma degli imponibili e delle imposte (%s)", (const char*)t, (const char*)i);
"somma degli imponibili e delle imposte (%s)",
(const char*)t, (const char*)i);
}
TSheet_field& iva = app().ivas();
@ -2266,8 +2274,8 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
if (key == K_ENTER)
{
const real totale(f.get());
if (totale.is_zero())
const TCurrency totale(real(f.get()));
if (totale.get_num().is_zero())
ok = yesno_box("Totale documento nullo: continuare ugualmente?");
if (ok)
@ -2276,10 +2284,10 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
if (cambio.in_valuta())
{
const real totval(m.get(SK_TOTDOCVAL));
const real totlit = cambio.val2lit(totval);
const TCurrency totlit(cambio.val2lit(totval));
if (totale != totlit)
ok = f.yesno_box("Il totale documento in lire dovrebbe essere %s: continuare ugualmente?",
totlit.string("."));
totlit.string(TRUE));
}
}
}

View File

@ -29,7 +29,6 @@ class TDati_incasso;
class TPrimanota_application : public TRelation_application
{
TArray _file; // Tutti i fiels da usare
TMovimentoPN* _rel; // Relazione principale
TPagamento* _pag;
@ -177,8 +176,6 @@ protected:
TMask* load_mask(int n);
TMask& occas_mask() { return *load_mask(3); }
void open_files(int logicnum, ...);
void close_files() { _file.destroy(); }
void mask2rel(const TMask& m);
@ -268,6 +265,7 @@ protected:
long calcola_m770(int tipo_coll, real& spese, real& compenso, real& iva, real& ritfis);
bool link_m770();
bool link_cesp(const TMask& msk, const char* action);
bool link_intra(const TMask& msk, const char* action);
public:
static char row_type(const TToken_string& s);

View File

@ -3,6 +3,7 @@
// fv 24/8/94
// --------------------------------------------------------------------------
#include <currency.h>
#include <msksheet.h>
#include <utility.h>
@ -239,7 +240,8 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
return f.error_box(s);
}
const bool in_valuta = m.get(SK_VALUTA).not_empty();
const TString& codval = m.get(SK_VALUTA);
const bool in_valuta = pag.in_valuta();
real imp;
if (key == K_ENTER && m.edit_mode())
@ -253,9 +255,10 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
if (imp != tot)
{
const char* const pic = in_valuta ? ".3" : ".";
const TString is(imp.string(pic));
const TString ts(tot.string(pic));
TCurrency curr(imp, in_valuta ? (const char*)codval : "_FIRM");
const TString is = curr.string(TRUE);
curr.set_num(tot);
const TString ts = curr.string(TRUE);
ok = yesno_box("Il totale delle rate e' %s mentre\n"
"il totale del documento e' %s.\n"
"Si desidera registrare ugualmente?",
@ -273,9 +276,11 @@ bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
imp.round(pag.round(FALSE));
if (imp != totlit)
{
const TString is(imp.string("."));
const TString ts(totlit.string("."));
{
TCurrency curr(imp, "_FIRM");
const TString is = curr.string(TRUE);
curr.set_num(totlit);
const TString ts = curr.string(TRUE);
ok = yesno_box("Il totale in lire delle rate e' %s mentre\n"
"il totale del documento e' %s.\n"
"Si desidera registrare ugualmente?",
@ -475,6 +480,7 @@ bool TPrimanota_application::datacambio_handler(TMask_field& f, KEY key)
{
if (app().is_fattura())
f.mask().set(FS_DATACAMBIO, f.get()); // Copia a pagina 3
::handler_data_cambio(f, key);
}
return TRUE;
}
@ -638,7 +644,7 @@ bool TPrimanota_application::rataval_handler(TMask_field& f, KEY key)
{
const TValuta v(app().curr_mask(), FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO);
const real other(f.mask().get(102));
TString16 s(v.lit2val(other).string());
TString80 s(v.lit2val(other).string());
f.set(s);
}
}
@ -694,7 +700,7 @@ void TPrimanota_application::set_totale_pagamento(bool update)
const real imposval = cambio.lit2val(imposta);
const real imponval = m.get_real(SK_TOTDOCVAL) - imposval;
pag.set_total_valuta(imponval, imposval, spese, cambio.cambio(),
imponibile, imposta, spese);
imponibile, imposta, spese, cambio.codice());
}
else
{
@ -711,8 +717,8 @@ void TPrimanota_application::set_totale_pagamento(bool update)
void TPrimanota_application::set_scadenze(TMask& m)
{
const TString cp(m.get(F_CODPAG));
const TString dt(m.get(F_DATADOC));
const TString16 cp(m.get(F_CODPAG));
const TString16 dt(m.get(F_DATADOC));
set_pagamento(cp, dt);
set_totale_pagamento(FALSE);
@ -1023,9 +1029,10 @@ bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
if (importo != speso)
{
TString msg(128);
TString msg(128);
const TCurrency curr(speso.valore(), "_FIRM");
msg << "L'importo sul saldaconto della riga " << (riga+1) << " e' "
<< speso.valore().string(".");
<< curr.string(TRUE);
if (!speso.is_zero())
msg << (speso.sezione() == 'A' ? " Avere" : " Dare");
return f.error_box(msg);
@ -1276,7 +1283,9 @@ bool TPrimanota_application::notify_cgline_deletion(TPartita& partita, long nreg
bool TPrimanota_application::notify_cgline_deletion(int numrig)
{
bool found = FALSE;
const long nreg = curr_mask().get_long(F_NUMREG);
const TMask& m = curr_mask();
const long nreg = m.insert_mode() ? NUMREG_PROVVISORIO : m.get_long(F_NUMREG);
// if (curr_mask().edit_mode())
// partite().add_numreg(nreg); // Gia' fatto dalla read

View File

@ -13,25 +13,22 @@ BEGIN
PROMPT 0 1 "@bScadenzario"
END
NUMBER F_IMPONIBILE 15
CURRENCY F_IMPONIBILE 15
BEGIN
PROMPT 2 2 "Imponibile "
PICTURE "."
FLAGS "DR"
FLAGS "D"
END
NUMBER F_IMPOSTA 15
CURRENCY F_IMPOSTA 15
BEGIN
PROMPT 29 2 "Imposta "
PICTURE "."
FLAGS "DR"
FLAGS "D"
END
NUMBER F_SPESE 15
CURRENCY F_SPESE 15
BEGIN
PROMPT 53 2 "Spese "
PICTURE "."
FLAGS "DR"
FLAGS "D"
END

View File

@ -1,3 +1,4 @@
#include <currency.h>
#include <defmask.h> // Serve per DLG_NEWREC
#include <msksheet.h>
#include <colors.h> // Colori righe
@ -43,7 +44,7 @@ protected:
static bool nuovo_handler(TMask_field& f, KEY k);
static bool cambio_handler(TMask_field& f, KEY k);
void add_importo(TToken_string& s, const TImporto& i, bool val = FALSE, int pos = -1);
void add_importo(TToken_string& s, const TImporto& i, const char* val = NULL, int pos = -1);
void add_descrizione(TToken_string& s, const TRiga_partite& riga, int pos = -1);
TImporto get_importo(TToken_string& s, int pos) const;
@ -276,6 +277,8 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
if (!in_valuta && prima_riga)
in_valuta = app().gestione_valuta();
enable(E_VALUTA, prima_riga); // La valuta puo' essere cambiata solo sulle partite nuove
#else
set(S_CODVAL, fatt.codice_valuta()); // Copia in maschera la valuta
#endif
show(-3, in_valuta); // Visualizza campi relativi alla valuta
attiva_valuta(in_valuta); // Attiva campi e handlers relativi alla valuta
@ -494,7 +497,8 @@ bool TPay_mask::saldo_handler(TMask_field& f, KEY k)
{
TMask& m = f.mask();
m.set_mode(MODE_QUERY);
TMask_field& imp = m.field(m.field(S_IMPORTOVAL).active() ? S_IMPORTOVAL : S_IMPORTO);
const bool valuta = m.field(S_IMPORTOVAL).active();
TMask_field& imp = m.field(valuta ? S_IMPORTOVAL : S_IMPORTO);
imp.set_dirty();
imp.on_hit();
m.set_mode(NO_MODE);
@ -895,7 +899,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
gm.add_descrizione(riga_fattura, riga);
gm.add_importo(riga_fattura, riga.importo(FALSE, 0x1));
if (in_valuta)
gm.add_importo(riga_fattura, riga.importo(TRUE, 0x1), TRUE);
gm.add_importo(riga_fattura, riga.importo(TRUE, 0x1), prima_valuta.codice());
else
riga_fattura.add("");
riga_fattura.add(riga.get(PART_NREG));
@ -912,9 +916,9 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
row = riga_fattura;
row.add(ra, 1);
row.add(scad.get(SCAD_DATASCAD), 3);
gm.add_importo(row, scad.importo(FALSE), FALSE, 5);
gm.add_importo(row, scad.importo(FALSE), NULL, 5);
if (in_valuta)
gm.add_importo(row, scad.importo(TRUE), TRUE, 6);
gm.add_importo(row, scad.importo(TRUE), prima_valuta.codice(), 6);
const TString& descr = scad.get(SCAD_DESCR);
if (descr.not_empty())
@ -940,7 +944,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (in_valuta)
{
gm.add_importo(row, imp);
gm.add_importo(row, TImporto(sez, pag.get_real(PAGSCA_IMPORTOVAL)), TRUE);
gm.add_importo(row, TImporto(sez, pag.get_real(PAGSCA_IMPORTOVAL)), prima_valuta.codice());
}
else
{
@ -981,12 +985,12 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
{
TImporto abb_lit = abb;
prima_valuta.val2lit(abb_lit);
gm.add_importo(rabb, abb_lit, FALSE);
gm.add_importo(rabb, abb, TRUE);
gm.add_importo(rabb, abb_lit);
gm.add_importo(rabb, abb, prima_valuta.codice());
}
else
{
gm.add_importo(rabb, abb, FALSE);
gm.add_importo(rabb, abb);
rabb.add("");
}
rabb.add(sum.get(PART_TIPOMOV), 11);
@ -1019,7 +1023,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (in_valuta)
{
sl = scad.residuo(TRUE, 0xB);
gm.add_importo(rsal, sl, TRUE);
gm.add_importo(rsal, sl, prima_valuta.codice());
tot_val += sl;
}
}
@ -1050,7 +1054,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
{
imp.set(sum.sezione(), impval);
imp.normalize();
gm.add_importo(row, imp, TRUE);
gm.add_importo(row, imp, prima_valuta.codice());
tot_val += imp;
}
else
@ -1083,7 +1087,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
prima_valuta.set(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
#endif
gm.add_importo(sp, tot_lit);
gm.add_importo(sp, tot_val, TRUE);
gm.add_importo(sp, tot_val, prima_valuta.codice());
}
if (should_delete_game)
@ -1096,6 +1100,17 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
gm._valfirst = !gm._valfirst;
}
TString80 header;
header = "Importo in "; header << TCurrency::get_firm_val();
sheet.set_column_header(106, header);
header = "Importo in ";
if (prima_valuta.in_valuta())
header << prima_valuta.codice();
else
header << "valuta";
sheet.set_column_header(107, header);
if (sheet.items() > 0)
sheet.select(0, TRUE);
else
@ -1232,7 +1247,8 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_mov
const int nrigp = nuova_riga(partita, tm);
#else
int nrigp = partita.mov2rig(_numreg, _numrig); // Cerca riga partita relativa alla riga rmov
if (nrigp <= 0) // Devo creare una nuova riga di partita
const bool nuovo = nrigp <= 0;
if (nuovo) // Devo creare una nuova riga di partita
nrigp = nuova_riga(partita, tm);
#endif
TRectype& pagamento = partita.pagamento(nriga, rata, nrigp); // Crea nuovo pagamento
@ -1259,11 +1275,14 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_mov
}
#ifndef __EXTRA__
const TCausale& causale = app().causale();
TBill contro; causale.bill(caus, contro); // Legge conto contropartita
if (caus != 2 && contro.empty()) // Se non specificato ...
causale.bill(caus = 2, contro); // ... prende il primo
contro.put(pagamento, TRUE); // Scrive conto contropartita
if (nuovo)
{
const TCausale& causale = app().causale();
TBill contro; causale.bill(caus, contro); // Legge conto contropartita
if (caus != 2 && contro.empty()) // Se non specificato ...
causale.bill(caus = 2, contro); // ... prende il primo
contro.put(pagamento, TRUE); // Scrive conto contropartita
}
#endif
return nrigp;
@ -1489,7 +1508,7 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
// Metodi della maschera delle partite
///////////////////////////////////////////////////////////
void TGame_mask::add_importo(TToken_string& s, const TImporto& i, bool valuta, int pos)
void TGame_mask::add_importo(TToken_string& s, const TImporto& i, const char* valuta, int pos)
{
if (i.is_zero())
s.add("", pos);
@ -1497,14 +1516,11 @@ void TGame_mask::add_importo(TToken_string& s, const TImporto& i, bool valuta, i
{
TString80 v;
TImporto n(i); n.normalize();
if (valuta)
{
v = n.valore().string(0, 3);
const int sep = v.find('.');
v[sep] = ',';
}
else
v = n.valore().string(0, 0);
if (valuta == NULL || *valuta == '\0')
valuta = "_FIRM";
const TCurrency curr(n.valore(), valuta);
v = curr.string(FALSE); v.replace('.', ','); // Mette la virgola
v << ' ' << n.sezione();
s.add(v, pos);
}
@ -1814,7 +1830,7 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
#endif
}
// delete pm;
// delete pm; // Perche' commentata?
return key != K_ESC;
}

View File

@ -464,7 +464,7 @@ bool TPrimanota_application::run_easydoc(const char* azione) const
ini.set("Descrizione", m.get(F_DESCR));
// prepara la sezione "DefinizioneDoc1" (se non esiste l'archivio mdb)
if (!fexist(archivio))
if (!archivio.exist())
{
ini.set_paragraph("DefinizioneDoc1");
ini.set("Archivio", archivio);

View File

@ -34,18 +34,14 @@ BEGIN
PROMPT 1 4 "Conto principale"
END
NUMBER CG_DARE 18
CURRENCY CG_DARE 18
BEGIN
PROMPT 2 5 "Dare "
FLAGS "V"
PICTURE "."
END
NUMBER CG_AVERE 18
CURRENCY CG_AVERE 18
BEGIN
PROMPT 38 5 "Avere "
FLAGS "V"
PICTURE "."
END
LIST CG_TIPO 1 10

View File

@ -49,19 +49,15 @@ BEGIN
FLAGS "D"
END
NUMBER 101 18
CURRENCY 101 18
BEGIN
PROMPT 2 4 "Imponibile "
FLAGS "V"
PICTURE "."
END
NUMBER 104 18
CURRENCY 104 18
BEGIN
PROMPT 48 4 "Imposta "
HELP "Importo dell'IVA. Se e' nullo, col tasto F8 si puo' effettuare lo scorporo"
FLAGS "V"
PICTURE "."
END
GROUPBOX DLG_NULL 76 5

View File

@ -7,21 +7,20 @@ BEGIN
WARNING "La data di scadenza e' obbligatoria"
END
NUMBER 102 18
CURRENCY 102 18
BEGIN
PROMPT 1 3 "Importo "
PICTURE "."
CHECKTYPE REQUIRED
WARNING "L'importo della rata non puo' essere nullo"
END
NUMBER 103 18 3
CURRENCY 103 18
BEGIN
PROMPT 1 4 "Importo valuta "
FLAGS "D"
PICTURE ".3"
VALIDATE REQIF_FUNC 1 102
WARNING "E' necessario specificare anche un importo in valuta"
DRIVENBY -SK_VALUTA
END
NUMBER 104 6 2

View File

@ -15,25 +15,22 @@ BEGIN
PROMPT 59 0 "Spese"
END
NUMBER FS_IMPONIBILI 18
CURRENCY FS_IMPONIBILI 18
BEGIN
PROMPT 1 1 ""
PICTURE "."
FLAGS "D"
CHECKTYPE REQUIRED
END
NUMBER FS_IMPOSTE 18
CURRENCY FS_IMPOSTE 18
BEGIN
PROMPT 30 1 ""
PICTURE "."
FLAGS "D"
END
NUMBER FS_SPESE 18
CURRENCY FS_SPESE 18
BEGIN
PROMPT 59 1 ""
PICTURE "."
FLAGS "D"
END

View File

@ -1,29 +1,23 @@
#include <xvt.h>
#include <checks.h>
#define __MAIN__
#include "cg3.h"
#define usage "Error - usage : %s -{0|1|2|3|4|5|6}"
int main(int argc,char** argv)
{
int rt = 1;
int s = atoi(argv[1]+1) ;
int s = argv[1][1] - '0';
switch (s)
{
case 0: rt = cg3100(argc,argv) ; break; // Lista movimenti
case 1: rt = cg3200(argc,argv) ; break; // Stampa mastrini
case 2: rt = cg3300(argc,argv) ; break; // Stampa allegati iva
case 3: rt = cg3400(argc,argv) ; break; // Stampa libro giornale
case 4: rt = cg3500(argc,argv) ; break; // Stampa ripilogo gruppi conti
case 5: rt = cg3600(argc,argv) ; break; // Visualizzazione mastrini
case 6: rt = cg3700(argc,argv) ; break; // Lista fatture
default: error_box(usage, argv[0]); break;
case 1 : cg3200(argc,argv) ; break; // Stampa mastrini
// case 2 : cg3300(argc,argv) ; break; // Stampa allegati iva
case 3 : cg3400(argc,argv) ; break; // Stampa libro giornale
case 4 : cg3500(argc,argv) ; break; // Stampa ripilogo gruppi conti
case 5 : cg3600(argc,argv) ; break; // Visualizzazione mastrini
case 6 : cg3700(argc,argv) ; break; // Lista fatture
default: cg3100(argc,argv) ; break; // Lista movimenti
}
exit(rt);
return rt;
exit(0);
return 0;
}

View File

@ -3,9 +3,8 @@
//
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
#include <urldefid.h>
#include "cg3.h"
#include "cg3100.h"
@ -79,10 +78,11 @@ class TListaMov_application : public TPrintapp
TBit_array _err;
TDate _data_ini, _data_fin, _datareg, _data_prec, _datacomp;
TString _descr, _descr_doc, _descr_causale;
TString _tipo_ini, _masc, _causale, _app;
TString _tipo_ini, _causale, _app;
TString _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_cod,_tipoelsucc;
TString _appoggio, _tipodoc, _tipodocumento;
char _appoggio;
TString16 _tipodoc, _tipodocumento;
TString _ragsoc, _indcf, _civcf, _paiv, _codcaus, _dencom, _provcom, _cofi;
TString _capcf, _codval, _simbolo, _statocf, _comcf, _tipo_fin, _reg_causale;
long _documenti, _codice_ini, _codice_fin, _numero_reg, _codcf;
@ -104,6 +104,8 @@ class TListaMov_application : public TPrintapp
liste _tipo_lista;
word _flags;
char _tipoc;
TDecoder _simbval, _descdoc;
protected:
virtual void preprocess_header();
@ -130,9 +132,12 @@ public:
void incrementa_totali();
void compila_clifo();
void compila_comuni();
bool RicercaDoc(const char*);
TListaMov_application(char tipost): _tipoc(tipost), _err(80) {}
bool RicercaDoc(const char*);
const TString& SimboloValuta (const char* cod);
const TString& DescrDoc(const char* cod);
TListaMov_application(char tipost);
virtual ~TListaMov_application() {}
};
@ -163,12 +168,12 @@ bool data_inizio(TMask_field& f, KEY k)
int decidi;
int anno = f.mask().get_int (F_ANNO);
TDate data = f.mask().get(F_DATAINI);
if (app()._masc == "cg3100a")
if (app()._tipo_lista == movimenti)
decidi = f.mask().get_int (F_DECIDI);
TEsercizi_contabili esc;
if (esc.exist(anno) && ( (app()._masc == "cg3100b") ||
((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
if (esc.exist(anno) && ( (app()._tipo_lista == fatture) ||
((app()._tipo_lista == movimenti ) && (decidi == 2)) ) )
{
const TDate inizio = esc[anno].inizio();
if (data.ok())
@ -194,10 +199,10 @@ bool data_fine(TMask_field& f, KEY k)
int anno = f.mask().get_int (F_ANNO);
TDate dataini = f.mask().get(F_DATAINI);
TDate datafin = f.mask().get(F_DATAFIN);
if (app()._masc == "cg3100a")
if (app()._tipo_lista == movimenti)
decidi = f.mask().get_int (F_DECIDI);
if ( (app()._masc == "cg3100b") ||
((app()._masc == "cg3100a" ) && (decidi == 2)) )
if ( (app()._tipo_lista == fatture) ||
((app()._tipo_lista == movimenti) && (decidi == 2)) )
if ( dataini.ok() && datafin.ok() )
if (dataini > datafin)
{
@ -206,7 +211,7 @@ bool data_fine(TMask_field& f, KEY k)
}
TEsercizi_contabili esc;
if (esc.exist(anno) && ( (app()._masc == "cg3100b") || ((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
if (esc.exist(anno) && ( (app()._tipo_lista == fatture) || ((app()._tipo_lista == movimenti) && (decidi == 2)) ) )
{
const int prossimo = esc.next(anno);
const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine();
@ -228,7 +233,7 @@ bool data_fine(TMask_field& f, KEY k)
bool TListaMov_application::RicercaDoc(const char * tipo)
{
TTable tab_tpd(TAB_TPD);
TString codtab = format ("%-2s", tipo);
TString16 codtab; codtab.format ("%-2s", tipo);
tab_tpd.zero();
tab_tpd.put("CODTAB", codtab);
tab_tpd.read();
@ -392,27 +397,16 @@ const char * TipoAttivita (const char * attreg, long codice_ditta)
return TMP;
}
const char * SimboloValuta (const char * cod)
{
TTable tab_val(TAB_VAL);
TString codtab = format ("%-3s", cod);
tab_val.zero();
tab_val.put("CODTAB", codtab);
tab_val.read();
if (tab_val.good())
TMP = tab_val.get("S7");
else
TMP = "";
return TMP;
const TString& TListaMov_application::SimboloValuta(const char* cod)
{
return _simbval.decode(cod);
}
const char * DescrDoc (const char * tipo)
const TString& TListaMov_application::DescrDoc(const char* tipo)
{
/*
TTable tab_tpd(TAB_TPD);
TString codtab = format ("%-2s", tipo);
TString16 codtab; codtab.format ("%-2s", tipo);
tab_tpd.zero();
@ -424,12 +418,14 @@ const char * DescrDoc (const char * tipo)
TMP = "";
return TMP;
*/
return _descdoc.decode(tipo);
}
const char * AttivitaRegistro (const char * cod, int anno)
{
TTable tab_reg("REG");
TString codtab ( format ("%04d%-3s", anno, cod) );
TString16 codtab; codtab.format ("%04d%-3s", anno, cod);
tab_reg.zero();
@ -444,13 +440,12 @@ const char * AttivitaRegistro (const char * cod, int anno)
return TMP;
}
const int CodiceRegistro (const char* cod, int anno)
{
int CodiceRegistro (const char* cod, int anno)
{
/*
TTable tab_reg("REG");
TString codtab;
TString16 codtab;
codtab.format("%4d%-3s", anno, cod);
//sprintf (__tmp, "%04d%-3s", anno, cod);
//TString codtab (__tmp);
int tipo_reg;
tab_reg.zero();
@ -460,8 +455,13 @@ const int CodiceRegistro (const char* cod, int anno)
tipo_reg = tab_reg.get_int("I0");
else
tipo_reg = 0;
return tipo_reg;
*/
static TDecoder tab_reg("REG", "I0");
TString16 codtab; codtab.format("%4d%-3s", anno, cod);
int tipo_reg = atoi(tab_reg.decode(codtab));
return tipo_reg;
}
bool filter_func_fatture (const TRelation* rel)
@ -758,8 +758,8 @@ void TListaMov_application::set_page(int file, int count)
set_row(_nr,"@58g@pn",FLD(LF_RMOV,RMV_CONTO,"###"));
set_row(_nr,"@62g@pn",FLD(LF_RMOV,RMV_SOTTOCONTO,"######"));
set_row(_nr,"@69g#.20t",&_descr);
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
if ((_appoggio=="D")||(_appoggio=="d"))
_appoggio = toupper(current_cursor()->curr(LF_RMOV).get_char(RMV_SEZIONE));
if (_appoggio=='D')
set_row(_nr,"@90g@n",FLD(LF_RMOV,RMV_IMPORTO));
else
set_row(_nr,"@110g@n",FLD(LF_RMOV,RMV_IMPORTO));
@ -936,15 +936,15 @@ bool TListaMov_application::preprocess_page(int file,int counter)
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
_alleg = AllegClifo(gruppo, conto, sottoconto);
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
_appoggio = toupper(current_cursor()->curr(LF_RMOV).get_char(RMV_SEZIONE));
if (!_no_preprocess_page)
{
if ((_appoggio=="D")||(_appoggio=="d"))
if (_appoggio=='D')
{
_tot_dare_generale += _importo;
_tot_dare += _importo;
}
else if ((_appoggio=="A")||(_appoggio=="a"))
else
{
_tot_avere += _importo;
_tot_avere_generale += _importo;
@ -1026,15 +1026,15 @@ bool TListaMov_application::preprocess_page(int file,int counter)
TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
_appoggio = toupper(current_cursor()->curr(LF_RMOV).get_char(RMV_SEZIONE));
if (!_no_preprocess_page)
{
if ((_appoggio=="D")||(_appoggio=="d"))
if (_appoggio=='D')
{
_tot_dare_generale += _importo;
_tot_dare += _importo;
}
else if ((_appoggio=="A")||(_appoggio=="a"))
else
{
_tot_avere += _importo;
_tot_avere_generale += _importo;
@ -1911,31 +1911,30 @@ void TListaMov_application::incrementa_totali()
bool TListaMov_application::set_print(int m)
{
_masc = "";
TString16 masc;
switch(toupper(_tipoc))
{
case 'C':
_masc = "cg3100b";
masc = "cg3100b";
_tipo_lista = fatture;
break;
case 'M':
_masc = "cg3100a";
masc = "cg3100a";
_tipo_lista = movimenti;
break;
break;
default:
NFCHECK("Bad _tipoc");
NFCHECK("Specificare C o M");
return FALSE;
}
TMask msk(_masc);
TMask msk(masc);
msk.set_handler(F_ANNO, annoes_handler);
msk.set_handler(F_DATAINI, data_inizio);
msk.set_handler(F_DATAFIN, data_fine);
if (msk.run() != K_ENTER)
return FALSE;
set_magic_currency(TRUE);
reset_files();
TLocalisamfile* fl;
@ -2122,9 +2121,6 @@ bool TListaMov_application::user_destroy() // releasev e arrmask
delete _relmov1;
delete _relmov2;
delete _relmov3;
delete _curr1;
delete _curr2;
delete _curr3;
delete _clifo;
delete _caus;
delete _pcon;
@ -2147,6 +2143,9 @@ void TListaMov_application::init_print(const TMask& msk)
printer().setdate(data);
printer().footerlen(5);
set_magic_currency(TRUE);
set_curr_codval(msk.get(F_CODVAL));
switch (_tipo_lista)
{
case movimenti:
@ -2462,9 +2461,15 @@ void TListaMov_application::preprocess_header()
set_header (++soh,(const char*)sep);
}
TListaMov_application::TListaMov_application(char tipost)
: _tipoc(tipost), _err(80),
_simbval(TAB_VAL, "S7"), _descdoc(TAB_TPD, "S0")
{ }
int cg3100(int argc, char* argv[])
{
const char tipo = *argv[2];
const char tipo = argc > 2 ? *argv[2] : 'M';
TListaMov_application a(tipo);
const char* title;

View File

@ -33,6 +33,7 @@
#define F_RAGSOCINI1 129
#define F_RAGSOCFIN1 130
#define F_SEPARATOR 131
#define F_CODVAL 132
#define ST_DATA 0x0001
#define ST_NUMERO 0x0002

View File

@ -2,13 +2,13 @@
TOOLBAR "" 0 20 0 2
BUTTON DLG_PRINT 9 2
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 9 2
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
@ -234,6 +234,18 @@ BEGIN
END
*/
STRING F_CODVAL 3
BEGIN
PROMPT 2 18 "Valuta "
USE %VAL
INPUT CODTAB F_CODVAL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAL CODTAB
CHECKTYPE NORMAL
FLAGS "U"
END
ENDPAGE
ENDMASK

View File

@ -1,6 +1,6 @@
#include "cg3100.h"
PAGE "Lista Fatture" -1 -1 73 16
PAGE "Lista Fatture" -1 -1 73 17
NUMBER F_CODDITTA 5
BEGIN
@ -218,13 +218,25 @@ BEGIN
PROMPT 2 13 "Non stampare i separatori delle migliaia"
END
BUTTON DLG_PRINT 9 2
STRING F_CODVAL 3
BEGIN
PROMPT 2 14 "Valuta "
USE %VAL
INPUT CODTAB F_CODVAL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAL CODTAB
CHECKTYPE NORMAL
FLAGS "U"
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 9 2
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END

View File

@ -1,3 +1,4 @@
#include <currency.h>
#include <execp.h>
#include <mailbox.h>
#include <msksheet.h>
@ -89,6 +90,8 @@ class TMastrini_application : public TPrintapp
bool _noseparator;
TString _real_picture;
TConfig* _collins;
protected:
virtual bool user_create() ;
virtual bool user_destroy();
@ -107,6 +110,8 @@ protected:
bool mask2sheet();
bool sheet2mask();
const char* real2str(const real& r) const;
public:
//TDate _inizioEs,_fineEs;
@ -151,12 +156,22 @@ public:
void setta_riga (int r, TString riga);
int righe_rimaste_da_stampare();
const char* trans(const char* italian);
TMastrini_application() {}
virtual ~TMastrini_application() {}
};
inline TMastrini_application& app() { return (TMastrini_application&)main_app(); }
const char* TMastrini_application::trans(const char* italian)
{
TString80 key(italian);
key.replace(' ', '_');
const TString& str = _collins->get(key, NULL, -1, italian);
return str;
}
int TMastrini_application::righe_rimaste_da_stampare()
{
int righe_rimaste = 0;
@ -548,7 +563,6 @@ bool TMastrini_application::contof_hnd (TMask_field& f, KEY k)
f.mask().set(F_DESCRFINE_FORN, ds);
f.mask().set(F_DESCRFINE_CONTO, ds);
}
}
return TRUE;
@ -875,11 +889,11 @@ void TMastrini_application::fai_stampa132()
set_row (_rw,"@0g#t", &_dataregs);
if (_stampanum == 1)
set_row (_rw,"@11g$[r]#7d$[n]", &_numreg);
set_row (_rw,"@11g$[r]#7ld$[n]", &_numreg);
else
if (_stampanum == 2)
{
set_row (_rw,"@11g#7d", &_numgio);
set_row (_rw,"@11g#7ld", &_numgio);
}
set_row (_rw,"@19g#t", &_datadocs);
@ -959,11 +973,11 @@ void TMastrini_application::fai_stampa198()
set_row (_rw,"@0g#t", &_dataregs);
if (_stampanum == 1)
{
set_row (_rw,"@11g$[r]#7d$[n]", &_numreg);
set_row (_rw,"@11g$[r]#7ld$[n]", &_numreg);
set_row (_rw,"@18g/#3d", &_numrig);
}
else if (_stampanum == 2)
set_row (_rw,"@11g#7d", &_numgio);
set_row (_rw,"@11g#7ld", &_numgio);
set_row (_rw,"@23g#t", &_datadocs);
set_row (_rw,"@34g#7t", &_numdoc);
@ -990,18 +1004,18 @@ void TMastrini_application::stampa_totali132()
_saldo_periodo = _totale_periodo_dare - _totale_periodo_avere;
_saldo_progre = _totprogre_dare - _totprogre_avere;
_saldo_progre_al = _totprogre_dare_al - _totprogre_avere_al;
set_row (_rw,"@32gTOTALI PERIODO");
set_row (_rw,"@32g%s", trans("TOTALI PERIODO"));
set_row (_rw,"@66g%r", &_saldo_periodo);
set_row (_rw,"@83g%r", &_totale_periodo_dare);
set_row (_rw++,"@100g%r", &_totale_periodo_avere);
set_row (_rw,"@32gTOTALI PROGRESSIVI");
set_row (_rw,"@32g%s", trans("TOTALI PROGRESSIVI"));
set_row (_rw,"@66g%r", &_saldo_progre);
set_row (_rw,"@83g%r", &_totprogre_dare);
set_row (_rw++,"@100g%r", &_totprogre_avere);
if (_stampaprogre) //Progressivi attuali
{
set_row (_rw,"@32gTOTALI PROGRESSIVI AL %s", _ultima_data_reg.string());
set_row (_rw,"@32g%s %s", trans("TOTALI PROGRESSIVI AL"), _ultima_data_reg.string());
set_row (_rw,"@66g%r", &_saldo_progre_al);
set_row (_rw,"@83g%r", &_totprogre_dare_al);
set_row (_rw,"@100g%r", &_totprogre_avere_al);
@ -1009,6 +1023,12 @@ void TMastrini_application::stampa_totali132()
_devi_stampare_footer = FALSE;
}
const char* TMastrini_application::real2str(const real& r) const
{
real2currency(TMP, r);
return TMP;
}
void TMastrini_application::carica_array_totali132()
{
TString sep(132);
@ -1035,27 +1055,30 @@ void TMastrini_application::carica_array_totali132()
_lista.add(r);
r = "";
r.add("@32gTOTALI PERIODO@66g%s@83g%s@100g%s");
r.add(_saldo_periodo.string(_real_picture));
r.add(_totale_periodo_dare.string(_real_picture));
r.add(_totale_periodo_avere.string(_real_picture));
r.add("@32g%s@66g%s@83g%s@100g%s");
r.add(trans("TOTALI PERIODO"));
r.add(real2str(_saldo_periodo));
r.add(real2str(_totale_periodo_dare));
r.add(real2str(_totale_periodo_avere));
_lista.add(r);
r = "";
r.add("@32gTOTALI PROGRESSIVI@66g%s@83g%s@100g%s");
r.add(_saldo_progre.string(_real_picture));
r.add(_totprogre_dare.string(_real_picture));
r.add(_totprogre_avere.string(_real_picture));
r.add("@32g%s@66g%s@83g%s@100g%s");
r.add(trans("TOTALI PROGRESSIVI"));
r.add(real2str(_saldo_progre));
r.add(real2str(_totprogre_dare));
r.add(real2str(_totprogre_avere));
_lista.add(r);
r = "";
if (_stampaprogre) //Progressivi attuali
{
r.add("@32gTOTALI PROGRESSIVI AL@55g%s@66g%s@83g%s@100g%s");
r.add("@32g%s@55g%s@66g%s@83g%s@100g%s");
r.add(trans("TOTALI PROGRESSIVI AL"));
r.add(_ultima_data_reg.string());
r.add(_saldo_progre_al.string(_real_picture));
r.add(_totprogre_dare_al.string(_real_picture));
r.add(_totprogre_avere_al.string(_real_picture));
r.add(real2str(_saldo_progre_al));
r.add(real2str(_totprogre_dare_al));
r.add(real2str(_totprogre_avere_al));
_lista.add(r);
r = "";
}
@ -1080,7 +1103,7 @@ void TMastrini_application::carica_array_totali132()
r.add(fmt);
r.add(riga._descrdoc);
totale = riga._totdociva;
r.add(totale.string(_real_picture));
r.add(real2str(totale));
_lista.add(r);
r = "";
}
@ -1171,15 +1194,16 @@ void TMastrini_application::stampa_totali198()
_totprogre_dare=_progredare+_totale_periodo_dare;
_totprogre_avere=_progreavere+_totale_periodo_avere;
set_row (_rw,"@32gTOTALI PERIODO@100g%r", &_totale_periodo_dare);
set_row (_rw,"@32g%s@100g%r", trans("TOTALI PERIODO"), &_totale_periodo_dare);
set_row (_rw,"@117g%r", &_totale_periodo_avere);
set_row (_rw++,"@151g%r", &_saldo_movimenti);
set_row (_rw,"@32gTOTALI PROGRESSIVI@100g%r", &_totprogre_dare);
set_row (_rw,"@32g%s@100g%r", trans("TOTALI PROGRESSIVI"), &_totprogre_dare);
set_row (_rw,"@117g%r", &_totprogre_avere);
set_row (_rw++,"@134g%r", &_saldo_progressivi);
if (_stampaprogre) //Progressivi attuali
{
set_row(_rw,"@32gTOTALI PROGRESSIVI AL@55g%s", _ultima_data_reg.string());
_saldo_progre_al = _totprogre_dare_al - _totprogre_avere_al;
set_row(_rw,"@32g%s@55g%s", trans("TOTALI PROGRESSIVI AL"), _ultima_data_reg.string());
set_row (_rw,"@100g%r", &_totprogre_dare_al);
set_row (_rw,"@117g%r", &_totprogre_avere_al);
set_row (_rw,"@134g%r", &_saldo_progressivi);
@ -1210,27 +1234,31 @@ void TMastrini_application::carica_array_totali198()
_totprogre_dare=_progredare+_totale_periodo_dare;
_totprogre_avere=_progreavere+_totale_periodo_avere;
r.add("@32gTOTALI PERIODO@100g%s@117g%s@151g%s");
r.add(_totale_periodo_dare.string(_real_picture));
r.add(_totale_periodo_avere.string(_real_picture));
r.add(_saldo_movimenti.string(_real_picture));
r.add("@32g%s@100g%s@117g%s@151g%s");
r.add(trans("TOTALI PERIODO"));
r.add(real2str(_totale_periodo_dare));
r.add(real2str(_totale_periodo_avere));
r.add(real2str(_saldo_movimenti));
_lista.add(r);
r = "";
r.add("@32gTOTALI PROGRESSIVI@100g%s@117g%s@134g%s");
r.add(_totprogre_dare.string(_real_picture));
r.add(_totprogre_avere.string(_real_picture));
r.add(_saldo_progressivi.string(_real_picture));
r.add("@32g%s@100g%s@117g%s@134g%s");
r.add(trans("TOTALI PROGRESSIVI"));
r.add(real2str(_totprogre_dare));
r.add(real2str(_totprogre_avere));
r.add(real2str(_saldo_progressivi));
_lista.add(r);
r = "";
if (_stampaprogre) //Progressivi attuali
{
r.add("@32gTOTALI PROGRESSIVI AL@55g%s@100g%s@117g%s@134g%s");
_saldo_progre_al = _totprogre_dare_al - _totprogre_avere_al;
r.add("@32g%s@55g%s@100g%s@117g%s@134g%s");
r.add(trans("TOTALI PROGRESSIVI AL"));
r.add(_ultima_data_reg.string());
r.add(_totprogre_dare_al.string(_real_picture));
r.add(_totprogre_avere_al.string(_real_picture));
r.add(_saldo_progressivi.string(_real_picture));
r.add(real2str(_totprogre_dare_al));
r.add(real2str(_totprogre_avere_al));
r.add(real2str(_saldo_progre_al));
_lista.add(r);
r = "";
}
@ -1259,7 +1287,7 @@ void TMastrini_application::carica_array_totali198()
r.add(fmt);
r.add(riga._descrdoc);
totale = riga._totdociva;
r.add(totale.string(_real_picture));
r.add(real2str(totale));
_lista.add(r);
r = "";
}
@ -1507,7 +1535,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
// nella maschera. Se non viene specificato li stampa tutti
_importo = current_cursor()->curr(LF_RMOV).get_real(RMV_IMPORTO);
_importo_str = _importo.string(_real_picture);
_importo_str = real2str(_importo);
_mov->setkey(1);
_mov->curr().zero();
_mov->curr().put(MOV_NUMREG,_numreg);
@ -1906,8 +1934,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO)
{
TString dare (dep_dare.string(_real_picture));
TString avere (dep_avere.string(_real_picture));
TString dare (real2str(dep_dare));
TString avere (real2str(dep_avere));
if (_numcarat == 1)
{
set_row (_rw,"@32gA RIPORTO@83g%s", (const char*) dare);
@ -1967,8 +1995,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
const int righe_rimaste = printer().rows_left();
_stampato = righe_rimaste >= 1;
_saldo_progressivi_str=_saldo_progressivi.string(_real_picture);
_saldo_movimenti_str=_saldo_movimenti.string(_real_picture);
_saldo_progressivi_str=real2str(_saldo_progressivi);
_saldo_movimenti_str=real2str(_saldo_movimenti);
if (_numcarat == 2)
{
ricerca_regiva();
@ -2261,7 +2289,7 @@ void TMastrini_application::stampa_totaliiva()
TDociva& riga = (TDociva&)_b[j];
set_row(_rw+j, "@0g%s",(const char*) riga._descrdoc);
totale = riga._totdociva;
TString string = totale.string(_real_picture);
TString string = real2str(totale);
set_row(_rw+j, fmt, (const char*)string);
}
@ -2379,7 +2407,8 @@ bool TMastrini_application::set_print(int)
else
_real_picture = "####.###.###.###";
set_real_picture(_real_picture);
set_curr_codval(_msk->get(F_VALUTA));
set_magic_currency(TRUE);
if (tasto == K_ENTER)
{
@ -2558,8 +2587,8 @@ void TMastrini_application::preprocess_footer()
if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO)
{
TString dare (dep_dare.string(_real_picture));
TString avere (dep_avere.string(_real_picture));
TString dare (real2str(dep_dare));
TString avere (real2str(dep_avere));
if (_numcarat == 1)
{
set_footer (2,"@32gA RIPORTO@83g%s", (const char*) dare);
@ -2698,7 +2727,7 @@ void TMastrini_application::crea_intestazione()
if (_nummast != 3 || _pagina != np)
{
set_header (1, "@0gDITTA@6g%5ld", _codice_ditta);
set_header (1, "@0g%s@6g%5ld", trans("DITTA"), _codice_ditta);
set_header (1, "@12g%-.45s", (const char*) _ragsoc);
set_header (1, "@59g%s", (const char*) _indulc);
//set_header (1, "@86g%-.9s", (const char*) _civulc);
@ -2707,9 +2736,9 @@ void TMastrini_application::crea_intestazione()
set_header (1, "@122g%-.3s", (const char*) _prov);
}
if (_nummast == 3)
set_header (3, "@0gSottoconto @b%3d %3d %6ld", _gruppo, _conto, _sottoc);
set_header (3, "@0g%s@12g@b%3d %3d %6ld", trans("Sottoconto"), _gruppo, _conto, _sottoc);
else
set_header (3, "@0gSottoconto %3d %3d %6ld", _gruppo, _conto, _sottoc);
set_header (3, "@0g%s@12g%3d %3d %6ld", trans("Sottoconto"), _gruppo, _conto, _sottoc);
if (_tmcf == 'C')
_tipo_mask = 1;
@ -2732,15 +2761,18 @@ void TMastrini_application::crea_intestazione()
{
sep.fill('-'); //Stampa 132 - (sep(132))
set_header (6, (const char *) sep);
set_header (7,"Operazione@19gDocumento@117gContro@131gA");
set_header (7,"%s@19g%s@117g%s@131g%s",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
if (_stampa_mov_prov)
set_header(7,"@129gM");
set_header (8,"Data");
set_header (8, trans("Data"));
if (_stampanum < 3)
set_header (8,"@11gnumero");
set_header (8,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@95gDare@111gAvere@117gPartita@131gC");
set_header (8,"@11g%s", trans("Numero"));
set_header (8,"@19g%s@30g%s@38g%s@61g%s@95g%s@111g%s@117g%s@131g%s",
trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"),
trans("Dare"), trans("Avere"), trans("Partita"), trans("C"));
if (_stampa_mov_prov)
set_header(8,"@129gP");
set_header(8,"@129g%s", trans("P"));
sep.fill('-');
set_header (9, (const char *) sep);
}
@ -2748,15 +2780,21 @@ void TMastrini_application::crea_intestazione()
{
sep1.fill('-'); //Stampa 198 - (sep1(198))
set_header (6,"@0g%s", (const char*)sep1);
set_header (7,"Operazione@23gData@34gNumero@169gContro@183gReg@190gNumero@197gA");
set_header (7,"%s@23g%s@34g%s@169g%s@183g%s@190g%s@197g%s",
trans("Operazione"), trans("Data"), trans("Numero"), trans("Contro"),
trans("Reg"), trans("Numero"), trans("A"));
if (_stampa_mov_prov)
set_header(7,"@195gM");
set_header (8,"Data");
set_header(7,"@195g%s", trans("M"));
set_header (8,trans("Data"));
if (_stampanum < 3)
set_header (8,"@11gnumero");
set_header (8,"@23gDocumento@42gCod.Causale@70gDescrizione@112gDare@127gAvere@135gSaldo progre.@152gSaldo movim.@169gPartita@183gIva@189gProtoc.@197gC");
set_header (8,"@11g%s", trans("Numero"));
set_header (8,"@23g%s@42g%s@70g%s@112g%s@127g%s@135g%s@152g%s@169g%s@183g%s@189g%s@197g%s",
trans("Documento"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"),
trans("Saldo progre."), trans("Saldo movim."), trans("Partita"), trans("Iva"),
trans("Protoc."), trans("C"));
if (_stampa_mov_prov)
set_header(8,"@195gP");
set_header(8,"@195g%s", trans("P"));
sep1.fill('-');
set_header (9,"@0g%s", (const char*)sep1);
}
@ -2768,15 +2806,15 @@ void TMastrini_application::crea_intestazione()
{
if (_numcarat == 1)
{
set_header (10,"@42gPROGRESSIVI PRECEDENTI@66g%s", _saldo_progre_prec.string(_real_picture));
set_header (10,"@83g%s", _progredare.string(_real_picture));
set_header (10,"@100g%s", _progreavere.string(_real_picture));
set_header (10,"@42g%s@66g%s", trans("PROGRESSIVI PRECEDENTI"), real2str(_saldo_progre_prec));
set_header (10,"@83g%s", real2str(_progredare));
set_header (10,"@100g%s", real2str(_progreavere));
}
if (_numcarat == 2)
{
set_header (10,"@70gPROGRESSIVI PRECEDENTI@100g%s", _progredare.string(_real_picture));
set_header (10,"@117g%s", _progreavere.string(_real_picture));
set_header (10,"@134g%s", _saldo_progre_prec.string(_real_picture));
set_header (10,"@70g%s@100g%s", trans("PROGRESSIVI PRECEDENTI"), real2str(_progredare));
set_header (10,"@117g%s", real2str(_progreavere));
set_header (10,"@134g%s", real2str(_saldo_progre_prec));
}
_riporto_dare = _progredare;
_riporto_avere = _progreavere;
@ -2797,13 +2835,13 @@ void TMastrini_application::crea_intestazione()
{
if (_numcarat == 1)
{
set_header (10,"@32gA RIPORTO@83g%s", dep_dare.string(_real_picture));
set_header (10,"@100g%s", dep_avere.string(_real_picture));
set_header (10,"@32g%s@83g%s", trans("A RIPORTO"), real2str(dep_dare));
set_header (10,"@100g%s", real2str(dep_avere));
}
if (_numcarat == 2)
{
set_header (10,"@32gA RIPORTO@100g%s", dep_dare.string(_real_picture));
set_header (10,"@117g%s", dep_avere.string(_real_picture));
set_header (10,"@32g%s@100g%s", trans("A RIPORTO"), real2str(dep_dare));
set_header (10,"@117g%s", real2str(dep_avere));
}
}
_riporto_parziale_dare = ZERO;
@ -2863,13 +2901,13 @@ int TMastrini_application::crea_intestazione(int start_riga)
else
{
if (_numcarat == 1)
set_row(r,"@126gPag. %2d", _numero_pag++);
set_row(r,"@126g%s %2d", trans("Pag."), _numero_pag++);
else if (_numcarat == 2)
set_row(r,"@190gPagina %2d", _numero_pag++);
set_row(r,"@190g%s %2d", trans("Pagina"),_numero_pag++);
}
if (_nummast != 3 || _pagina != np)
{
set_row (r, "@0gDITTA@6g%5ld", _codice_ditta);
set_row (r, "@0g%s@6g%5ld", trans("DITTA"), _codice_ditta);
set_row (r, "@12g%-45s", (const char*) _ragsoc);
set_row (r, "@59g%s", (const char*) _indulc);
//set_row (r, "@86g%-9s", (const char*) _civulc);
@ -2879,9 +2917,9 @@ int TMastrini_application::crea_intestazione(int start_riga)
r += 2;
}
if (_nummast == 3)
set_row (r, "@0gSottoconto@12g@b%3d %3d %6ld", _gruppo, _conto, _sottoc);
set_row (r, "@0g%s@12g@b%3d %3d %6ld", trans("Sottoconto"), _gruppo, _conto, _sottoc);
else
set_row (r, "@0gSottoconto@12g%3d %3d %6ld", _gruppo, _conto, _sottoc);
set_row (r, "@0g%s@12g%3d %3d %6ld", trans("Sottoconto"), _gruppo, _conto, _sottoc);
if (_tmcf == 'C')
_tipo_mask = 1;
@ -2907,12 +2945,13 @@ int TMastrini_application::crea_intestazione(int start_riga)
{
sep.fill('-'); //Stampa 132 - (sep(132))
set_row (r++,"@1g%s", (const char *) sep);
set_row (r++,"Operazione@19gDocumento@117gContro@131gA");
set_row (r++,"%s@19g%s@117g%s@131g%s",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
if (_stampa_mov_prov)
set_header(r-1,"@129gM");
set_row (r,"Data");
set_header(r-1,"@129g%s", trans("M"));
set_row (r, trans("Data"));
if (_stampanum < 3)
set_row (r,"@11gnumero");
set_row (r,"@11g%s", trans("Numero"));
set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@95gDare@111gAvere@117gPartita@131gC");
if (_stampa_mov_prov)
set_header(r-1,"@129gP");
@ -2969,12 +3008,12 @@ void TMastrini_application::stampa_progre_riporto()
{
if (_numcarat == 1)
{
set_row (_rw,"@32gA RIPORTO@83g%r", &dep_dare);
set_row (_rw,"@32g%s@83g%r", trans("A RIPORTO"), &dep_dare);
set_row (_rw++,"@100g%r",&dep_avere);
}
if (_numcarat == 2)
{
set_row (_rw,"@32gA RIPORTO@100g%r", &dep_dare);
set_row (_rw,"@32g%s@100g%r", trans("A RIPORTO"), &dep_dare);
set_row (_rw++,"@117g%r", &dep_avere);
}
}
@ -3020,12 +3059,12 @@ int TMastrini_application::stampa_progre_riporto(int start_riga)
{
if (_numcarat == 1)
{
set_row (r,"@32gA RIPORTO@83g%r", &dep_dare);
set_row (r,"@32g%s@83g%r", trans("A RIPORTO"), &dep_dare);
set_row (r++,"@100g%r", &dep_avere);
}
if (_numcarat == 2)
{
set_row (r,"@32gA RIPORTO@100g%r", &dep_dare);
set_row (r,"@32g%s@100g%r", trans("A RIPORTO"), &dep_dare);
set_row (r++,"@117g%r", &dep_avere);
}
}
@ -3393,9 +3432,9 @@ void TMastrini_application::ricerca_clifo()
set_header(3,"@59g%-.30s",(const char*) descrizione_conto());
set_header(3, "@91g%-.41s",(const char*) ragsoc);
if (_nummast == 3)
set_header(4, "@rClasse@8g@b%c", _lettivd);
set_header(4, "@r%s@8g@b%c", trans("Classe"), _lettivd);
else
set_header(4, "Classe@8g%c", _lettivd);
set_header(4, "%s@8g%c", trans("Classe") , _lettivd);
set_header(4, "@10g%-8s", (const char*) _numrivd);
if (_numivd != 0)
set_header(4, "@19g%2d", _numivd);
@ -3532,9 +3571,9 @@ int TMastrini_application::ricerca_clifo(int start)
set_row (r,"@59g%-30s",(const char*) descrizione_conto());
set_row(r++, "@91g%-30s",(const char*) ragsoc);
if (_nummast == 3)
set_row(r, "@rClasse@8g@b%c", _lettivd);
set_row(r, "@r%s@8g@b%c", trans("Classe"), _lettivd);
else
set_row(r, "Classe@8g%c", _lettivd);
set_row(r, "%s@8g%c", trans("Classe"), _lettivd);
set_row(r, "@10g%-8s", (const char*) _numrivd);
if (_numivd != 0)
set_row(r, "@19g%2d", _numivd);
@ -3553,12 +3592,12 @@ int TMastrini_application::ricerca_clifo(int start)
{
if (_nummast == 3)
{
set_row (r, "@rPeriodo@10g@b%s", (const char*) dataini);
set_row (r, "@r%s@10g@b%s", trans("Periodo"), (const char*) dataini);
set_row (r, "@22g%s@r", (const char*) datafine);
}
else
{
set_row (r, "Periodo@10g%s", (const char*) dataini);
set_row (r, "%s@10g%s", trans("Periodo"), (const char*) dataini);
set_row (r, "@22g%s", (const char*) datafine);
}
}
@ -3566,13 +3605,13 @@ int TMastrini_application::ricerca_clifo(int start)
{
if (_nummast == 3)
{
set_row (r, "@rComp. da@9g@b%s", (const char*) dataini);
set_row (r, "@20g@ra@22g@b%s@r", (const char*) datafine);
set_row (r, "@r%s@9g@b%s", trans("Comp.dal"), (const char*) dataini);
set_row (r, "@20g@r%s@22g@b%s@r", trans("al"), (const char*) datafine);
}
else
{
set_row (r, "Comp. da@9g%s", (const char*) dataini);
set_row (r, "@20ga@22g%s", (const char*) datafine);
set_row (r, "%s@9g%s", trans("Comp.dal"), (const char*) dataini);
set_row (r, "@20g%s@22g%s", trans("al"), (const char*) datafine);
}
}
@ -3643,9 +3682,9 @@ void TMastrini_application::ricerca_gruppo()
set_header(3,"@91g%-.41s",(const char*) descrizione_sottoconto());
if (_nummast == 3)
set_header(4, "@0g@rClasse@12g@b%c", _lettivd);
set_header(4, "@0g@r%s@12g@b%c", trans("Classe"), _lettivd);
else
set_header(4, "@0gClasse@12g%c", _lettivd);
set_header(4, "@0g%s@12g%c", trans("Classe"), _lettivd);
set_header(4, "@14g%-8s",(const char*) _numrivd);
if (_numivd != 0)
set_header(4, "@23g%d", _numivd);
@ -3664,12 +3703,12 @@ void TMastrini_application::ricerca_gruppo()
{
if (_nummast == 3)
{
set_header (5, "@rPeriodo@12g@b%s", (const char*) dataini);
set_header (5, "@r%s@12g@b%s", trans("Periodo"), (const char*) dataini);
set_header (5, "@24g@b%s@r", (const char*) datafine);
}
else
{
set_header (5, "Periodo@12g%s", (const char*) dataini);
set_header (5, "%s@12g%s", trans("Periodo"), (const char*) dataini);
set_header (5, "@24g%s", (const char*) datafine);
}
}
@ -3677,12 +3716,12 @@ void TMastrini_application::ricerca_gruppo()
{
if (_nummast == 3)
{
set_header (5, "@rPeriodo di competenza@23g@b%s", (const char*) dataini);
set_header (5, "@r%s@23g@b%s", trans("Periodo di competenza"), (const char*) dataini);
set_header (5, "@35g%s@r", (const char*) datafine);
}
else
{
set_header (5, "Periodo di competenza@23g%s", (const char*) dataini);
set_header (5, "%s@23g%s", trans("Periodo di competenza"), (const char*) dataini);
set_header (5, "@35g%s", (const char*) datafine);
}
}
@ -3718,9 +3757,9 @@ int TMastrini_application::ricerca_gruppo(int start)
set_row(r++,"@91g%-.41s",(const char*) descrizione_sottoconto());
if (_nummast == 3)
set_row(r, "@0g@rClasse@12g@b%c", _lettivd);
set_row(r, "@0g@r%s@12g@b%c", trans("Classe"), _lettivd);
else
set_row(r, "@0gClasse@12g%c", _lettivd);
set_row(r, "@0g%s@12g%c", trans("Classe"), _lettivd);
set_row(r, "@14g%-8s",(const char*) _numrivd);
if (_numivd != 0)
set_row(r, "@23g%d", _numivd);
@ -3739,12 +3778,12 @@ int TMastrini_application::ricerca_gruppo(int start)
{
if (_nummast == 3)
{
set_row (r, "@rPeriodo@12g@b%s", (const char*) dataini);
set_row (r, "@r%s@12g@b%s", trans("Periodo"), (const char*) dataini);
set_row (r, "@24g%s@r", (const char*) datafine);
}
else
{
set_row (r, "Periodo@12g%s", (const char*) dataini);
set_row (r, "%s@12g%s", trans("Periodo"), (const char*) dataini);
set_row (r, "@24g%s", (const char*) datafine);
}
}
@ -3752,12 +3791,12 @@ int TMastrini_application::ricerca_gruppo(int start)
{
if (_nummast == 3)
{
set_row (r, "@rPeriodo di competenza@23g@b%s", (const char*) dataini);
set_row (r, "@r%s@23g@b%s", trans("Periodo di competenza"), (const char*) dataini);
set_row (r, "@35g%s@r", (const char*) datafine);
}
else
{
set_row (r, "Periodo di competenza@23g%s", (const char*) dataini);
set_row (r, "%s@23g%s", trans("Periodo di competenza"), (const char*) dataini);
set_row (r, "@35g%s", (const char*) datafine);
}
}
@ -3951,6 +3990,10 @@ bool TMastrini_application::user_create()
_gia_stampata_intestazione = FALSE;
_collins = new TConfig("cg3200.ini", "Main");
const TString& language = _collins->get("Language");
_collins->set_paragraph(language);
return TRUE;
}
@ -3972,6 +4015,8 @@ bool TMastrini_application::user_destroy()
delete _d23;
delete _d30;
delete _collins;
return TRUE;
}

View File

@ -37,6 +37,9 @@
#define F_TIPOSTAMPA 115
#define F_STAMPAMOVPROV 116
#define F_SEPARATOR 117
#define F_VALUTA 118
#define F_DESVALUTA 119
#define F_MEMORIZZA 500
#define F_NUMCARAT 501
#define F_NUMMAST 502

View File

@ -1,19 +1,19 @@
#include "cg3200.h"
TOOLBAR "" 0 20 0 2
TOOLBAR "" 0 19 0 2
BUTTON DLG_PRINT 16 2
BUTTON DLG_PRINT 18 2
BEGIN
PROMPT -13 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON F_MEMORIZZA 16 2
BUTTON F_MEMORIZZA 18 2
BEGIN
PROMPT -23 -11 "~Memorizza scelte"
END
BUTTON DLG_QUIT 16 2
BUTTON DLG_QUIT 18 2
BEGIN
PROMPT -33 -11 ""
END
@ -475,6 +475,31 @@ BEGIN
ITEM "3|Completa"
END
STRING F_VALUTA 3
BEGIN
PROMPT 4 17 "Valuta di stampa "
FLAGS "U"
USE %VAL
INPUT CODTAB F_VALUTA
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@60" S0
OUTPUT F_VALUTA CODTAB
OUTPUT F_DESVALUTA S0
CHECKTYPE NORMAL
END
STRING F_DESVALUTA 50 40
BEGIN
PROMPT 32 17 ""
USE %VAL KEY 2
INPUT S0 F_DESVALUTA
DISPLAY "Descrizione@60" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_VALUTA
CHECKTYPE NORMAL
END
ENDPAGE
PAGE "Parametri" -1 -1 78 20

View File

@ -1,6 +1,7 @@
// cg3400 - Stampa libro giornale
#include <config.h>
#include <currency.h>
#include <mask.h>
#include <tabutil.h>
#include <printapp.h>
@ -46,59 +47,58 @@ HIDDEN const int SEZA132 = 108;
HIDDEN const int TOTAVERE132 = 110;
HIDDEN enum descr { causale, conto, operazione };
HIDDEN enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione };
class TContoOccas : public TBill
{
long _s;
char _t;
TString _occfpi;
TString _descrizione;
TString16 _occfpi;
TDecoder _clifoccas;
TDecoder _occas;
TAssoc_array _desc;
public:
const TContoOccas& set(int g = 0, int c = 0, long s = 0L, char t = ' ',
const char* d = NULL, int r = -1, const char* occfpi = NULL);
const char* occfpi = NULL);
const TString& descrizione();
TContoOccas() : _occfpi(NULL) {};
virtual ~TContoOccas() {};
TContoOccas();
virtual ~TContoOccas() {}
};
const TContoOccas& TContoOccas::set(int g, int c, long s, char t,const char* d, int r, const char* occfpi)
TContoOccas::TContoOccas()
: _occfpi(NULL), _clifoccas(LF_CLIFO, CLI_OCCAS),
_occas(LF_OCCAS, "RAGSOC")
{ }
const TContoOccas& TContoOccas::set(int g, int c, long s, char t, const char* occfpi)
{
_s = s; _t = t;
TBill::set(g,c,s,t,d,r);
TBill::set(g,c,s,t);
_occfpi = occfpi;
return *this;
}
const TString& TContoOccas::descrizione()
{
bool really_occas = FALSE;
{
if (_occfpi.not_empty())
{
TLocalisamfile clifo(LF_CLIFO);
clifo.zero();
clifo.put(CLI_CODCF, (long)_s);
clifo.put(CLI_TIPOCF, _t);
const bool clifo_ok = (clifo.read() == NOERR);
if (clifo_ok)
really_occas = clifo.get_bool(CLI_OCCAS);
TString16 code; code << tipo() << '|' << sottoconto();
bool really_occas = _clifoccas.decode(code).not_empty();
if (really_occas)
return _occas.decode(_occfpi);
}
if (really_occas)
{
TLocalisamfile occ(LF_OCCAS);
occ.zero();
occ.put(OCC_CFPI, _occfpi);
if (occ.read() != NOERR) occ.zero();
_descrizione = occ.get("RAGSOC");
}
else
_descrizione = TBill::descrizione();
return _descrizione;
TString16 code; code.format("%c%03d%03d%06ld",
tipo(), gruppo(), conto(), sottoconto());
TString* d = (TString*)_desc.objptr(code);
if (d == NULL)
{
d = new TString(TBill::descrizione());
_desc.add(code, d);
}
return *d;
}
class TStampa_giornale : public TPrintapp
@ -111,7 +111,7 @@ class TStampa_giornale : public TPrintapp
static bool filter_func(const TRelation * r);
static bool filtra_reg (const TRelation * r);
int righe_rimaste() const;
int righe_rimaste() const;
private:
TRelation* _rel;
@ -137,6 +137,8 @@ private:
char _sezione;
int _pagine_contate; // cnt pag. stampate.
TContoOccas _tc;
public:
TRigaiva_array _iva_array;
@ -165,12 +167,13 @@ public:
TString16 _provfis, _cap, _occfpi;
TString80 _cofi;
TLocalisamfile * _com, *_clifo,*_pconti,*_nditte,*_anag;
TRecord_cache *_com;
TLocalisamfile *_clifo,*_pconti,*_nditte,*_anag;
TLocalisamfile* _attiv; // da togliere in futuro (?)
TTable *_tabreg, *_tabval, *_tabes, *_tabiva;
TTable *_tabreg;
TDecoder* _causali; // Guy: saggia aggiunta
TDecoder *_causali, *_tabiva; // Guy: saggia aggiunta
public:
virtual void preprocess_header();
@ -182,6 +185,8 @@ public:
virtual void postclose_print();
// virtual bool cancel_hook();
virtual bool set_print(int);
virtual void on_firm_change();
virtual bool user_create();
virtual bool user_destroy();
@ -214,9 +219,8 @@ public:
void get_dati_ditta ();
const char* get_descr_caus (const char * codcaus);
TRectype& look_com (const char * cod);
TRectype& look_com (const TString& stato, const TString& cod);
const char* get_codiva_des(const char* codiva);
const TRectype& look_com (const char* cod, const char* stato = "");
const TString& get_codiva_des(const char* codiva);
void get_date_aep(int aep, TDate* in, TDate* fin);
void update_totals (char sezione, real& importo);
void set_reg_filter(TMask& m);
@ -247,6 +251,11 @@ bool TStampa_giornale::filter_func(const TRelation * r)
const TString& provvis = recmov.get(MOV_PROVVIS);
if (!provvis.blank())
return FALSE;
// Scarto i movimenti che hanno il registro ai soli fini della liquidazione
const tipo_sospensione ts = r->lfile("REG").get_bool("B1") ? (tipo_sospensione) r->lfile("REG").get_int("I9") : nessuna;
if (ts == liquidazione)
return FALSE;
// In caso di NO libro con iva scarta quelli che non hanno righe contabili
if (!app()._libro_giornale_iva_unico)
@ -271,37 +280,12 @@ bool TStampa_giornale::filter_func(const TRelation * r)
//////////////////////////////////////////////////////////////////////////
// Funzioni legate ai parametri ditta
//////////////////////////////////////////////////////////////////////////
HIDDEN bool libro_giornale_iva_unico()
const TRectype& TStampa_giornale::look_com (const char* cod, const char* stato)
{
TConfig conf(CONFIG_DITTA);
return conf.get_bool("StLgiU");
}
HIDDEN bool libro_cronologico()
{
TConfig conf(CONFIG_DITTA);
return conf.get_bool("GsLbCn");
}
TRectype& TStampa_giornale::look_com (const TString& stato, const TString& cod)
{
_com->zero();
_com->put(COM_COM, cod);
_com->put(COM_STATO, stato);
if (_com->read() != NOERR)
_com->zero();
return _com->curr();
}
TRectype& TStampa_giornale::look_com (const char * cod)
{
_com->zero();
_com->put(COM_COM, cod);
if (_com->read() != NOERR)
_com->zero();
return _com->curr();
TString16 codice;
codice << stato << '|' << cod;
return _com->get(codice);
}
const char* TStampa_giornale::get_descr_caus (const char * codcaus)
@ -311,8 +295,8 @@ const char* TStampa_giornale::get_descr_caus (const char * codcaus)
void TStampa_giornale::get_dati_ditta ()
{
TString16 codanagr;
char tipoa;
TString16 codanagr;
char tipoa;
_nditte->zero();
_nditte->put(NDT_CODDITTA, get_firm());
@ -338,7 +322,7 @@ void TStampa_giornale::get_dati_ditta ()
if (_comunefis.empty())
_comunefis = _anag->get(ANF_COMRES);
TRectype dep = look_com (_comunefis);
const TRectype& dep = look_com (_comunefis);
_comunefis = dep.get(COM_DENCOM);
_provfis = dep.get(COM_PROVCOM);
@ -358,18 +342,23 @@ void TStampa_giornale::get_dati_ditta ()
}
}
void TStampa_giornale::on_firm_change()
{
TConfig conf(CONFIG_DITTA);
_libro_giornale_iva_unico = conf.get_bool("StLgiU");
_libro_cronologico = conf.get_bool("GsLbCn");
}
bool TStampa_giornale::user_create()
{
_ae = 0;
_ae_solare = 0;
_tabreg = new TTable ("REG");
_tabval = new TTable ("%VAL");
_tabes = new TTable ("ESC");
_tabiva = new TTable ("%IVA");
_tabiva = new TDecoder("%IVA");
_nditte = new TLocalisamfile(LF_NDITTE);
_anag = new TLocalisamfile (LF_ANAG);
_com = new TLocalisamfile(LF_COMUNI);
_com = new TRecord_cache(LF_COMUNI);
_clifo = new TLocalisamfile(LF_CLIFO);
_pconti = new TLocalisamfile(LF_PCON);
_attiv = new TLocalisamfile(LF_ATTIV); // da togliere
@ -378,6 +367,7 @@ bool TStampa_giornale::user_create()
_rel = new TRelation (LF_MOV);
_rel->add (LF_RMOV, "NUMREG=NUMREG");
_rel->add (LF_RMOVIVA, "NUMREG=NUMREG");
_rel->add ("REG", "CODTAB[1,4]=ANNOIVA|CODTAB[5,7]=REG");
_cur = new TCursor (_rel, "", 2); // usa la chiave 2: DATAREG+NUMREG
@ -395,19 +385,18 @@ bool TStampa_giornale::user_create()
bool TStampa_giornale::user_destroy()
{
delete _rel;
delete _cur;
delete _RecPartoDa;
delete _RecArrivoA;
delete _com; delete _clifo; delete _pconti;
delete _com;
delete _clifo; delete _pconti;
delete _nditte; delete _anag;
delete _tabreg; delete _tabes; delete _tabval; delete _tabiva;
delete _tabreg;
delete _tabiva;
delete _causali;
delete _attiv; // da togliere in futuro
delete _nditte;
delete _anag;
return TRUE;
}
@ -449,8 +438,8 @@ int TStampa_giornale::set_totali_giorno(const TDate& data, const int righeiva)
// Se e' l'unico totale lo stampo anche se e' zero
if (competenza_ec() || (_tot_avere_gg != ZERO || _tot_dare_gg != ZERO))
{
TString td(_tot_dare_gg.string (REAL_PICTURE));
TString ta(_tot_avere_gg.string(REAL_PICTURE));
TString80 td; real2currency(td, _tot_dare_gg);
TString80 ta; real2currency(ta, _tot_avere_gg);
sprintf(dep, "@b@%dgTotale operazioni del %s @%dg%c %s @%dg%c @%dg%s",
_stampa_width == 132 ? SCRITTA : DARE198-STACC,
@ -470,8 +459,8 @@ int TStampa_giornale::set_totali_giorno(const TDate& data, const int righeiva)
if (competenza_ep() || (_tot_avere_gg_ap != ZERO || _tot_dare_gg_ap != ZERO))
{
TString tdp(_tot_dare_gg_ap.string(REAL_PICTURE));
TString tap(_tot_avere_gg_ap.string(REAL_PICTURE));
TString80 tdp; real2currency(tdp, _tot_dare_gg_ap);
TString80 tap; real2currency(tap, _tot_avere_gg_ap);
sprintf (dep, "@b@%dgTotale operazioni del %s Anno precedente @%dg%c %s @%dg%c @%dg%s",
_stampa_width == 132 ? SCRITTA : DARE198-STACC,
@ -495,14 +484,11 @@ int TStampa_giornale::set_totali_giorno(const TDate& data, const int righeiva)
void TStampa_giornale::postclose_print()
{
if (_stampa_definitiva)
if (_stampa_definitiva && yesno_box("La stampa e' corretta?"))
{
if (yesno_box("La stampa e' corretta ?"))
{
const int ultima_fatta = _pagine_contate;
aggiorna_mov();
aggiorna_tabreg (_pagina_da, ultima_fatta);
}
const int ultima_fatta = _pagine_contate;
aggiorna_mov();
aggiorna_tabreg (_pagina_da, ultima_fatta);
}
}
@ -521,8 +507,8 @@ void TStampa_giornale::preprocess_footer()
if (_tot_avere_progr_ap != ZERO || _tot_dare_progr_ap != ZERO)
{
progr_dare_ap = _tot_dare_progr_ap.string(REAL_PICTURE);
progr_avere_ap = _tot_avere_progr_ap.string(REAL_PICTURE);
real2currency(progr_dare_ap, _tot_dare_progr_ap);
real2currency(progr_avere_ap, _tot_avere_progr_ap);
ap = TRUE;
}
@ -544,8 +530,8 @@ void TStampa_giornale::preprocess_footer()
{
dt = _tot_dare_progr + _tot_dare_progr_ap;
at = _tot_avere_progr + _tot_avere_progr_ap;
dts = dt.string(REAL_PICTURE);
ats = at.string(REAL_PICTURE);
real2currency(dts, dt);
real2currency(ats, at);
riga.format ("@b@%dg%s@%dg%c %s @%dg%c @%dg%s",
_stampa_width == 132 ? SCRITTA : DARE198-STUMB,
@ -581,8 +567,8 @@ int TStampa_giornale::set_totali_pagina(int righe)
if (_tot_avere_progr_ap != ZERO || _tot_dare_progr_ap != ZERO)
{
progr_dare_ap = _tot_dare_progr_ap.string(REAL_PICTURE);
progr_avere_ap = _tot_avere_progr_ap.string(REAL_PICTURE);
real2currency(progr_dare_ap, _tot_dare_progr_ap);
real2currency(progr_avere_ap, _tot_avere_progr_ap);
ap = TRUE;
}
@ -591,8 +577,8 @@ int TStampa_giornale::set_totali_pagina(int righe)
// I totali distinti tra anno precedente e corrente SOLO SE STAMPA DI PROVA
if (!_stampa_definitiva)
{
progr_dare = _tot_dare_progr.string (REAL_PICTURE);
progr_avere = _tot_avere_progr.string(REAL_PICTURE);
real2currency(progr_dare, _tot_dare_progr);
real2currency(progr_avere, _tot_avere_progr);
riga = "";
riga.format("@b@%dgTotale progressivi @%dg%c %s @%dg%c @%dg%s",
_stampa_width == 132 ? SCRITTA : DARE198-STUMB,
@ -625,8 +611,8 @@ int TStampa_giornale::set_totali_pagina(int righe)
_tot_dare_generale = _tot_dare_progr + _tot_dare_progr_ap;
_tot_avere_generale = _tot_avere_progr + _tot_avere_progr_ap;
dts = _tot_dare_generale.string (REAL_PICTURE);
ats = _tot_avere_generale.string(REAL_PICTURE);
real2currency(dts, _tot_dare_generale);
real2currency(ats, _tot_avere_generale);
riga.format("@b@%dgTotale progressivi generali @%dg%c %s @%dg%c @%dg%s",
_stampa_width == 132 ? SCRITTA : DARE198-STUMB,
@ -653,8 +639,8 @@ int TStampa_giornale::set_totali_pagina(int righe)
dt = _tot_dare_progr + _tot_dare_progr_ap;
at = _tot_avere_progr + _tot_avere_progr_ap;
dts = dt.string(REAL_PICTURE);
ats = at.string(REAL_PICTURE);
real2currency(dts, dt);
real2currency(ats, at);
// "Se il mese e' finito devo scrivere Totale progressivi generali
// invece che A riportare"
@ -800,8 +786,8 @@ void TStampa_giornale::preprocess_header()
return;
}
TString dare (riporto_dare.string (REAL_PICTURE));
TString avere(riporto_avere.string(REAL_PICTURE));
TString80 dare; real2currency(dare, riporto_dare);
TString80 avere; real2currency(avere, riporto_avere);
riporto.format("@b@%dgRiporto: @%dg%c %17s @%dg%c@%dg%17s", // prima erano %15s
_stampa_width == 132 ? SCRITTA : DARE198-11,
@ -1054,8 +1040,6 @@ void TStampa_giornale::set_rows (int file, int counter)
TString16 datadoc_str, datareg_str, numdoc, frm, caus;
TDate datadoc, datareg;
TString80 mov_descr, rmv_descr;
TParagraph_string descr_conto("", 50);
TContoOccas tc;
long numreg, protiva;
int r = 1;
int g, c;
@ -1066,152 +1050,156 @@ void TStampa_giornale::set_rows (int file, int counter)
switch (file)
{
case LF_MOV:
reset_row(1);
reset_row(2);
datareg = _cur->file(LF_MOV).get_date("DATAREG");
datadoc = _cur->file(LF_MOV).get_date("DATADOC");
datareg_str = datareg.string();
// "Fai vedere lo stesso ..-..-.... anche se non c'e' la data..."
if (datareg_str.empty())
datareg_str = " - - ";
datadoc_str = datadoc.string();
if (datadoc_str.empty())
datadoc_str = " - - ";
numdoc = _cur->file(LF_MOV).get("NUMDOC");
numreg = _cur->file(LF_MOV).get_long("NUMREG");
mov_descr = _cur->file(LF_MOV).get("DESCR");
// Usati in setta_righe_iva per determinare tipo attivita'
_reg = _cur->file(LF_MOV).get(MOV_REG);
_anno_iva = _cur->file(LF_MOV).get_int(MOV_ANNOIVA);
protiva = _cur->file(LF_MOV).get_long(MOV_PROTIVA);
caus = _cur->file(LF_MOV).get(MOV_CODCAUS);
_occfpi = _cur->file(LF_MOV).get(MOV_OCFPI);
_annoEsMov = _cur->file(LF_MOV).get_int(MOV_ANNOES);
_MovGiaStampato = _cur->file(LF_MOV).get_bool(MOV_STAMPATO);
if (_stampa_definitiva)
{
set_row(r,"Operazione n. @b%-7ld@r", _nprog_mov);
set_row(r," del @b%s@r", (const char*)datareg_str); // XX/XX/XXXX
set_row(r," doc. n. @b%-7s@r",(const char*)numdoc);
set_row(r," del @b%s@r %-50s",(const char*)datadoc_str,
(const char*)mov_descr);
}
else
{
set_row(r,"Operazione n. @b%-7ld@r", numreg);
set_row(r," del @b%s@r", (const char*) datareg_str);
set_row(r," doc. n. @b%-7s@r", (const char*) numdoc);
set_row(r," del @b%s@r %-50s", (const char*)datadoc_str,(const char*)mov_descr);
}
if (_annoEsMov != _ae)
set_row(r," Comp. %04d", _annoEsMov);
const TRectype& mov = _cur->curr(LF_MOV);
reset_row(1);
reset_row(2);
if (_MovGiaStampato && !_stampa_definitiva)
{
TString16 str;
str.format("@%dg*",_stampa_width == 132 ? 131 : 197);
set_row(r,str);
}
datareg = mov.get_date("DATAREG");
datadoc = mov.get_date("DATADOC");
datareg_str = datareg.string();
// "Fai vedere lo stesso ..-..-.... anche se non c'e' la data..."
if (datareg_str.empty())
datareg_str = " - - ";
datadoc_str = datadoc.string();
if (datadoc_str.empty())
datadoc_str = " - - ";
numdoc = mov.get("NUMDOC");
numreg = mov.get_long("NUMREG");
mov_descr = mov.get("DESCR");
if (caus.not_empty())
{
const char* desc_caus = get_descr_caus(caus);
set_row(r+1, "@36gCausale %3s %-50s", (const char*) caus, desc_caus);
if (_reg.not_empty())
set_row(r+1, " (R.IVA @b%3s@r Prot. @b%ld@r) ", (const char*)_reg,protiva);
}
// Usati in setta_righe_iva per determinare tipo attivita'
_reg = mov.get(MOV_REG);
_anno_iva = mov.get_int(MOV_ANNOIVA);
protiva = mov.get_long(MOV_PROTIVA);
caus = mov.get(MOV_CODCAUS);
_occfpi = mov.get(MOV_OCFPI);
_annoEsMov = mov.get_int(MOV_ANNOES);
_MovGiaStampato = mov.get_bool(MOV_STAMPATO);
if (_stampa_definitiva)
{
set_row(r,"Operazione n. @b%-7ld@r", _nprog_mov);
set_row(r," del @b%s@r", (const char*)datareg_str); // XX/XX/XXXX
set_row(r," doc. n. @b%-7s@r",(const char*)numdoc);
set_row(r," del @b%s@r %-50s",(const char*)datadoc_str,
(const char*)mov_descr);
}
else
{
set_row(r,"Operazione n. @b%-7ld@r", numreg);
set_row(r," del @b%s@r", (const char*) datareg_str);
set_row(r," doc. n. @b%-7s@r", (const char*) numdoc);
set_row(r," del @b%s@r %-50s", (const char*)datadoc_str,(const char*)mov_descr);
}
if (_annoEsMov != _ae)
set_row(r," Comp. %04d", _annoEsMov);
if (_MovGiaStampato && !_stampa_definitiva)
{
TString16 fmt;
fmt.format("@%dg*", _stampa_width == 132 ? 131 : 197);
set_row(r,fmt);
}
if (caus.not_empty())
{
const char* desc_caus = get_descr_caus(caus);
set_row(r+1, "@36gCausale %3s %-50s", (const char*) caus, desc_caus);
if (_reg.not_empty())
set_row(r+1, " (R.IVA @b%3s@r Prot. @b%ld@r) ", (const char*)_reg,protiva);
}
}
break;
case LF_RMOV:
_num_rig++;
reset_print();
g = _cur->file(LF_RMOV).get_int("GRUPPO");
c = _cur->file(LF_RMOV).get_int("CONTO");
s = _cur->file(LF_RMOV).get_long("SOTTOCONTO");
cf = _cur->file(LF_RMOV).get_char(RMV_TIPOC);
if (cf != 'C' && cf != 'F')
cf = ' ';
numreg = _cur->file(LF_RMOV).get_long("NUMREG");
datareg = _cur->file(LF_RMOV).get("DATAREG");
_sezione = _cur->file(LF_RMOV).get_char (RMV_SEZIONE);
_importo = _cur->file(LF_RMOV).get_real (RMV_IMPORTO);
rmv_descr = _cur->file(LF_RMOV).get(RMV_DESCR);
r=1;
// Num. progressivo di operazione. Azzerato in preprocess_page
if (!_stampa_definitiva) set_row (r, "%7ld", _num_rig);
set_row (r, "@8g%-50s", (const char*) rmv_descr);
set_row (r, "@59g%03d.", g);
if (c != 0)
set_row (r, "%03d.", c);
if (s != 0L)
set_row (r, "%06ld", s);
tc.set(g,c,s,cf,NULL,-1,_occfpi);
if (_stampa_width == 132)
descr_conto.set_width (WCONTO132);
else // se a 198 non spezzo le descrizioni
descr_conto.set_width(198);
descr_conto = tc.descrizione();
if (_stampa_width == 132)
rdes = setta_righe_descr (descr_conto, conto);
else
{
rdes = 2;
frm.format("@%dg%%-%ds", POSCONTO,50);
set_row (r, frm, (const char*) descr_conto);
}
const TRectype& rmov = _cur->curr(LF_RMOV);
_num_rig++;
reset_print();
if (cf > ' ')
if (_libro_cronologico)
rdes = setta_righe_indirizzo(cf, s, rdes);
g = rmov.get_int("GRUPPO");
c = rmov.get_int("CONTO");
s = rmov.get_long("SOTTOCONTO");
cf = rmov.get_char(RMV_TIPOC);
// NB Totali aggiornati in postprocess_page (update_totals())
if (_stampa_width == 132)
{
set_row (r, "@110g%r %c", &_importo, _sezione);
}
else // stampa_width == 198
set_row (r, _sezione == 'D' ? "@152g%r" : "@174g%r", &_importo);
if (cf != 'C' && cf != 'F')
cf = ' ';
if (_MovGiaStampato && !_stampa_definitiva)
{
TString16 str;
str.format("@%dg*",_stampa_width == 132 ? 131 : 197);
set_row(r, str);
}
numreg = rmov.get_long("NUMREG");
datareg = rmov.get("DATAREG");
{
const int rows = rdes - 1;
const int left = printer().rows_left();
if (left > 0 && left < rows)
{
_totals_updated = TRUE;
update_totals(_sezione, _importo);
}
_sezione = rmov.get_char (RMV_SEZIONE);
_importo = rmov.get_real (RMV_IMPORTO);
rmv_descr = rmov.get(RMV_DESCR);
r=1;
// Num. progressivo di operazione. Azzerato in preprocess_page
if (!_stampa_definitiva) set_row (r, "%7ld", _num_rig);
set_row (r, "@8g%-50s", (const char*) rmv_descr);
set_row (r, "@59g%03d.", g);
if (c != 0)
set_row (r, "%03d.", c);
if (s != 0L)
set_row (r, "%06ld", s);
_tc.set(g,c,s,cf,_occfpi);
TParagraph_string descr_conto("", 198);
if (_stampa_width == 132)
descr_conto.set_width (WCONTO132);
else // se a 198 non spezzo le descrizioni
descr_conto.set_width(198);
descr_conto = _tc.descrizione();
if (_stampa_width == 132)
rdes = setta_righe_descr (descr_conto, conto);
else
_totals_updated = FALSE;
}
{
rdes = 2;
frm.format("@%dg%%-%ds", POSCONTO,50);
set_row (r, frm, (const char*) descr_conto);
}
if (cf > ' ')
if (_libro_cronologico)
rdes = setta_righe_indirizzo(cf, s, rdes);
// NB Totali aggiornati in postprocess_page (update_totals())
if (_stampa_width == 132)
{
set_row (r, "@110g%r %c", &_importo, _sezione);
}
else // stampa_width == 198
set_row (r, _sezione == 'D' ? "@152g%r" : "@174g%r", &_importo);
if (_MovGiaStampato && !_stampa_definitiva)
{
TString16 fmt;
fmt.format("@%dg*", _stampa_width == 132 ? 131 : 197);
set_row(r,fmt);
}
{
const int rows = rdes - 1;
const int left = printer().rows_left();
if (left > 0 && left < rows)
{
_totals_updated = TRUE;
update_totals(_sezione, _importo);
}
else
_totals_updated = FALSE;
}
}
break;
default:
@ -1228,21 +1216,24 @@ bool TStampa_giornale::preprocess_page(int file, int counter)
{
if (counter) return TRUE;
switch (file) {
switch (file)
{
case LF_MOV:
_annoEsMov = _anno_iva = 0;
_iva_array.destroy();
*_RecArrivoA = _cur->file(LF_MOV).curr();
_nprog_mov++;
// Il numero di operazione deve ripartire da 0 per ogni movimento
_num_rig = 0;
_data_corr = _cur->file(LF_MOV).get_date(MOV_DATAREG);
// _ultima_data_mov finisce sul registro come ultima data di stampa
if (_data_corr > _ultima_data_mov)
_ultima_data_mov = _data_corr;
_mese_corr = _data_corr.month();
_devo_riportare = TRUE;
{
_annoEsMov = _anno_iva = 0;
_iva_array.destroy();
*_RecArrivoA = _cur->file(LF_MOV).curr();
_nprog_mov++;
// Il numero di operazione deve ripartire da 0 per ogni movimento
_num_rig = 0;
_data_corr = _cur->file(LF_MOV).get_date(MOV_DATAREG);
// _ultima_data_mov finisce sul registro come ultima data di stampa
if (_data_corr > _ultima_data_mov)
_ultima_data_mov = _data_corr;
_mese_corr = _data_corr.month();
_devo_riportare = TRUE;
}
break;
case LF_RMOV:
@ -1261,11 +1252,11 @@ bool TStampa_giornale::preprocess_page(int file, int counter)
void TStampa_giornale::calcola_iva()
{
TString codiva;
TString16 codiva;
int tipocr, tipodet, tipoatt;
real impo, impos;
bool intra;
TRectype iva (_cur->file(LF_RMOVIVA).curr());
const TRectype& iva = _cur->file(LF_RMOVIVA).curr();
if (!iva.empty())
{
@ -1322,14 +1313,9 @@ int TStampa_giornale::setta_righe_descr(TParagraph_string& str, enum descr des)
return i;
}
const char* TStampa_giornale::get_codiva_des(const char* codiva)
const TString& TStampa_giornale::get_codiva_des(const char* codiva)
{
_tabiva->zero();
_tabiva->put("CODTAB", codiva);
if (_tabiva->read() == NOERR)
return _tabiva->get("S0");
else
return NULL;
return _tabiva->decode(codiva);
}
// NB
@ -1343,18 +1329,18 @@ int TStampa_giornale::setta_righe_iva()
for (j = 0; j < _iva_array.items(); j++)
{
TRigaiva& riga = (TRigaiva&)_iva_array[j];
const TRigaiva& riga = (TRigaiva&)_iva_array[j];
r = j+1;
TString impon_str(riga._imponibile.string(REAL_PICTURE));
TString impos_str(riga._imposta.string(REAL_PICTURE));
TString80 impon_str; real2currency(impon_str, riga._imponibile);
TString80 impos_str; real2currency(impos_str, riga._imposta);
// set_row(r, " Imponibile@15g%15r", &riga._imponibile);
// set_row(r, "@31gImposta@39g%15r", &riga._imposta);
set_row(r, " Imponibile@15g%15s", (const char*)impon_str);
set_row(r, "@35gImposta@43g%15s", (const char*)impos_str);
// set_row(r, "@58gCod.Iva@68g%3s", (const char*)riga._codiva);
set_row(r, "@64gCod.Iva %3s", (const char*)riga._codiva);
const TString80 codiva_des(get_codiva_des(riga._codiva));
const int tipoatt = riga._tipoatt;
const TString& codiva_des = get_codiva_des(riga._codiva);
const int tipoatt = riga._tipoatt;
if (_stampa_width == 132)
set_row(r, "@76g%-.17s", (const char*)codiva_des);
else
@ -1384,32 +1370,31 @@ int TStampa_giornale::setta_righe_iva()
if (meseliq > 0)
set_row(r, " Mese liq. %2d", meseliq);
TRegistro reg(_reg, _anno_iva);
const bool att_mista_ev = reg.attivita_mista();
if (tipoatt != 0 && att_mista_ev)
set_row(r, " Tipo attivita' %d", tipoatt);
if (tipoatt != 0)
{
TRegistro reg(_reg, _anno_iva);
const bool att_mista_ev = reg.attivita_mista();
if (att_mista_ev)
set_row(r, " Tipo attivita' %d", tipoatt);
}
}
_iva_array.destroy();
return r;
}
int TStampa_giornale::setta_righe_valuta(int riga)
int TStampa_giornale::setta_righe_valuta(int r)
{
TString16 codvali;
real corrval;
int r = riga;
corrval = current_cursor()->file(LF_MOV).get_real(MOV_CORRVALUTA);
const real corrval = current_cursor()->file(LF_MOV).get_real(MOV_CORRVALUTA);
if (corrval != ZERO)
{
codvali = current_cursor()->file(LF_MOV).get(MOV_CODVALI);
TString valut(corrval.string("###.###.###.###,@@@"));
r = riga+1;
set_row(r,"@56gValuta %3s", (const char*)codvali);
const TString16 codvali = current_cursor()->file(LF_MOV).get(MOV_CODVALI);
const TCurrency cur(corrval, codvali);
set_row(++r,"@56gValuta %3s", (const char*)codvali);
if (_stampa_width == 132)
set_row(r,"@89gCorr.in valuta @109g%s", (const char*)valut);
set_row(r,"@89gCorr.in valuta @109g%20v", &cur);
else
set_row(r,"@119gCorr.in valuta @171g%s", (const char*)valut);
set_row(r,"@119gCorr.in valuta @171g%20v", &cur);
}
return r;
}
@ -1462,7 +1447,7 @@ int TStampa_giornale::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
codanagr = _clifo->get_long(CLI_CODANAGPER);
}
TRectype rec = look_com (statocf, comcf);
const TRectype& rec = look_com (comcf, statocf);
comune = rec.get(COM_DENCOM);
prov = rec.get(COM_PROVCOM);
if (comcf.empty()) comune = _clifo->get(CLI_LOCCF);
@ -1500,7 +1485,7 @@ int TStampa_giornale::setta_righe_indirizzo(char tipocf, long codcf,int rdes)
{
codcomna = _clifo->get("COMNASC");
statona = _clifo->get("STATONASC");
TRectype dep = look_com (statona,codcomna);
const TRectype& dep = look_com (codcomna, statona);
comna = dep.get(COM_DENCOM);
provna = dep.get(COM_PROVCOM);
@ -1571,7 +1556,7 @@ bool TStampa_giornale::controlla_mov_aep()
a.put (MOV_DATAREG, fine_ep);
_cur->setregion(da, a);
_cur->set_filterfunction(filter_func);
_cur->set_filterfunction(filter_func, TRUE);
// _cur->setfilter(format("ANNOES=%04d && STAMPATO!=\"X\"", aep));
bool gia_stampati = TRUE;
@ -1880,7 +1865,7 @@ bool TStampa_giornale::init_cursor()
a.put (MOV_DATAREG, _data_a);
_cur->setregion(da, a);
_cur->set_filterfunction(filter_func);
_cur->set_filterfunction(filter_func, TRUE);
_cur->setfilter(_stampa_definitiva ? "STAMPATO!=\"X\"" : "");
(*_cur) = 0L;
@ -1897,7 +1882,6 @@ bool TStampa_giornale::init_cursor()
bool TStampa_giornale::set_print(int)
{
TMask ma ("cg3400a");
KEY tasto;
ma.set_handler (CODREG, mask_a_cod_reg);
ma.set_handler (DATA_A, data_a_hndl);
@ -1907,11 +1891,9 @@ bool TStampa_giornale::set_print(int)
_pagina_da = 0; // Parto dall'inizio
_forza_ariportare = FALSE;
KEY tasto;
while ((tasto = ma.run()) != K_QUIT)
{
_libro_giornale_iva_unico = libro_giornale_iva_unico();
_libro_cronologico = libro_cronologico();
_reg_cod = ma.get(CODREG);
_stampa_definitiva = ma.get_bool(STAMPA_DEF);
_data_da = ma.get(DATA_DA);
@ -1920,6 +1902,9 @@ bool TStampa_giornale::set_print(int)
_stampa_width = ma.get_int(STAMPA_WIDTH);
_stampa_len = ma.get_int(STAMPA_LEN);
set_magic_currency(TRUE);
set_curr_codval(ma.get(F_CODVAL));
// Se stampa definitiva DALLA_DATA e' la data di inizio esercizio
// e si scartano i movimenti gia' stampati su bollato
if (_stampa_definitiva)

View File

@ -5,6 +5,7 @@
#define DATA_A 102
#define STAMPA_DEF 103
//#define PAGINA_DA 104
#define F_CODVAL 105
#define REG_DESC 107
@ -14,4 +15,3 @@
#define STAMPA_LEN 110
#define F_CODDITTA 111
#define F_RAGSOC 112

View File

@ -2,25 +2,25 @@
PAGE "Stampa Libro Giornale" -1 -1 76 14
GROUPBOX DLG_NULL 77 3
GROUPBOX DLG_NULL 74 3
BEGIN
PROMPT 1 0 ""
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 3 1 "Ditta "
FLAGS "FRD"
USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA
OUTPUT F_RAGSOC RAGSOC
PROMPT 2 1 "Ditta "
FLAGS "FRD"
USE LF_NDITTE KEY 1
INPUT CODDITTA F_CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE REQUIRED
END
STRING F_RAGSOC 50
BEGIN
PROMPT 17 1 "Ragione "
FLAGS "D"
PROMPT 15 1 "Ragione "
FLAGS "D"
END
DATE DATA_DA
@ -69,9 +69,8 @@ END
STRING REG_DESC 50
BEGIN
// PROMPT 1 7 "Descrizione "
PROMPT 25 6 ""
FLAGS "D"
PROMPT 24 6 ""
FLAGS "D"
END
@ -106,7 +105,6 @@ END
LISTBOX STAMPA_WIDTH 4
BEGIN
PROMPT 41 9 "Numero di colonne "
// PROMPT 2 9 "Numero di colonne "
HELP "Numero di colonne per pagina del modulo di stampa."
ITEM "1|132"
ITEM "2|198"
@ -115,26 +113,37 @@ END
NUMBER STAMPA_LEN 3
BEGIN
PROMPT 41 10 "Numero di righe "
// PROMPT 2 10 "Numero di righe "
HELP "Numero di righe per pagina del modulo di stampa. Se non specificato assume 66 righe"
END
BOOLEAN STAMPA_DEF
BEGIN
// PROMPT 2 13 "Stampa definitiva su bollato"
PROMPT 1 9 "Stampa definitiva su bollato"
HELP "Seleziona la stampa su bollato oppure, se vuoto, la stampa di prova"
MESSAGE TRUE DISABLE,DATA_DA | CLEAR, DATA_DA
MESSAGE TRUE CLEAR,DATA_DA
MESSAGE FALSE ENABLE,DATA_DA
END
BUTTON DLG_PRINT 9 2
STRING F_CODVAL 3
BEGIN
PROMPT 1 10 "Valuta "
USE %VAL
INPUT CODTAB F_CODVAL
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAL CODTAB
CHECKTYPE NORMAL
// Per ora non visibile
FLAGS "HU"
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 9 2
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END

View File

@ -8,10 +8,9 @@ BEGIN
PROMPT 1 1 "Ultimo numero di riga stampato "
END
NUMBER PROGR_DARE 18
CURRENCY PROGR_DARE 18
BEGIN
PROMPT 1 3 "Progressivo dare "
PICTURE "##.###.###.###.###"
END
DATE ULTIMA_DATA

View File

@ -424,15 +424,13 @@ bool TStampa_riepilogo::ricerca_cf(TConto& conto,int indbil,real& prg_conto_dare
bool TStampa_riepilogo::preprocess_print(int file, int counter)
{
#ifdef DBG
set_real_picture ("@@@.@@@.###.###.###");
#else
set_real_picture ("###.###.###.###.###");
#endif
set_print_zero(FALSE);
set_print_zero(FALSE);
set_magic_currency(TRUE);
_tmp_saldi->setkey(2);
_prg_dare_tot = 0.00;
_prg_avere_tot = 0.00;
_prg_dare_tot = 0.0;
_prg_avere_tot = 0.0;
_gprec = -1;
_cprec = -1;
@ -783,9 +781,9 @@ void TStampa_riepilogo::setta_riga_totale()
go += 20;
}
TString st(24);
st << '@' << go << 'g' << _saldo_tot.string("###.###.###.###.###");
set_row(r, (const char*)st);
TString16 st;
st << '@' << go << "g%r";
set_row(r, st, &_saldo_tot);
}
}
@ -838,12 +836,11 @@ bool TStampa_riepilogo::user_destroy()
bool TStampa_riepilogo::set_print(int)
{
TMask m ("cg3500a");
KEY tasto = m.run();
if (tasto == K_ENTER)
if (m.run() == K_ENTER)
{
_annoese = atoi(m.get(F_ANNO));
_scelta = atoi(m.get(F_STAMPA));
_richiesta = atoi(m.get(F_RICHIESTA));
_annoese = m.get_int(F_ANNO);
_scelta = m.get_int(F_STAMPA);
_richiesta = m.get_int(F_RICHIESTA);
_data = m.get(F_DATASTAMPA);
_prog = new TProgind(_pcn->items(), "Elaborazione in corso...", FALSE);

View File

@ -3,6 +3,7 @@
#include <applicat.h>
#include <colors.h>
#include <controls.h>
#include <currency.h>
#include <execp.h>
#include <mailbox.h>
#include <progind.h>
@ -2189,12 +2190,18 @@ void TMastrini_grid::destroy()
grid().select(-1);
}
HIDDEN const char* real2string(const real& r)
{
TCurrency cur(r, "_FIRM");
return cur.string(TRUE);
}
HIDDEN void set_imp(TMask_field& f, const TImporto& imp)
{
if (!imp.is_zero())
{
TString80 str;
str.format("%s %c", imp.valore().string("."), imp.sezione());
str.format("%s %c", real2string(imp.valore()), imp.sezione());
f.set(str);
}
else
@ -2271,14 +2278,14 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
{
const TRectype& rmov = _mastrino.riga(rec);
if (rmov.get_char(RMV_SEZIONE) == 'D')
cell = rmov.get_real(RMV_IMPORTO).string(".");
cell = real2string(rmov.get_real(RMV_IMPORTO));
}
break;
case 106:
{
const TRectype& rmov = _mastrino.riga(rec);
if (rmov.get_char(RMV_SEZIONE) == 'A')
cell = rmov.get_real(RMV_IMPORTO).string(".");
cell = real2string(rmov.get_real(RMV_IMPORTO));
}
break;
case 107:
@ -2292,7 +2299,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
case 108:
{
const TRectype& rmov = _mastrino.riga(rec);
cell = rmov.get_real(RMV_IMPORTO).string(".");
cell = real2string(rmov.get_real(RMV_IMPORTO));
cell << ' ' << rmov.get(RMV_SEZIONE);
}
break;
@ -2311,7 +2318,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
TImporto imp = riga.saldo();
imp += _mastrino.saldo_iniziale();
imp.normalize();
cell = imp.valore().string(".");
cell = real2string(imp.valore());
cell << ' ' << imp.sezione();
}
}

View File

@ -63,9 +63,9 @@ SPREADSHEET F_MASTRINI 0 -6
BEGIN
PROMPT 1 2 "Mastrini"
FLAGS "DM2"
ITEM "Data Op. \nData Doc.@10F"
ITEM "C@1F"
ITEM "Causale@20F"
ITEM "Data Op. \nData Doc.@10"
ITEM "C@1"
ITEM "Causale@20"
ITEM "Operazione@20"
ITEM "Dare@15R"
ITEM "Avere@15R"
@ -100,17 +100,15 @@ BEGIN
FLAGS "DR"
END
NUMBER F_TOTPRO_DAR 19
CURRENCY F_TOTPRO_DAR 19
BEGIN
PROMPT 37 -4 ""
PICTURE "."
FLAGS "D"
END
NUMBER F_TOTPRO_AVE 19
CURRENCY F_TOTPRO_AVE 19
BEGIN
PROMPT 58 -4 ""
PICTURE "."
FLAGS "D"
END
@ -125,17 +123,15 @@ BEGIN
FLAGS "DR"
END
NUMBER F_TOTRIG_DAR 19
CURRENCY F_TOTRIG_DAR 19
BEGIN
PROMPT 37 -3 ""
PICTURE "."
FLAGS "D"
END
NUMBER F_TOTRIG_AVE 19
CURRENCY F_TOTRIG_AVE 19
BEGIN
PROMPT 58 -3 ""
PICTURE "."
FLAGS "D"
END
@ -150,17 +146,15 @@ BEGIN
FLAGS "DR"
END
NUMBER F_TOTPER_DAR 19
CURRENCY F_TOTPER_DAR 19
BEGIN
PROMPT 37 -2 ""
PICTURE "."
FLAGS "D"
END
NUMBER F_TOTPER_AVE 19
CURRENCY F_TOTPER_AVE 19
BEGIN
PROMPT 58 -2 ""
PICTURE "."
FLAGS "D"
END
@ -175,17 +169,15 @@ BEGIN
FLAGS "DR"
END
NUMBER F_TOTATT_DAR 19
CURRENCY F_TOTATT_DAR 19
BEGIN
PROMPT 37 -1 ""
PICTURE "."
FLAGS "D"
END
NUMBER F_TOTATT_AVE 19
CURRENCY F_TOTATT_AVE 19
BEGIN
PROMPT 58 -1 ""
PICTURE "."
FLAGS "D"
END

View File

@ -1,15 +1,15 @@
//
//Lista fatture:
// CG3 -6 I ==> Lista fatture con iva indetrabile
// CG3 -6 C ==> Lista fatture per tipo costo/ricavo
// CG3 -6 I ==> Lista fatture con iva indetrabile
// CG3 -6 N ==> Lista fatture intracomunitarie
//
#include <printapp.h>
#include <tabutil.h>
#include <mask.h>
#include <sheet.h>
#include <urldefid.h>
#include <prefix.h>
#include <printapp.h>
#include <recarray.h>
#include <sheet.h>
#include <defmask.h>
#include "cg3.h"
#include "cg3700a.h"
@ -45,8 +45,8 @@ enum tipo_st
class TLista_fatture : public TPrintapp
{
TLocalisamfile *_nditte; // File delle ditte
TTable *_reg,
*_iva;
TDecoder *_reg;
TDecoder *_iva;
TRelation* _rel; // Relazione principale
int _cur1,
_cur2,
@ -76,6 +76,9 @@ class TLista_fatture : public TPrintapp
_tp_iva; // Totali parziali della stampa
bool _one_printed,
_print_all; // Flags per il controllo della stampa totali/parziali e righe multiple
TString _tmp;
static bool filter_func1(const TRelation *); // Funzione di filtro per cursore 1
static bool filter_func2(const TRelation *); // Funzione di filtro per cursore 3
@ -99,6 +102,9 @@ protected:
void set_the_header();
virtual void set_page(int,int);
virtual bool set_print(int);
const char* real2string(const real& r, const char* pic = NULL)
{ real2currency(_tmp, r, pic); return _tmp; }
public:
virtual bool user_create();
@ -113,69 +119,63 @@ inline TLista_fatture& app() { return (TLista_fatture&) main_app(); }
int TLista_fatture::tiporeg(const TString& reg)
{
TString s(12); s << _date_from.year(); s.format("%4d%-3s",_date_from.year(),(const char*)reg);
_reg->put("CODTAB",s);
if (_reg->read() == NOERR)
return _reg->get_int("I0");
return 0;
TString16 s; s.format("%4d%-3s",_date_from.year(),(const char*)reg);
// _reg->put("CODTAB",s);
// if (_reg->read() == NOERR)
// return _reg->get_int("I0");
// return 0;
return atoi(_reg->decode(s));
}
bool TLista_fatture::filter_func1(const TRelation *r)
{
TLocalisamfile& cau = r->lfile(LF_CAUSALI);
TLocalisamfile& mov = r->lfile(LF_MOV);
TLocalisamfile& riv = r->lfile();
TDate& from_d = app()._date_from;
TDate& to_d = app()._date_to;
TString& from_reg = app()._from_reg;
TString& to_reg = app()._to_reg;
long& from_cf = app()._from_cf;
long& to_cf = app()._to_cf;
TLista_fatture& a = app();
const TRectype& mov = r->curr(LF_MOV);
TString rg = mov.get(MOV_REG);
TDate data = mov.get_date(MOV_DATAREG);
const TDate data = mov.get_date(MOV_DATAREG);
if (data < a._date_from || data > a._date_to)
return FALSE;
const TString16 rg = mov.get(MOV_REG);
if (rg < a._from_reg || rg > a._to_reg)
return FALSE;
if (data < from_d || data > to_d)
return FALSE;
if (rg < from_reg || rg > to_reg)
return FALSE;
const long cod = mov.get_long(MOV_CODCF);
const int tiporeg = app().tiporeg(rg);
if (app()._tipo == indetraibile)
const TRectype& riv = r->curr();
if (a._tipo == indetraibile)
{
if (riv.get_int(RMI_TIPODET) == 0)
return FALSE;
if (tiporeg == 2 && cod >= from_cf && cod <= to_cf)
return TRUE;
const int tiporeg = a.tiporeg(rg);
if (tiporeg != 2)
return FALSE;
}
else // Tipo costo/ricavo
{
if (riv.get_int(RMI_TIPOCR) == 0)
return FALSE;
if (cod >= from_cf && cod <= to_cf)
return TRUE;
}
return FALSE;
const long cod = mov.get_long(MOV_CODCF);
const bool ok = cod >= a._from_cf && cod <= a._to_cf;
return ok;
}
bool TLista_fatture::filter_func2(const TRelation *r)
{
TString& from_cau = app()._from_cau;
TString& to_cau = app()._to_cau;
TDate& from_d = app()._date_from;
TDate& to_d = app()._date_to;
TLocalisamfile& mov = r->lfile(LF_MOV);
TString cau = mov.get(MOV_CODCAUS);
TDate data = mov.get_date(MOV_DATAREG);
const TLista_fatture& a = app();
const TRectype& mov = r->curr(LF_MOV);
if (data < from_d || data > to_d)
const TDate data = mov.get_date(MOV_DATAREG);
if (data < a._date_from || data > a._date_to)
return FALSE;
const bool is_intra = r->lfile().get_bool(RMI_INTRA);
if (cau >= from_cau && cau <= to_cau && is_intra)
return TRUE;
const TString& cau = mov.get(MOV_CODCAUS);
if (cau >= a._from_cau && cau <= a._to_cau)
{
const bool is_intra = r->lfile().get_bool(RMI_INTRA);
return is_intra;
}
return FALSE;
}
@ -368,7 +368,6 @@ void TLista_fatture::set_choice_limits(TMask& m)
void TLista_fatture::build_ditte_sheet()
{
_ditte->destroy();
for (_nditte->first(); _nditte->good(); _nditte->next())
{
@ -406,18 +405,18 @@ bool TLista_fatture::preprocess_page(int file, int counter)
if (new_det || new_cr) // Stampa totali parziali
{
const bool is_cr = _tipo == costo_ricavo;
TString s("TOTALE TIPO ");
TString256 s("TOTALE TIPO ");
_pr.reset();
_pr.set_style(boldstyle);
s << (is_cr ? "COSTO/RICAVO " : "INDETRAIBILITA' ");
s << (is_cr ? _tipocrprec : _tipodetprec);
_pr.put(s,42);
if (_tp_doc != 0.0)
_pr.put(_tp_doc.string("###.###.###.###"),73);
_pr.put(real2string(_tp_doc),73);
if (_tp_imp != 0.0)
_pr.put(_tp_imp.string("###.###.###.###"),89);
_pr.put(real2string(_tp_imp),89);
if (_tp_iva != 0.0)
_pr.put(_tp_iva.string("#.###.###.###"),112);
_pr.put(real2string(_tp_iva),112);
printer().print(_pr);
_pr.reset();
printer().print(_pr);
@ -492,18 +491,18 @@ print_action TLista_fatture::postprocess_print(int file, int counter)
if (_tipo != intra)
{
const bool is_cr = _tipo == costo_ricavo;
TString s("TOTALE TIPO ");
TString256 s("TOTALE TIPO ");
_pr.reset();
_pr.set_style(boldstyle);
s << (is_cr ? "COSTO/RICAVO " : "INDETRAIBILITA' ");
s << (is_cr ? _tipocrprec : _tipodetprec);
_pr.put(s,42);
if (_tp_doc != 0.0)
_pr.put(_tp_doc.string("###.###.###.###"),73);
_pr.put(real2string(_tp_doc),73);
if (_tp_imp != 0.0)
_pr.put(_tp_imp.string("###.###.###.###"),89);
_pr.put(real2string(_tp_imp),89);
if (_tp_iva != 0.0)
_pr.put(_tp_iva.string("#.###.###.###"),112);
_pr.put(real2string(_tp_iva),112);
p.print(_pr);
_pr.reset();
p.print(_pr);
@ -511,11 +510,11 @@ print_action TLista_fatture::postprocess_print(int file, int counter)
_pr.set_style(boldstyle);
_pr.put("TOTALE GENERALE :",42);
if (_tot_doc != 0.0)
_pr.put(_tot_doc.string("###.###.###.###"),73);
_pr.put(real2string(_tot_doc),73);
if (_tot_imp != 0.0)
_pr.put(_tot_imp.string("###.###.###.###"),89);
_pr.put(real2string(_tot_imp),89);
if (_tot_iva != 0.0)
_pr.put(_tot_iva.string("#.###.###.###"),112);
_pr.put(real2string(_tot_iva),112);
p.print(_pr);
}
else
@ -523,7 +522,7 @@ print_action TLista_fatture::postprocess_print(int file, int counter)
// Stampa gli elementi di _intra_items
real tot1,tot2,tot3,tot4;
TString16 cod;
TString des;
TString80 des;
_Iva_item * xiva; // Scorre gli elementi memorizzati
_pr.reset();
@ -549,13 +548,13 @@ print_action TLista_fatture::postprocess_print(int file, int counter)
p.print(_pr);
_pr.put("Totale ",1);
if (tot1 != 0.0)
_pr.put(tot1.string("###.###.###.###"),40);
_pr.put(real2string(tot1),40);
if (tot2 != 0.0)
_pr.put(tot2.string("###.###.###.###"),58);
_pr.put(real2string(tot2),58);
if (tot3 != 0.0)
_pr.put(tot3.string("###.###.###.###"),77);
_pr.put(real2string(tot3),77);
if (tot4 != 0.0)
_pr.put(tot4.string("###.###.###.###"),93);
_pr.put(real2string(tot4),93);
p.print(_pr);
_pr.reset();
p.print(_pr);
@ -564,22 +563,18 @@ print_action TLista_fatture::postprocess_print(int file, int counter)
}
else
{
_iva->put("CODTAB",cod);
if (_iva->read() == NOERR)
des = _iva->get("S0");
else
des = "";
des = _iva->decode(cod);
_pr.put(cod,1);
_pr.put(des,6);
}
if (r1 != 0.0)
_pr.put(r1.string("###.###.###.###"),40);
_pr.put(real2string(r1),40);
if (r2 != 0.0)
_pr.put(r2.string("###.###.###.###"),58);
_pr.put(real2string(r2),58);
if (r3 != 0.0)
_pr.put(r3.string("###.###.###.###"),77);
_pr.put(real2string(r3),77);
if (r4 != 0.0)
_pr.put(r4.string("###.###.###.###"),93);
_pr.put(real2string(r4),93);
tot1 += r1;
tot2 += r2;
tot3 += r3;
@ -590,13 +585,13 @@ print_action TLista_fatture::postprocess_print(int file, int counter)
p.print(_pr);
_pr.put("Totale Generale IVA",1);
if (tot1 != 0.0)
_pr.put(tot1.string("###.###.###.###"),40);
_pr.put(real2string(tot1),40);
if (tot2 != 0.0)
_pr.put(tot2.string("###.###.###.###"),58);
_pr.put(real2string(tot2),58);
if (tot3 != 0.0)
_pr.put(tot3.string("###.###.###.###"),77);
_pr.put(real2string(tot3),77);
if (tot4 != 0.0)
_pr.put(tot4.string("###.###.###.###"),93);
_pr.put(real2string(tot4),93);
p.print(_pr);
}
return NEXT_PAGE;
@ -611,11 +606,12 @@ void TLista_fatture::set_the_header()
_nditte->zero();
_nditte->put(NDT_CODDITTA, firm);
_nditte->read();
if (_nditte->bad()) _nditte->zero();
if (_nditte->bad())
_nditte->zero();
TDate today(TODAY);
TString rw(132);
TString s,s1,s2;
TString s(132), rw(132);
TString16 s1,s2;
s = _nditte->get(NDT_RAGSOC);
s1 = _date_from.string();
s2 = _date_to.string();
@ -695,7 +691,7 @@ void TLista_fatture::set_page(int file, int counter)
}
set_row(nriga,"@89g@15n@105g@4,rs",FLD(LF_RMOVIVA,RMI_IMPONIBILE),FLD(LF_RMOVIVA,RMI_CODIVA));
set_row(nriga,"@110g@1s",FLD(LF_RMOVIVA, cr ? RMI_TIPOCR : RMI_TIPODET));
set_row(nriga,"@112g@13pn",FLD(LF_RMOVIVA,RMI_IMPOSTA,"#.###.###.###"));
set_row(nriga,"@112g@15n",FLD(LF_RMOVIVA,RMI_IMPOSTA));
}
bool TLista_fatture::set_print(int m)
@ -716,6 +712,7 @@ bool TLista_fatture::set_print(int m)
add_file(LF_RMOVIVA);
set_real_picture("###.###.###.###");
set_magic_currency(TRUE);
switch (_tipo)
{
@ -733,83 +730,77 @@ bool TLista_fatture::set_print(int m)
break;
}
KEY k;
do
while (msk.run() == K_ENTER)
{
k = msk.run();
if (k == K_ENTER)
{
_from_cf = msk.get_long(FLD_FROM_FOR);
_to_cf = msk.get_long(FLD_TO_FOR);
if (_to_cf == 0L)
_to_cf = 999999L;
_from_reg = msk.get(FLD_FROM_REG);
_to_reg = msk.get(FLD_TO_REG);
if (_to_reg.empty())
_to_reg = "~~~";
_from_cau = msk.get(FLD_FROM_CAU);
_to_cau = msk.get(FLD_TO_CAU);
if (_to_cau.empty())
_to_cau = "~~~";
_date_from = msk.get_date(FLD_DATE_FROM);
_date_to = msk.get_date(FLD_DATE_TO);
_from_cf = msk.get_long(FLD_FROM_FOR);
_to_cf = msk.get_long(FLD_TO_FOR);
if (_to_cf == 0L)
_to_cf = 999999L;
_from_reg = msk.get(FLD_FROM_REG);
_to_reg = msk.get(FLD_TO_REG);
if (_to_reg.empty())
_to_reg = "~~~";
_from_cau = msk.get(FLD_FROM_CAU);
_to_cau = msk.get(FLD_TO_CAU);
if (_to_cau.empty())
_to_cau = "~~~";
_date_from = msk.get_date(FLD_DATE_FROM);
_date_to = msk.get_date(FLD_DATE_TO);
int cur; // Seleziona il cursore corrente
switch (_tipo)
int cur; // Seleziona il cursore corrente
switch (_tipo)
{
case costo_ricavo:
cur = _cur2;
break;
case intra:
cur = _cur3;
break;
default:
cur = _cur1;
break;
}
// Cosi' filtra il cursore ad ogni inizio stampa
get_cursor(_cur1)->set_filterfunction(filter_func1,TRUE); // Cursore 1
get_cursor(_cur2)->set_filterfunction(filter_func1,TRUE); // Cursore 2
get_cursor(_cur3)->set_filterfunction(filter_func2,TRUE); // Cursore 3
select_cursor(cur);
// Salva la ditta corrente
TPrefix& pref = prefix();
const long save_firm = pref.get_codditta();
// Ciclo sulle ditte slezionate
const long items = _ditte->items();
printer().open();
for (int i = 0; i < items; i++)
{
if (_ditte->checked(i))
{
case costo_ricavo:
cur = _cur2;
break;
case intra:
cur = _cur3;
break;
default:
cur = _cur1;
break;
}
select_cursor(cur);
// Cosi' forza la costruzione del cursore ad ogni inizio di stampa
get_cursor(_cur1)->set_filterfunction(filter_func1,TRUE); // Cursore 1
get_cursor(_cur2)->set_filterfunction(filter_func1,TRUE); // Cursore 2
get_cursor(_cur3)->set_filterfunction(filter_func2,TRUE); // Cursore 3
// Salva la ditta corrente
TPrefix& pref = prefix();
const long save_firm = pref.get_codditta();
// Ciclo sulle ditte slezionate
const long items = _ditte->items();
printer().open();
for (int i = 0; i < items; i++)
{
if (_ditte->checked(i))
_tipocrprec = -1;
_tipodetprec = -1;
_numregprec = -1L;
_tot_doc = 0.0;
_tot_imp = 0.0; _tot_iva = 0.0;
_tp_doc = 0.0; _tp_imp = 0.0; _tp_iva = 0.0;
_one_printed = FALSE; _print_all = TRUE;
pref.set_codditta(_ditte->row(i).get_long(1));
if (get_cursor(cur)->items() > 0)
{
_tipocrprec = -1;
_tipodetprec = -1;
_numregprec = -1L;
_tot_doc = 0.0;
_tot_imp = 0.0; _tot_iva = 0.0;
_tp_doc = 0.0; _tp_imp = 0.0; _tp_iva = 0.0;
_one_printed = FALSE; _print_all = TRUE;
pref.set_codditta(_ditte->row(i).get_long(1));
if (get_cursor(cur)->items() > 0)
{
if (_tipo == intra)
_intra_items.destroy(); // Azzera l'array dei totali per fatture intra
print();
}
if (_tipo == intra)
_intra_items.destroy(); // Azzera l'array dei totali per fatture intra
print();
}
}
if (printer().isopen())
printer().close();
// Ripristina la ditta
pref.set_codditta(save_firm);
}
} while (k==K_ENTER);
if (printer().isopen())
printer().close();
// Ripristina la ditta
pref.set_codditta(save_firm);
}
return FALSE;
}
@ -833,8 +824,8 @@ bool TLista_fatture::user_create()
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Ditte",
"@1|Cod.@5R|Ragione Sociale@50");
_nditte = new TLocalisamfile(LF_NDITTE);
_reg = new TTable("REG");
_iva = new TTable("%IVA");
_reg = new TDecoder("REG", "I0");
_iva = new TDecoder("%IVA");
_rel = new TRelation(LF_RMOVIVA);
_rel->add(LF_MOV,"NUMREG==NUMREG");
_rel->add(LF_CAUSALI,"CODCAUS==CODCAUS",1,LF_MOV); // Relazione

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