Patch level : xx.54

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


git-svn-id: svn://10.65.10.50/trunk@8178 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1999-05-24 13:34:11 +00:00
parent 7da1be4f90
commit a86682531f
183 changed files with 7091 additions and 3669 deletions

View File

@ -1,6 +1,7 @@
#include <xinclude.h>
#include <applicat.h>
#include <automask.h>
#include <colors.h>
#include <config.h>
#include <dongle.h>
@ -18,6 +19,10 @@
#include "ba0.h"
#include "ba0100a.h"
#include "ba0400a.h"
#define OPTIONS_MENU M_FONT
#define PREFERRED_MENU M_HELP
///////////////////////////////////////////////////////////
// TPriority_image
@ -114,7 +119,7 @@ void TPicture_mask::update()
int y = 1;
if (fld.class_id() == CLASS_TREE_FIELD)
{
x = cli.right - maxx + 1;
x = cli.right - maxx;
y = (cli.bottom - maxy) / 2;
}
@ -548,6 +553,7 @@ public:
void select(int i) { _item = i; }
int selected() const { return _item; }
TMenuitem& curr_item() { return _current->item(_item); }
bool perform();
TSubmenu* find_string(const char* str);
@ -701,7 +707,7 @@ bool TMenuitem::perform_program() const
if (mask.run() == K_ENTER)
{
const TDate oggi(TODAY);
TString16 pwd; pwd << "PRASSI" << (oggi.month() + oggi.day());
TString16 pwd; pwd << dongle().administrator() << (oggi.month() + oggi.day());
ok = pwd == mask.get(F_PASSWORD);
}
if (!ok) error_box("Password di servizio errata!\nAccesso negato.");
@ -1088,6 +1094,7 @@ class TMenu_application : public TApplication
TMenu _menu;
bool _tree_view;
TString_array _preferred;
TPicture_mask* _mask;
@ -1113,11 +1120,18 @@ protected:
static bool tree_handler(TMask_field& f, KEY k);
static bool tree_find_handler(TMask_field& f, KEY k);
static bool tree_shrink_handler(TMask_field& f, KEY k);
void select_tree_current();
bool choose_colors();
bool choose_editors();
bool choose_study();
void load_preferences();
void save_preferences();
void update_preferred();
void add_to_preferred();
void manage_preferred();
bool test_programs();
public:
@ -1133,8 +1147,6 @@ bool TMenu_application::_find_button = FALSE;
inline TMenu_application& app()
{ return (TMenu_application&)main_app(); }
bool TMenu_application::menu_item_handler(TMask_field&f, KEY k)
{
if (k == K_SPACE)
@ -1146,7 +1158,6 @@ bool TMenu_application::menu_item_handler(TMask_field&f, KEY k)
return TRUE;
}
bool TMenu_application::menu_find_handler(TMask_field&f, KEY k)
{
if (k == K_TAB && f.focusdirty())
@ -1275,9 +1286,10 @@ HIDDEN bool pwd_handler(TMask_field& fld, KEY key)
{
if (key == K_F8)
{
TMask& m = fld.mask();
m.set(F_USER, "PRASSI");
m.set(F_PASSWORD, "pr.assi");
TMask& m = fld.mask();
TString16 pwd;
m.set(F_USER, dongle().administrator(&pwd));
m.set(F_PASSWORD, pwd);
m.stop_run(K_ENTER);
}
return TRUE;
@ -1299,7 +1311,7 @@ bool TMenu_application::check_user()
bool ok = FALSE;
for (int i = 0 ; i < 3 && !ok; i++)
{
if (utente.not_empty() && utente != "PRASSI")
if (utente.not_empty() && utente != dongle().administrator())
{
m.set(F_USER, utente);
m.first_focus(F_PASSWORD);
@ -1320,9 +1332,9 @@ bool TMenu_application::check_user()
pwd = decode(users.get("PASSWORD"));
}
else
if (utente == "PRASSI")
{
if (utente == dongle().administrator(&pwd))
{
pwd = "pr.assi";
users.zero();
users.put("USERNAME", utente);
users.put("USERDESC", utente);
@ -1330,6 +1342,7 @@ bool TMenu_application::check_user()
users.write();
err = users.read(_isequal);
}
}
ok = utente.not_empty() && pwd.not_empty() && pwd == m.get(F_PASSWORD);
@ -1344,12 +1357,12 @@ bool TMenu_application::check_user()
if (ok)
{
users.put("USERNAME", "PRASSI");
users.put("USERNAME", dongle().administrator());
users.read(_isequal);
if (users.get("AUTSTR") == "CONVERTING")
{
TString msg = "E' in corso una conversione archivi:\n";
if (utente == "PRASSI")
if (utente == dongle().administrator())
{
msg << "Si desidera continuare ugualmente?";
ok = yesno_box(msg);
@ -1386,7 +1399,8 @@ bool TMenu_application::check_user()
users.put("CONNECTED", "X");
users.rewrite();
enable_menu_item(M_FONT);
enable_menu_item(OPTIONS_MENU);
enable_menu_item(PREFERRED_MENU);
customize_colors(); // Aggiorna set di colori
reload_images(); // Ritrasparentizza immagini
@ -1397,14 +1411,13 @@ bool TMenu_application::check_user()
if (ok)
{
if (utente != "PRASSI")
if (utente != dongle().administrator())
{
TConfig prawin(CONFIG_INSTALL, "Main");
prawin.set("User", utente);
}
TConfig userini(CONFIG_USER, "ba0");
_tree_view = userini.get_bool("TreeView");
load_preferences();
}
return ok;
@ -1490,7 +1503,7 @@ bool TMenu_application::test_programs()
}
}
if (dangerous.not_empty() && user() == "PRASSI")
if (dangerous.not_empty() && user() == dongle().administrator())
{
TExternal_app app("ba1 -6");
app.run(TRUE, TRUE, FALSE);
@ -1520,12 +1533,12 @@ bool TMenu_application::create()
}
#endif
#ifndef _DEMO_
#ifndef _DEMO_
if (!check_user())
return FALSE;
#else
enable_menu_item(M_FONT);
#endif
#else
enable_menu_item(OPTIONS_MENU);
#endif
set_perms();
test_temp();
@ -1584,7 +1597,7 @@ bool TMenu_application::main_loop()
bool TMenu_application::choose_colors()
{
disable_menu_item(M_FONT);
disable_menu_item(OPTIONS_MENU);
TColor_mask * cm = new TColor_mask();
if (cm->run() == K_ENTER)
{
@ -1601,7 +1614,7 @@ bool TMenu_application::choose_colors()
if (_mask != NULL)
_mask->stop_run(K_CTRL + 'R');
}
enable_menu_item(M_FONT);
enable_menu_item(OPTIONS_MENU);
delete cm;
return TRUE;
}
@ -1616,7 +1629,7 @@ HIDDEN bool browse_file_handler(TMask_field& f, KEY k)
xvt_fsys_convert_str_to_dir(".", &fs.dir);
strcpy(fs.type, "EXE");
strcpy(fs.name, f.get());
strcpy(fs.creator, "ba0");
strcpy(fs.creator, "MENU");
DIRECTORY dir;
xvt_fsys_get_dir(&dir);
@ -1659,7 +1672,7 @@ HIDDEN bool link_notify(TSheet_field& s, int r, KEY k)
bool TMenu_application::choose_editors()
{
disable_menu_item(M_FONT);
disable_menu_item(OPTIONS_MENU);
TConfig link(CONFIG_USER, "Link");
@ -1700,7 +1713,7 @@ bool TMenu_application::choose_editors()
}
delete msk;
enable_menu_item(M_FONT);
enable_menu_item(OPTIONS_MENU);
return TRUE;
}
@ -1753,20 +1766,6 @@ long TMenu_application::handler(WINDOW win, EVENT* ep)
return ret;
}
bool TMenu_application::menu(MENU_TAG mt)
{
bool ok = TRUE;
switch (mt)
{
case MENU_ITEM(1): ok = main_loop(); break;
case MENU_ITEM(2): choose_colors(); break;
case MENU_ITEM(3): choose_editors(); break;
case MENU_ITEM(4): choose_study(); break;
default: break;
}
return ok;
}
HIDDEN bool convert(const char* menuname)
{
TString tag(_MAX_FNAME);
@ -1885,6 +1884,7 @@ public:
const TSubmenu& curr_submenu() const;
const TMenuitem& curr_item() const;
bool find_string(const TString& str);
bool find_leaf(const TString& str);
TMenu_tree(TMenu& menu);
virtual ~TMenu_tree() { }
@ -1947,14 +1947,28 @@ HIDDEN bool find_node_callback(TTree& tree, void* jolly, word flags)
return FALSE;
}
HIDDEN bool find_leaf_callback(TTree& tree, void* jolly, word flags)
{
if (flags == SCAN_PRE_ORDER)
{
const TString& leaf = *(TString*)jolly;
TString id; tree.curr_id(id);
const int slash = id.rfind('/');
if (slash > 0)
id = id.mid(slash+1);
if (id == leaf)
return TRUE;
}
return FALSE;
}
bool TMenu_tree::find_string(const TString& str)
{
static TFind_string_data data;
data._str = str; data._str.upper();
goto_root();
bool ok = scan_depth_first(find_string_callback, &data,
SCAN_PRE_ORDER);
bool ok = scan_depth_first(find_string_callback, &data, SCAN_PRE_ORDER);
if (ok)
data._ignore = curr_submenu().name();
else
@ -1963,6 +1977,13 @@ bool TMenu_tree::find_string(const TString& str)
return ok;
}
bool TMenu_tree::find_leaf(const TString& str)
{
goto_root();
bool ok = scan_depth_first(find_leaf_callback, (void *)&str, SCAN_PRE_ORDER);
return ok;
}
void TMenu_tree::node2id(const TObject* node, TString& id) const
{
TString* str = (TString*)node;
@ -2014,6 +2035,7 @@ bool TMenu_tree::goto_rbrother()
bool TMenu_tree::goto_node(const TString &id)
{
const int dot = id.rfind('.');
CHECKS(dot > 0, "Invalid tree node ", (const char*)id);
_menuitem = atoi(id.mid(dot+1));
_curr_id = id.left(dot);
const int slash = _curr_id.rfind('/');
@ -2126,6 +2148,36 @@ bool TMenu_application::tree_handler(TMask_field& f, KEY k)
return TRUE;
}
void TMenu_application::select_tree_current()
{
TTree_field& tf = (TTree_field&)_mask->field(101);
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
tf.select_current();
TString id; mt.curr_id(id);
do { mt.expand(); } while (mt.goto_father());
TFind_node_data data;
data._id = id;
data._count = 0;
mt.goto_root();
mt.scan_depth_first(find_node_callback, &data,
SCAN_PRE_ORDER | SCAN_IGNORING_UNEXPANDED);
TField_window& win = tf.win();
const TPoint& range = win.range();
if (data._count > range.y)
win.set_scroll_max(win.columns(), data._count+win.rows());
const int dot = id.rfind('.');
const int pos = atoi(id.mid(dot+1));
win.update_thumb(-1, data._count-pos-2);
win.force_update();
tf.set_focus();
}
bool TMenu_application::tree_find_handler(TMask_field&f, KEY k)
{
if (k == K_TAB && f.focusdirty() && !f.empty())
@ -2138,31 +2190,7 @@ bool TMenu_application::tree_find_handler(TMask_field&f, KEY k)
TTree_field& tf = (TTree_field&)m.field(101);
TMenu_tree& mt = *(TMenu_tree*)tf.tree();
if (mt.find_string(v))
{
tf.select_current();
TString id; mt.curr_id(id);
do { mt.expand(); } while (mt.goto_father());
TFind_node_data data;
data._id = id;
data._count = 0;
mt.goto_root();
mt.scan_depth_first(find_node_callback, &data,
SCAN_PRE_ORDER | SCAN_IGNORING_UNEXPANDED);
TField_window& win = tf.win();
const TPoint& range = win.range();
if (data._count > range.y)
win.set_scroll_max(win.columns(), data._count+win.rows());
const int dot = id.rfind('.');
const int pos = atoi(id.mid(dot+1));
win.update_thumb(-1, data._count-pos-2);
win.force_update();
tf.set_focus();
}
app().select_tree_current();
else
beep();
}
@ -2182,14 +2210,210 @@ bool TMenu_application::tree_shrink_handler(TMask_field&f, KEY k)
tf.win().force_update();
}
return TRUE;
}
void TMenu_application::update_preferred()
{
MENU_ITEM* mm = xvt_menu_get_tree(TASK_WIN);
for (MENU_ITEM* mi = mm; mi->tag != 0 && mi->tag != PREFERRED_MENU; mi++);
if (mi->tag <= 0 || mi->child == NULL)
{
NFCHECK("Can't find Preferiti Menu");
return;
}
int i;
MENU_ITEM* pm = (MENU_ITEM*)xvt_mem_zalloc((_preferred.items()+4)*sizeof(MENU_ITEM));
memcpy(pm, mi->child, 3*sizeof(MENU_ITEM));
for (i = 0; i < 2; i++)
{
const char* src = mi->child[i].text;
pm[i].text = xvt_mem_zalloc(strlen(src)+1);
strcpy(pm[i].text, src);
}
xvt_res_free_menu_tree(mi->child);
mi->child = pm;
for (i = -1; i < _preferred.items(); i++)
{
MENU_ITEM& m = pm[i+3];
if (i >= 0)
{
m.tag = MENU_ITEM(50+i);
m.enabled = TRUE;
const char* src = _preferred.row(i).get(0);
m.text = xvt_mem_zalloc(strlen(src)+1);
strcpy(m.text, src);
}
else
{
m.tag = -1;
m.separator = TRUE;
}
}
xvt_menu_set_tree(TASK_WIN, mm);
xvt_menu_update(TASK_WIN);
xvt_res_free_menu_tree(mm);
}
HIDDEN void left_align_field(TMask_field& fld, int x)
void TMenu_application::load_preferences()
{
RCT rct;
fld.get_rect(rct);
rct.left = x;
fld.set_rect(rct);
TConfig cfg(CONFIG_USER, "ba0");
_tree_view = cfg.get_bool("TreeView");
_preferred.destroy();
TToken_string row;
for (int i = 0; ; i++)
{
row = cfg.get("Preferred", NULL, i);
if (row.empty_items())
break;
_preferred.add(row);
}
update_preferred();
}
void TMenu_application::save_preferences()
{
TConfig cfg(CONFIG_USER, "ba0");
for (int i = 0; i < _preferred.items(); i++)
cfg.set("Preferred", _preferred.row(i), NULL, TRUE, i);
cfg.set("Preferred", "", NULL, TRUE, i);
cfg.set("TreeView", _tree_view);
}
void TMenu_application::add_to_preferred()
{
const int maxpref = 16;
if (_preferred.items() < maxpref)
{
TToken_string tok;
if (_tree_view)
{
TTree_field& tf = _mask->tfield(101);
tf.goto_selected();
tf.tree()->get_description(tok);
TString id; tf.tree()->curr_id(id);
tok.add(id);
}
else
{
const TMask_field& butt = _mask->focus_field();
const int index = butt.dlg() - 101;
if (index >= 0 && index < 16)
{
_menu.select(index);
tok = _menu.curr_item().caption();
tok.add(_menu.current().name());
tok << '.' << index;
}
}
if (!tok.empty())
{
_preferred.add(tok);
update_preferred();
save_preferences();
}
}
else
error_box("Non e' possibile memorizzare piu' di %d preferenze", maxpref);
}
class TPreferred_mask : public TAutomask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TPreferred_mask() : TAutomask("ba0400a") { }
virtual ~TPreferred_mask() { }
};
bool TPreferred_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_PREF_SHEET:
switch (e)
{
case se_query_add:
return FALSE;
case se_enter:
enable(F_PREF_UP, jolly > 0);
enable(F_PREF_DN, jolly < ((TSheet_field&)o).items()-1);
break;
default:
break;
}
break;
case F_PREF_UP:
if (e == fe_button)
{
TSheet_field& sf = sfield(F_PREF_SHEET);
const int r = sf.selected();
if (r > 0)
{
sf.rows_array().swap(r, r-1);
sf.select(r-1);
sf.force_update();
}
}
break;
case F_PREF_DN:
if (e == fe_button)
{
TSheet_field& sf = sfield(F_PREF_SHEET);
const int r = sf.selected();
if (r < sf.items()-1)
{
sf.rows_array().swap(r, r+1);
sf.select(r+1);
sf.force_update();
}
}
break;
case DLG_DELREC:
if (e == fe_button && jolly == 0) // Main delete button pressed
{
TSheet_field& sf = sfield(F_PREF_SHEET);
const int r = sf.selected();
if (r >= 0)
sf.destroy(r);
return FALSE;
}
break;
default:
break;
}
return TRUE;
}
void TMenu_application::manage_preferred()
{
TPreferred_mask* m = new TPreferred_mask;
m->set(F_PREF_TREE, _tree_view ? "X" : "");
TSheet_field& sf = m->sfield(F_PREF_SHEET);
sf.rows_array() = _preferred;
sf.force_update();
if (m->run() == K_ENTER)
{
_preferred = sf.rows_array();
const bool old_tv = _tree_view;
_tree_view = m->get_bool(F_PREF_TREE);
update_preferred();
save_preferences();
if (_tree_view != old_tv)
_mask->stop_run(K_CTRL + 'R'); // Provoca chiusura forzata del menu
}
delete m;
}
int TMenu_application::do_tree()
@ -2202,27 +2426,24 @@ int TMenu_application::do_tree()
CHECK(_mask == NULL, "Two masks are better than one?");
_mask = &mask;
const int twidth = 50;
const int bwidth = mask.columns() - twidth - 8;
TMenu_tree tree(_menu);
TTree_field& tree_fld = mask.add_tree(101, 0, 0, 0, 60, -1);
TTree_field& tree_fld = mask.add_tree(101, 0, 0, 0, twidth, -1);
tree_fld.set_tree(&tree);
tree_fld.set_handler(tree_handler);
RCT rct; tree_fld.get_rect(rct);
const int x = rct.right + CHARX;
const int bwidth = 20;
TMask_field& sf = mask.add_static(DLG_NULL, 0, "Cerca", -1, 0);
left_align_field(sf, x);
TMask_field& sf = mask.add_static(DLG_NULL, 0, "Cerca", -2, 0);
TEdit_field& ef = mask.add_string(DLG_USER, 0, "", -2, 1, 50, "", bwidth);
ef.set_handler(tree_find_handler);
left_align_field(ef, x);
TButton_field& mf = mask.add_button(102, 0, "Menu principale", -1, 2, bwidth, 2);
mf.set_handler(tree_shrink_handler);
left_align_field(mf, x);
TButton_field& bf = mask.add_button(DLG_QUIT, 0, "Fine", -1, -1, bwidth, 2);
left_align_field(bf, x);
mask.first_focus(101);
KEY key = mask.run();
@ -2231,6 +2452,49 @@ int TMenu_application::do_tree()
return key == K_QUIT ? -2 : 0;
}
bool TMenu_application::menu(MENU_TAG mt)
{
bool ok = TRUE;
switch (mt)
{
case MENU_ITEM(1): ok = main_loop(); break;
case MENU_ITEM(2): choose_colors(); break;
case MENU_ITEM(3): choose_editors(); break;
case MENU_ITEM(4): choose_study(); break;
case MENU_ITEM(5): add_to_preferred(); break;
case MENU_ITEM(6): manage_preferred(); break;
default:
if (mt >= MENU_ITEM(50) && mt < MENU_ITEM(50+_preferred.items()))
{
bool ok = FALSE;
const int index = mt - MENU_ITEM(50);
TToken_string node(_preferred.row(index).get(1), '/');
if (_tree_view)
{
TMenu_tree& met = *(TMenu_tree*)_mask->tfield(101).tree();
ok = node.items() == 1 ? met.find_leaf(node) : met.goto_node(node);
if (ok)
select_tree_current();
}
else
{
TToken_string mi(node.get(-2), '.');
const char* sub = mi.get(0);
TSubmenu* sm = _menu.find(sub);
if (sm && _menu.jumpto(sm))
{
ok = TRUE;
_menu.select(mi.get_int());
_mask->stop_run(K_CTRL + 'R');
}
}
if (!ok) beep();
}
break;
}
return ok;
}
///////////////////////////////////////////////////////////
// Main program
///////////////////////////////////////////////////////////

View File

@ -7,6 +7,7 @@ MENU MENU_BAR(0)
SUBMENU M_FILE "~File"
SUBMENU M_EDIT "~Modifica"
SUBMENU M_FONT "~Opzioni" DISABLED
SUBMENU M_PREF "~Preferiti" DISABLED
SUBMENU M_HELP "~Help"
MENU M_FONT
@ -15,4 +16,7 @@ MENU M_FONT
ITEM MENU_ITEM(3) "~Editors"
ITEM MENU_ITEM(4) "~Studio"
MENU M_PREF
ITEM MENU_ITEM(5) "~Aggiungi"
ITEM MENU_ITEM(6) "~Organizza"

View File

@ -90,6 +90,11 @@ BEGIN
PROMPT 36 10 "Scuro"
END
BOOLEAN 113
BEGIN
PROMPT 2 -3 "Campi 3D"
END
GROUPBOX DLG_NULL 14 8
BEGIN
PROMPT 35 12 ""

9
ba/ba0400a.h Executable file
View File

@ -0,0 +1,9 @@
#define F_PREF_TREE 200
#define F_PREF_SHEET 201
#define F_PREF_UP 202
#define F_PREF_DN 203
#define F_PREF_DESC 101
#define F_PREF_ADDR 102

80
ba/ba0400a.uml Executable file
View File

@ -0,0 +1,80 @@
#include "ba0400a.h"
PAGE "Preferiti" -1 -1 70 16
BOOLEAN F_PREF_TREE
BEGIN
PROMPT 1 0 "Menu ad albero"
END
SPREADSHEET F_PREF_SHEET 63 -3
BEGIN
PROMPT 1 1 ""
ITEM "Descrizione@50"
ITEM "Indirizzo@50"
END
BUTTON F_PREF_UP 2 2
BEGIN
PROMPT -1 5 "/\"
END
BUTTON F_PREF_DN 2 2
BEGIN
PROMPT -1 8 "\/"
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 "Riga" -1 -1 60 5
STRING F_PREF_DESC 50 45
BEGIN
PROMPT 1 1 "Descrizione "
END
STRING F_PREF_ADDR 128 45
BEGIN
PROMPT 1 2 "Indirizzo "
FLAGS "D"
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

@ -1,8 +1,13 @@
#include <ctype.h>
#include <fcntl.h>
#include <share.h>
#include <errno.h>
#include <dos.h>
#include <applicat.h>
#include <extcdecl.h>
#include <dongle.h>
#include <execp.h>
#include <isam.h>
#include <mask.h>
@ -12,6 +17,7 @@
#include <progind.h>
#include <urldefid.h>
#include <utility.h>
#include <validate.h>
#include "ba1.h"
#include "ba1100.h"
@ -335,22 +341,16 @@ bool TManutenzione_app::create() // initvar e arrmask
if (!set_firm())
return FALSE;
#endif
load_des();
load_des();
#ifdef DBG
const bool superprassi = user() == "PRASSI" || user() == "GUEST";
#else
const bool superprassi = user() == "PRASSI";
#endif
const bool superprassi = user() == ::dongle().administrator();
_mask = new TMask ("ba1100a");
_browse = new TDir_sheet ("Manutenzione file di sistema", superprassi ? 0xC : 0x8);
if (superprassi)
{
_browse->add_button(DLG_INSFILE, "~Inserisci", K_F6);
_browse->add_button(DLG_CONVERT, "~Converti", K_F7);
_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_exit_key(K_F5);
_mask->enable(-1); // Abilita campi privilegiati
@ -508,12 +508,7 @@ void TManutenzione_app::edit_riga (const TString& name)
const TFilename n(name);
TExternisamfile* f = new TExternisamfile(n);
#ifdef DBG
const bool superprassi = user() == "PRASSI" || user() == "GUEST";
#else
const bool superprassi = user() == "PRASSI";
#endif
const bool superprassi = user() == ::dongle().administrator();
_mask->set (FLD_NUM, "");
_mask->set (FLD_NOME, n);
_mask->set (FLD_EOD, f->items());
@ -555,11 +550,7 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga)
TDir d;
const int logicnum = int(riga_sel) + 1;
#ifdef DBG
const bool superprassi = user() == "PRASSI" || user() == "GUEST";
#else
const bool superprassi = user() == "PRASSI";
#endif
const bool superprassi = user() == ::dongle().administrator();
_mask->enable(DLG_PACK, superprassi);
_mask->enable(DLG_RECORD, superprassi);
@ -824,6 +815,7 @@ void TManutenzione_app::update_dir()
fseek(f, 0L, SEEK_END);
const long size = ftell(f);
fclose(f);
if (size > 0L && d.len() > 0)
{
TSystemisamfile b(i);
@ -1101,7 +1093,7 @@ void TManutenzione_app::convert_dir()
{
{
TLocalisamfile u(LF_USER);
u.zero(); u.put("USERNAME","PRASSI");
u.zero(); u.put("USERNAME", ::dongle().administrator());
if (u.read() == NOERR)
{
u.zero("AUTSTR");
@ -1295,7 +1287,7 @@ void TManutenzione_app::update()
for (int err = utenti.first(); err == NOERR; err = utenti.next())
{
const TString16 u = utenti.get("USERNAME");
if (u == "PRASSI")
if (u == ::dongle().administrator())
{
if (utenti.get("AUTSTR") == "CONVERTING")
{
@ -1394,7 +1386,7 @@ void TManutenzione_app::update()
do_events();
}
utenti.put("USERNAME", "PRASSI");
utenti.put("USERNAME", ::dongle().administrator());
if (utenti.read() == NOERR)
{
utenti.zero("AUTSTR");
@ -1419,7 +1411,8 @@ bool TManutenzione_app::menu(MENU_TAG m)
KEY key = _browse->run();
if (key != K_ENTER && key != K_QUIT && key != K_ESC && user() != "PRASSI")
if (key != K_ENTER && key != K_QUIT && key != K_ESC &&
user() != ::dongle().administrator())
{
error_box("Operazione non permessa all'utente %s", (const char*)user());
key = 0;

View File

@ -52,9 +52,9 @@ BEGIN
FLAGS "D"
END
SPREADSHEET F_FIELDS 0 11
SPREADSHEET F_FIELDS 0 10
BEGIN
PROMPT 0 4 "Fields"
PROMPT 0 2 "Fields"
ITEM "Nome@10"
ITEM "Tipo"
ITEM "Lunghezza"
@ -64,7 +64,7 @@ END
SPREADSHEET F_KEYS
BEGIN
PROMPT 0 16 "Keys"
PROMPT 0 13 "Keys"
ITEM "Espressione@65"
ITEM "Chiavi duplicate"
END
@ -145,7 +145,7 @@ END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -33 -1 "Elimina"
PROMPT -33 -1 "~Elimina"
MESSAGE EXIT,K_DEL
END
@ -179,7 +179,7 @@ END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -33 -1 "Elimina"
PROMPT -33 -1 "~Elimina"
MESSAGE EXIT,K_DEL
END

View File

@ -239,9 +239,14 @@ void TRec_sheet::save()
{
if ((*_rec == *_rec_old && !_descr) ||
!yesnocancel_box("Salvare le modifiche")) return;
TSystemisamfile f(_rec->num());
if (prefix().name()[0]) // Non fare conversioni sui dati standard
{
TSystemisamfile f(_rec->num());
f.update(*_rec);
}
save_desc();
f.update(*_rec);
*_rec_old = *_rec;
// modifica del 16-1-98, Augusto :
// Il bottone "salva" salva anche il trr e dir in recdesc
@ -249,13 +254,13 @@ void TRec_sheet::save()
TFilename nf;
nf << "recdesc\\f" << _dir->num();
nf.ext("trr");
save_desc();
{
_rec->set_des(_descr,_tab.upper());
ofstream out(nf);
out << *_rec;
_rec->set_des();
}
nf.ext("dir");
ofstream out(nf);
out << *_dir;

View File

@ -1,4 +1,5 @@
#include <defmask.h>
#include <dongle.h>
#include <prefix.h>
#include <progind.h>
#include <relation.h>
@ -38,7 +39,7 @@ bool TEdit_file::_browse(TCursor& cursor, const TFilename& name)
head << 'R';
}
const bool superprassi = user() == "PRASSI";
const bool superprassi = user() == ::dongle().administrator();
KEY ch;
TCursor_sheet sheet(&cursor, trac, name, head, superprassi ? 6 : 0);

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <dongle.h>
#include <execp.h>
#include <isam.h>
#include <prefix.h>
@ -33,7 +34,7 @@ bool TPackFiles_application::create() // initvar e arrmask
_firm = get_firm();
if (!set_firm())
return FALSE;
const bool is_prassi = user() == "PRASSI";
const bool is_prassi = user() == ::dongle().administrator();
_selsheet = new TArray_sheet(-1, -1, -4, -4, "Selezione files",
is_prassi ?
"@1|N.@5|Nome@20|EOD@7|EOX@7|Lung. |Descrizione@43|Flags@7" :
@ -56,7 +57,7 @@ void TPackFiles_application::build_sheet()
_selsheet->destroy();
TDir cdir;
cdir.get(LF_DIR,_nolock,_nordir,_sysdirop);
const bool is_prassi = user() == "PRASSI";
const bool is_prassi = user() == ::dongle().administrator();
const int nitems = (int)cdir.eod();
for (int i = 0; i < nitems; i++) // fill sheet
{

View File

@ -471,6 +471,8 @@ bool TSet_users::tree_handler(TMask_field& f, KEY key)
if (prop)
{
sf.rows_array() = *prop;
FOR_EACH_SHEET_ROW(sf, r, n)
sf.check_row(r);
sf.force_update();
}
const TString16 mod = cmd.left(2);
@ -539,7 +541,7 @@ void TSet_users::build_tree(const TRectype* r)
if (r)
{
TToken_string prop_field(r->get("PERMISSION"), '\n');
TAuto_token_string pro, row;
TToken_string pro("",SAFE_PIPE_CHR),row("",SAFE_PIPE_CHR);
TString app;
FOR_EACH_TOKEN(prop_field, tok)
{
@ -549,9 +551,8 @@ void TSet_users::build_tree(const TRectype* r)
if (!app.empty())
{
TString_array& prop = _tree->properties(app);
row.separator(pro.separator());
row = " ";
row.add(pro.get(1));
row = pro.get(1);
row.add(pro.get());
row.add(pro.get());
prop.add(row);
}
@ -562,7 +563,7 @@ void TSet_users::build_tree(const TRectype* r)
// mostra le abilitazioni
void TSet_user_passwd::enable_aut()
{
const bool prassi = _msk->get(F_USER) == "PRASSI";
const bool prassi = _msk->get(F_USER) == ::dongle().administrator();
const int uns = _im->unassigned();
TSheet_field& sf = sheet_field();
const int itms = sf.items();
@ -607,7 +608,7 @@ bool TSet_users::k_notify(TSheet_field& f, int r, KEY k)
bool TSet_user_passwd::user_create()
{
bool superuser = user() == "PRASSI";
bool superuser = user() == ::dongle().administrator();
_rel = new TRelation(LF_USER);
_im = new TInformazione_moduli;
@ -684,12 +685,15 @@ void TSet_users::put_in_record(const TMask& m)
TToken_string prop_field(256, '\n');
TAssoc_array& prop = _tree->properties();
TString prg;
FOR_EACH_ASSOC_OBJECT(prop, hash, key, obj)
{
TString_array& arr = *(TString_array*)obj;
prg = key;
prg << m.sfield(F_PROPERTIES).separator();
FOR_EACH_ARRAY_ROW(arr, r, row)
{
row->add(key, 0);
row->insert(prg, 0);
prop_field.add(*row);
}
}
@ -769,7 +773,7 @@ void TSet_user_passwd::init_modify_mode(TMask& m)
int ba1400(int argc, char** argv)
{
if (user() == "PRASSI")
if (user() == ::dongle().administrator())
{
TSet_users a ;
a.run(argc, argv, "Configurazione utenti");

View File

@ -6,17 +6,6 @@ ENDPAGE
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
GROUP G_SUPERUSER
END
STRING F_USER 8
BEGIN
PROMPT 15 1 ""
@ -32,6 +21,19 @@ BEGIN
FIELD USERNAME
END
LIST F_GROUP 1 8
BEGIN
PROMPT 1 1 ""
ITEM " |Utente"
MESSAGE SHOW,3@
ITEM "X|Gruppo"
MESSAGE HIDE,3@
FIELD ISGROUP
GROUP G_SUPERUSER
KEY 1
END
STRING F_GROUPNAME 8
BEGIN
PROMPT 32 1 "Gruppo di appartenenza "

View File

@ -765,15 +765,24 @@ bool TAttivazione_moduli::aga_handler(TMask_field& fld, KEY key)
{
if (key == K_SPACE)
{
TMask mask("Produttore", 1, 54, 5);
mask.add_string(DLG_USER, 0, "", 1, 1, 50);
TMask mask("Produttore", 1, 50, 6);
mask.add_string(101, 0, "Ditta ", 1, 1, 40);
mask.add_string(102, 0, "Amministratore di sistema ", 1, 2, 8, "U");
mask.add_string(103, 0, "Password di amministratore ", 1, 3, 8, "*");
mask.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
mask.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
TConfig ini("install.ini", "Main");
mask.set(DLG_USER, ::decode(ini.get("Producer")));
mask.set(101, ::decode(ini.get("Producer")));
mask.set(102, ::decode(ini.get("Administrator")));
mask.set(103, ::decode(ini.get("Password")));
if (mask.run() == K_ENTER)
ini.set("Producer", ::encode(mask.get(DLG_USER)));
{
ini.set("Producer", ::encode(mask.get(101)));
ini.set("Administrator", ::encode(mask.get(102)));
ini.set("Password", ::encode(mask.get(103)));
}
}
return TRUE;
}
@ -1338,7 +1347,11 @@ bool TAttivazione_moduli::create()
_msk->set_handler(F_AGGLISTINO, aggiorna_listino_handler);
const TDongleType mydongle = ::dongle().type();
#ifdef DBG
if (::dongle().number() == 0)
#else
if (mydongle == _aga_dongle)
#endif
{
_msk->show(F_AGA);
_msk->set_handler(F_AGA, aga_handler);
@ -1430,7 +1443,7 @@ bool TAttivazione_moduli::menu(MENU_TAG)
int ba1500(int argc, char** argv)
{
// dipende dalla check_parameters fatta in main()
if (user() == "PRASSI")
if (user() == ::dongle().administrator())
{
TAttivazione_moduli a ;
a.run(argc, argv, "Attivazione moduli");

View File

@ -95,7 +95,7 @@ BEGID
FLAGS "H"
END
BUTTON F_AGA 14
BUTTON F_AGA 18
BEGID
PROMPT 22 4 " Produttore "
FLAGS "H"

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <defmask.h>
#include <dongle.h>
#include <execp.h>
#include <files.h>
#include <golem.h>
@ -1880,7 +1881,7 @@ int find(const TString& name, TString_array & rows)
int ba1600(int argc, char* argv[])
{
if (user() == "PRASSI")
if (user() == ::dongle().administrator())
{
if (argc>2 && strcmp(argv[1],"GODMODE"))
{

View File

@ -1,7 +1,8 @@
#include <applicat.h>
#include <colors.h>
#include <defmask.h>
#include <execp.h>
#include <dongle.h>
#include <execp.h>
#include <isamrpc.h>
#include <os_dep.h>
#include <progind.h>
@ -1297,7 +1298,7 @@ void TInstaller::main_loop()
int ba1700(int argc, char* argv[])
{
if (user() == "PRASSI")
if (user() == ::dongle().administrator())
{
TInstaller app;
app.run(argc, argv, "Installer");

View File

@ -1,28 +1,27 @@
#include <xvt.h>
#include <checks.h>
#include "ba2.h"
#define usage "Error - usage : %s -[0,1,2,3,4]"
int main(int argc, char** argv)
{
int rt = 0 ;
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
const int r = (argc > 1) ? argv[1][1]-'0' : 0;
switch (r)
{
case 0:
rt = ba2100(argc, argv); break;
case 1:
rt = ba2200(argc, argv); break; // Backup
ba2200(argc, argv); break;
#if XVT_OS == XVT_OS_SCOUNIX
case 2:
ba2300(argc, argv) ; break;
#endif
case 3:
rt = ba2400(argc, argv) ; break;
ba2400(argc, argv) ; break;
case 4:
rt = ba2500(argc, argv) ; break;
ba2500(argc, argv) ; break;
default:
error_box(usage, argv[0]) ; rt = 1; break;
}
return rt;
ba2100(argc, argv); break;
}
exit(0);
return 0;
}

View File

@ -75,8 +75,8 @@ bool TMail_box::default_params(TString& server, TString& user,TString& password)
user = ::user();
if (password.empty())
{
TDecoder users(LF_USER, "PASSWORD");
password = ::decode(users.decode(user));
const TString& pwd = cache().get(LF_USER, user).get("PASSWORD");
password = ::decode(pwd);
}
return ok;
}
@ -362,9 +362,14 @@ TFilter_expr::TFilter_expr(TAutomask& m, int logicnum, const char* expr)
class TMailer_mask : public TAutomask
{
int _timer_id;
int _mail_semaphore;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
virtual void handler(WINDOW win, EVENT* ep);
protected:
bool file2app(const TString& file, TString& app) const;
void expand_tabs(TString& str, const int tab = 8) const;
@ -376,17 +381,34 @@ public:
int fill_messages();
bool save_curr_line();
void save_all_lines();
void auto_save_all();
void save() const;
void load();
void mail_lock()
{ _mail_semaphore++; }
void mail_unlock()
{ CHECK(_mail_semaphore > 0, "Bad timer unlock"); _mail_semaphore--; }
TMailer_mask();
virtual ~TMailer_mask();
};
class TMail_lock
{
TMailer_mask* _mm;
public:
TMail_lock(TMailer_mask* mm) : _mm(mm) { _mm->mail_lock(); }
~TMail_lock() { _mm->mail_unlock(); }
};
void TMailer_mask::test_delete()
{
TMail_lock ml(this);
TWait_cursor hourglass;
xvt_statbar_set("Eliminazione messaggi POP3...");
do_events();
@ -462,6 +484,7 @@ void TMailer_mask::expand_tabs(TString& str, const int tab) const
int TMailer_mask::fill_messages()
{
TMail_lock ml(this);
TWait_cursor hourglass;
TMail_messages box;
@ -521,6 +544,7 @@ int TMailer_mask::fill_messages()
sf.force_update();
xvt_statbar_set("Pronto");
return sf.items();
}
@ -550,6 +574,8 @@ bool TMailer_mask::file2app(const TString& file, TString& app) const
bool TMailer_mask::save_curr_line()
{
TMail_lock ml(this);
TSheet_field& sf = sfield(F_MESSAGES);
TMask& m = sf.sheet_mask();
const int nrow = sf.selected();
@ -604,7 +630,9 @@ bool TMailer_mask::save_curr_line()
void TMailer_mask::save_all_lines()
{
TMail_lock ml(this);
TWait_cursor hourglass;
TSheet_field& sf = sfield(F_MESSAGES);
TString body;
@ -630,18 +658,36 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
{
switch (o.dlg())
{
case F_TIMER:
if (e == fe_init || e == fe_modify)
{
if (_timer_id)
{
xvt_timer_destroy(_timer_id);
_timer_id = XVT_TIMER_ERROR;
}
const long minutes = atol(o.get());
if (minutes > 0)
{
_timer_id = xvt_timer_create(win(), minutes * 60000L);
if (_timer_id == XVT_TIMER_ERROR)
return error_box("Impossibile impostare il timer");
}
}
break;
case F_MESSAGES:
if (e == fe_init)
{
if (!field(F_SERVER).empty() &&
!field(F_USER).empty() &&
!field(F_PASSWORD).empty())
fill_messages();
{
auto_save_all();
}
} else
if (e == se_query_add)
{
test_delete();
fill_messages();
auto_save_all();
return FALSE;
}
break;
@ -720,6 +766,30 @@ void TMailer_mask::load_sheet(TConfig& ini, short dlg, const char* var)
sf.row(r) = ini.get(var, NULL, r);
}
void TMailer_mask::auto_save_all()
{
if (_mail_semaphore == 0)
{
TMail_lock ml(this);
test_delete();
fill_messages();
if (!field(F_TIMER).empty())
save_all_lines();
}
else
NFCHECK("Can't save locked mail");
}
void TMailer_mask::handler(WINDOW win, EVENT* ep)
{
if (ep->type == E_TIMER)
{
if (ep->v.timer.id == _timer_id && _mail_semaphore == 0)
auto_save_all();
}
TAutomask::handler(win, ep);
}
void TMailer_mask::save() const
{
TConfig ini(CONFIG_DITTA, "MailTransactions");
@ -727,6 +797,7 @@ void TMailer_mask::save() const
ini.set("Server", get(F_SERVER));
ini.set("User", get(F_USER));
ini.set("Password", encode(get(F_PASSWORD)));
ini.set("Timer", get(F_TIMER));
save_sheet(ini, F_ADDRESSES, "Recipient");
save_sheet(ini, F_PARAMS, "Filter");
}
@ -737,17 +808,25 @@ void TMailer_mask::load()
set(F_SERVER, ini.get("Server"));
set(F_USER, ini.get("User"));
set(F_PASSWORD, decode(ini.get("Password")));
set(F_TIMER, ini.get_int("Timer"));
load_sheet(ini, F_ADDRESSES, "Recipient");
load_sheet(ini, F_PARAMS, "Filter");
}
TMailer_mask::TMailer_mask() : TAutomask("ba7100a")
TMailer_mask::TMailer_mask()
: TAutomask("ba7100a"),
_timer_id(XVT_TIMER_ERROR), _mail_semaphore(0)
{
load();
}
TMailer_mask::~TMailer_mask()
{
if (_timer_id != XVT_TIMER_ERROR)
{
xvt_timer_destroy(_timer_id);
_timer_id = XVT_TIMER_ERROR;
}
save();
}

View File

@ -2,10 +2,11 @@
#define F_USER 202
#define F_PASSWORD 203
#define F_MAPI 204
#define F_TIMER 205
#define F_MESSAGES 205
#define F_ADDRESSES 206
#define F_PARAMS 207
#define F_MESSAGES 210
#define F_ADDRESSES 211
#define F_PARAMS 212
#define F_CHECKED 101
#define F_SENDER 102

View File

@ -32,6 +32,17 @@ BEGIN
PROMPT 1 0 "Preleva messaggi MAPI"
END
NUMBER F_TIMER 4
BEGIN
PROMPT 41 0 "Controlla la posta ogni "
FLAGS "U"
END
TEXT DLG_NULL
BEGIN
PROMPT 71 0 "minuti"
END
STRING F_SERVER 80 28
BEGIN
PROMPT 1 1 "Server "

View File

@ -31,7 +31,7 @@ class TClifo_application : public TRelation_application
TLocalisamfile* _comuni;
TLocalisamfile* _pcon;
bool _lbcn, _gesven, _has_cg, _liscatven;
bool _lbcn, _gesven, _gessal, _has_cg, _liscatven;
bool _savenew;
TToken_string _tmp;
@ -80,10 +80,9 @@ public:
inline TClifo_application& app() { return (TClifo_application&)main_app(); }
bool TClifo_application::protected_record(TRectype &rec)
{
if (!_has_cg)
return FALSE;
return FALSE;
TMask* m = get_mask(MODE_MOD);
const TString16 tipocf(m->get(F_TIPOCF));
const long codice = atol(m->get(F_CODCF));
@ -429,9 +428,12 @@ void TClifo_application::on_config_change()
{
TConfig cnf(CONFIG_DITTA);
_gesven = cnf.get_bool("GesVen") || !_has_cg;
_gessal = cnf.get_bool("GesSal") || !_has_cg;
_lbcn = cnf.get_bool("GsLbCn");
_liscatven = cnf.get_bool("GESLISCV", "ve");
init_pages(*_msk);
_msk->show(-9, _gessal); // Mostra campi Estratti conto
}
@ -442,8 +444,8 @@ void TClifo_application::init_pages(TMask& m)
m.show(-5, _lbcn);
// Se non e' abilitata la gestione delle vendite disabilita le
// maschere dalla 4 in poi
m.enable_page(3, _gesven);
// maschere dalla 5 in poi
m.enable_page(4, _gesven);
}
void TClifo_application::init_query_mode(TMask& m)
@ -462,6 +464,23 @@ int TClifo_application::read(TMask& m)
{
TRelation_application::read(m);
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();
if (_gesven)
{
TToken_string riga(240);
@ -496,23 +515,6 @@ 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();
}
@ -571,6 +573,26 @@ void TClifo_application::indsp_pack()
void TClifo_application::common_f(const TMask& m)
{
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);
if (_gesven)
{
const char tipocf = m.get(F_TIPOCF)[0];
@ -603,26 +625,6 @@ 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);
}
}
@ -728,8 +730,7 @@ bool TClifo_application::user_destroy() // releasev e arrmask
{
delete _msk;
delete _rel;
if (_has_cg)
delete _mov;
if (_mov) delete _mov;
delete _anag;
delete _fis;
delete _pcon;

View File

@ -113,6 +113,7 @@
#define F_MAXSOLL 206
#define F_DATAESC 207
#define F_DATASOLL 208
#define F_NUMESC 209
#define F_TITOLO 210
#define F_RAGGOR 211
#define F_MINORD 212

View File

@ -881,6 +881,147 @@ BEGIN
PROMPT 1 0 "Dati identificativi"
END
LIST DLG_NULL 1 11
BEGIN
PROMPT 2 1 "Tipo "
FLAGS "D"
GROUP 1
ITEM "C|Clienti"
ITEM "F|Fornitori"
END
NUMBER DLG_NULL 6
BEGIN
PROMPT 2 2 "Codice "
FLAGS "RD"
GROUP 2
END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome / Seconda Parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
NUMBER F_CODABIPR 5
BEGIN
PROMPT 2 4 "Banca presentazione ABI "
FIELD LF_CFVEN->CODABIPR
FLAGS "Z"
COPY USE F_CODABI
INPUT CODTAB F_CODABIPR
COPY DISPLAY F_CODABI
OUTPUT F_CODABIPR CODTAB[1,5]
// OUTPUT F_CODBANPR CODTAB[6,10]
HELP "Codice ABI della banca presentazione effetti"
CHECKTYPE NORMAL
END
NUMBER F_CODBANPR 5
BEGIN
PROMPT 43 4 "CAB "
FIELD LF_CFVEN->CODCABPR
FLAGS "Z"
COPY USE F_CODBAN
INPUT CODTAB[1,5] F_CODABIPR
INPUT CODTAB[6,10] F_CODBANPR
COPY DISPLAY F_CODABI
OUTPUT F_CODABIPR CODTAB[1,5]
OUTPUT F_CODBANPR CODTAB[6,10]
HELP "Codice CAB della banca presentazione effetti"
CHECKTYPE NORMAL
END
NUMBER F_IMPMINEFF 10
BEGIN
PROMPT 2 5 "Importo minimo effetti "
PICTURE "."
FIELD LF_CFVEN->IMPMINEFF
END
BOOLEAN F_EMEFFRICH
BEGIN
PROMPT 43 5 "Emissione effetti"
FIELD LF_CFVEN->EMEFFRICH
END
BOOLEAN F_RAGGEFF
BEGIN
PROMPT 43 6 "Raggruppamento effetti"
FIELD LF_CFVEN->RAGGEFF
END
NUMBER F_NUMESC 5
BEGIN
PROMPT 2 7 "Ultimo Nr. estratto conto "
FIELD LF_CFVEN->NUMESC
GROUP 9
END
NUMBER F_MAXSOLL 2
BEGIN
PROMPT 43 7 "Numero max solleciti "
FIELD LF_CFVEN->MAXSOLL
GROUP 7 9
END
DATE F_DATAESC
BEGIN
PROMPT 2 8 "Data ultimo estratto conto "
FIELD LF_CFVEN->DATAESC
GROUP 9
END
DATE F_DATASOLL
BEGIN
PROMPT 43 8 "Data ultimo sollecito "
FIELD LF_CFVEN->DATASOLL
GROUP 7 9
END
/* Campo non ancora utilizzato
STRING F_PROFSOLL 5
BEGIN
PROMPT 45 9 "Codice profilo "
FIELD LF_CFVEN->PROFSOLL
GROUP 7
END
*/
TEXT DLG_NULL
BEGIN
PROMPT 1 9 "@bPeriodi di non accettazione effetti"
END
SPREADSHEET F_NONACCEFF 76
BEGIN
PROMPT 1 10 "Periodi effetti"
ITEM "Dal\nGiorno@8"
ITEM "Dal\nMese"
ITEM "Al\nGiorno@8"
ITEM "Al\nMese"
ITEM "Sposta al\nGiorno@9"
ITEM "Sposta al\nMese"
GROUP 7
END
ENDPAGE
PAGE "Pag.5" -1 -1 78 19
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 0 "Dati identificativi"
END
LIST DLG_NULL 1 11
BEGIN
PROMPT 2 1 "Tipo "
@ -913,9 +1054,9 @@ BEGIN
GROUP 6
END
SPREADSHEET F_SHEET_G_VEN
SPREADSHEET F_SHEET_G_VEN 0 -4
BEGIN
PROMPT 0 5 ""
PROMPT 0 4 ""
ITEM "Ragione Sociale@50"
ITEM "Indirizzo@35"
ITEM "N. civico@10"
@ -930,9 +1071,42 @@ BEGIN
ITEM "Iva Rid."
END
NUMBER F_CODINDDOC 3
BEGIN
PROMPT 2 -3 "Codice indirizzo documento "
FIELD LF_CFVEN->CODINDDOC
GROUP 7
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
ITEM " |**Nessuno**| | | "
INPUT F_CODINDDOC
OUTPUT F_CODINDDOC
END
NUMBER F_CODINDSP 3
BEGIN
PROMPT 2 -2 "Codice indirizzo spedizione "
FIELD LF_CFVEN->CODINDSP
GROUP 7
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
INPUT F_CODINDSP
OUTPUT F_CODINDSP
HELP "Codice dell'indirizzo di spedizione da proporre"
END
NUMBER F_CODINDEFF 3
BEGIN
PROMPT 2 -1 "Codice indirizzo effetti "
FIELD LF_CFVEN->CODINDEFF
GROUP 7
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
INPUT F_CODINDEFF
OUTPUT F_CODINDEFF
HELP "Codice indirizzo effetti"
END
ENDPAGE
PAGE "Pag.5" -1 -1 78 19
PAGE "Pag.6" -1 -1 78 19
GROUPBOX DLG_NULL 76 4
BEGIN
@ -971,18 +1145,6 @@ BEGIN
GROUP 6
END
NUMBER F_CODINDDOC 3
BEGIN
PROMPT 2 4 "Codice indirizzo documento "
FIELD LF_CFVEN->CODINDDOC
GROUP 7
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
ITEM " |**Nessuno**| | | "
INPUT F_CODINDDOC
OUTPUT F_CODINDDOC
HELP "Codice indirizzi di pag.4"
END
STRING F_CODNOTE 2
BEGIN
PROMPT 43 4 "Codice Note Cli/Fo "
@ -1001,7 +1163,7 @@ END
STRING F_CODLEG 3
BEGIN
PROMPT 2 6 "Codice Legale "
PROMPT 2 4 "Codice Legale "
FIELD LF_CFVEN->CODLEG
GROUP 7
USE %LEG
@ -1015,7 +1177,7 @@ END
STRING F_CODCATC 2
BEGIN
PROMPT 43 6 "Codice Categoria contabile "
PROMPT 43 5 "Codice Categoria contabile "
FIELD LF_CFVEN->CODCATC
USE CCO
INPUT CODTAB F_CODCATC
@ -1028,31 +1190,20 @@ END
STRING F_CODPRCF 10
BEGIN
PROMPT 2 8 "Codice presso cliente "
PROMPT 2 5 "Codice presso cliente "
FIELD LF_CFVEN->CODPRCF
GROUP 7
HELP "Codice meccanografico assegnato dal cliente"
END
NUMBER F_CODINDSP 3
BEGIN
PROMPT 43 8 "Codice indirizzo spedizione "
FIELD LF_CFVEN->CODINDSP
GROUP 7
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
INPUT F_CODINDSP
OUTPUT F_CODINDSP
HELP "Codice dell'indirizzo di spedizione da proporre"
END
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 10 "Dati Agente"
PROMPT 1 7 "@bDati Agente"
END
STRING F_CODZONA 2
BEGIN
PROMPT 2 11 "Codice Zona "
PROMPT 2 8 "Codice Zona "
FIELD LF_CFVEN->CODZONA
GROUP 7
USE ZON
@ -1066,7 +1217,7 @@ END
STRING F_CODAG 5
BEGIN
PROMPT 44 11 "Codice agente "
PROMPT 44 8 "Codice agente "
FLAGS "UZ"
FIELD LF_CFVEN->CODAG
USE LF_AGENTI
@ -1082,7 +1233,7 @@ END
NUMBER F_PROVV 5 2
BEGIN
PROMPT 2 12 "Provvigione "
PROMPT 2 9 "Provvigione "
FIELD LF_CFVEN->PERCPROVV
GROUP 7
HELP "Provvigione percepita dall'agente"
@ -1090,7 +1241,7 @@ END
BOOLEAN F_LIQPAG
BEGIN
PROMPT 46 12 "Liquidazione provvigioni"
PROMPT 46 9 "Liquidazione provvigioni"
FIELD LF_CFVEN->LIQPAG
GROUP 7
HELP "Indicare se si usa la liquidazione provvigioni"
@ -1098,7 +1249,7 @@ END
BOOLEAN F_ADDCONAI
BEGIN
PROMPT 2 15 "Addebito CONAI"
PROMPT 2 12 "Addebito CONAI"
FIELD LF_CFVEN->ADDCONAI
MESSAGE FALSE CLEAR,8@|ENABLE,F_CONAIASS
MESSAGE TRUE ENABLE,8@|CLEAR,F_CONAIASS
@ -1106,7 +1257,7 @@ END
BOOLEAN F_CONAIASS
BEGIN
PROMPT 43 15 "Stampa contributo CONAI assolto"
PROMPT 43 12 "Stampa contributo CONAI assolto"
FIELD LF_CFVEN->CONAIASS
MESSAGE FALSE ENABLE,F_ADDCONAI
MESSAGE TRUE CLEAR,F_ADDCONAI
@ -1114,54 +1265,54 @@ END
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 16 "Esenzioni CONAI"
PROMPT 1 13 "@bEsenzioni CONAI"
END
NUMBER F_ESACC 6 2
BEGIN
PROMPT 2 17 "Acciaio "
PROMPT 2 14 "Acciaio "
FIELD LF_CFVEN->ESACC
GROUP 8
END
NUMBER F_ESALL 6 2
BEGIN
PROMPT 30 17 "Alluminio "
PROMPT 30 14 "Alluminio "
FIELD LF_CFVEN->ESALL
GROUP 8
END
NUMBER F_ESCAR 6 2
BEGIN
PROMPT 50 17 "Carta "
PROMPT 50 14 "Carta "
FIELD LF_CFVEN->ESCAR
GROUP 8
END
NUMBER F_ESPLA 6 2
BEGIN
PROMPT 2 18 "Plastica "
PROMPT 2 15 "Plastica "
FIELD LF_CFVEN->ESPLA
GROUP 8
END
NUMBER F_ESLEG 6 2
BEGIN
PROMPT 30 18 "Legno "
PROMPT 30 15 "Legno "
FIELD LF_CFVEN->ESLEG
GROUP 8
END
NUMBER F_ESVET 6 2
BEGIN
PROMPT 50 18 "Vetro "
PROMPT 50 15 "Vetro "
FIELD LF_CFVEN->ESVET
GROUP 8
END
ENDPAGE
PAGE "Pag.6" -1 -1 78 19
PAGE "Pag.7" -1 -1 78 19
GROUPBOX DLG_NULL 76 4
BEGIN
@ -1408,171 +1559,6 @@ END
ENDPAGE
PAGE "Pag.7" -1 -1 78 19
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 0 "Dati identificativi"
END
LIST DLG_NULL 1 11
BEGIN
PROMPT 2 1 "Tipo "
FLAGS "D"
GROUP 1
ITEM "C|Clienti"
ITEM "F|Fornitori"
END
NUMBER DLG_NULL 6
BEGIN
PROMPT 2 2 "Codice "
FLAGS "RD"
GROUP 2
END
STRING DLG_NULL 30
BEGIN
PROMPT 23 1 "Cognome / Rag. Soc. "
FLAGS "D"
GROUP 3
END
STRING DLG_NULL 20
BEGIN
PROMPT 23 2 "Nome / Seconda Parte Rag. Soc. "
FLAGS "D"
GROUP 6
END
NUMBER F_CODABIPR 5
BEGIN
PROMPT 2 4 "Banca presentazione ABI "
FIELD LF_CFVEN->CODABIPR
FLAGS "Z"
COPY USE F_CODABI
INPUT CODTAB F_CODABIPR
COPY DISPLAY F_CODABI
OUTPUT F_CODABIPR CODTAB[1,5]
// OUTPUT F_CODBANPR CODTAB[6,10]
HELP "Codice ABI della banca presentazione effetti"
CHECKTYPE NORMAL
END
NUMBER F_CODBANPR 5
BEGIN
PROMPT 45 4 "CAB "
FIELD LF_CFVEN->CODCABPR
FLAGS "Z"
COPY USE F_CODBAN
INPUT CODTAB[1,5] F_CODABIPR
INPUT CODTAB[6,10] F_CODBANPR
COPY DISPLAY F_CODABI
OUTPUT F_CODABIPR CODTAB[1,5]
OUTPUT F_CODBANPR CODTAB[6,10]
HELP "Codice CAB della banca presentazione effetti"
CHECKTYPE NORMAL
END
NUMBER F_CODINDEFF 3
BEGIN
PROMPT 2 5 "Codice indirizzo effetti "
FIELD LF_CFVEN->CODINDEFF
GROUP 7
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
INPUT F_CODINDEFF
OUTPUT F_CODINDEFF
HELP "Codice indirizzo effetti"
END
BOOLEAN F_EMEFFRICH
BEGIN
PROMPT 45 5 "Emissione effetti"
FIELD LF_CFVEN->EMEFFRICH
GROUP 7
HELP "Indicare se emettere effetti a richiesta"
END
NUMBER F_IMPMINEFF 6
BEGIN
PROMPT 2 6 "Importo minimo effetti "
FIELD LF_CFVEN->IMPMINEFF
GROUP 7
HELP "Importo minimo effetti"
END
BOOLEAN F_RAGGEFF
BEGIN
PROMPT 45 6 "Raggruppamento effetti"
FIELD LF_CFVEN->RAGGEFF
GROUP 7
END
TEXT DLG_NULL
BEGIN
PROMPT 1 7 "@bPeriodi di non accettazione effetti"
END
SPREADSHEET F_NONACCEFF 76 6
BEGIN
PROMPT 1 8 "Periodi effetti"
ITEM "Dal\nGiorno@6"
ITEM "Dal\nMese"
ITEM "Al\nGiorno@6"
ITEM "Al\nMese"
ITEM "Sposta al\nGiorno@9"
ITEM "Sposta al\nMese"
GROUP 7
END
BOOLEAN F_ADDBOLLI
BEGIN
PROMPT 2 16 "Addebito Bolli Ricevute bancarie "
FIELD LF_CFVEN->ADDBOLLI
GROUP 7
HELP "Indicare se addebitare bolli ricevute bancarie"
END
NUMBER F_PERCSPINC 6 2
BEGIN
PROMPT 44 16 "% Addebito Spese incasso "
FIELD LF_CFVEN->PERCSPINC
GROUP 7
HELP "Indicare la percentuale di addebito delle spese d'incasso"
END
BOOLEAN F_IVARID
BEGIN
PROMPT 2 17 "Aliquota ridotta "
FIELD LF_CFVEN->IVARID
GROUP 7
HELP "Indicare se applicare l'aliquota ridotta"
END
BOOLEAN F_GESTCONTR
BEGIN
PROMPT 26 17 "Gestione contratto"
FIELD LF_CFVEN->GESTCONTR
HELP "Indicare se si gestisce un contratto"
END
STRING F_CATVEN 2
BEGIN
PROMPT 54 17 "Categoria vendita "
FIELD LF_CFVEN->CATVEN
GROUP 7
USE CVE
INPUT CODTAB F_CATVEN
DISPLAY "Codice vendita" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CATVEN CODTAB
HELP "Codice della categoria di vendita"
CHECKTYPE NORMAL
FLAGS "U"
END
ENDPAGE
PAGE "Pag.8" -1 -1 78 19
GROUPBOX DLG_NULL 76 4
@ -1763,36 +1749,50 @@ BEGIN
HELP "Percentuale sconto di riga applicato nelle forme: semplice, es. 10 (per 10%) composto, es. 10+5 (per 10%+5%) oppure 10+5-2 (per 10%+5%-2%)"
END
STRING F_PROFSOLL 5
BOOLEAN F_ADDBOLLI
BEGIN
PROMPT 2 11 "Profilo sollecito "
FIELD LF_CFVEN->PROFSOLL
PROMPT 2 10 "Addebito Bolli Ricevute bancarie "
FIELD LF_CFVEN->ADDBOLLI
GROUP 7
HELP "Codice del profilo sollecito"
HELP "Indicare se addebitare bolli ricevute bancarie"
END
NUMBER F_MAXSOLL 2
NUMBER F_PERCSPINC 6 2
BEGIN
PROMPT 47 11 "Numero solleciti "
FIELD LF_CFVEN->MAXSOLL
PROMPT 44 10 "% Addebito Spese incasso "
FIELD LF_CFVEN->PERCSPINC
GROUP 7
HELP "Massimo numero di solleciti"
HELP "Indicare la percentuale di addebito delle spese d'incasso"
END
DATE F_DATAESC
BOOLEAN F_IVARID
BEGIN
PROMPT 2 12 "Ultimo estratto conto "
FIELD LF_CFVEN->DATAESC
PROMPT 2 11 "Aliquota ridotta "
FIELD LF_CFVEN->IVARID
GROUP 7
HELP "Data dell'ultimo estratto conto"
HELP "Indicare se applicare l'aliquota ridotta"
END
DATE F_DATASOLL
BOOLEAN F_GESTCONTR
BEGIN
PROMPT 47 12 "Ultimo sollecito "
FIELD LF_CFVEN->DATASOLL
PROMPT 26 11 "Gestione contratto"
FIELD LF_CFVEN->GESTCONTR
HELP "Indicare se si gestisce un contratto"
END
STRING F_CATVEN 2
BEGIN
PROMPT 54 11 "Categoria vendita "
FIELD LF_CFVEN->CATVEN
GROUP 7
HELP "Data dell'ultimo sollecito"
USE CVE
INPUT CODTAB F_CATVEN
DISPLAY "Codice vendita" CODTAB
DISPLAY "Descrizione@30" S0
OUTPUT F_CATVEN CODTAB
HELP "Codice della categoria di vendita"
CHECKTYPE NORMAL
FLAGS "U"
END
STRING F_TITOLO 2
@ -1857,8 +1857,6 @@ ENDPAGE
ENDMASK
#include "cg0200b.uml"
PAGE "Effetti" -1 -1 42 10
GROUPBOX DLG_NULL 40 4
@ -1929,6 +1927,6 @@ BEGIN
END
ENDPAGE
ENDMASK
#include "cg0200b.uml"

View File

@ -88,13 +88,13 @@ int TClifoVI::registra(bool re, bool force)
int err=write_rec(re,c.curr(),c);
if (err!=NOERR) return err;
TLocalisamfile& v = lfile(LF_CFVEN);
err = write_rec(TRUE,v.curr(),v);
if (err!=NOERR) return err;
// Put here gest_vend() discrimination
if (_gesven)
{
TLocalisamfile& v = lfile(LF_CFVEN);
err = write_rec(TRUE,v.curr(),v);
if (err!=NOERR) return err;
TLocalisamfile& rind=lfile(LF_INDSP);
const char tipocf=c.get(CLI_TIPOCF)[0];
const long codcf=c.get_long(CLI_CODCF);

View File

@ -482,13 +482,25 @@ bool TCaus_app::cod_reg_hndl (TMask_field& f, KEY k)
bool TCaus_app::ss_notify(TSheet_field& s, int r, KEY k)
{
if (k == K_ENTER)
static bool selecting = FALSE;
switch(k)
{
TToken_string &riga = s.row(r);
const int g = riga.get_int(3);
if (g == 0) // riga azzerata
app().clear(r); // pulisco la riga anche nell'array
}
case K_TAB:
if (!selecting && s.row(r).get_char(1) <= ' ') // riga azzerata
{
selecting = TRUE;
s.select(r); // Vado alla prima colonna delle righe vuote
selecting = FALSE;
}
break;
case K_ENTER:
if (s.row(r).get_int(3) == 0) // riga azzerata
app().clear(r); // pulisco la riga anche nell'array
break;
default:
break;
}
return TRUE;
}

View File

@ -29,7 +29,7 @@ class TRiga_sez_opp : public TObject
public:
int gruppo() { return atoi(_str->get(0)); }
int conto() { return atoi(_str->get(1)); }
int sottoc() { return atoi(_str->get(2)); }
long sottoc() { return atol(_str->get(2)); }
const char * sezione () { return _str->get(3); }
const char * lettera () { return _str->get(4); }
const char * num_rom () { return _str->get(5); }
@ -92,7 +92,7 @@ public:
TRiga_sez_opp* riga() { return (TRiga_sez_opp*) get(); }
int gruppo() { return riga()->gruppo(); }
int conto() { return riga()->conto(); }
int sottoc() { return riga()->sottoc(); }
long sottoc() { return riga()->sottoc(); }
const char * sezione () { return riga()->sezione(); }
const char * lettera () { return riga()->lettera(); }
const char * num_rom () { return riga()->num_rom(); }
@ -4259,7 +4259,7 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
// num = bil->num;
gruppo = atoi(bil->gruppo);
conto = atoi(bil->conto);
sottoc = atoi(bil->sottoc);
sottoc = atol(bil->sottoc);
descr_let = descrizione_lettera(sezione,lettera);
descr_numr = descrizione_numeroromano(sezione,lettera,numeror);
descr_num = descrizione_numero(sezione,lettera,numeror,numero);
@ -4510,7 +4510,7 @@ void TStampa_IVdirettiva::setta_righe_verifica()
// num = bil->num;
gruppo = atoi(bil->gruppo);
conto = atoi(bil->conto);
sottoc = atoi(bil->sottoc);
sottoc = atol(bil->sottoc);
tmcf = bil->tipocf;
descr_let = descrizione_lettera(sezione,lettera);
descr_numr = descrizione_numeroromano(sezione,lettera,numeror);

View File

@ -1275,7 +1275,7 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_mov
}
#ifndef __EXTRA__
if (nuovo)
if (pagamento.get_int(PAGSCA_GRUPPOC) == 0)
{
const TCausale& causale = app().causale();
TBill contro; causale.bill(caus, contro); // Legge conto contropartita
@ -1299,7 +1299,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
return FALSE; // Ho cliccato su di un saldo (per sbaglio!)
TGame_mask& gm = (TGame_mask&)(m.get_sheet()->mask());
const TBill& bill = gm.conto(); // Clifo
const TBill& bill = gm.conto(); // Clifo
TSheet_field& sp = gm.partite();
TToken_string& spr = sp.row(sp.selected());
@ -1829,9 +1829,7 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
app().notify_edit_pagamento(p, newpag, val);
#endif
}
// delete pm; // Perche' commentata?
delete pm; // Perche' commentarla ?
return key != K_ESC;
}

View File

@ -129,14 +129,12 @@ BEGIN
PROMPT 16 12 "Stampa mov. dal numero "
USE LF_MOV KEY 1
INPUT NUMREG F_NUMEROINI
DISPLAY "Numero@6" NUMREG
DISPLAY "Numero@7" NUMREG
DISPLAY "Data@10" DATAREG
DISPLAY "Causale" CODCAUS
DISPLAY "Documento" NUMDOC
DISPLAY "Descrizione@50" DESCR
OUTPUT F_NUMEROINI NUMREG
//CHECKTYPE NORMAL
FLAGS "R"
GROUP 2
END

View File

@ -45,7 +45,7 @@ class TMastrini_application : public TPrintapp
TLocalisamfile* _clifo;
TLocalisamfile* _caus;
TSaldo* _sld;
TParagraph_string* _d18,* _d23,* _d30;
TParagraph_string* _d18,* _d22,* _d30;
TArray _riga, _lista;
TDate _data_ini,_data_fine,_data_finese,_data_finesesucc,_ultima_data_reg;
@ -1613,27 +1613,27 @@ bool TMastrini_application::preprocess_page(int file, int counter)
{
if (_descrizione != "")
{
*_d23 = (const char*) _descrizione;
*_d22 = (const char*) _descrizione;
if (_descrizionemov != "")
{
*_d18 = (const char*) _descrizionemov;
set_row(_rw, "@42g#a", _d18);
set_row(_rw, "@61g#a", _d23);
set_row(_rw, "@61g#a", _d22);
}
else if (_descrizionemov == "")
{
*_d18 = (const char*) _descrcaus;
set_row(_rw, "@42g#a", _d18);
set_row(_rw, "@61g#a", _d23);
set_row(_rw, "@61g#a", _d22);
}
}
else if (_descrizione == "")
if (_descrizionemov != "")
{
*_d23 = (const char*) _descrizionemov;
*_d22 = (const char*) _descrizionemov;
*_d18 = (const char*) _descrcaus;
set_row (_rw,"@42g#a", _d18);
set_row (_rw,"@61g#a", _d23);
set_row (_rw,"@61g#a", _d22);
}
else
if (_descrizionemov == "")
@ -1648,8 +1648,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
set_row (_rw,"@42g#a", _d18);
if (descr_contr != "Sconosciuto")
{
*_d23 = (const char*) descr_contr;
set_row (_rw,"@61g#a", _d23);
*_d22 = (const char*) descr_contr;
set_row (_rw,"@61g#a", _d22);
}
}
}
@ -1661,16 +1661,16 @@ bool TMastrini_application::preprocess_page(int file, int counter)
*_d30 = (const char*) _descrizione;
if (_descrizionemov != "")
{
*_d23 = (const char*) _descrizionemov;
set_row (_rw,"@46g#a", _d23);
*_d22 = (const char*) _descrizionemov;
set_row (_rw,"@46g#a", _d22);
set_row (_rw,"@70g#a", _d30);
}
else if (_descrizionemov == "")
{
//set_row (1,"@46g%.23s", (const char*) _descrcaus);
//set_row (1,"@70g%.30s", (const char*) _descrizione);
*_d23 = (const char*) _descrcaus;
set_row(_rw, "@46g#a", _d23);
*_d22 = (const char*) _descrcaus;
set_row(_rw, "@46g#a", _d22);
set_row(_rw, "@70g#a", _d30);
}
}
@ -1680,8 +1680,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
//set_row (1,"@46g%.23s", (const char*) _descrcaus);
//set_row (1,"@70g%.30s", (const char*) _descrizionemov);
*_d30 = (const char*) _descrizionemov;
*_d23 = (const char*) _descrcaus;
set_row (_rw,"@46g#a", _d23);
*_d22 = (const char*) _descrcaus;
set_row (_rw,"@46g#a", _d22);
set_row (_rw,"@70g#a", _d30);
}
else
@ -1693,8 +1693,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
//set_row (1,"@46g%.23s", (const char*) _descrcaus);
//if (descr_contr != "Sconosciuto")
// set_row (1,"@70g%.30s", (const char*) descr_contr);
*_d23 = (const char*) _descrcaus;
set_row (_rw,"@46g#a", _d23);
*_d22 = (const char*) _descrcaus;
set_row (_rw,"@46g#a", _d22);
if (descr_contr != "Sconosciuto")
{
*_d30 = (const char*) descr_contr;
@ -3976,7 +3976,7 @@ bool TMastrini_application::user_create()
_sld = new TSaldo ();
_d18 = new TParagraph_string ("",18);
_d23 = new TParagraph_string ("",23);
_d22 = new TParagraph_string ("",22);
_d30 = new TParagraph_string ("",30);
_msk = new TMask("cg3200a");
@ -4012,7 +4012,7 @@ bool TMastrini_application::user_destroy()
delete _tabreg;
delete _sld;
delete _d18;
delete _d23;
delete _d22;
delete _d30;
delete _collins;

View File

@ -2250,6 +2250,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
case 104:
if (riga.tipo() == riga_mastrino)
{
/* Invertire l'ordine
const TRectype& mov = _mastrino.testata(rec);
cell.set(mov.get(MOV_DESCR));
if (cell.empty())
@ -2262,6 +2263,19 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
cell.set(uncle.descrizione());
}
}
*/
const TRectype& rmov = _mastrino.riga(rec);
cell.set(rmov.get(RMV_DESCR));
if (cell.empty())
{
const TRectype& mov = _mastrino.testata(rec);
cell.set(mov.get(MOV_DESCR));
if (cell.empty())
{
TBill uncle(rmov,TRUE);
cell.set(uncle.descrizione());
}
}
}
else
{

View File

@ -66,7 +66,7 @@ BEGIN
ITEM "Data Op. \nData Doc.@10"
ITEM "C@1"
ITEM "Causale@20"
ITEM "Operazione@20"
ITEM "Descrizione@20"
ITEM "Dare@15R"
ITEM "Avere@15R"
ITEM "N.Doc. \nN.Prot.@7"

View File

@ -2955,6 +2955,19 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
_lim->put("R11", acc_dec);
_lim->put("R12", res_cred);
_lim->put("R13", res_debt);
// Riporta eventuale credito nella tabella parametri liquidazione dell'anno successivo
if (risultato < 0) // Risultato a credito
{
TString yr = _year;
_year = format("%d", atoi(_year) + 1);
if (look_lia(0l, TRUE))
{
_lia->put("R0", abs(risultato));
_lia->rewrite();
}
_year = yr;
}
// ciapa
}

View File

@ -1690,7 +1690,7 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
set_row(row++, "%% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r",
(const char*) ss, (const char*)prc.string(), &(d._r11));
yy--;
yy-=2;
if (d._r13 != INVALID_PRORATA && d._r12 != ZERO)
{
rprc = CENTO - d._r13;
@ -2074,6 +2074,7 @@ bool TLiquidazione_app::set_annual(_DescrItem& d)
set_row(row++,"C2 - Operazioni esenti di cui nr. 11 art. 10 @69g%r", &(d._r4));
set_row(row++,"C3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r", &(d._r5));
set_row(row++,"C1A - Operazioni esenti di cui all'art.10 n. 27 quinquies @69g%r", &(d._r7));
set_row(row++,"@6gdi cui cessione beni ammortizzabili");
set_row(row++,"Volume d'affari @69g%r", &(d._r0));
set_row(row++,"Detraibilita' @69g%r%%", &(perc_det));
}

View File

@ -1747,7 +1747,7 @@ void TStampa_registri_app::set_page_tot_reg()
stampa_plafonds(rr);
}
bool TStampa_registri_app::stampa_plafonds(int r)
bool TStampa_registri_app::stampa_plafonds(int r, bool test_mode)
{
TTable pla ("%PLA");
TTable ppa ("PPA");
@ -1788,7 +1788,12 @@ bool TStampa_registri_app::stampa_plafonds(int r)
disponibile = r8 + r8b + r9;
}
if ((r1 > ZERO || r2 > ZERO || r3 > ZERO) && disponibile > ZERO)
const bool print_prospect = (r1 > ZERO || r2 > ZERO || r3 > ZERO) && disponibile > ZERO;
if (test_mode)
return print_prospect;
if (print_prospect)
{
if (print_now)
{
@ -2369,22 +2374,25 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
long items = _cur->items();
const bool last_mov = pos == items-1;
if (_stampa_plafonds)
if (_stampa_plafonds && !last_mov)
{
// Nel caso sia richiesta la stampa prospetto mensile plafond e vi siano mesi
// senza movimenti, è necessario forzarne la stampa
TDate save_date(_datareg);
// Caso speciale, in cui non vi siano movimenti sull'ultimo mese indicato in stampa
const bool print_over = last_mov && _dataregp == _dataregs && _dataregp.month() < _data_a.month();
//const bool print_over = last_mov && _dataregp == _dataregs && _dataregp.month() < _data_a.month();
const int m1 = _dataregp.month()+1;
const int m2 = print_over ? _data_a.month()+1 : _dataregs.month();
const int m2 = _dataregs.month();
for (int kk = m1; kk < m2; kk++)
{
_datareg = TDate(1, kk, _annoes);
printer().formfeed();
stampa_plafonds(-1);
if (stampa_plafonds(-1, TRUE))
{
printer().formfeed();
stampa_plafonds(-1);
}
}
_datareg = save_date;
}
@ -2410,7 +2418,7 @@ print_action TStampa_registri_app::postprocess_page (int file, int counter)
if (last_mov)
{
if (_tipo_stampa != libro_unico && _liquidazione)
if (_stampa_plafonds || (_tipo_stampa != libro_unico && _liquidazione))
stampa_liq_mesi_succ();
if (_tipo_stampa != prova)
{
@ -3158,9 +3166,15 @@ void TStampa_registri_app::stampa_liq_mesi_succ()
int a = _data_a.month();
for (int m = da; m <= a; m++)
{
_datareg = TDate(1, m, _annoes);
if (_stampa_plafonds && stampa_plafonds(-1, TRUE))
{
printer().formfeed();
stampa_plafonds(-1);
}
if (stampo_liquidazione(m))
{
_datareg = TDate(1, m, _annoes);
TFilename t;
t.temp("iva");

View File

@ -136,7 +136,7 @@ public:
int stampa_intestazione();
int stampa_prospetto(int, bool);
long select_firm_range(long,long);
bool stampa_plafonds(int);
bool stampa_plafonds(int r, bool test_mode = FALSE);
void get_dati_ditta();
void stampa_vidi();
void scrivi_reg(const TDate&);

View File

@ -14,49 +14,53 @@
#define FLD_CRIVAP 113
#define FLD_COCACH 115
#define FLD_COCAAP 116
#define FLD_CSBICHS 117
#define FLD_CSBICHG 118
#define FLD_CSBICHC 119
#define FLD_CSPRPES 120
#define FLD_CSPRPEG 121
#define FLD_CSPRPEC 122
#define FLD_CSBIAPS 123
#define FLD_CSBIAPG 124
#define FLD_CSBIAPC 125
#define FLD_CSUECPS 126
#define FLD_CSUECPG 127
#define FLD_CSUECPC 128
#define FLD_CSPECPS 129
#define FLD_CSPECPG 130
#define FLD_CSPECPC 131
#define FLD_CSUECES 132
#define FLD_CSUECEG 133
#define FLD_CSUECEC 134
#define FLD_CSPECES 135
#define FLD_CSPECEG 136
#define FLD_CSPECEC 137
#define LST_RRFRAM 138
#define CHK_RRMECO 139
#define FLD_RRCCRA 140
#define FLD_RRCCRI 141
#define CHK_GESVEN 142
#define FLD_DCOCAAP 143
#define FLD_DCOCACH 144
#define FLD_DRRCCRA 145
#define FLD_DRRCCRI 146
#define FLD_DCSBICH 147
#define FLD_DCSPRPE 148
#define FLD_DCSBIAP 149
#define FLD_DCSUECP 150
#define FLD_DCSPECP 151
#define FLD_DCSUECE 152
#define FLD_DCSPECE 153
#define FLD_DESLIN 154
#define FLD_DESLIC 155
#define CHK_GEST74 156
#define CHK_INTRTR 157
#define CHK_DTCFPG 158
#define CHK_RIFPRO 159
#define FLD_NUM_EC 117
#define FLD_LAST_EC 118
#define FLD_CSBICHS 217
#define FLD_CSBICHG 218
#define FLD_CSBICHC 219
#define FLD_CSPRPES 220
#define FLD_CSPRPEG 221
#define FLD_CSPRPEC 222
#define FLD_CSBIAPS 223
#define FLD_CSBIAPG 224
#define FLD_CSBIAPC 225
#define FLD_CSUECPS 226
#define FLD_CSUECPG 227
#define FLD_CSUECPC 228
#define FLD_CSPECPS 229
#define FLD_CSPECPG 230
#define FLD_CSPECPC 231
#define FLD_CSUECES 232
#define FLD_CSUECEG 233
#define FLD_CSUECEC 234
#define FLD_CSPECES 235
#define FLD_CSPECEG 236
#define FLD_CSPECEC 237
#define LST_RRFRAM 338
#define CHK_RRMECO 339
#define FLD_RRCCRA 340
#define FLD_RRCCRI 341
#define CHK_GESVEN 342
#define FLD_DCOCAAP 343
#define FLD_DCOCACH 344
#define FLD_DRRCCRA 345
#define FLD_DRRCCRI 346
#define FLD_DCSBICH 347
#define FLD_DCSPRPE 348
#define FLD_DCSBIAP 349
#define FLD_DCSUECP 350
#define FLD_DCSPECP 351
#define FLD_DCSUECE 352
#define FLD_DCSPECE 353
#define FLD_DESLIN 354
#define FLD_DESLIC 355
#define CHK_GEST74 356
#define CHK_INTRTR 357
#define CHK_DTCFPG 358
#define CHK_RIFPRO 359
// gruppi
#define GROUP_SALDACONTO 1

View File

@ -1,17 +1,15 @@
#include "cg5100a.h"
/* toolbar */
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
PROMPT -12 -11 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
PROMPT -22 -11 ""
END
ENDPAGE
@ -58,11 +56,6 @@ BEGIN
PROMPT 2 5 "Parametri contabilita'"
END
GROUPBOX DLG_NULL 76 6
BEGIN
PROMPT 2 12 "Parametri saldaconto"
END
BOOLEAN CHK_GSLBCN
BEGIN
PROMPT 4 6 "Gestione libro cronologico "
@ -103,22 +96,20 @@ BEGIN
GROUP GROUP_CONTABILITA
END
GROUPBOX DLG_NULL 76 7
BEGIN
PROMPT 2 12 "Parametri saldaconto"
END
BOOLEAN CHK_GESSAL
BEGIN
PROMPT 4 13 "Gestione saldaconto "
HELP "Indicare se attivare la gestione del saldaconto clienti/fornitori"
MESSAGE TRUE ENABLE,CHK_GESVAL
MESSAGE TRUE ENABLE,CHK_NRCLIDX
MESSAGE TRUE ENABLE,CHK_NRFORDX
MESSAGE TRUE ENABLE,CHK_DTCFPG
MESSAGE TRUE ENABLE,CHK_RIFPRO
MESSAGE TRUE ENABLE,FLD_CODLIN
MESSAGE FALSE DISABLE,CHK_GESVAL
MESSAGE FALSE DISABLE,CHK_NRCLIDX
MESSAGE FALSE DISABLE,CHK_NRFORDX
MESSAGE FALSE DISABLE,CHK_DTCFPG
MESSAGE FALSE DISABLE,CHK_RIFPRO
MESSAGE FALSE DISABLE,FLD_CODLIN
MESSAGE TRUE ENABLE,CHK_GESVAL|ENABLE,CHK_NRCLIDX|ENABLE,CHK_NRFORDX
MESSAGE TRUE ENABLE,CHK_DTCFPG|ENABLE,CHK_RIFPRO|ENABLE,FLD_CODLIN
MESSAGE TRUE ENABLE,FLD_NUM_EC|ENABLE,FLD_LAST_EC
MESSAGE FALSE DISABLE,CHK_GESVAL|DISABLE,CHK_NRCLIDX|DISABLE,CHK_NRFORDX
MESSAGE FALSE DISABLE,CHK_DTCFPG|DISABLE,CHK_RIFPRO|DISABLE,FLD_CODLIN
MESSAGE FALSE DISABLE,FLD_NUM_EC|DISABLE,FLD_LAST_EC
FIELD GesSal
GROUP GROUP_SALDACONTO
END
@ -178,6 +169,22 @@ BEGIN
GROUP GROUP_SALDACONTO
END
LIST FLD_NUM_EC 1 10
BEGIN
PROMPT 4 17 "Numerazione estratti conto "
ITEM " |Nessuna" MESSAGE HIDE,FLD_LAST_EC
ITEM "G|Globale" MESSAGE SHOW,FLD_LAST_EC
ITEM "A|Anagrafica" MESSAGE HIDE,FLD_LAST_EC
FIELD NumEC
GROUP GROUP_SALDACONTO
END
NUMBER FLD_LAST_EC 6
BEGIN
PROMPT 50 17 "Ultimo E.C. "
FIELD LastEC
GROUP GROUP_SALDACONTO
END
ENDPAGE

View File

@ -576,13 +576,17 @@ bool Visliq_app::vis_one(int m)
{
begin_wait();
TMask msk("cg5500d");
bool recorded = TRUE;
TString nomem("Liquidazione IVA ");
nomem << itoname(m);
nomem << " " << _year;
msk.show(F_PERIODOM, _freqviva == "M");
msk.show(F_PERIODOT, _freqviva != "M");
msk.set(_freqviva == "M" ? F_PERIODOM : F_PERIODOT, m);
// ricalcolo liquidazione
TFilename f;
f.temp("prliq");

View File

@ -19,6 +19,8 @@
#define F_DELABI 119
#define F_DELCAB 120
#define F_DELCON 121
#define F_PERIODOM 122
#define F_PERIODOT 123
#define F_CODDITTA2 201
#define F_RAGSOC2 202

View File

@ -4,32 +4,31 @@
*/
#include "cg5500a.h"
PAGE "Visualizzazione Liquidazione" -1 -1 70 6
PAGE "Visualizzazione Liquidazione" -1 -1 72 8
NUMBER F_YEAR 4
BEGIN
PROMPT 1 1 "Anno liquidazione "
FLAGS "AR"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 1 "Codice ditta "
PROMPT 1 3 "Codice ditta "
FLAGS "B"
HELP "Codice della ditta da attivare"
END
STRING F_RAGSOC 50 30
BEGIN
PROMPT 25 1 "Rag. soc. "
PROMPT 28 3 "Rag.soc. "
FLAGS "B"
HELP "Ragione sociale della ditta da selezionare"
END
NUMBER F_YEAR 4
BEGIN
PROMPT 1 2 "Anno liquid. "
FLAGS "AR"
END
LIST F_MONTHS 30
BEGIN
PROMPT 25 2 "Mese liq. "
PROMPT 1 5 "Mese liquidazione "
ITEM " |Prospetto complessivo"
ITEM "1|Gennaio"
ITEM "2|Febbraio"
@ -48,7 +47,7 @@ END
LIST F_TRIMS 30
BEGIN
PROMPT 25 2 "Trim. liq."
PROMPT 1 5 "Trim. liq. "
ITEM " |Prospetto complessivo"
ITEM "3|1° Trimestre"
ITEM "6|2° Trimestre"

View File

@ -35,10 +35,39 @@ BEGIN
FLAGS "D"
END
BROWSEFILE F_VISFLQ 76 11
LISTBOX F_PERIODOM 30
BEGIN
PROMPT 1 3 ""
PROMPT 2 3 "Periodo liquidazione "
FLAGS "D"
ITEM "1|Gennaio"
ITEM "2|Febbraio"
ITEM "3|Marzo"
ITEM "4|Aprile"
ITEM "5|Maggio"
ITEM "6|Giugno"
ITEM "7|Luglio"
ITEM "8|Agosto"
ITEM "9|Settembre"
ITEM "10|Ottobre"
ITEM "11|Novembre"
ITEM "12|Dicembre"
ITEM "13|Annuale"
END
LISTBOX F_PERIODOT 30
BEGIN
PROMPT 2 3 "Periodo liquidazione "
FLAGS "D"
ITEM "3|1° Trimestre"
ITEM "6|2° Trimestre"
ITEM "9|3° Trimestre"
ITEM "12|4° Trimestre"
ITEM "13|Annuale"
END
BROWSEFILE F_VISFLQ 76 10
BEGIN
PROMPT 1 4 ""
END
/* gruppo 1: edit rimborso */

View File

@ -1,3 +1,3 @@
17
0
$cfven|0|0|399|0|Clienti/Fornitori per vendite|||
$cfven|0|0|404|0|Clienti/Fornitori per vendite|||

View File

@ -1,5 +1,5 @@
17
69
70
TIPOCF|1|1|0|Tipo <C>liente, <F>ornitore
CODCF|3|6|0|Codice
CODINDDOC|2|3|0|Codice indirizzo documenti
@ -53,6 +53,7 @@ CODSP4|1|8|0|Spese da addebitare 4
PROFSOLL|1|5|0|Profilo sollecito ???
MAXSOLL|2|2|0|Massimo sollecito ???
DATAESC|5|8|0|Data estratto conto
NUMESC|3|5|0|Numero ultimo estratto conto
DATASOLL|5|8|0|Data sollecito
SCONTO|1|25|0|Sconto (aa+bb-cc)
TITOLO|1|2|0|Titolo onorifico

View File

@ -42,13 +42,13 @@ struct _ParmStruct
expltype _explosion;
valtype _valorization;
TExplosion_grouping _group_by;
TString_array _numerazioni;
TString16 _anno_es, _from_num, _to_num, _sl_mag, _mb_mag; // Ma perche'...
TDate _from_date, _to_date, _obs_date;
long _from_doc, _to_doc;
int _year, _periods, _det_lev, _ordering;
bool _vis_art, _vis_lav, _vis_vir, _vis_gho,
_fabbisogno, _val_magmb, _val_depmb,
_cfr_scmin, _separate_dists;
bool _last_qta, _vis_art, _vis_lav, _vis_vir, _fabbisogno,
_val_magmb, _val_depmb, _cfr_scmin, _separate_dists, _det_ord_for;
};
struct _CallBackStruct
@ -67,53 +67,28 @@ static TDate __current_period;
// Particolarita' della classe: il metodo "vero" per calcolare
// la disponibilita' viene chiamato solo la prima volta, poi viene sempre
// tenuto in memoria per eventuali aggiornamenti sulle qta, in modo
// da non fare cazzilli pocciosi sul file delle giacenza
// da non fare calcoli pocciosi sul file delle giacenza
class TArticolo_giacenza_static : public TArticolo_giacenza
{
bool _calc;
real _disp; // Disponibilita': sempre espressa in UM base!!
// Prima di effettuare addizioni/sottrazioni ricordarsi di convertire
TArray _ordinato_fornitori; // Array di real per l'ordinato fornitori (espressi in UM BASE)
TString16 _umbase;
protected:
void calc_ordinato_fornitori(_ParmStruct *p, const char * codmag, const char * livello);
void calcola_ordinato_documento(TRectype& rec);
public:
const real ordinato_fornitori(const int p); // ritorna l'ordinato fornitori per il periodo indicato
const real get_scmin(const char * annoes, const char * codmag, const char * livello);
real& static_disp(const char * annoes, const char * codmag, const char * livello, bool solo_giac=FALSE);
real& static_disp(_ParmStruct* p, const char * codmag, const char * livello);
TArticolo_giacenza_static(const char* codice = NULL);
TArticolo_giacenza_static(const TRectype& rec);
virtual ~TArticolo_giacenza_static() {}
};
TArticolo_giacenza_static::TArticolo_giacenza_static(const char* codice)
: TArticolo_giacenza(codice), _calc(FALSE)
{
}
TArticolo_giacenza_static::TArticolo_giacenza_static(const TRectype& rec)
: TArticolo_giacenza(rec), _calc(FALSE)
{
}
const real TArticolo_giacenza_static::get_scmin(const char * annoes, const char * codmag, const char * livello)
{
real r;
const int i = find_mag(annoes, codmag, livello);
if (i > 0)
{
TRecord_array& ra = mag(annoes);
r = ra[i].get_real("SCORTAMIN");
}
return r;
}
real& TArticolo_giacenza_static::static_disp(const char * annoes, const char * codmag, const char * livello, bool solo_giac)
{
if (!_calc)
{
_calc =TRUE;
_disp = disponibilita(annoes, codmag, livello, solo_giac);
}
return _disp;
}
///////////////////////////////////////////////////////////
// TArticolo_cache
///////////////////////////////////////////////////////////
@ -134,7 +109,8 @@ TArticolo_cache::TArticolo_cache()
TObject* TArticolo_cache::rec2obj(const TRectype& curr) const
{
return new TArticolo_giacenza_static(curr);
TArticolo_giacenza_static * a = new TArticolo_giacenza_static(curr);
return a;
}
TArticolo_giacenza_static& TArticolo_cache::art(const char* key)
@ -154,17 +130,23 @@ class TRiga_esplosione2print : public TRiga_esplosione
real _qta2order;
real _value;
real _residuo;
real _ordfor;
real _totordfor;
public:
const real& fabbisogno() { return _fabbisogno; }
const real& disponibilita() { return _disponibilita; }
const real& qta2order() { return _qta2order; }
const real& value() { return _value; }
const real& residuo() { return _residuo; }
const real& ordfor() { return _ordfor; }
const real& totordfor() { return _totordfor; }
void set_fabbisogno(const real& r) { _fabbisogno = r; }
void set_disponibilita(const real& r) { _disponibilita = r; }
void set_qta2order(const real& r) { _qta2order = r; }
void set_value(const real& r) { _value = r; }
void set_residuo(const real& r) { _residuo = r; }
void set_ordfor(const real& r) { _ordfor = r; }
void set_totordfor(const real& r) { _totordfor = r; }
TRiga_esplosione2print() {};
TRiga_esplosione2print(const TDistinta_tree& tree);
TRiga_esplosione2print(const TRiga_esplosione& re);
@ -254,6 +236,43 @@ public:
TExplode_distinta_form* TExplode_distinta_form::_f = NULL;
///////////////////////////////////////////////////////////
// TEsplosione_distinta_app
///////////////////////////////////////////////////////////
class TEsplosione_distinta_app : public TSkeleton_application
{
TMask *_mask;
TDocumento *_doc;
TExplode_distinta_form
*_form;
TAssoc_array _dist_list;
TArray _date_array;
TCodgiac_livelli
*_liv_giac;
// Dati "i/n/m/putati" ma non ancora condannati...
_ParmStruct _parameters;
protected:
static bool sheet_notify(TSheet_field& s, int r, KEY key);
virtual bool create();
virtual bool destroy();
virtual void main_loop();
static bool check_articoli(TMask_field& f, KEY k);
void compile_list();
void compile_periods();
void compile_numeration_list();
virtual void print();
public:
const int date2period(const TDate&);
const TDate& date_period(const TDate&);
TEsplosione_distinta_app() {};
virtual ~TEsplosione_distinta_app() {};
};
inline TEsplosione_distinta_app& app() { return (TEsplosione_distinta_app&) main_app(); }
///////////////////////////////////////////////////////////////////
// Callback & funzione per valorizzazione nodi
///////////////////////////////////////////////////////////////////
@ -369,6 +388,191 @@ static bool valorizza_nodo(TTree& node, void* jolly, word when)
return FALSE;
}
/////////////////////////////////////////////////////////////
// Implementazione metodi di TArticolo_giacenza_static
/////////////////////////////////////////////////////////////
TArticolo_giacenza_static::TArticolo_giacenza_static(const char* codice)
: TArticolo_giacenza(codice), _calc(FALSE)
{
}
TArticolo_giacenza_static::TArticolo_giacenza_static(const TRectype& rec)
: TArticolo_giacenza(rec), _calc(FALSE)
{
}
const real TArticolo_giacenza_static::ordinato_fornitori(const int p)
{
// con p ==0 ritorna il totale ordinato fornitori
real r;
r = (real&) _ordinato_fornitori[p];
return r;
}
const real TArticolo_giacenza_static::get_scmin(const char * annoes, const char * codmag, const char * livello)
{
real r;
const int i = find_mag(annoes, codmag, livello);
if (i > 0)
{
TRecord_array& ra = mag(annoes);
r = ra[i].get_real("SCORTAMIN");
}
return r;
}
void TArticolo_giacenza_static::calcola_ordinato_documento(TRectype& rec)
{
CHECK(rec.num() == LF_DOC, "E' necessario passare un record di LF_DOC");
TRectype from(LF_RIGHEDOC), to(LF_RIGHEDOC);
TString filter;
filter = "CODART==\"";
filter << codice() << "\"";
from.zero();
from.put(RDOC_CODNUM, rec.get(DOC_CODNUM));
from.put(RDOC_ANNO, rec.get(DOC_ANNO));
from.put(RDOC_PROVV, rec.get(DOC_PROVV));
from.put(RDOC_NDOC, rec.get(DOC_NDOC)); // Se NDOC non è settato effettua il filtro su tutti i documenti di questa numerazione
to = from;
TRelation rdoc(LF_RIGHEDOC);
TCursor cur(&rdoc, filter, 1, &from, &to);
const TRecnotype items = cur.items();
TProgind *pi = NULL;
real val;
filter = "Calcolo ordinato fornitori in corso. ";
filter << rec.get(DOC_CODNUM);
filter << "/" << codice();
if (items > 10)
pi = new TProgind(items, filter, FALSE, TRUE);
for (cur = 0L; cur.pos() < items; ++cur)
{
// Calcola la qta residua
if (pi)
pi->addstatus(1L);
TRectype& rec = cur.curr();
if (!rec.get_bool(RDOC_RIGAEVASA))
{
val = rec.get_real(RDOC_QTA) - rec.get_real(RDOC_QTAEVASA);
// Converte il valore della quantità in UM base
val = convert_to_um(val, _umbase, rec.get(RDOC_UMQTA));
if (val < ZERO)
val = ZERO;
}
// Aggiorna il valore ordinato del periodo relativo
real& rr = (real&) _ordinato_fornitori[app().date2period(rec.get_date(RDOC_DATACONS))];
rr += val;
}
if (pi)
delete pi;
}
void TArticolo_giacenza_static::calc_ordinato_fornitori(_ParmStruct* p, const char * codmag, const char * livello)
{
// Calcolo del dettaglio ordinato fornitori, chiamata UNA sola volta per ogni articolo
// ad ogni stampa
// Toglie l'ordinato fornitori dalla disponibilita
TString16 annoes(p->_anno_es);
TRecord_array & rmag = mag(annoes);
for (int i = find_mag(annoes, codmag, livello); i > 0;
i = find_mag(annoes, codmag, livello, i))
_disp -= rmag.row(i).get_real(MAG_ORDF);
// Rimuove eventuali elementi rimasti, anche se questo metodo viene effettivamente chiamato una sola
// volta per articolo.
_ordinato_fornitori.destroy();
// Azzera l'array...
for (i=0; i <= p->_periods; i++)
_ordinato_fornitori.add(new real);
//Scorre tutte le numerazioni
TString_array& a = p->_numerazioni;
for (i = a.last(); i >= 0; i--)
{
TToken_string& t = (TToken_string&) a[i];
const int items = t.items();
if (items == 2) // Un solo tipo documento: scorre solo le righe di questa numerazione
{
TRectype doc(LF_DOC);
doc.put(DOC_CODNUM, t.get(0));
doc.put(DOC_ANNO, p->_year);
doc.put(DOC_PROVV, "D");
calcola_ordinato_documento(doc);
}
else // Se invece vi sono piu' tipi doc. per questa numerazione e' necessario considerare le testate doc.
if (items >= 3)
{
TRectype from(LF_DOC), to(LF_DOC);
TString filter;
from.zero();
from.put(DOC_CODNUM, t.get(0));
from.put(DOC_ANNO, p->_year);
from.put(DOC_PROVV, "D");
to = from;
for (int j=2; j<=items; j++)
{
filter << "(TIPODOC==\"";
filter << t.get(j-1);
filter << "\")||";
}
filter.rtrim(2);
TRelation doc(LF_DOC);
TCursor cur(&doc, filter, 1, &from, &to);
for (cur = 0L; cur.pos() < cur.items(); ++cur)
// Per ogni documento scorre le sue righe
calcola_ordinato_documento(cur.curr());
}
}
// Progressivizza gli importi
for (i=2; i <= p->_periods ; i++)
{
real& rr = (real&)_ordinato_fornitori[i];
rr += (real&)_ordinato_fornitori[i-1];
if (i==p->_periods)
{
real& zz = (real&)_ordinato_fornitori[0]; // Totale...
zz += rr;
}
}
}
real& TArticolo_giacenza_static::static_disp(_ParmStruct* p, const char * codmag, const char * livello)
{
if (!_calc)
{
_calc =TRUE;
_disp = disponibilita(p->_anno_es, codmag, livello);
_umbase = ((TRectype&)(um()[1])).get("UM");
// Calcola ordinato fornitori di questo articolo, suddividendo per periodi
// L'ordinato viene espresso nell'unità di misura principale, per poi essere riconvertita in
// quella esplicitata nella riga di esplosione
if (p->_det_ord_for)
calc_ordinato_fornitori(p, codmag, livello);
}
return _disp;
}
/////////////////////////////////////////////////////////////
// Implementazione metodi di TExplode_distinta_form
/////////////////////////////////////////////////////////////
@ -398,7 +602,9 @@ void TExplode_distinta_form::set_parameters(_ParmStruct* ps)
// Accende o spegne le colonne a seconda di stampa disponibilita/valorizzazione
for (short i = 7; i<=9; i++)
find_field('B',odd_page,i).enable(_p->_fabbisogno); // Colonne disponibilita...
find_field('B',odd_page,10).enable(_p->_valorization != no_val);
find_field('B',odd_page,10).enable(_p->_valorization != no_val); // Valorizzazione
find_field('B',odd_page,11).enable(_p->_det_ord_for); // Dettaglio ord. fornitori
find_field('B',odd_page,12).enable(_p->_det_ord_for); // Dettaglio ord. fornitori
}
void TExplode_distinta_form::print_header(TPrinter& pr)
@ -533,6 +739,16 @@ bool TExplode_distinta_form::validate(TForm_item &f, TToken_string &t)
{
valore = re.value().string();
}
else
if (code == "_ORDFOR")
{
valore = re.ordfor().string();
}
else
if (code == "_TOTORDFOR")
{
valore = re.totordfor().string();
}
f.set(valore);
return TRUE;
}
@ -540,7 +756,6 @@ bool TExplode_distinta_form::validate(TForm_item &f, TToken_string &t)
real TExplode_distinta_form::res2produce_by_father(TRiga_esplosione& re)
{
real r;
TString k;
if (!_p->_fabbisogno) // Se non e' abilitata il calcolo del fabbisogno/disponibilita
r = _d->qta(); // ritorna la qta della distinta come residuo da produrre
@ -616,7 +831,7 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
// del presente articolo....
const real zero_ref = _p->_cfr_scmin ? aaa.get_scmin(_p->_anno_es, codmag, liv) : ZERO;
real& disp = aaa.static_disp(_p->_anno_es, codmag, liv);
real& disp = aaa.static_disp(_p, codmag, liv);
// Converte in UM della riga corrente
r = aaa.convert_to_um(disp, re.um());
@ -650,7 +865,20 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
r = disp - zero_ref;
r2p->set_residuo(aaa.convert_to_um(r, re.um())); // In UM locale...
}
if (_p->_det_ord_for)
{
real of;
of = aaa.ordinato_fornitori(app().date2period(_d->data_per()));
of = aaa.convert_to_um(of, re.um());
r2p->set_ordfor(of); // Ordinato fornitori per questo periodo espresso in UM esplicitata dalla riga esplosione
of = aaa.ordinato_fornitori(0);
of = aaa.convert_to_um(of, re.um());
r2p->set_totordfor(of); // Ordinato fornitori totale espresso in UM esplicitata dalla riga esplosione
}
if (disp < zero_ref) // Se la disponibilita' va sotto il riferimento... azzera
disp = zero_ref;
}
@ -723,11 +951,11 @@ void TExplode_distinta_form::print()
// Effettua la valorizzazione scorrendo i nodi...
if (_p->_valorization > no_val)
{
_CallBackStruct setter; // many, many dog races exists...
// I know this is kinda dog-programming
setter._p = _p; // but it seems quite reasonable setting a couple
setter._a = &_valori; // of pointers and passing'em in a struct
_distinta.set_root(_d->cod(), _d->um());
_CallBackStruct setter; //
// Dog programming on...
setter._p = _p; //
setter._a = &_valori; //
_distinta.set_root(_d->cod());
_distinta.scan_depth_first(valorizza_nodo, &setter);
}
@ -782,46 +1010,9 @@ void TExplode_distinta_form::print()
return ;
}
///////////////////////////////////////////////////////////
// TEsplosione_distinta_app
///////////////////////////////////////////////////////////
class TEsplosione_distinta_app : public TSkeleton_application
{
TMask *_mask;
TDocumento *_doc;
TExplode_distinta_form
*_form;
TAssoc_array _dist_list;
TArray _date_array;
TArray _file;
TCodgiac_livelli
*_liv_giac;
// Dati "i/n/m/putati" ma non ancora condannati...
_ParmStruct _parameters;
protected:
static bool sheet_notify(TSheet_field& s, int r, KEY key);
void open_files(int logicnum, ...);
virtual bool create();
virtual bool destroy();
virtual void main_loop();
static bool check_articoli(TMask_field& f, KEY k);
void compile_list();
void compile_periods();
virtual void print();
public:
const int date2period(const TDate&);
const TDate& date_period(const TDate&);
TEsplosione_distinta_app() {};
virtual ~TEsplosione_distinta_app() {};
};
inline TEsplosione_distinta_app& app() { return (TEsplosione_distinta_app&) main_app(); }
///////////////////////////////////////////////////////////
// _Dist2Explode
// Generic Minkiatell used...
// .
///////////////////////////////////////////////////////////
//
// Implementation of base object used in skantacazz 2 be stored in a TAssoc_array so we can order it
@ -835,6 +1026,11 @@ TRiga_esplosione * _Dist2Explode::head_obj()
tree.set_root(qta);
TRiga_esplosione * re = new TRiga_esplosione(tree);
re->set(_cod, _um, real(1.00));
re->set_tipo('A'); // La testata e' cmq un articolo...
re->set_path(_cod);
return re;
}
@ -846,6 +1042,8 @@ void _Dist2Explode::set(const TRiga_documento& r)
_mag = r.get(RDOC_CODMAG);
_qta = r.get_real("QTARES"); // Virtual field... must exist!!
_datacons = r.get_date(RDOC_DATACONS);
if (!_datacons.ok())
_datacons = r.doc().get_date(DOC_DATACONS);
_acq_ven = r.doc().get(DOC_TIPOCF) == "F" ? TRUE : FALSE;
_data_per = app().date_period(_datacons);
}
@ -891,18 +1089,6 @@ bool TEsplosione_distinta_app::sheet_notify(TSheet_field& s, int r, KEY key)
return TRUE;
}
void TEsplosione_distinta_app::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);
}
}
const int TEsplosione_distinta_app::date2period(const TDate& d)
{
const int items = _date_array.items();
@ -996,6 +1182,10 @@ bool TEsplosione_distinta_app::create()
sa.enable_column(F_DEP-F_CODDIS,depositi);
_mask->show(-5, depositi);
_doc = new TDocumento;
//Compila la lista di codici numerazione validi per la ricerca dell'ordinato fornitori
compile_numeration_list();
return TSkeleton_application::create();
}
@ -1053,9 +1243,9 @@ void TEsplosione_distinta_app::compile_list()
DOC_CODNUM, (const char*) _parameters._to_num);
// Filtra i documenti
TLocalisamfile& dist = (TLocalisamfile&)_file[LF_DIST];
TRelation *r = new TRelation(LF_DOC);
TCursor c(r, filter_expr, _parameters._selections == by_num ? 1 : 3);
TLocalisamfile dist(LF_DIST);
TRelation r(LF_DOC);
TCursor c(&r, filter_expr, _parameters._selections == by_num ? 1 : 3);
c.setregion(from,to);
const bool null_sel = _parameters._from_num.empty() || _parameters._to_num.empty();
const long items = null_sel ? 0L : c.items();
@ -1082,7 +1272,7 @@ void TEsplosione_distinta_app::compile_list()
if (is_key)
{
_Dist2Explode * dd = (_Dist2Explode*)_dist_list.objptr(key);
// Check 2 see whether we've 2 convert in base UM...
// Check whether we've 2 convert in base UM...
if (de->acqven()) // Se acquisto sottrae...
de->qta() = dd->qta() - de->qta();
else
@ -1118,7 +1308,51 @@ void TEsplosione_distinta_app::compile_list()
_dist_list.add(key, de, TRUE);
}
}
delete r;
}
void TEsplosione_distinta_app::compile_numeration_list()
{
// Reperisce prima la lista dei tipi documento che siano Ordini fornitore
TProgind p(0,"Creazione lista numerazioni in corso...", FALSE, FALSE);
TString_array a;
TTable tip("%TIP");
for (tip.first(); tip.good(); tip.next())
{
TTipo_documento tp(tip.curr());
if (tp.is_ordine() && tp.tipocf() == 'F') // Ordine a fornitore
a.add(tp.codice());
}
// Poi si interseca questa lista con quella delle numerazioni
TTable num("%NUM");
TToken_string t;
TString s;
int r=0;
for (num.first(); num.good(); num.next())
{
_parameters._numerazioni.add(num.get("CODTAB"));
TToken_string& riga = (TToken_string&)_parameters._numerazioni[r++];
s = num.get("S2"); // Lista dei tipi documento validi
t = "";
for (int x = 0; x <= s.len(); x += 4)
t.add(s.mid(x,4));
// Scorre i tipi documento ordine fornitore esistenti
for (int i = a.last(); i >= 0; i--)
{
// Se il tipo documento esiste in questa numerazione...
TToken_string& ai = (TToken_string &) a[i];
if (t.find(ai.get(0)) >= 0)
// Aggiunge questo tipo documento alla lista per la numerazione corrente
riga.add(ai.get(0));
}
}
}
void TEsplosione_distinta_app::print()
@ -1215,6 +1449,7 @@ void TEsplosione_distinta_app::main_loop()
_parameters._val_depmb = _mask->get_bool(F_VALDEPMB);
_parameters._cfr_scmin = _mask->get_bool(F_SCMIN);
_parameters._separate_dists = _mask->get_bool(F_SEPARATE);
_parameters._det_ord_for = _mask->get_bool(F_DETORDFOR);
// Credo che il seguente anno esercizio sia calcolato
// in modo abbastanza schifoso, visto che si e' in possesso del solo anno solare

View File

@ -155,6 +155,28 @@ BEGIN
PICTURE "."
END
NUMBER 11 14 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cOrd.Fornitori attuale" "Ord.Fornitori"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Ordinato fornitori alla data"
PROMPT 11 1 ""
MESSAGE _DISTINTA,_ORDFOR
PICTURE "########,@@@@@"
END
NUMBER 12 14 5
BEGIN
SPECIAL STRINGA INTESTAZIONE "@cOrd. Forn. Totale" "Tot. Ord.Fornitori"
SPECIAL NUMERO OFFSET "0" "Offset iniziale campo"
SPECIAL STRINGA FINCATURA "XX" "Fincatura sinistra e destra"
KEY "Totale ordinato fornitori"
PROMPT 12 1 ""
MESSAGE _DISTINTA,_TOTORDFOR
PICTURE "########,@@@@@"
END
END // End of Body
END // End of form

View File

@ -31,6 +31,7 @@
#define F_SCMIN 129
#define F_SEPARATE 130
#define F_SHEETART 131
#define F_DETORDFOR 132
#define F_CODDIS 101
#define F_LIV1 102

View File

@ -185,14 +185,19 @@ BEGIN
// GROUP 4
END
BOOLEAN F_DETORDFOR
BEGIN
PROMPT 37 12 "Dettaglia ordinato fornitori"
END
GROUPBOX DLG_NULL 40 6
BEGIN
PROMPT 37 12 "Disponibilita' & Valorizzazione"
PROMPT 37 13 "Disponibilita' & Valorizzazione"
END
STRING F_SLMAG 3
BEGIN
PROMPT 38 13 "Mag. semilavorati "
PROMPT 38 14 "Mag. semilavorati "
FLAGS "U"
USE MAG SELECT CODTAB[4,5]==""
INPUT CODTAB F_SLMAG
@ -205,7 +210,7 @@ END
STRING F_SLDEP 2
BEGIN
PROMPT 69 13 ""
PROMPT 69 14 ""
FLAGS "U"
USE MAG SELECT (IF(#F_SLMAG!="";((CODTAB[1,3]==#F_SLMAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!="")))
INPUT CODTAB[1,3] F_SLMAG
@ -221,7 +226,7 @@ END
STRING F_MBMAG 3
BEGIN
PROMPT 38 14 "Mag. materiali base "
PROMPT 38 15 "Mag. materiali base "
FLAGS "U"
USE MAG SELECT CODTAB[4,5]==""
INPUT CODTAB F_MBMAG
@ -236,7 +241,7 @@ END
STRING F_MBDEP 2
BEGIN
PROMPT 69 14 ""
PROMPT 69 15 ""
FLAGS "U"
USE MAG SELECT (IF(#F_MBMAG!="";((CODTAB[1,3]==#F_MBMAG)&&(CODTAB[4,5]!=""));(CODTAB[4,5]!="")))
INPUT CODTAB[1,3] F_MBMAG
@ -254,13 +259,13 @@ END
BOOLEAN F_VALMAGMB
BEGIN
PROMPT 38 15 "Usa magazzino in valorizzazione"
PROMPT 38 16 "Usa magazzino in valorizzazione"
GROUP 6
END
BOOLEAN F_VALDEPMB
BEGIN
PROMPT 38 16 "Usa deposito in valorizzazione"
PROMPT 38 17 "Usa deposito in valorizzazione"
GROUP 6
END
@ -292,7 +297,7 @@ END
NUMBER F_SORT 1
BEGIN
PROMPT 2 18 "Ordina "
PROMPT 2 19 "Ordina "
USE ORD
INPUT CODTAB F_SORT
DISPLAY "Codice ordinamento" CODTAB
@ -306,13 +311,13 @@ END
STRING F_SORTDESC 50
BEGIN
PROMPT 17 18 ""
PROMPT 17 19 ""
FLAGS "D"
END
LIST F_GROUPMODE 1 53
BEGIN
PROMPT 2 19 "Raggruppa "
PROMPT 2 20 "Raggruppa "
ITEM "0|Nessun raggruppamento"
ITEM "1|Raggruppa per unita' di misura"
ITEM "2|Converti nell'unita' principale"

View File

@ -1,16 +1,15 @@
#include <applicat.h>
#include <mask.h>
#include <maskfld.h>
#include <sheet.h>
#include <msksheet.h>
#include <urldefid.h>
#include <lffiles.h>
#include <clifo.h>
#include "effetti.h"
#include "ef0.h"
#include "ef0200.h"
class Creazione_Effetti_da_EC : public TApplication
#include <clifo.h>
#include <effetti.h>
class Creazione_Effetti_da_EC : public TSkeleton_application
{
TMask * _msk;
TArray_sheet * _Partite_aperte;
@ -22,7 +21,7 @@ class Creazione_Effetti_da_EC : public TApplication
static bool Cli_Handler(TMask_field& f, KEY k);
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual void main_loop();
public:
real get_res() {return _residuo;}
void set_res(const real& a) {_residuo = a;}
@ -200,8 +199,8 @@ bool Creazione_Effetti_da_EC::create()
mask.set_handler(F_SPESE,Gen_Handler);
mask.set_handler(F_BOLLI,Gen_Handler);
_msk->set_handler(F_CODCF,Cli_Handler);
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
return TSkeleton_application::create();
}
bool Creazione_Effetti_da_EC::destroy()
@ -210,7 +209,7 @@ bool Creazione_Effetti_da_EC::destroy()
return TRUE;
}
bool Creazione_Effetti_da_EC::menu(MENU_TAG)
void Creazione_Effetti_da_EC::main_loop()
{
KEY tasto;
@ -244,7 +243,6 @@ bool Creazione_Effetti_da_EC::menu(MENU_TAG)
break;
}
} while (tasto!=K_QUIT);
return FALSE;
}
int ef0200(int argc, char* argv[])

View File

@ -1,4 +1,5 @@
#include <currency.h>
#include <recarray.h>
#include <relapp.h>
#include <msksheet.h>
#include <sheet.h>
@ -20,8 +21,7 @@ class TVariazione_distinte: public TRelation_application
TMask *_msk, *_m2;
TDistinta *_distinta;
TRelation *_rel;
TLocalisamfile *_reff, *_cession, *_clifo;
TTable *_ban;
protected:
virtual void init_query_mode(TMask&);
virtual void init_insert_mode(TMask&);
@ -199,15 +199,17 @@ int TVariazione_distinte::read(TMask& m)
TSheet_field& shrighe = righe_sheet();
shrighe.reset();
// prendo il numero di effetti nella distinta
int items = _distinta->items();
TArray& righedist = _distinta->righe();
const int items = _distinta->items();
// carico tutti gli effetti della distinta nello sheet
if (items > 0)
{
TString16 codice; // Codice per cache
TArray& righedist = _distinta->righe();
TEffetto& e = (TEffetto&)righedist[0];
m.set(F_DATA, e.get("DATADIST"));// distinta
m.set(F_CODABIP, e.get("CODABIP")); // dalla maschera
m.set(F_CODCABP, e.get("CODCABP"));
m.set(F_DATA, e.get(EFF_DATADIST));// distinta
m.set(F_CODABIP, e.get(EFF_CODABIP)); // dalla maschera
m.set(F_CODCABP, e.get(EFF_CODCABP));
for (int i = 0; i < items; i++)
{
TEffetto& eff = (TEffetto&)righedist[i];
@ -217,15 +219,14 @@ int TVariazione_distinte::read(TMask& m)
riga.add(numero);
riga.add(eff.get(EFF_DATASCAD));
//prendo la ragione sociale del cliente conoscendone il codice
const long codcf = eff.get_long(EFF_CODCF);
const char tipo = eff.get_tipo();
_clifo->zero();
_clifo->put(CLI_TIPOCF , tipo);
_clifo->put(CLI_CODCF, codcf);
if (_clifo->read() == NOERR)
riga.add(_clifo->get(CLI_RAGSOC));
else
riga.add("");
codice.cut(0);
codice << eff.get_tipo(); codice << '|' << eff.get(EFF_CODCF);
riga.add(cache().get(LF_CLIFO, codice, CLI_RAGSOC));
codice = eff.get(EFF_CODABIP); codice << eff.get(EFF_CODCABP);
riga.add(cache().get("%BAN", codice, "S0"));
if (eff.fatt(numero))// se l'effetto contiene solo una fattura
{ // metto i riferimenti al documento ed al numero di rata
const TRectype& rec_r = eff.row_r(1);
@ -296,32 +297,32 @@ int TVariazione_distinte::rewrite(const TMask& m)
for (int i = items - 1; i >= 0; i--)
{
TToken_string& row = sf.row(i);
if (*row.get(0) == 'X') // to delete
{
const long num = row.get_long(1);
//ciclo sugli elementi dell'array
for (int j = 0; j < distinta->items(); j++)
TToken_string& row = sf.row(i);
if (*row.get(0) == 'X') // to delete
{
const long num = row.get_long(1);
//ciclo sugli elementi dell'array
for (int j = 0; j < distinta->items(); j++)
{
TEffetto& eff = (TEffetto&)righedist[j];
if (num == eff.get_long(EFF_NPROGTR))
{
TEffetto& eff = (TEffetto&)righedist[j];
if (num == eff.get_long(EFF_NPROGTR))
{
// tolgo l'effetto dall'array
righedist.destroy(j,TRUE);
break;
}
}
// tolgo l'effetto dallo sheet
sf.destroy(i);
eff.read(file, tipodist, ndist, i + 1);
eff.zero(EFF_TIPODIST);
eff.zero(EFF_NDIST);
eff.zero(EFF_DATADIST);
eff.zero(EFF_NRIGADIST);
eff.zero(EFF_CODABIP);
eff.zero(EFF_CODCABP);
eff.rewrite(file);
}
// tolgo l'effetto dall'array
righedist.destroy(j,TRUE);
break;
}
}
// tolgo l'effetto dallo sheet
sf.destroy(i);
eff.read(file, tipodist, ndist, i + 1);
eff.zero(EFF_TIPODIST);
eff.zero(EFF_NDIST);
eff.zero(EFF_DATADIST);
eff.zero(EFF_NRIGADIST);
eff.zero(EFF_CODABIP);
eff.zero(EFF_CODCABP);
eff.rewrite(file);
}
}
}
//resetto l'array che contiene gli effetti nella distinta
@ -376,13 +377,11 @@ bool TVariazione_distinte::remove()
// creo la relap
bool TVariazione_distinte::user_create()
{
open_files(LF_TAB, LF_TABCOM, LF_EFFETTI, LF_REFFETTI, LF_CESS, NULL);
_msk = new TMask("ef0300a");
_m2 = new TMask("ef0300c");
_rel = new TRelation(LF_EFFETTI);
_reff = new TLocalisamfile(LF_REFFETTI);
_cession = new TLocalisamfile(LF_CESS);
_clifo = new TLocalisamfile(LF_CLIFO);
_ban = new TTable("%BAN");
_distinta = new TDistinta;
set_search_field(F_NUMBER);//setto il campo di ricerca della distinta
_msk->set_handler(F_TIPODIST, tipodist_handler);
@ -404,10 +403,6 @@ bool TVariazione_distinte::user_destroy()
delete _msk;
delete _m2;
delete _rel;
delete _reff;
delete _cession;
delete _clifo;
delete _ban;
delete _distinta;
return TRUE;
}
@ -444,8 +439,6 @@ void TVariazione_distinte::carica_riba(int tipopag, const bool reset)
TEffetto eff;
TLocalisamfile f(LF_EFFETTI);
// per prendere la ragione sociale del cliente di cui ho il codice
TLocalisamfile * clifo = app()._clifo;
TTable * ban = app()._ban;
TToken_string riga(80);
TMask* m2 = app()._m2;
if (reset)
@ -471,9 +464,9 @@ void TVariazione_distinte::carica_riba(int tipopag, const bool reset)
const bool to_select = (tipopag == 0) || (tipopag == tipop) ||
((tipopag == 2 || tipopag ==5 || tipopag == 7) &&
(tipop == 2 || tipop ==5 || tipop == 7));
char tipo = eff.get_tipo();
const char tipo = eff.get_tipo();
TString16 valuta = eff.get(EFF_CODVAL);
if (valuta.empty())
valuta = "LIT";
@ -486,21 +479,14 @@ void TVariazione_distinte::carica_riba(int tipopag, const bool reset)
riga.add(numero);
riga.add(eff.get(EFF_DATASCAD));
long codcf = eff.get_long(EFF_CODCF);
clifo->zero();
clifo->put(CLI_TIPOCF, tipo);
clifo->put(CLI_CODCF, codcf);
if (clifo->read() == NOERR)
riga.add(clifo->get(CLI_RAGSOC));
else
riga.add("");
codtab = eff.get(EFF_CODABI);
codtab << eff.get(EFF_CODCAB);
ban->put("CODTAB", codtab);
if (ban->read() == NOERR)
riga.add(ban->get("S0"));
else
riga.add("");
TString16 codice;
codice << tipo << '|' << eff.get(EFF_CODCF);
riga.add(cache().get(LF_CLIFO, codice, CLI_RAGSOC));
codice = eff.get(EFF_CODABIP); codice << eff.get(EFF_CODCABP);
riga.add(cache().get("%BAN", codice, "S0"));
if (eff.fatt(numero))// se l'effetto contiene solo una fattura
{ // metto i riferimenti al documento ed al numero di rata
const TRectype& rec_r = eff.row_r(1);

View File

@ -159,7 +159,8 @@ BEGIN
ITEM "Da elim."
ITEM "Nr. Ri.Ba."
ITEM "Scadenza"
ITEM "Cliente@50"
ITEM "Cliente/Fornitore@30"
ITEM "Banca d'appoggio@30"
ITEM "Nr. Fattura"
ITEM "Data Fattura"
ITEM "Nr. Rata"

View File

@ -1,7 +1,7 @@
// DEFINIZIONE MASCHERE, PER RIGHE DISTINTA, PER LA GESTIONE DISTINTE
#include "ef0300.h"
PAGE "Righe Distinta" -1 -1 63 13
PAGE "Righe Distinta" -1 -1 63 14
BOOLEAN F_CHECK
BEGIN
@ -28,44 +28,50 @@ BEGIN
FLAGS "D"
END
STRING F_BANCA 50 40
BEGIN
PROMPT 2 5 "Banca d'appoggio "
FLAGS "D"
END
STRING F_NFATT 7
BEGIN
PROMPT 2 5 "Numero Fatt. "
PROMPT 2 6 "Numero Fattura "
FIELD LF_REFFETTI->NFATT
FLAGS "D"
END
DATA F_DATAFATT
BEGIN
PROMPT 2 6 "Data Fattura "
PROMPT 2 7 "Data Fattura "
FIELD LF_REFFETTI->DATAFATT
FLAGS "D"
END
NUMBER F_NRATA 3
BEGIN
PROMPT 2 7 "Numero Rata "
PROMPT 2 8 "Numero Rata "
FIELD LF_REFFETTI->NRATA
FLAGS "D"
END
STRING F_VALUTA 3
BEGIN
PROMPT 2 8 "Valuta "
PROMPT 2 9 "Valuta "
FIELD LF_EFFETTI->CODVAL
FLAGS "D"
END
STRING F_IMPORTO 18
BEGIN
PROMPT 2 9 "Importo "
PROMPT 2 10 "Importo "
FIELD LF_EFFETTI->IMPORTO
FLAGS "DR"
END
STRING F_IMPORTOVAL 18
BEGIN
PROMPT 2 10 "Importo Val. "
PROMPT 2 11 "Importo Val. "
FIELD LF_EFFETTI->IMPORTOVAL
FLAGS "DR"
END
@ -89,4 +95,5 @@ BEGIN
END
ENDPAGE
ENDMASK

View File

@ -1,7 +1,7 @@
// DEFINIZIONE MASCHERE, PER RIGHE DISTINTA, PER LA GESTIONE DISTINTE
#include "ef0300.h"
PAGE "Righe Distinta" -1 -1 63 13
PAGE "Righe Distinta" -1 -1 63 14
BOOLEAN F_CHECK
BEGIN

View File

@ -7,13 +7,13 @@
// costruttore distinta utilizzando il record passato
TDistinta::TDistinta(const TRectype& rec, word lockop)
{
read(rec,lockop);
read(rec,lockop);
}
// costruisce la distinta del tipo e numero passati
TDistinta::TDistinta(const char tipo, const long numero, word lockop)
{
read(tipo,numero,lockop);
read(tipo,numero,lockop);
}
TDistinta::~TDistinta()

View File

@ -16,6 +16,7 @@ class TDistinta:public TObject
protected:
TEffetto& eff(int n) { return (TEffetto&)_righe_dist[n]; }
const TEffetto& eff(int n) const { return (const TEffetto&)_righe_dist[n]; }
public:
//ritorna un riferimento all'array degli effetti nella distinta
@ -35,23 +36,25 @@ public:
//rimuove la distinta del tipo e numero passati
int remove(char tipodist, long ndist);
//restituisce il tipo di distinta
const char tipodist() const { return ((TRectype&)_righe_dist[0]).get_char(EFF_TIPODIST); }
const char tipodist() const { return eff(0).get_char(EFF_TIPODIST); }
//restituisce il tipo degli effetti della distinta (<C>lienti/<F>ornitori)
const char tipocf() const { return ((TRectype&)_righe_dist[0]).get_char(EFF_TIPOCF); }
const char tipocf() const { return eff(0).get_char(EFF_TIPOCF); }
//restituisce il tipo di pagamento della distinta [1,9]
const int tipopag() const { return eff(0).get_int(EFF_TIPOPAG); }
//restituisce il numero di distinta
const long ndist() const { return ((TRectype&)_righe_dist[0]).get_long(EFF_NDIST); }
const long ndist() const { return eff(0).get_long(EFF_NDIST); }
//restituisce il codice valuta della distinta
const TString& codval() const { return ((TRectype&)_righe_dist[0]).get(EFF_CODVAL); }
const TString& codval() const { return eff(0).get(EFF_CODVAL); }
//restituisce la data distinta della distinta
TDate data_dist() const { return ((TRectype&)_righe_dist[0]).get_date(EFF_DATADIST); }
TDate data_dist() const { return eff(0).get_date(EFF_DATADIST); }
//restituisce la data cambio della distinta
TDate data_cam() const { return ((TRectype&)_righe_dist[0]).get_date(EFF_DATACAMBIO); }
TDate data_cam() const { return eff(0).get_date(EFF_DATACAMBIO); }
//restituisce il cambio delle distinta
real cambio() const { return ((TRectype&)_righe_dist[0]).get_real(EFF_CAMBIO); }
real cambio() const { return eff(0).get_real(EFF_CAMBIO); }
//restituisce il codice abi di presentazione effetti
const TString& abip()const { return ((TRectype&)_righe_dist[0]).get(EFF_CODABIP); }
const TString& abip()const { return eff(0).get(EFF_CODABIP); }
//restituisce il codice cab di presentazione effetti
const TString& cabp()const { return ((TRectype&)_righe_dist[0]).get(EFF_CODCABP); }
const TString& cabp()const { return eff(0).get(EFF_CODCABP); }
// restituisce l'effetto n-esimo
TEffetto& operator[](const int index) { return eff(index); }
//costruttore di default

View File

@ -773,6 +773,7 @@ bool TPrint_effetti_app::set_print(int)
_pr_type = (pt) mask.get_int(RDB_TIPOST);
TDate data_stampa (mask.get(F_DATA_STAMPA));
_data_stampa = data_stampa.string();
// inizializzo i record di scelta del cursore
TRectype from(current_cursor()->curr());
from.zero();
@ -805,30 +806,27 @@ bool TPrint_effetti_app::set_print(int)
filter << "(CODABIP>=" << cod_from << ")&&(CODABIP<=" << cod_to << ")";
select_cursor(_cur_2);
break;
case st_distinta:
cod_from = mask.get(F_DA_DATA3);
cod_to = mask.get(F_A_DATA3);
from.put(EFF_DATASCAD,cod_from);
to.put(EFF_DATASCAD,cod_to);
cod_from = mask.get(F_DADIST);
cod_to = mask.get(F_ADIST);
const TString & tipo_dist = &mask.get(F_DATIPODIST);
filter.cut(0);
if (tipo_dist.empty())
filter << "(NDIST==\"\")";
else
{
if (cod_from.empty() && )
cod_from = "1";
filter << "(NDIST>=" << cod_from << ")";
if (cod_to.not_empty())
filter << "&&(NDIST<=" << cod_to << ")";
filter << "&&(TIPODIST==\"" << tipo_dist << "\")"; // di distinta
}
select_cursor(_cur_3);
break;
case st_distinta:
cod_from = mask.get(F_DA_DATA3);
cod_to = mask.get(F_A_DATA3);
from.put(EFF_DATASCAD,cod_from);
to.put(EFF_DATASCAD,cod_to);
cod_from = mask.get(F_DADIST);
cod_to = mask.get(F_ADIST);
filter.cut(0);
if (mask.get(F_DATIPODIST).empty())
filter << "(NDIST==\"\")";
else
{
if (cod_from.empty())
cod_from = "1";
filter << "(NDIST>=" << cod_from << ")";
if (cod_to.not_empty())
filter << "&&(NDIST<=" << cod_to << ")";
filter << "&&(TIPODIST==\"" << mask.get(F_DATIPODIST) << "\")";
}
select_cursor(_cur_3);
break;
case st_cliente:
{
cod_from = mask.get(F_DA_DATA4);
@ -844,14 +842,13 @@ bool TPrint_effetti_app::set_print(int)
from.put(EFF_CODCF,cod_from);
to.put(EFF_CODCF,cod_to);
filter = "";
const TString & tipocf = mask.get(F_TIPOCF);
filter << "(TIPOCF == \"" << tipocf << "\")&&";
filter << "(TIPOCF == \"" << mask.get(F_TIPOCF) << "\")&&";
filter << "(CODCF>=" << cod_from << ")&&(CODCF<=" << cod_to << ")" ;
select_cursor(_cur_4);
}
break;
default:
break;
break;
}
current_cursor()->setfilter(filter,TRUE);
current_cursor()->setregion(from, to);

View File

@ -117,16 +117,16 @@ BEGIN
PROMPT 4 9 " "
KEY 4
GROUP 3
ITEM " |Senza distinta" MESSAGE CLEAR,F_DADIST|MESSAGE CLEAR,F_ADIST
ITEM "I|All'incasso" MESSAGE ENABLE,F_DADIST|MESSAGE ENABLE,F_ADIST
ITEM "B|Salvo buon fine" MESSAGE ENABLE,F_DADIST|MESSAGE ENABLE,F_ADIST
ITEM "S|Allo sconto" MESSAGE ENABLE,F_DADIST|MESSAGE ENABLE,F_ADIST
ITEM " |Senza distinta" MESSAGE CLEAR,F_DADIST|CLEAR,F_ADIST
ITEM "I|All'incasso" MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST
ITEM "B|Salvo buon fine" MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST
ITEM "S|Allo sconto" MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST
END
NUMBER F_DADIST 5
BEGIN
PROMPT 4 10 " "
FLAGS "R"
FLAGS "D"
GROUP 3
KEY 4
USE LF_EFFETTI KEY 4 SELECT NRIGADIST=1
@ -148,7 +148,7 @@ END
NUMBER F_ADIST 5
BEGIN
PROMPT 31 10 " "
FLAGS "R"
FLAGS "D"
KEY 4
GROUP 3
USE LF_EFFETTI KEY 4 SELECT NRIGADIST=1

View File

@ -29,13 +29,12 @@
*/
#include <applicat.h>
#include <mask.h>
#include <modaut.h>
#include <progind.h>
#include <relation.h>
#include <tabutil.h>
#include <mask.h>
#include <sheet.h>
#include <urldefid.h>
#include <progind.h>
#include <modaut.h>
#include "../cg/cg2101.h"
#include "../cg/cg2103.h"
@ -60,7 +59,7 @@
// TContabilizzazione_effetti_app
// Applicazione di contabilizzazione effetti
class TContabilizzazione_effetti_app : public TApplication
class TContabilizzazione_effetti_app : public TSkeleton_application
{
TDate _data_op; // Data operazione
TString16 _cod_caus; // Codice causale
@ -70,6 +69,7 @@ class TContabilizzazione_effetti_app : public TApplication
bool _can_write; // se TRUE e' abilitata la scrittura. Non appena rileva un errore rimane a FALSE for this instance
real _total_mov, // Totale del movimento corrente
_total_mov_val;// Same as above but in valuta
TString _desc_inc, _desc_pag; // Descrizioni movimento generato
TMask *_msk; // maschera di selezione dati
TLocalisamfile *_attiv, // file delle attivita' (per far funzionare TRegistro)
*_fcaus, // file delle causale (per far funzionare TCausale)
@ -82,7 +82,7 @@ class TContabilizzazione_effetti_app : public TApplication
*_pags, // file dei pagamenti (per far funzionare TPartita)
*_clifo, // file dei clienti
*_doc, // file dei documenti
*_pcon; // file piano dei conti
*_pcon; // file piano dei conti
TTable *_cpg, // tabella condizioni di pagamento
*_bnp; // tabella banca presentazione effetti
TBill _banca, // conto di contropartita della banca
@ -111,7 +111,7 @@ protected: // TApplication
// ritorna la sezione corretta per la riga di partita
char sezione() const;
// aggiunge una riga all'array dei clienti
bool add_cg_row(const TRectype& eff, TArray& customers, TAssoc_array& _banks);
bool add_cg_row(const TEffetto& eff, TArray& customers, TAssoc_array& _banks);
// unisce gli array clienti/banche nel record array delle righe contabili
void join_rows(TArray& customers, TAssoc_array& banks,
const TImporto& abbuoni_att, const TImporto& abbuoni_pas,
@ -129,7 +129,7 @@ protected: // TApplication
// Handler del pulsante di reset
static bool handle_reset(TMask_field& f, KEY k);
// Le 4 seguenti non hanno bisogno di commenti
virtual bool menu(MENU_TAG mt);
virtual void main_loop();
virtual bool create();
virtual bool destroy();
virtual void on_config_change();
@ -231,10 +231,11 @@ void TContabilizzazione_effetti_app::on_config_change()
bool TContabilizzazione_effetti_app::create()
{
TApplication::create();
TConfig conf(CONFIG_DITTA);
_cod_caus = conf.get("CODCAUS","ef"); // implementare programma di gestione parametri effetti
_cod_caus_pag = conf.get("CODCAUSPAG","ef"); // implementare programma di gestione parametri effetti
TConfig conf(CONFIG_DITTA, "ef");
_cod_caus = conf.get("CODCAUS"); // implementare programma di gestione parametri effetti
_cod_caus_pag = conf.get("CODCAUSPAG"); // implementare programma di gestione parametri effetti
_desc_inc = conf.get("DESCINC", NULL, -1, "Distinta d'incasso");
_desc_pag = conf.get("DESCPAG", NULL, -1, "Ordine di pagamento");
_caus = NULL;
_sc_enabled = conf.get_bool("GesSal","cg");
if (!has_module(CGAUT) && _sc_enabled)
@ -266,8 +267,7 @@ bool TContabilizzazione_effetti_app::create()
_dist_sheet = new TArray_sheet(-1, -1, -4, -4, "Selezione distinte",
"@1|Tipo|Numero distinta@R|Numero effetti@R|ABI@5|CAB@5");
_part_array = new TPartite_array;
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
return TSkeleton_application::create();
}
bool TContabilizzazione_effetti_app::destroy()
@ -295,7 +295,7 @@ bool TContabilizzazione_effetti_app::destroy()
return TApplication::destroy();
}
bool TContabilizzazione_effetti_app::menu(MENU_TAG mt)
void TContabilizzazione_effetti_app::main_loop()
{
build_dist_sheet();
@ -345,7 +345,6 @@ bool TContabilizzazione_effetti_app::menu(MENU_TAG mt)
_msk->reset(F_DISTINTE);
build_dist_sheet();
}
return FALSE;
}
void TContabilizzazione_effetti_app::display_error()
@ -374,7 +373,7 @@ void TContabilizzazione_effetti_app::display_error()
_can_write = FALSE; // But from now on u cannot write anymore. U must exit this program and repair errors occurred.
}
bool TContabilizzazione_effetti_app::add_cg_row(const TRectype& eff, TArray& customers, TAssoc_array& banks)
bool TContabilizzazione_effetti_app::add_cg_row(const TEffetto& eff, TArray& customers, TAssoc_array& banks)
{
const long numreg = _movimento->curr().get_long(MOV_NUMREG);
real imp = eff.get_real(EFF_IMPORTO);
@ -390,6 +389,15 @@ bool TContabilizzazione_effetti_app::add_cg_row(const TRectype& eff, TArray& cus
c_rec->put(RMV_CONTO,_cliente.conto());
c_rec->put(RMV_SOTTOCONTO,_cliente.sottoconto());
c_rec->put(RMV_ROWTYPE,"K");
TString80 desc = _cliente.tipo() == 'F' ? "Pag. ft." : "Inc. ft.";
for (int n = 1; n <= eff.rows_r(); n++)
{
const TRectype& riga = eff.row_r(n);
desc << ' ' << riga.get(REFF_NFATT);
}
if (desc.len() > 50) desc.cut(50);
c_rec->put(RMV_DESCR, desc);
// setta i valori per la riga banca
TRectype b_r(*c_rec);
@ -408,7 +416,8 @@ bool TContabilizzazione_effetti_app::add_cg_row(const TRectype& eff, TArray& cus
b_rec.put(RMV_GRUPPO,_banca.gruppo());
b_rec.put(RMV_CONTO,_banca.conto());
b_rec.put(RMV_SOTTOCONTO,_banca.sottoconto());
b_rec.put(RMV_ROWTYPE,"I");
b_rec.put(RMV_ROWTYPE,"I");
b_rec.zero(RMV_DESCR);
}
real b_imp = b_rec.get_real(RMV_IMPORTO) + imp; // aggiorna l'importo per questa banca
b_rec.put(RMV_IMPORTO,b_imp);
@ -589,8 +598,24 @@ void TContabilizzazione_effetti_app::compile_head_mov()
const TString16 codval = _distinta->codval();
const real cambio = _distinta->cambio();
const long ndist = _distinta->ndist();
TString des;
des.format("Contabilizzazione distinta nr. %ld ",ndist, datadist.string());
des = (_distinta->tipocf() == 'F') ? _desc_pag : _desc_inc;
des << ' ';
switch (_distinta->tipopag())
{
case 1: des << "rimessa diretta"; break;
case 2: des << "tratta"; break;
case 3: des << "ricevuta bancaria"; break;
case 4: des << "cessione"; break;
case 5: des << "paghero'"; break;
case 6: des << "lettera di credito"; break;
case 7: des << "tratta accettata"; break;
case 8: des << "rapp. interb. dir."; break;
case 9: des << "bonifico"; break;
default: des.rtrim(); break;
}
des << " n." << ndist;
mov.zero();
mov.put(MOV_DESCR,des);
@ -711,7 +736,8 @@ error_type TContabilizzazione_effetti_app::write_all(bool change_status)
for (int n = 0; n < items; n++)
{
TRectype& eff = distinta[n];
eff.put(EFF_EFFCONT,TRUE);
eff.put(EFF_EFFCONT, TRUE);
eff.put(EFF_NUMREG, numreg);
}
int err = distinta.rewrite();
if (err != NOERR)
@ -869,7 +895,11 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon
else // ...oppure dalla testata movimento.
{ // Appunto: da verificare se facciamo cosi' o generiamo un errore...
anno = distinta.data_dist().year();
numpart.format("%7ld", numero);
const char all = TPartita::allineamento_richiesto(distinta.tipocf());
if (all == 'R')
numpart.format("%7ld", numero);
else
numpart.format("%ld", numero);
numdoc_to_search = numpart; // A mali estremi... estremi rimedi
}
}
@ -884,20 +914,27 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon
compile_riga_partita(riga_part,eff,reff);
// Compila la riga di pagamento:
// reperire il numero della riga partita (nrigp) appena aggiunta
int nrigp = riga_part.get_int(PART_NRIGA);
const int nrigp = riga_part.get_int(PART_NRIGA);
((TRectype&)reff).put(REFF_NRIGP, nrigp);
// scorrere le righe della partita (nriga) per trovare il riferimento alla fattura di cui si sta effettuando il pagamento
// se non la si trova allora... nriga = UNASSIGNED
const int uns = (int) TPartita::UNASSIGNED;
int nriga = uns;
for (int r = partita->last(); r > 0; r = partita->pred(r))
int nriga = reff.get_int(REFF_NRIGA);
if (nriga == 0 || nriga == uns)
{
TRiga_partite& rpart = partita->riga(r);
if (rpart.is_fattura() && rpart.get(PART_NUMDOC) == numdoc_to_search)
nriga = uns;
for (int r = partita->last(); r > 0; r = partita->pred(r))
{
nriga = r;
break;
const TRiga_partite& rpart = partita->riga(r);
const TString16 numdoc = rpart.get(PART_NUMDOC);
if (numdoc == numdoc_to_search && rpart.is_fattura())
{
nriga = r;
break;
}
}
}
}
// reperire il numero di rata (nrata) dalla riga effetto
int nrata = reff.get_int(REFF_NRATA);
char acc_sal = 'A';
@ -915,9 +952,11 @@ void TContabilizzazione_effetti_app::contabilize_bill(const char tipo, const lon
}
}
else
{
if (nriga != uns)
nriga = uns; // E' praticamente impossibile che si trovi la fattura
// senza le proprie scadenze. Al limite settiamo il numero di riga per non assegnati.
}
// Creo una nuova riga di pagamento
TRectype& old_riga_pagamento = partita->pagamento(nriga,nrata,nrigp);
// compilo i campi di riga_pagamento

View File

@ -5,4 +5,3 @@
#define F_RESET 103
#define F_DATA_OP 104
#define F_FORCE 105

View File

@ -1,3 +1,5 @@
#define F_CAUSALE 101
#define F_CAUSALE_PAG 102
#define F_CODSIA 103
#define F_DESCINC 103
#define F_DESCPAG 104
#define F_CODSIA 105

View File

@ -4,21 +4,21 @@ TOOLBAR "" 0 19 0 3
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -11 ""
PROMPT -12 -11 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Parametri effetti" 1 1 60 14
GROUPBOX DLG_NULL 78 5
GROUPBOX DLG_NULL 78 7
BEGIN
PROMPT 1 2 "@bContabilizzazione"
PROMPT 1 2 "@bContabilizzazione"
END
STRING F_CAUSALE 3
@ -37,6 +37,12 @@ BEGIN
CHECKTYPE NORMAL
END
STRING F_DESCINC 25
BEGIN
PROMPT 30 3 "Descrizione movimento "
FIELD DESCINC
END
STRING F_CAUSALE_PAG 3
BEGIN
PROMPT 2 5 "Causale pagamento "
@ -50,6 +56,12 @@ BEGIN
CHECKTYPE NORMAL
END
STRING F_DESCPAG 25
BEGIN
PROMPT 30 5 "Descrizione movimento "
FIELD DESCPAG
END
STRING F_CODSIA 5
BEGIN
PROMPT 2 7 "Codice SIA "

View File

@ -1,3 +1,3 @@
14
0
$reffetti|0|0|126|34|Righe effetti|#13||
$reffetti|0|0|130|34|Righe effetti|#13||

View File

@ -1,11 +1,12 @@
14
16
17
NPROGTR|3|7|0|Numero progressivo effetto
NRIGATR|2|3|0|Numero riga effetto
ANNO|2|4|0|Anno/Esercizio
NUMPART|1|7|0|Numero partita
NRIGA|2|4|0|Numero riga
NRATA|2|3|0|Numero rata
NRIGP|2|4|0|Numero riga pagamento
PROVV|1|1|0|Tipo numerazione <P>rovvisoria <D>efinitivo
ANNODOC|2|4|0|Anno/Esercizio della fattura
CODNUM|1|4|0|Codice della numerazione
@ -18,4 +19,4 @@ IMPORTOVAL|4|18|3|Importo effetto in valuta
ACCSAL|1|1|0|Acconto/Saldo
2
NPROGTR+NRIGATR|
ANNO+NUMPART+NRIGA+NRATA|
ANNO+NUMPART+NRIGA+NRATA|X

View File

@ -1,3 +1,3 @@
31
0
$effetti|0|0|155|0|Effetti|NEFF||
$effetti|0|0|162|34|Effetti|NEFF||

View File

@ -1,5 +1,5 @@
31
28
29
NPROGTR|3|7|0|Numero progressivo effetto
DATASCAD|5|8|0|Data di scadenza
TIPOPAG|2|1|0|Tipo pagamento
@ -22,6 +22,7 @@ EFFCOMP|8|1|0|Effetto completato
EFFSTAMP|8|1|0|Effetto stampato
DISTSTAM|8|1|0|Distinta stampata
EFFCONT|8|1|0|Effetto contabilizzato
NUMREG|3|7|0|Numero di registrazione contabile
CODABIP|10|5|0|Codice ABI banca di presentazione
CODCABP|10|5|0|Codice CAB banca di presentazione
DATARIBA|5|8|0|Data RIBA

View File

@ -880,8 +880,8 @@ void TApplication::open_files(int logicnum, ...)
va_start(marker, logicnum);
while (logicnum > 0)
{
CHECKD(_used_files.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
_used_files.add(new TLocalisamfile(logicnum), logicnum);
if (_used_files.objptr(logicnum) == NULL)
_used_files.add(new TLocalisamfile(logicnum), logicnum);
logicnum = va_arg(marker, int);
}
}

View File

@ -89,7 +89,8 @@ FILE* TArchive::ask_disk(
{
f = fopen(name, lettura ? "rb" : "wb");
if (f == NULL)
retry = yesno_box("Il file %s non e' accessibile: riprovare?", (const char*)name);
retry = yesno_box("Il file %s non e' %s: riprovare?",
(const char*)name, lettura ? "accessibile" : "scrivibile");
else
{
setvbuf(f, NULL, _IOFBF, BUFSIZE);
@ -153,28 +154,34 @@ int TArchive::build_restore_list(
if (firm < 0) // Crea lista automaticamente
{
TFilename name("a:/backup.ini"); name[0] = floppy;
TConfig ini(name);
TString_array pl;
const int max = ini.list_paragraphs(pl); // Lista degli archivi
for (int i = 0; i < max; i++)
if (yesno_box("Inserire il dischetto nel drive %c e continuare ?\n"
"(Rispondere NO se si desidera interrompere la procedura)", floppy))
{
const TString& name = pl.row(i);
const int disk = ini.get_int("Disk", name);
if (disk == 1)
{
if (name == "config")
{
TFilename fn(firm2dir(-1)); // __ptprf
fn.add(name); // Aggiungi configurazioni
fl.add(fn);
TConfig ini(name);
TString_array pl;
const int max = ini.list_paragraphs(pl); // Lista degli archivi
for (int i = 0; i < max; i++)
{
const TString& name = pl.row(i);
const int disk = ini.get_int("Disk", name);
if (disk == 1)
{
if (name == "config")
{
TFilename fn(firm2dir(-1)); // __ptprf
fn.add(name); // Aggiungi configurazioni
fl.add(fn);
}
else
{
firm = atol(name);
fl.add(firm2dir(firm)); // Aggiungi gli archivi che iniziano qui
}
}
else
{
firm = atol(name);
fl.add(firm2dir(firm)); // Aggiungi gli archivi che iniziano qui
}
}
}
}
}
else return -1;
}
else
{
@ -184,6 +191,48 @@ int TArchive::build_restore_list(
return fl.items();
}
// @doc EXTERNAL
// @mfunc Scrive il file backup.ini sul drive indicato
//
// @rdesc Ritorna se e' riuscito a scrivere il file
bool TArchive::write_ini(TFilename& work, int disk, long tot, const char* desc, char floppy) const
{
TFilename parag(work.name()); parag.ext("");
TFilename ini("a:/backup.ini"); ini[0] = floppy;
bool ok = TRUE;
if (fexist(ini))
{
TConfig c(ini, parag);
const int d = c.get_int("Disk");
if (d == disk)
{
ok = yesno_box("Il disco %d contiene gia' un backup del direttorio %s del %s"
"\nSi desidera continuare?",
disk, (const char*)parag, (const char*)c.get("Date"));
}
}
else
{
FILE* i = fopen(ini, "w"); // Crea il file backup.ini per evitare messaggi
fclose(i);
}
if (ok)
{
TConfig c(ini, parag);
const char* oggi = TDate(TODAY).string();
c.set("Size", tot , NULL, TRUE);
c.set("Disk", disk, NULL, TRUE);
c.set("Description", desc, NULL, TRUE);
c.set("Date", oggi, NULL, TRUE);
}
return ok;
}
#if XVT_OS == XVT_OS_WIN
// @doc EXTERNAL
@ -198,8 +247,9 @@ bool TArchive::fsplit(
{
const TFilename from(filename); // File da splittare
FILE* i = fopen(from, "rb"), *o = NULL;
if (i == NULL) return error_box("Impossibile aprire il file '%s'", from);
FILE* i = fopen(from, "rb");
if (i == NULL)
return error_box("Impossibile aprire il file '%s'", from);
setvbuf(i, NULL, _IOFBF, BUFSIZE);
const long tot = fsize(i);
@ -208,22 +258,29 @@ bool TArchive::fsplit(
TFilename work;
work << floppy << ":/" << from.name(); // File su dischetto
TString msg("Archiviazione di "); msg << work << " (" << (tot/1024) << "K)";
TProgind w(tot, msg, TRUE, TRUE, 40);
if (!os_test_disk_free_space(work, tot))
{
TString16 dev("A:\\*.*"); dev[0] = floppy;
TString_array dir;
if (list_files(dev, dir) > 0)
if (list_files(dev, dir) > 1)
{
warning_box("Il file %s non puo' essere contenuto per intero nel dischetto corrente:\n"
"Accertarsi di aver inserito un dischetto formattato e completamente vuoto prima di continuare.",
(const char*)from.name());
fclose(o);
::remove(work);
warning_box("La copia del file %s, generato dalla procedura, richiederà più di un dischetto: "
"il floppy inserito risulta contenere uno o più files. E' consigliabile "
"utilizzare dischetti vuoti o formattati per ridurre il loro numero."
"Premere OK per continuare.", (const char*)from.name());
o = fopen(work, "wb");
}
}
int disk = 0;
int disk = 1;
if (!write_ini(work, disk, tot, desc, floppy))
return FALSE;
TString msg("Archiviazione di "); msg << work << " (" << (tot/1024) << "K)";
TProgind w(tot, msg, TRUE, TRUE, 40);
TString buffer(BUFSIZE);
bool ok = TRUE;
@ -238,7 +295,6 @@ bool TArchive::fsplit(
if (!ok)
{
if (o != NULL)
{
chsize(fileno(o),scritti); // Must truncate output file or some information will be rewritten on next disk!
@ -252,34 +308,9 @@ bool TArchive::fsplit(
TFilename parag(work.name()); parag.ext("");
TFilename ini("a:/backup.ini"); ini[0] = floppy;
if (ini.exist())
{
TConfig c(ini, parag);
const int d = c.get_int("Disk");
if (d == disk)
{
ok = yesno_box("Il disco %d contiene gia' un backup del direttorio %s del %s"
"\nSi desidera continuare?",
disk, (const char*)parag, (const char*)c.get("Date"));
}
}
else
{
FILE* i = fopen(ini, "w"); // Crea il file backup.ini per evitare messaggi
fclose(i);
}
if (ok)
{
TConfig c(ini, parag);
const char* oggi = TDate(TODAY).string();
c.set("Date", oggi);
c.set("Description", desc);
c.set("Disk", disk);
c.set("Size", tot);
}
else
if (!write_ini(work, disk, tot, desc, floppy))
break;
ok = (letti > 0) ? (fwrite((char*)(const char*)buffer, letti, 1, o) == 1) : TRUE;
if (!ok)
error_box("Impossibile scrivere i dati sul dischetto");
@ -578,7 +609,10 @@ bool TArchive::restore(long firm, char floppy, bool temp. bool)
{
TString_array fl;
const int num_ditte = build_restore_list(firm, floppy, fl);
if (num_ditte < 0)
break;
for (int f = 0; f < num_ditte; f++)
{
const TToken_string& code = fl.row(f);
@ -598,7 +632,7 @@ bool TArchive::restore(long firm, char floppy, bool temp. bool)
{
TFilename cfg("a:/config.001"); cfg[0] = floppy;
if (!fexist(cfg))
lastdisk = !yesno_box("Si desidera procedere col prossimo disco di ripristino?\n"
lastdisk = !yesno_box("Inserire il successivo disco di ripristino?\n"
"(Rispondere NO se si desidera interrompere la procedura)");
}
} while(!lastdisk);

View File

@ -35,6 +35,10 @@ class TArchive : public TObject
// @cmember Funzione per richiedere all'utente il dischetto e per controllare la
// corretta sequenza dei dischetti da inserire
FILE* ask_disk(TFilename& name, int disk, char floppy, bool lettura) const;
// @cmember Scrive il file backup.ini sul drive indicato
bool write_ini(TFilename& name, int disk, long tot, const char* desc, char floppy) const;
// @cmember Spezza il file in modo da farlo stare sul dischetto
bool fsplit(const char* filename, char floppy, const char* desc = "") const;
// @cmember Ricostruisce il file spezzato

View File

@ -50,6 +50,7 @@
#define CLASS_GRID_FIELD 247
#define CLASS_TREE_FIELD 248
#define CLASS_CURRENCY_FIELD 249
#define CLASS_GOLEM_CLIENT_FIELD 250
#define CLASS_GOLEM 900

View File

@ -1220,13 +1220,12 @@ char* DB_memoptr( const int handle, const char * fieldname )
int DB_memowrite( const int handle, const char * fieldname, const char * data )
{
int ret;
FIELD4 * f;
f = d4field(dbdata[handle], fieldname );
ret = f4memoAssign( f, ( char * )data );
d4flush(dbdata[handle]);
d4unlock(dbdata[handle]);
return ret;
}
@ -2516,11 +2515,11 @@ char* DB_memoptr( const int handle, const char * fieldname )
int DB_memowrite( const int handle, const char * fieldname, const char * data )
{
int ret;
FIELD4 * f;
f = d4field( dbdata[ handle ], (char *)fieldname );
ret = f4memo_assign( f, ( char * )data );
d4flush_data( dbdata[ handle ] );
d4unlock(dbdata[handle]);
return ret;
}

View File

@ -1356,7 +1356,7 @@ void TButton_control::create(WINDOW win, short cid,
if (wc == WC_PUSHBUTTON && height == 1) // Troppo bassi!
{
rct.top--;
rct.bottom++;
// rct.bottom++;
}
const unsigned long attrib = flags2attr(flags);

View File

@ -66,7 +66,7 @@ TObject* TDowJones::rec2obj(const TRectype& rec) const
data->_chg = rec.get_real("R10");
if (data->_chg <= ZERO)
{
NFCHECK("Codice valuta errato: '%s'", (const char*)codval);
NFCHECK("Codice valuta senza cambio: '%s'", (const char*)codval);
data->_chg = 1.0;
}
}
@ -236,6 +236,11 @@ const TString& TCurrency::get_firm_val()
return DowJones.get_firm_val();
}
const TString& TCurrency::get_euro_val()
{
return DowJones.get_euro_val();
}
int TCurrency::get_base_dec(bool price)
{
return DowJones.get_dec(NULL, price);
@ -246,6 +251,11 @@ int TCurrency::get_firm_dec(bool price)
return DowJones.get_dec(get_firm_val(), price);
}
int TCurrency::get_euro_dec(bool price)
{
return DowJones.get_dec(get_euro_val(), price);
}
void TCurrency::force_value(const char* newval, const real& newchange)
{
newval = DowJones.expand_value(newval);

View File

@ -23,8 +23,10 @@ protected:
public:
static const TString& get_base_val();
static const TString& get_firm_val();
static const TString& get_euro_val();
static int get_base_dec(bool price = FALSE);
static int get_firm_dec(bool price = FALSE);
static int get_euro_dec(bool price = FALSE);
void set_price(bool p) { _price = p; }
bool is_price() const { return _price; }
@ -33,12 +35,13 @@ public:
void change_value(const char* newval, const real& newchange = ZERO);
void change_to_base_val() { change_value(get_base_val()); }
void change_to_firm_val() { change_value(get_firm_val()); }
void change_to_euro_val() { change_value(get_euro_val()); }
const char* get_value() const { return _val; }
bool is_base_value() const;
bool same_value_as(const TCurrency& cur) const;
void set_num(const real& num) { _num = num; }
void set_num(const real& num) { _num = num; _num.round(decimals()); }
const real& get_num() const { return _num; }
const TCurrency& operator=(const TCurrency& cur) { copy(cur); return *this; }

View File

@ -433,10 +433,10 @@ bool TDongle::network_login(bool test_all_keys)
TConfig ini(CONFIG_INSTALL, "Server");
const char* server = ini.get("Dongle");
const TString16 appname = main_app().name();
TString16 utente = user();
if (utente.empty() || (!xvt_running() && appname == "ba0100"))
utente = "GUEST";
const char* guest = "******";
// const TString appname = main_app().firm_change_enabled() ? main_app().name() : "ba0100";
const TString appname = main_app().name();
const char* utente = (!xvt_running() && appname == "ba0100") ? guest : user();
const bool ok = rpc_UserLogin(server, utente, "******", appname);
if (ok)

View File

@ -16,6 +16,8 @@ class TDongle : public TObject
{
TDongleHardware _hardware;
TDongleType _type;
TString16 _admin, _admpwd;
word _serno, _max_users, _year_assist;
word _eprom[64];

View File

@ -23,6 +23,7 @@
#define EFF_EFFSTAMP "EFFSTAMP"
#define EFF_DISTSTAM "DISTSTAM"
#define EFF_EFFCONT "EFFCONT"
#define EFF_NUMREG "NUMREG"
#define EFF_CODABIP "CODABIP"
#define EFF_CODCABP "CODCABP"
#define EFF_DATARIBA "DATARIBA"

View File

@ -62,7 +62,6 @@ word TExternal_app::run(
iconize &= !async && show;
_exitcode = os_execute(path, !async, iconize, show);
// restore cwd
xvt_fsys_restore_dir();
@ -82,14 +81,21 @@ word TExternal_app::run(
}
bool TExternal_app::can_run() const
{
TRecord_cache users(LF_USER);
TToken_string perm(4096, '\n'), row(80);
for (TString16 u = user();
u.not_empty() && !users.already_loaded(u);
u = users.get(u, "GROUPNAME"))
{
if (*prefix().name() < ' ')
return TRUE;
TAssoc_array antiloop;
TToken_string perm(4096, '\n'), row(80,SAFE_PIPE_CHR);
for (TString16 u = user(); u.not_empty(); u = cache().get(LF_USER, u, "GROUPNAME"))
{
perm = users.get(u, "PERMISSION");
if (antiloop.is_key(u))
{
NFCHECK("L'utente %s ha dei permessi ricorsivi", (const char*)u);
break;
}
else
antiloop.add(u);
perm = cache().get(LF_USER, u, "PERMISSION");
if (!perm.blank())
{
FOR_EACH_TOKEN(perm, tok)

View File

@ -4,8 +4,6 @@
#define __EXPR_CPP
#include <expr.h>
#include <stack.h>
#include <utility.h>
#include <date.h>
void TCodearray::clear()
@ -49,7 +47,7 @@ void TVararray::set(const char* name, const real& val)
for (int i = last(); i >= 0; i--)
{
TVar* var = (TVar*)objptr(i);
if (strcmp(var->getname(), name) == 0)
if (var->getname() == name)
{
*var = val;
return;
@ -64,7 +62,7 @@ void TVararray::set(const char* name, const char* val)
for (int i = last(); i >= 0; i--)
{
TVar* var = (TVar*)objptr(i);
if (strcmp(var->getname(), name) == 0)
if (var->getname() == name)
{
*var = val;
return;
@ -78,7 +76,7 @@ const real& TVararray::getnum(const char* name)
for (int i = items()-1; i >= 0; i--)
{
TVar* var = (TVar*)objptr(i);
if (var && strcmp(var->getname(), name) == 0)
if (var->getname() == name)
return var->number();
}
NFCHECK("Unknown variable: %s", name);
@ -99,10 +97,10 @@ const real& TVararray::getnum(int varnum)
const TString& TVararray::getstring(const char* name)
{
for (int i = items()-1; i >= 0; i--)
for (int i = last(); i >= 0; i--)
{
TVar* var = (TVar*)objptr(i);
if (var && strcmp(var->getname(), name) == 0)
if (var->getname() == name)
return var->string();
}
NFCHECK("Unknown variable : %s", name);
@ -112,7 +110,8 @@ const TString& TVararray::getstring(const char* name)
const TString& TVararray::getstring(int varnum)
{
if (varnum < 0 || varnum >= items())
TVar* var = (TVar*)objptr(varnum);
if (var == NULL)
{
NFCHECK("Invalid variable number : %d", varnum);
return EMPTY_STRING;
@ -211,7 +210,6 @@ TString& TEval_stack::peek_string()
TExpression::TExpression(const char* expression, TTypeexp type, bool ignore_err)
: _original(expression)
{
_ignore_error=ignore_err;
_error=0;
@ -222,7 +220,6 @@ TExpression::TExpression(const char* expression, TTypeexp type, bool ignore_err)
TExpression::TExpression(TTypeexp type, bool ignore_err)
: _original("")
{
_ignore_error=ignore_err;
_error=0;
@ -272,13 +269,12 @@ void TExpression::print_on(ostream& out) const
void TExpression::evaluate_user_func(int index, int nparms, TEval_stack& stack, TTypeexp curtype) const
{
NFCHECK("Unknown function %d.", index);
for ( int i = nparms ; i > 0; i--)
for (int i = nparms; i > 0; i--)
stack.pop();
stack.push(ZERO);
}
void TExpression::setvar(const char* varname, const real& val)
{
if (_var.getnum(varname) != val)
{
@ -287,9 +283,7 @@ void TExpression::setvar(const char* varname, const real& val)
}
}
void TExpression::setvar(int varnum, const real& val)
{
if (_var.getnum(varnum) != val)
{
@ -298,10 +292,9 @@ void TExpression::setvar(int varnum, const real& val)
}
}
void TExpression::setvar(const char* varname, const char* val)
{
if (strcmp(_var.getstring(varname), val) != 0)
if (_var.getstring(varname) != val)
{
_var.set(varname, val);
_dirty = TRUE;
@ -693,7 +686,7 @@ void TExpression::eval()
break;
case _ansi:
{
TString & s = evalstack.peek_string();
TString& s = evalstack.peek_string();
const TDate d(s);
s = d.string(ANSI);
}
@ -1035,7 +1028,7 @@ TCodesym TExpression::__factor(TCodesym startsym)
else
{
_code.add(_number, real(__parms_found));
val.set(format("%d", index));
val = real(index);
_code.add(startsym, val);
_user_func_defined = TRUE;
}
@ -1169,7 +1162,7 @@ bool TExpression::compile(const TString& expression, TTypeexp type)
_user_func_defined = FALSE;
_s = expression;
_type = type;
_val = real(0.0);
_val = ZERO;
_code.clear();
if (expression.blank())
return TRUE;

View File

@ -68,8 +68,8 @@ enum TCodesym {
_scorp, // @emem Scorpora una percentuale
_substr, // @emem Estrae una sottostringa
_len, // @emem Lunghezza di una stringa
_trim // @emem Trimma una stringa
} ;
_trim, // @emem Elimina spazi iniziali e finali di una stringa
};
// @doc INTERNAL
// @enum TTypeexp | Tipi di espressioni definiti
@ -287,7 +287,7 @@ public:
void setname(const char* name)
{ _name = name;}
// @cmember Ritorna il nome della variabile
const char* getname() const
const TString& getname() const
{ return _name;}
// @cmember Ritorna il valore assegnato alla variabile (un <c TValue>)

View File

@ -1760,13 +1760,16 @@ public:
};
class TForm_picture : public TForm_item
{
{
TFieldref _field;
protected:
virtual const char* class_name() const { return "FIGURA"; }
virtual bool parse_item(TScanner& scanner);
virtual bool update();
public:
TForm_picture(TGraphic_section* section) : TForm_item(section) {}
TForm_picture(TPrint_section* section) : TForm_item(section) {}
virtual ~TForm_picture() {}
};
@ -1792,15 +1795,63 @@ public:
virtual ~TForm_box() {}
};
bool TForm_picture::parse_item(TScanner& scanner)
{
if (scanner.key() == "FI") // FIELD reference
{
_field = scanner.line();
return TRUE;
}
return TForm_item::parse_item(scanner);
}
bool TForm_picture::update()
{
const bool ok = _prompt.not_empty();
TFilename i;
if (_field.ok())
{
const TRelation* r = form().relation();
if (r)
{
TToken_string list(_field.read(*r), '\n');
FOR_EACH_TOKEN(list, tok)
{
i = tok;
const int pos = i.find('|');
if (pos >= 0)
i.cut(pos);
if (stricmp(i.ext(), "bmp") == 0)
{
i.replace('\\', '/');
i.trim();
break;
}
else
i.cut(0);
}
}
else
NFCHECK("Can't read picture from NULL relation");
}
else
i = _prompt;
bool ok = i.not_empty() && i.exist();
if (ok)
{
TString80 i;
i << "i{" << _prompt << ',' << _x << ',' << _y << ','
<< (_x+width()-1) << ',' << (_y+height()-1) << '}';
((TGraphic_section&)section()).append(i);
i << ',' << _x << ',' << _y << ',' << (_x+width()-1) << ',' << (_y+height()-1);
if (section().section_type() == 'G')
{
i.insert("i{", 0); i << '}';
((TGraphic_section&)section()).append(i);
}
else
{
i.insert("@F[", 0); i << ']';
TPrintrow& row = section().row(_y-1);
row.put(i);
}
}
return ok;
}
@ -1962,7 +2013,10 @@ TForm_item* TPrint_section::create_item(const TString& s)
if (s.compare("GRUPPO", 2, TRUE) == 0)
f = new TForm_group(this); else
if (s.compare("SECTION", 2, TRUE) == 0)
f = new TForm_subsection(this);
f = new TForm_subsection(this); else
if (s.compare("FIGURA", 2, TRUE) == 0)
f = new TForm_picture(this);
return f;
}

View File

@ -6,6 +6,7 @@
#include <execp.h>
#include <golem.h>
#include <msksheet.h>
#include <os_dep.h>
#include <prefix.h>
#include <relation.h>
#include <urldefid.h>
@ -166,6 +167,8 @@ HIDDEN word mail2icon()
icon = file2icon(key);
}
if (icon == 0)
icon = file2icon(".eml");
if (icon == 0)
icon = file2icon(".msg");
if (icon == 0)
@ -272,7 +275,13 @@ bool TGolem_mask::file_handler(TMask_field& f, KEY k)
if (k == K_F9)
{
FILE_SPEC fs;
xvt_fsys_convert_str_to_dir(".", &fs.dir);
if (!f.empty())
{
const TFilename n = f.get();
xvt_fsys_convert_str_to_dir((char*)(const char*)n.path(), &fs.dir);
}
else
xvt_fsys_convert_str_to_dir(".", &fs.dir);
strcpy(fs.type, "");
strcpy(fs.name, "*.*");
strcpy(fs.creator, "GOLEM");
@ -289,12 +298,13 @@ bool TGolem_mask::file_handler(TMask_field& f, KEY k)
m.set(S_FILE, file);
k = K_TAB;
}
f.set_focus();
}
if (k == K_TAB && f.focusdirty())
{
TFilename file = m.get(S_FILE);
if (fexist(file))
if (file.exist())
{
char ext[_MAX_EXT];
char name[_MAX_FNAME];
@ -632,10 +642,13 @@ bool TGolem_field::on_key(KEY key)
tmp.add(*row);
}
set(tmp);
_selected = sheet.selected();
do_message(0);
}
}
else
{
tmp.separator('|');
TMask& sm = sheet.sheet_mask();
for (int i = 0; i < 3; i++)
sm.set(S_FILE+i, tmp.get());
@ -646,6 +659,7 @@ bool TGolem_field::on_key(KEY key)
for (int i = 0; i < 3; i++)
tmp.add(sm.get(S_FILE+i));
set(tmp);
do_message(0);
}
}
@ -655,12 +669,252 @@ bool TGolem_field::on_key(KEY key)
}
TGolem_field::TGolem_field(TMask* m)
: TEditable_field(m), _old_value(80, '\n')
: TEditable_field(m), _selected(0), _old_value(80, '\n')
{ }
TGolem_field::~TGolem_field()
{ }
///////////////////////////////////////////////////////////
// TGolem_client_field
///////////////////////////////////////////////////////////
class TGolem_window : public TField_window
{
TFilename _last_file;
unsigned long _last_handle;
protected:
virtual bool on_key(KEY k);
virtual void update();
virtual void handler(WINDOW win, EVENT* ep);
public:
TGolem_field* driver() const { return ((TGolem_client_field&)owner()).driver(); }
const TFilename& get_current_file(TFilename& fn) const;
TGolem_window(int x, int y, int dx, int dy, WINDOW parent, TGolem_client_field* owner);
virtual ~TGolem_window();
};
const TFilename& TGolem_window::get_current_file(TFilename& fn) const
{
TGolem_field* gf = driver();
if (gf != NULL)
{
TToken_string list(gf->get(), '\n');
TToken_string tok = list.get(gf->selected());
fn = tok.get();
}
else
fn.cut(0);
return fn;
}
void TGolem_window::update()
{
bool drawn = FALSE;
TField_window::update();
TFilename file; get_current_file(file);
if (file.not_empty() && file.exist())
{
const TString16 ext = file.ext();
if (ext.compare("bmp", -1, TRUE) == 0)
{
TImage img(file);
if (img.ok())
{
RCT cli; xvt_vobj_get_client_rect(win(), &cli);
if (owner().automagic())
{
const double ratiox = double(cli.right-cli.left) / img.width();
const double ratioy = double(cli.bottom-cli.top) / img.height();
const double ratio = min(ratiox, ratioy);
const int maxx = int(ratio * img.width());
const int maxy = int(ratio * img.height());
RCT dst; xvt_rect_set(&dst, 0, 0, maxx, maxy);
img.draw(win(), dst);
}
else
{
long sx = img.width() - (cli.right-cli.left); if (sx < 0) sx = 0;
long sy = img.height() - (cli.bottom-cli.top); if (sy < 0) sy = 0;
set_scroll_max(sx, sy); // Setta le scroll bar
const TPoint orig = origin();
img.draw(win(), -int(orig.x), -int(orig.y));
}
drawn = TRUE;
}
}
}
if (!drawn)
{
set_scroll_max(0, 0); // Toglie le scroll bar
RCT cli; xvt_vobj_get_client_rect(win(), &cli);
set_pen(COLOR_RED, 5);
line(cli.right/4, cli.bottom/4, 3*cli.right/4, 3*cli.bottom/4);
line(cli.right/4, 3*cli.bottom/4, 3*cli.right/4, cli.bottom/4);
}
}
bool TGolem_window::on_key(KEY k)
{
if (k == K_SPACE)
{
TFilename file; get_current_file(file);
if (file != _last_file)
{
if (_last_handle)
{
if (IsWindow(HWND(_last_handle)))
SendMessage(HWND(_last_handle), WM_CLOSE, 0, 0);
_last_handle = NULL;
}
_last_file = file;
if (!file.blank() && file.exist())
{
const TString16 ext = file.ext();
if (ext != "BMP")
{
TFilename cmd;
const char* good_ext[] = { "BAT", "COM", "DLL", "DOC", "EXE", "INI", "TXT", "WRI", "XLS", NULL };
for (int i = 0; good_ext[i]; i++)
{
if (ext == good_ext[i])
{
GetSystemDirectory(cmd.get_buffer(), cmd.size());
cmd.add("viewers");
cmd.add("quikview.exe");
break;
}
}
if (!cmd.exist())
file2app(file, cmd);
if (cmd.not_empty())
{
cmd << ' ' << file;
_last_handle = os_execute_in_window(cmd, win());
}
}
}
force_update();
}
}
return TField_window::on_key(k);
}
void TGolem_window::handler(WINDOW win, EVENT* ep)
{
switch (ep->type)
{
case E_USER:
switch (ep->v.user.id)
{
case E_DROP_FILES:
if (driver())
{
HDROP hdrop = (HDROP)(DWORD)ep->v.user.ptr;
const int num_files = DragQueryFile(hdrop, -1, NULL, 0); // Numero totale di files
TToken_string file_list(driver()->get(), '\n');
TFilename fname; // File corrente
for (int i = 0; i < num_files; i++)
{
DragQueryFile(hdrop, i, (char*)(const char*)fname, fname.size());
fname << '|' << fname.name() << "|X";
if (driver()->roman())
{
file_list.add(fname);
}
else
{
file_list = fname;
break;
}
}
DragFinish(hdrop);
driver()->set(file_list);
on_key(K_SPACE);
}
break;
default:
break;
}
break;
case E_MOUSE_DBL:
on_key(K_SPACE);
break;
default:
break;
}
TField_window::handler(win, ep);
}
TGolem_window::TGolem_window(int x, int y, int dx, int dy, WINDOW parent, TGolem_client_field* owner)
: TField_window(x, y, dx, dy, parent, owner), _last_handle(0)
{
_pixmap = TRUE;
HWND nat = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
DragAcceptFiles(nat, TRUE);
}
TGolem_window::~TGolem_window()
{
if (_last_handle)
PostMessage(HWND(_last_handle), WM_CLOSE, 0, 0);
HWND nat = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
DragAcceptFiles(nat, FALSE);
}
word TGolem_client_field::class_id() const
{ return CLASS_GOLEM_CLIENT_FIELD; }
bool TGolem_client_field::is_kind_of(word cid) const
{ return cid == CLASS_GOLEM_CLIENT_FIELD || TWindowed_field::is_kind_of(cid); }
TField_window* TGolem_client_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{ return new TGolem_window(x, y, dx, dy, parent, this); }
bool TGolem_client_field::parse_item(TScanner& scan)
{
if (scan.key() == "DR")
{
TMask& m = mask();
const short driver = atodlg(scan.pop());
const int pos = m.id2pos(driver);
if (pos >= 0)
{
_driver = (TGolem_field*)&m.fld(pos);
TString16 msg;
msg.format("PUSH,%d", dlg());
_driver->message(0, TRUE)->add(msg);
}
else
yesnofatal_box("Non esiste il campo driver %d", driver);
return TRUE;
}
return TWindowed_field::parse_item(scan);
}
bool TGolem_client_field::on_hit()
{
dispatch_e_char(win().win(), K_SPACE);
return TWindowed_field::on_hit();
}
TGolem_client_field::TGolem_client_field(TMask* m)
: TWindowed_field(m), _driver(NULL)
{ }
TGolem_client_field::~TGolem_client_field()
{ }
///////////////////////////////////////////////////////////
// MAPI session
///////////////////////////////////////////////////////////

View File

@ -1,21 +0,0 @@
[BITMAP]
Extension = bmp
Editor = pbrush.exe
Icon = 135
[SOUND]
Extension = wav
Editor = soundrec.exe
Icon = 136
[EXCEL]
Extension = xls
Editor = excel.exe
Icon = 137
[WORD]
Extension = doc
Editor = winword.exe
Icon = 138
[EOF]

View File

@ -1,3 +1,5 @@
#include <fcntl.h>
#include <share.h>
#include <stdio.h>
#include <stdlib.h>
@ -1056,7 +1058,6 @@ bool TBaseisamfile::empty()
return items() <= 0;
}
// @doc EXTERNAL
// @mfunc Apre il file isam di base con lock
@ -1078,6 +1079,7 @@ int TBaseisamfile::_open(
// @flag FALSE | Il file viene aperto senza indici
{
<<<<<<< isam.cpp
CHECKD(_isam_handle == 0, "Can't reopen file ", _logicnum);
_curr_key = index ? 1 : 0;
@ -1086,6 +1088,7 @@ int TBaseisamfile::_open(
if (_isam_handle > 0)
{
_recno = RECORD_NON_FISICO;
setkey(1);
_lasterr = NOERR;
}
else
@ -1182,17 +1185,6 @@ int TBaseisamfile::is_valid()
return err;
}
void TBaseisamfile::notify_change() const
{
prefix().notify_change(_isam_handle);
}
bool TBaseisamfile::is_changed_since(long clk) const
{
const clock_t last = prefix().last_change(_isam_handle);
return clk < last;
}
struct TCallbackFileinfo
{
TString16 _var;
@ -1221,6 +1213,25 @@ bool TBaseisamfile::get_relapp(TString& app) const
return app.not_empty();
}
bool TBaseisamfile::is_changed_since(long& last) const
{
bool yes = FALSE;
const int fh = ::_sopen(filename(), _O_RDONLY, _SH_DENYNO);
if (fh > 0)
{
struct _stat stat;
if (::_fstat(fh, &stat) == 0)
{
const long tim = long(stat.st_mtime);
yes = tim != last;
last = tim;
}
::_close(fh);
}
return yes;
}
///////////////////////////////////////////////////////////
// TLocalisamfile
///////////////////////////////////////////////////////////
@ -1446,8 +1457,8 @@ int TIsamtempfile::open(
filename.ext("dbf");
if (err == -60)
{
if (!filename.exist()) // check for existance
fatal_box("Apertura file %s : errore n. %d. File non esistente.",(const char*)filename,err);
if (access(n,0)) // check for existence
fatal_box("Apertura file %s : errore n. %d. File non esistente.",(const char*) n,err);
else
fatal_box("Apertura file %s : errore n. %d. File aperto in uso esclusivo da un'altra applicazione.",(const char*)filename,err);
}

View File

@ -498,10 +498,10 @@ public:
virtual bool get_relapp(TString& app) const;
// @cmember Notifica che il file e' stato modificato
void notify_change() const;
// @cmember Testa se il file e' cambiato dal ciclo di clock <p clk>
bool is_changed_since(long clk) const;
// @cmember Testa se il file e' cambiato dal momento <p stat>
bool is_changed_since(long& stat) const;
// @cmember Costruttore
TBaseisamfile(int logicnum);

View File

@ -216,7 +216,7 @@ TMask::TMask(const char* maskname, int num, int max)
TMask::~TMask()
{
{
for (int p = MAX_PAGES; p >= 0; p--)
if (_pagewin[p])
{
@ -532,13 +532,11 @@ int TMask::id2pos(
TMask_field& TMask::field(short id) const
{
int pos = id2pos(id);
#ifdef DBG
if (pos < 0)
{
NFCHECK("Il campo %d non esiste", id);
yesnofatal_box("Il campo %d non esiste", id);
pos = 0;
}
#endif
return fld(pos);
}
@ -862,10 +860,21 @@ TMask_field* TMask::parse_field(TScanner& scanner)
if (k == "BR") return new TBrowsefile_field(this);
if (k == "SP") return new TSheet_field(this);
if (k == "TR") return new TTree_field(this);
if (k == "CL") return new TGolem_client_field(this);
return NULL;
}
int TMask::sheets() const
{
int s = 0;
for (int f = fields()-1; f >= 0; f--)
{
if (fld(f).is_kind_of(CLASS_SHEET_FIELD))
s++;
}
return s;
}
// @doc EXTERNAL
// @mfunc Legge la pagina dal file

View File

@ -4,6 +4,7 @@
#include <expr.h>
#include <msksheet.h>
#include <prefix.h>
#include <recarray.h>
#include <relation.h>
#include <sheet.h>
#include <tabutil.h>
@ -2331,11 +2332,12 @@ bool TBrowse::do_link(bool insert)
ok = _cursor->ok();
if (ok)
{
rec_cache(_cursor->file().num()).destroy(); // Svuota eventule cache
do_output();
_cursor->file().notify_change();
}
else
NFCHECK("Selezione da programma esterno errata");
}
#ifdef DBG
else yesnofatal_box("Selezione da programma esterno errata");
#endif
}
::remove(msg);
}
@ -4789,7 +4791,6 @@ void TWindowed_field::highlight() const
}
}
RCT& TWindowed_field::get_rect(RCT& r) const
{
if (_win)
@ -4804,6 +4805,11 @@ void TWindowed_field::set_rect(const RCT&)
CHECK(NULL, "Can't resize windowed field by now!");
}
short TWindowed_field::dlg() const
{
return _dlg ? _dlg : _ctl_data._dlg;
}
void TWindowed_field::parse_head(TScanner& scanner)
{
_ctl_data._width = scanner.integer();

View File

@ -427,8 +427,6 @@ public:
virtual ~TGroup_field() {}
};
class TOperable_field : public TMask_field
{
// @cmember Comandi da eseguire in caso di modifica del campo
@ -1503,13 +1501,12 @@ public:
class TGolem_field : public TEditable_field
{
TToken_string _old_value;
int _selected;
protected: // TEditable_field
virtual TString& get_window_data();
virtual void set_window_data(const char* data);
virtual bool on_key(KEY k);
// @cmember Ritorna FALSE in quanto il campo non e' realmente editable
virtual bool is_editable() const;
@ -1522,6 +1519,9 @@ protected: // TEditable_field
virtual bool autosave(TRelation& r);
public:
virtual bool on_key(KEY k);
int selected() const { return _selected; }
TGolem_field(TMask* m);
virtual ~TGolem_field();
};
@ -1562,7 +1562,7 @@ protected:
WINDOW parent) pure;
public: // TMask_field
virtual short dlg() const { return _dlg; }
virtual short dlg() const;
virtual WINDOW parent() const { return win().parent(); }
virtual void enable(bool on = TRUE);
virtual void show(bool on = TRUE);
@ -1572,7 +1572,7 @@ public: // TMask_field
public:
TField_window& win() const { CHECK(_win, "NULL Window in field"); return *_win; }
TWindowed_field(TMask* m) : TOperable_field(m), _win(NULL) { }
TWindowed_field(TMask* m) : TOperable_field(m), _win(NULL), _dlg(0) { }
virtual ~TWindowed_field();
};
@ -1594,11 +1594,32 @@ public:
void hide_leaves(bool yes = TRUE);
void show_leaves(bool yes = TRUE) { hide_leaves(!yes); }
bool select_current();
bool goto_selected();
TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { }
};
class TGolem_client_field : public TWindowed_field
{
TGolem_field* _driver;
protected: // TObject
word class_id() const;
bool is_kind_of(word cid) const;
protected: // TWindowed_field
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
virtual bool parse_item(TScanner& scan);
public:
TGolem_field* driver() const { return _driver; }
virtual bool on_hit();
TGolem_client_field(TMask* m);
virtual ~TGolem_client_field();
};
#endif // __MASKFLD_H

View File

@ -13,6 +13,8 @@ extern "C"
#include <recarray.h>
#include <relation.h>
#include <urldefid.h>
#include <utility.h>
#include <progind.h>
///////////////////////////////////////////////////////////
// TSpreadsheet
@ -2234,7 +2236,7 @@ bool TSheet_field::parse_item(TScanner& scanner)
{
case 'A': _enable_autoload = TRUE; break;
case 'I': _append = FALSE; break;
case '|': _separator = '¦'; break;
case '|': _separator = SAFE_PIPE_CHR; break;
default : break;
}
}

View File

@ -25,6 +25,7 @@ unsigned long os_get_disk_size(const char* path);
COLOR os_choose_color(COLOR col, WINDOW win);
void os_exec_help_command(MENU_TAG tag, const char* key);
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild);
unsigned long os_execute_in_window(const TFilename& path, WINDOW win);
bool os_file_exist(const char* path);
bool os_destroy_native_icon(unsigned icon);

View File

@ -28,6 +28,8 @@ extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); }
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
HTASK _waiting_for = 0xFFFF;
extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); }
HIDDEN BOOLEAN event_hook(HWND hwnd,
UINT msg,
UINT wparam,
@ -72,6 +74,20 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
}
}
break;
case WM_DROPFILES:
if (cur_win() != NULL_WIN)
{
WINDOW win = xvtwi_hwnd_to_window(hwnd);
if (win != NULL)
{
EVENT e;
e.type = E_USER;
e.v.user.id = E_DROP_FILES;
e.v.user.ptr = (void*)wparam;
xvt_win_dispatch_event(win, &e);
}
}
break;
default:
if (msg == WM_WAKEUP)
{
@ -205,12 +221,14 @@ bool os_test_disk_free_space(const char* path, unsigned long filesize)
{
const char letter = toupper(path[0]);
disk = 'A' - letter + 1;
}
}
bool space_ok = FALSE;
struct _diskfree_t drive;
_dos_getdiskfree(disk, &drive);
const unsigned requested_clusters = unsigned(filesize / drive.sectors_per_cluster / drive.bytes_per_sector) + 1;
bool space_ok = requested_clusters <= drive.avail_clusters;
if (_dos_getdiskfree(disk, &drive) == 0)
{
const unsigned requested_clusters = unsigned(filesize / drive.sectors_per_cluster / drive.bytes_per_sector) + 1;
space_ok = requested_clusters <= drive.avail_clusters;
}
return space_ok;
}
@ -222,12 +240,15 @@ unsigned long os_get_disk_size(const char* path)
const char letter = toupper(path[0]);
disk = 'A' - letter + 1;
}
unsigned long bytes = 0;
struct _diskfree_t drive;
_dos_getdiskfree(disk, &drive);
unsigned long bytes = drive.total_clusters;
bytes *= drive.sectors_per_cluster;
bytes *= drive.bytes_per_sector;
if (_dos_getdiskfree(disk, &drive) == 0)
{
unsigned long bytes = drive.total_clusters;
bytes *= drive.sectors_per_cluster;
bytes *= drive.bytes_per_sector;
}
return bytes;
}
@ -551,3 +572,88 @@ bool os_dongle_server_running()
ATOM a = GlobalFindAtom("DONGLE_SERVER_ATOM");
return a != 0;
}
HIDDEN const char* _file_to_find = NULL;
struct TFindWindowInfo
{
HINSTANCE _instance;
TFilename _file;
HWND _hwnd;
TFindWindowInfo() : _instance(NULL), _hwnd(NULL) { }
};
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
TFindWindowInfo* w = (TFindWindowInfo*)lParam;
HINSTANCE inst = GetWindowWord(hwnd, GWW_HINSTANCE);
if (inst == w->_instance)
{
const LONG style = GetWindowLong(hwnd, GWL_STYLE);
if ((style & WS_CAPTION) != 0) // Ha la caption?
{
w->_hwnd = hwnd;
return FALSE;
}
return TRUE;
}
TString256 str;
GetWindowText(hwnd, str.get_buffer(), str.size());
str.upper();
if (str.find(w->_file) >= 0)
{
w->_hwnd = hwnd;
return FALSE;
}
return TRUE;
}
unsigned long os_execute_in_window(const TFilename& path, WINDOW win)
{
const word exitcode = WinExec(path, SW_SHOWNORMAL);
if (exitcode < 32)
return 0;
TFindWindowInfo w;
w._instance = exitcode;
const int space = path.find(' ');
if (space > 0)
w._file = path.mid(space+1);
else
w._file = path;
w._file = w._file.name();
w._file.ext("");
w._file.upper();
const clock_t start = clock();
while (w._hwnd == NULL && (clock() - start) < 10*CLOCKS_PER_SEC)
{
xvt_app_process_pending_events();
FARPROC farproc = MakeProcInstance(FARPROC(EnumWindowsProc), NULL);
EnumWindows(farproc, LPARAM(&w));
FreeProcInstance(farproc);
}
if (w._hwnd != NULL) // L'ho trovata!
{
RCT rct; xvt_vobj_get_client_rect(win, &rct);
HWND nat = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
SetParent(w._hwnd, nat);
// LONG style = GetWindowLong(w._hwnd, GWL_STYLE);
// style |= WS_CHILD;
// SetWindowLong(w._hwnd, GWL_STYLE, style);
const int fx = GetSystemMetrics(SM_CXFRAME);
const int fy = GetSystemMetrics(SM_CYFRAME);
int cy = GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYBORDER);
if (GetMenu(w._hwnd) != NULL)
cy += GetSystemMetrics(SM_CYMENU);
SetWindowPos(w._hwnd, nat, -fx, -fy-cy, rct.right+2*fx, rct.bottom+cy+2*fy, SWP_NOZORDER);
}
return w._hwnd;
}

View File

@ -25,4 +25,5 @@ const char* get_user_write_filter();
bool user_can_read(const TRelation* rel);
bool user_can_write(const TRelation* rel);
#endif
#endif
=======

View File

@ -654,19 +654,26 @@ TPrintrow::TPrintrow()
}
TPrintrow::TPrintrow(const TPrintrow& pr)
{
{
reset();
_row = pr.row ();
memcpy (_attr, pr._attr, MAX_PR_WIDTH);
memcpy (_cols, pr._cols, MAX_PR_WIDTH);
_currentcolor = 'w';
_currentcolor <<= 8;
_currentcolor += 'n';
_tab = pr._tab;
if (pr._images)
_images = new TToken_string(*pr._images);
_currentstyle = pr._currentstyle;
for (int i = 0; i < MAX_PR_WIDTH; i++)
_cols[i] = _currentcolor;
_currentcolor = pr._currentcolor;
_lastpos = pr._lastpos;
}
TPrintrow::~TPrintrow()
{
if (_images)
delete _images;
}
TObject *TPrintrow::dup () const
{
return new TPrintrow (*this);
@ -690,7 +697,7 @@ TPrintrow& TPrintrow::reset()
memset(_attr, normalstyle, sizeof (_attr)); // Azzera stile
_tab.reset(); // Azzera tabulazioni
_images = NULL;
_currentcolor = 'w';
_currentcolor <<= 8;
_currentcolor += 'n';
@ -704,15 +711,21 @@ TPrintrow& TPrintrow::reset()
const char* TPrintrow::row_codified() const
{
char last_attr = -1;
int last_color = -1;
int last = 0, k = 0, len = -1;
int k = 0, i = 0, len = 0;
for (int i = 0; i < _row.size(); i++)
if (_row[i] > ' ') len = i;
// Calcolo lunghezza stringa
for (i = _row.size()-1; i >= 0; i--)
{
if (_row[i] > ' ')
{
len = i+1;
break;
}
}
for (i = 0; i < _row.size(); i++)
for (i = 0; i < len; i++)
{
if (_tab[i])
{
@ -740,7 +753,7 @@ const char* TPrintrow::row_codified() const
}
last_attr = _attr[i];
}
if (_cols[i] != last_color && i <= len)
if (_cols[i] != last_color)
{
__tmp_string[k++] = '$';
__tmp_string[k++] = '[';
@ -751,16 +764,22 @@ const char* TPrintrow::row_codified() const
last_color = _cols[i];
}
__tmp_string[k++] = _row[i];
if (_row[i] > ' ') last = k;
}
__tmp_string[last] = '\0';
__tmp_string[k] = '\0';
if (_images)
{
strcat(__tmp_string, "$[w,w]"); // Bianco su bianco!
FOR_EACH_TOKEN((*_images), tok)
strcat(__tmp_string, tok);
}
return __tmp_string;
}
TPrintrow& TPrintrow::put(const char *str, int position, int len)
{
if (len < 1)
if (len <= 0)
len = strlen (str);
if (position < 0)
@ -810,67 +829,77 @@ TPrintrow& TPrintrow::put(const char *str, int position, int len)
}
}
break;
case 'T':
_tab.set(position);
break;
case 'B':
_currentstyle = boldstyle;
break;
case 'I':
_currentstyle = italicstyle;
break;
case 'U':
_currentstyle = underlinedstyle;
break;
case 'R':
_currentstyle = normalstyle;
break;
default:
// should be number followed by skip or jump
if (isdigit (c))
{
// read number
char digbuf[8];
int cnt = 0;
digbuf[cnt++] = c;
while (isdigit (c = str[++i]))
case 'T':
_tab.set(position);
break;
case 'B':
_currentstyle = boldstyle;
break;
case 'I':
_currentstyle = italicstyle;
break;
case 'U':
_currentstyle = underlinedstyle;
break;
case 'R':
_currentstyle = normalstyle;
break;
case 'F':
{
const int f = i;
for ( ; str[i] && str[i] != ']'; i++);
TString name = &str[f+2];
name.cut(i-f-2);
name.insert("i{"); name << '}';
if (_images == NULL) _images = new TToken_string;
_images->add(name);
}
break;
default:
// should be number followed by skip or jump
if (isdigit (c))
{
// read number
char digbuf[8];
int cnt = 0;
digbuf[cnt++] = c;
digbuf[cnt] = '\0';
int pp = atoi (digbuf);
if (toupper (c) == 'G')
{
if (pp >= MAX_PR_WIDTH)
fatal_box ("printrow reaches position %d", pp);
if (pp > position)
for (int k = position; k < pp; k++)
{
_attr[k] = _currentstyle;
_cols[k] = _currentcolor;
}
position = pp;
_tab.set(position);
}
else if (toupper (c) == 'J')
{
if (pp + position >= MAX_PR_WIDTH)
fatal_box ("printrow reaches position %d", pp + position);
for (int k = 0; k < pp; k++)
while (isdigit (c = str[++i]))
digbuf[cnt++] = c;
digbuf[cnt] = '\0';
int pp = atoi (digbuf);
if (toupper (c) == 'G')
{
_attr[k + position] = _currentstyle;
_cols[k + position] = _currentcolor;
if (pp >= MAX_PR_WIDTH)
fatal_box ("printrow reaches position %d", pp);
if (pp > position)
for (int k = position; k < pp; k++)
{
_attr[k] = _currentstyle;
_cols[k] = _currentcolor;
}
position = pp;
_tab.set(position);
}
else if (toupper (c) == 'J')
{
if (pp + position >= MAX_PR_WIDTH)
fatal_box ("printrow reaches position %d", pp + position);
for (int k = 0; k < pp; k++)
{
_attr[k + position] = _currentstyle;
_cols[k + position] = _currentcolor;
}
position += pp;
_tab.set(position);
}
position += pp;
_tab.set(position);
}
}
else
{
_row[position] = c;
_attr[position++] = _currentstyle;
_cols[position++] = _currentcolor;
}
} // switch
else
{
_row[position] = c;
_attr[position++] = _currentstyle;
_cols[position++] = _currentcolor;
}
} // switch
}
else
{

View File

@ -9,6 +9,10 @@
#include <stdio.h>
#endif
#ifndef XVT_INCL_XVTTYPE
#include <xvt_type.h>
#endif
#ifndef __DATE_H
#include <date.h>
#endif
@ -66,15 +70,16 @@ class TPrintrow : public TObject
// @access:(INTERNAL) Private Member
{
// @cmember:(INTERNAL) Stringa da stampare nella riga
TString256 _row;
// @cmember:(INTERNAL) Attributi carattere dei caratteri
// @cmember:(INTERNAL) Attributi stile dei caratteri
char _attr[MAX_PR_WIDTH];
// @cmember:(INTERNAL) Attributi colore dei caratteri
int _cols[MAX_PR_WIDTH];
// @cmember:(INTERNAL) Inizio delle nuove posizioni di tabulazione
TBit_array _tab;
// @cmember:(INTERNAL) Immagini
TToken_string* _images;
// @cmember:(INTERNAL) Attributo carattere corrente
TPrintstyle _currentstyle;
@ -90,8 +95,7 @@ public:
// @cmember Costruttore
TPrintrow(const TPrintrow& pr);
// @cmember Distruttore
virtual ~TPrintrow()
{}
virtual ~TPrintrow();
// TPrintrow& center(const char* str, int position);
// @cmember Ritorna l'identificatore della classe
@ -662,7 +666,7 @@ public:
const char* background_chars(int l) const;
// @cmember Ritorna TRUE se la stampante e' un fax
bool isfax() const;
// @cmember Lancia ik fax server
// @cmember Lancia il fax server
bool start_fax_server() const;
// @cmember Spedisce la stampa attuale via fax
bool send_fax(const char* tipo, const char* codice);

View File

@ -164,14 +164,43 @@ void TPrintwin::paint_background(long j)
}
// restore default pen
set_pen(COLOR_BLACK);
}
void TPrintwin::paint_image(int row, const char* cp)
{
TToken_string tok(cp+2, ',');
TImage img(tok.get(0));
const int x = _hofs + LEN_SPACES(win(), tok.get_int()-1);
const int y = _vofs + row * _chary;
int dx = LEN_SPACES(win(), tok.get_int(3)-tok.get_int(1)+1);
int dy = _chary * (tok.get_int(4)-tok.get_int(2)+1);
if (img.ok())
{
const double ratiox = double(img.width()) / dx;
const double ratioy = double(img.height()) / dy;
const double ratio = ratiox > ratioy ? ratiox : ratioy;
dx = int(img.width() / ratio);
dy = int(img.height() / ratio);
RCT dst; xvt_rect_set(&dst, x, y, x+dx, y+dy);
img.draw(win(), dst);
}
else
{
RCT dst; xvt_rect_set(&dst, x, y, x+dx, y+dy);
set_pen(COLOR_RED);
xvt_dwin_draw_rect(win(), &dst);
}
}
void TPrintwin::paint_row(long j)
{
const int row = (int)(j % _formlen);
const int y = row*_chary + _chary - _descent + ((_chary == 1) ? 0 : _vofs);
if (_chary > 1)
if (_chary > 1) // Stampante vera (non Generica solo Testo)
{
paint_background(j);
@ -183,27 +212,36 @@ void TPrintwin::paint_row(long j)
while((cp = _txt.piece()) != NULL)
{
const int st = _txt.get_style();
set_font(printer().fontname(), st, _char_size);
const COLOR bg = trans_color(_txt.get_background());
const COLOR fg = trans_color(_txt.get_foreground());
set_color(fg, bg);
const char* beg = cp;
while (*beg)
{
for (; *beg == ' '; beg++) // Salta spazi iniziali
pos++;
if (bg != fg) // Testo vero
{
set_color(fg, bg);
set_font(printer().fontname(), st, _char_size);
if (*beg)
{
int len = 0;
for (const char * end = beg; *end && (*end != ' ' || *(end+1) != ' '); end++)
len++; // Misura stringa da stampare
xvt_dwin_draw_text(win(), _hofs + LEN_SPACES(win(), pos), y, (char*)beg, len);
pos += len;
beg = end;
}
const char* beg = cp;
while (*beg)
{
for (; *beg == ' '; beg++) // Salta spazi iniziali
pos++;
if (*beg)
{
int len = 0;
for (const char * end = beg; *end && (*end != ' ' || *(end+1) != ' '); end++)
len++; // Misura stringa da stampare
xvt_dwin_draw_text(win(), _hofs + LEN_SPACES(win(), pos), y, (char*)beg, len);
pos += len;
beg = end;
}
}
}
else // Testo trasparente (elementi grafici aggiuntivi)
{
if (*cp == 'i')
paint_image(row, cp);
}
}
}

View File

@ -71,6 +71,8 @@ class TPrintwin : public TWindow
void paint_background(long j);
// @cmember:(INTERNAL) Permette di disegnare la riga <p j>-esima
void paint_row(long j);
// @cmember:(INTERNAL) Permette di disegnare un'immagine alla riga y
void paint_image(int y, const char* cp);
// @cmember:(INTERNAL) Permette di disegnare la parte di finestra per la pagina <p page>
bool print_band(int page, RCT&);

View File

@ -435,8 +435,9 @@ TFile_cache::~TFile_cache()
void TFile_cache::init_file(TLocalisamfile* f)
{
if (_file != NULL)
{
if (_file != NULL)
{
CHECK(_file != f, "Suspicious file pointer");
delete _file;
_file = NULL;
}
@ -498,8 +499,6 @@ void TFile_cache::test_firm()
flush();
_cache.destroy();
}
_last_read = clock();
}
void TFile_cache::flush()
@ -534,15 +533,14 @@ const TObject& TFile_cache::query(const char* code)
{
const RecDes* recd = curr.rec_des(); // Descrizione del record della testata
const KeyDes& kd = recd->Ky[_key-1]; // Elenco dei campi della chiave
for (int i = f.tab() ? 1 :0; i < kd.NkFields; i++) // Riempie la chiave selezionata
for (int i = f.tab() ? 1 : 0; i < kd.NkFields; i++) // Riempie la chiave selezionata
{
const int nf = kd.FieldSeq[i] % MaxFields;
const RecFieldDes& rf = recd->Fd[nf];
const char* val = _code.get();
if (val)
curr.put(rf.Name, val);
else
NFCHECK("Valore del campo chiave %s non specificato per la cache", rf.Name);
// else NFCHECK("Valore del campo chiave %s non specificato per la cache", rf.Name);
}
f.setkey(_key);
_error = f.read();

View File

@ -7,6 +7,7 @@
#define REFF_NUMPART "NUMPART"
#define REFF_NRIGA "NRIGA"
#define REFF_NRATA "NRATA"
#define REFF_NRIGP "NRIGP"
#define REFF_PROVV "PROVV"
#define REFF_ANNODOC "ANNODOC"
#define REFF_CODNUM "CODNUM"

View File

@ -33,7 +33,6 @@ void TRelation_application::setkey()
file().setkey(1);
}
void TRelation_application::set_key_filter()
{
TString rf = get_user_read_filter(); rf.trim();

View File

@ -1434,6 +1434,7 @@ TRecnotype TCursor::operator =(const TRecnotype pos)
CHECKD(pos >= 0 && pos <= _totrec, "Bad cursor position : ", pos);
_pos = pos;
readrec();
return _pos;
}

View File

@ -16,9 +16,10 @@ class TStack : public TObject
// @access:(INTERNAL) Private Member
{
protected:
protected:
// @cmember:(INTERNAL) Dati dello stack
TArray _data;
// @cmember:(INTERNAL) Puntatore alla cima dello stack
int _sp;

View File

@ -97,7 +97,12 @@ void TString512::strncpy(const char* s, int n)
#endif
}
HIDDEN TString512 _spark;
#ifdef FOXPRO
HIDDEN TString512 spark;
#else
HIDDEN TString512* ptr_spark = new TString512;
HIDDEN TString512& spark = *ptr_spark;
#endif
inline bool is_space(char c)
{ return c >= '\t' && c <= ' '; }
@ -1362,6 +1367,14 @@ TToken_string::TToken_string(const TToken_string& s)
CHECK(_separator, "NULL TToken_string separator");
}
const TToken_string& TToken_string::operator =(const TToken_string& s)
{
set(s);
restart();
separator(separator());
return *this;
}
void TToken_string::separator(char s)
{
CHECK(s, "NULL TToken_string separator");
@ -1741,7 +1754,7 @@ TAuto_token_string& TAuto_token_string::create(const char* ts)
set(ts);
// Calcola il separatore
for (const char* s = ts; *s; s++)
for (const char* s = ts; s && *s; s++)
{
if (strchr("\t\n^;,!&+", *s) != NULL)
{
@ -1770,15 +1783,16 @@ const TString& TParagraph_string::operator =(const char* s)
void TParagraph_string::tokenize()
{
int last_space = 0, last_start = 0;
int last_space = -1, last_start = 0;
int num_chars = 0;
const int l = len();
TString stmp,sstr(_str),swork; // stringhe di lavoro
TString stmp,swork; // stringhe di lavoro
for (int start = 0; start < l;)
{
switch (_str[start])
{
case '\r':
case '\n': last_space = start; num_chars = _width; break;
case ' ' : last_space = start; num_chars++; break;
default : num_chars++; break;
@ -1788,9 +1802,8 @@ void TParagraph_string::tokenize()
{
int num_of_chars_in_row = (last_space+1) - last_start;
if (num_of_chars_in_row <= 0) num_of_chars_in_row = _width; // Se non ci sono spazi tronca la stringa a 25
swork=sstr.mid(last_start,num_of_chars_in_row);
stmp << swork.trim();
stmp << "|";
swork = mid(last_start,num_of_chars_in_row);
stmp << swork.trim(); stmp << '|';
last_space = num_chars = 0;
// start = start - (_width - num_of_chars_in_row); // riporta indietro (toglie il numero di caratteri effettivi della riga)
start = last_start + num_of_chars_in_row;
@ -1799,10 +1812,10 @@ void TParagraph_string::tokenize()
else
start++;
}
swork=sstr.mid(last_start,l-last_start);
swork=mid(last_start,l-last_start);
swork.trim();
stmp << swork;
if (stmp.empty()) stmp = sstr;
if (stmp.empty()) stmp = _str;
TToken_string::operator=(stmp);
}

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