Patch level : 10.0 308
Files correlati : cg3 Ricompilazione Demo : [ ] Commento : 0001299: richiamo registrazioni da mastrini Se richiamo le registrazioni contabili da mastrini, la prima volta funziona, dalla seconda il prgramma sembra bloccarsi, nel task manager ci sono aperi 2 volte il cg2.exe ed una volta il cg3. git-svn-id: svn://10.65.10.50/trunk@18900 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
01e68ca1b1
commit
4b21725834
@ -155,18 +155,13 @@ const TString& TCausale::tipodoc() const
|
|||||||
|
|
||||||
bool TCausale::saldaconto(const TDate& datareg) const
|
bool TCausale::saldaconto(const TDate& datareg) const
|
||||||
{
|
{
|
||||||
static TDate _data_sal(8,8,3);
|
bool yes = tipomov() > 0;
|
||||||
if (datareg.ok())
|
if (yes && datareg.ok())
|
||||||
{
|
{
|
||||||
if (_data_sal.year() == 3)
|
static TDate _data_sal = ini_get_string(CONFIG_DITTA, "cg", "DatSal");
|
||||||
{
|
yes = datareg >= _data_sal;
|
||||||
TConfig cfg(CONFIG_DITTA, "cg");
|
|
||||||
_data_sal = TDate(cfg.get("DatSal"));
|
|
||||||
}
|
|
||||||
if (datareg < _data_sal)
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return tipomov() > 0;
|
return yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TCausale::link_m770() const
|
int TCausale::link_m770() const
|
||||||
@ -278,7 +273,7 @@ const TString& TCausale::compatible(const TCausale& c) const
|
|||||||
if (tipomov() != c.tipomov())
|
if (tipomov() != c.tipomov())
|
||||||
err = TR("il tipo di movimento");
|
err = TR("il tipo di movimento");
|
||||||
|
|
||||||
if (err != NULL)
|
if (err != NULL)
|
||||||
{
|
{
|
||||||
TString& msg = get_tmp_string();
|
TString& msg = get_tmp_string();
|
||||||
msg.format(FR("La causale e' incompatibile per %s"), err);
|
msg.format(FR("La causale e' incompatibile per %s"), err);
|
||||||
|
242
cg/cg3600.cpp
242
cg/cg3600.cpp
@ -1,12 +1,11 @@
|
|||||||
#include <xinclude.h>
|
#include <xinclude.h>
|
||||||
|
|
||||||
#include "cg3.h"
|
#include "cg3.h"
|
||||||
#include "cglib01.h"
|
|
||||||
#include "cglib02.h"
|
#include "cglib02.h"
|
||||||
#include "cg3600.h"
|
#include "cg3600.h"
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <colors.h>
|
#include <colmask.h>
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
@ -14,7 +13,6 @@
|
|||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <varmask.h>
|
|
||||||
|
|
||||||
#include <causali.h>
|
#include <causali.h>
|
||||||
#include <mov.h>
|
#include <mov.h>
|
||||||
@ -73,7 +71,7 @@ enum tipo_riga_mastrino { riga_mastrino, riga_contropartita };
|
|||||||
class TRiga_mastrino : public TObject
|
class TRiga_mastrino : public TObject
|
||||||
{
|
{
|
||||||
tipo_riga_mastrino _type; // Tipo della riga
|
tipo_riga_mastrino _type; // Tipo della riga
|
||||||
TRecnotype _mov, _rmov; // Numero fisico di record movivento e riga movimento
|
TRecnotype _mov, _rmov; // Numero fisico di record movimento e riga movimento
|
||||||
real _dare, _avere; // Progressivi dare ed avere
|
real _dare, _avere; // Progressivi dare ed avere
|
||||||
TDate _data; // Data di registrazione (Ottimizzazione)
|
TDate _data; // Data di registrazione (Ottimizzazione)
|
||||||
|
|
||||||
@ -1543,200 +1541,26 @@ void TGrid_field::save_columns_order() const
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Maschere per colori
|
// Maschera per colori
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TRow_mask : public TMask
|
class TColor_mask : public TSelect_color_mask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void update();
|
void get_colors(COLOR& mb, COLOR& mf, COLOR& cb, COLOR& cf);
|
||||||
|
TColor_mask();
|
||||||
TRow_mask();
|
|
||||||
virtual ~TRow_mask() { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TColor_mask : public TVariable_mask
|
void TColor_mask::get_colors(COLOR& mb, COLOR& mf, COLOR& cb, COLOR& cf)
|
||||||
{
|
|
||||||
static TRow_mask* _sheet_mask;
|
|
||||||
static TMask* get_mask(int, TMask&) { return _sheet_mask; }
|
|
||||||
|
|
||||||
COLOR _mas_back, _mas_fore;
|
|
||||||
COLOR _con_back, _con_fore;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static bool color_handler(TMask_field& f, KEY k);
|
|
||||||
static bool reset_handler(TMask_field& f, KEY k);
|
|
||||||
|
|
||||||
void type2colors(char tipo, COLOR& back, COLOR& fore) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void get_cur_colors(COLOR& back, COLOR& fore) const;
|
|
||||||
void set_cur_colors(COLOR back, COLOR fore);
|
|
||||||
|
|
||||||
void get_colors(COLOR& mb, COLOR& mf, COLOR& cb, COLOR& cf) const;
|
|
||||||
|
|
||||||
TColor_mask(COLOR mb, COLOR mf, COLOR cb, COLOR cf);
|
|
||||||
virtual ~TColor_mask();
|
|
||||||
};
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// TRow_mask
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
TRow_mask* TColor_mask::_sheet_mask = NULL;
|
|
||||||
|
|
||||||
TRow_mask::TRow_mask() : TMask("cg2100k", 1)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void TRow_mask::update()
|
|
||||||
{
|
{
|
||||||
TSheet_field* s = get_sheet();
|
get_color("M", mb, mf);
|
||||||
TColor_mask& m = (TColor_mask&)s->mask();
|
get_color("C", cb, cf);
|
||||||
COLOR back, fore;
|
|
||||||
m.get_cur_colors(back, fore);
|
|
||||||
|
|
||||||
_pixmap = true;
|
|
||||||
set_pen(COLOR_BLACK);
|
|
||||||
|
|
||||||
RCT rct; field(100).get_rect(rct);
|
|
||||||
set_brush(back);
|
|
||||||
frame(rct.left, 2*rct.top - rct.bottom - CHARY/2, rct.right, rct.top - CHARY/2, 0);
|
|
||||||
|
|
||||||
field(99).get_rect(rct);
|
|
||||||
set_brush(fore);
|
|
||||||
frame(rct.left, 2*rct.top - rct.bottom - CHARY/2, rct.right, rct.top - CHARY/2, 0);
|
|
||||||
|
|
||||||
_pixmap = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
TColor_mask::TColor_mask() : TSelect_color_mask("cg3600b")
|
||||||
// TColor_mask
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void TColor_mask::type2colors(char tipo, COLOR& back, COLOR& fore) const
|
|
||||||
{
|
{
|
||||||
if (toupper(tipo) == 'M')
|
add_color_def("M", TR("Riga mastrino"), REQUIRED_BACK_COLOR, FOCUS_COLOR);
|
||||||
{
|
add_color_def("C", TR("Riga contropartita"), NORMAL_BACK_COLOR, NORMAL_COLOR);
|
||||||
back = _mas_back;
|
|
||||||
fore = _mas_fore;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
back = _con_back;
|
|
||||||
fore = _con_fore;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TColor_mask::get_cur_colors(COLOR& back, COLOR& fore) const
|
|
||||||
{
|
|
||||||
TSheet_field& s = (TSheet_field&)fld(0);
|
|
||||||
TToken_string& row = s.row(s.selected());
|
|
||||||
const char tipo = row[5];
|
|
||||||
type2colors(tipo, back, fore);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TColor_mask::set_cur_colors(COLOR back, COLOR fore)
|
|
||||||
{
|
|
||||||
TSheet_field& s = (TSheet_field&)fld(0);
|
|
||||||
const int cur = s.selected();
|
|
||||||
TToken_string& row = s.row(cur);
|
|
||||||
const char tipo = toupper(row[5]);
|
|
||||||
if (tipo == 'M')
|
|
||||||
{
|
|
||||||
_mas_back = back;
|
|
||||||
_mas_fore = fore;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_con_back = back;
|
|
||||||
_con_fore = fore;
|
|
||||||
}
|
|
||||||
s.set_back_and_fore_color(back, fore, cur);
|
|
||||||
s.force_update(cur);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TColor_mask::color_handler(TMask_field& f, KEY k)
|
|
||||||
{
|
|
||||||
if (k == K_SPACE)
|
|
||||||
{
|
|
||||||
TMask& m = f.mask();
|
|
||||||
TColor_mask& cm = (TColor_mask&)m.get_sheet()->mask();
|
|
||||||
|
|
||||||
COLOR back, fore;
|
|
||||||
cm.get_cur_colors(back, fore);
|
|
||||||
const bool use_back = f.dlg() == 100;
|
|
||||||
|
|
||||||
const COLOR col = choose_color(use_back ? back : fore, m.win());
|
|
||||||
if (col != COLOR_INVALID)
|
|
||||||
{
|
|
||||||
if (use_back)
|
|
||||||
back = col;
|
|
||||||
else
|
|
||||||
fore = col;
|
|
||||||
cm.set_cur_colors(back, fore);
|
|
||||||
cm._sheet_mask->update();
|
|
||||||
m.set_focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TColor_mask::reset_handler(TMask_field& f, KEY k)
|
|
||||||
{
|
|
||||||
if (k == K_SPACE && f.yesno_box(TR("Si desidera azzerare tutti i colori?")))
|
|
||||||
{
|
|
||||||
TColor_mask& m = (TColor_mask&) f.mask();
|
|
||||||
|
|
||||||
m._mas_back = NORMAL_BACK_COLOR;
|
|
||||||
m._mas_fore = NORMAL_COLOR;
|
|
||||||
m._con_back = NORMAL_BACK_COLOR;
|
|
||||||
m._con_fore = NORMAL_COLOR;
|
|
||||||
TSheet_field& s = (TSheet_field&)f.mask().field(101);
|
|
||||||
s.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, -1);
|
|
||||||
s.force_update();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TColor_mask::get_colors(COLOR& mb, COLOR& mf, COLOR& cb, COLOR& cf) const
|
|
||||||
{
|
|
||||||
mb = _mas_back;
|
|
||||||
mf = _mas_fore;
|
|
||||||
cb = _con_back;
|
|
||||||
cf = _con_fore;
|
|
||||||
}
|
|
||||||
|
|
||||||
TColor_mask::TColor_mask(COLOR mb, COLOR mf, COLOR cb, COLOR cf)
|
|
||||||
: TVariable_mask("cg2100k"),
|
|
||||||
_mas_back(mb), _mas_fore(mf), _con_back(cb), _con_fore(cf)
|
|
||||||
{
|
|
||||||
set_handler(102, reset_handler);
|
|
||||||
set_caption("Colori delle righe mastrini");
|
|
||||||
CHECK(_sheet_mask == NULL, "One color at time, please");
|
|
||||||
_sheet_mask = new TRow_mask;
|
|
||||||
_sheet_mask->set_handler(99, color_handler);
|
|
||||||
_sheet_mask->set_handler(100, color_handler);
|
|
||||||
|
|
||||||
TVariable_sheet_field& s = (TVariable_sheet_field&)fld(0);
|
|
||||||
s.set_getmask(get_mask);
|
|
||||||
|
|
||||||
const char* const tipi = "MC";
|
|
||||||
int row = 0;
|
|
||||||
for (const char* c = tipi; *c; c++)
|
|
||||||
{
|
|
||||||
COLOR back, fore;
|
|
||||||
type2colors(*c, back, fore);
|
|
||||||
TToken_string& riga = s.row(-1);
|
|
||||||
riga << TR("Riga ") << (*c == 'M' ? TR("mastrino") : TR("contropartita"));
|
|
||||||
s.set_back_and_fore_color(back, fore, row++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TColor_mask::~TColor_mask()
|
|
||||||
{
|
|
||||||
delete _sheet_mask;
|
|
||||||
_sheet_mask = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -1750,8 +1574,10 @@ class TMastrini_grid : public TGrid_field
|
|||||||
TDecoder _causali;
|
TDecoder _causali;
|
||||||
TEsercizi_contabili _esercizi;
|
TEsercizi_contabili _esercizi;
|
||||||
|
|
||||||
|
TColor_mask _colmsk;
|
||||||
COLOR _mas_back, _mas_fore;
|
COLOR _mas_back, _mas_fore;
|
||||||
COLOR _con_back, _con_fore;
|
COLOR _con_back, _con_fore;
|
||||||
|
bool _primanoting;
|
||||||
|
|
||||||
protected: // TGrid_field
|
protected: // TGrid_field
|
||||||
virtual bool on_record(long rec);
|
virtual bool on_record(long rec);
|
||||||
@ -1783,7 +1609,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
TMastrini_grid::TMastrini_grid(TMask* m)
|
TMastrini_grid::TMastrini_grid(TMask* m)
|
||||||
: TGrid_field(m), _causali(LF_CAUSALI, CAU_DESCR)
|
: TGrid_field(m), _causali(LF_CAUSALI, CAU_DESCR), _primanoting(false)
|
||||||
{
|
{
|
||||||
load_colors();
|
load_colors();
|
||||||
}
|
}
|
||||||
@ -2054,10 +1880,15 @@ void TMastrini_grid::on_grid_button()
|
|||||||
|
|
||||||
void TMastrini_grid::on_record_button(long rec)
|
void TMastrini_grid::on_record_button(long rec)
|
||||||
{
|
{
|
||||||
const TRectype& testata = _mastrino.testata(rec);
|
if (!_primanoting)
|
||||||
bool refresh = testata.edit();
|
{
|
||||||
if (refresh && yesno_box(TR("Si desidera aggiornare il mastrino?")))
|
_primanoting = true;
|
||||||
reread();
|
const TRectype& testata = _mastrino.testata(rec);
|
||||||
|
bool refresh = testata.edit();
|
||||||
|
if (refresh && yesno_box(TR("Si desidera aggiornare il mastrino?")))
|
||||||
|
reread();
|
||||||
|
_primanoting = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Posso ridimensionare solo le descrizioni, le altre devono rimanere fisse per
|
// Posso ridimensionare solo le descrizioni, le altre devono rimanere fisse per
|
||||||
@ -2117,30 +1948,13 @@ void TMastrini_grid::update_mask() const
|
|||||||
|
|
||||||
void TMastrini_grid::load_colors()
|
void TMastrini_grid::load_colors()
|
||||||
{
|
{
|
||||||
TConfig conf(CONFIG_GUI, "cg3600b");
|
_colmsk.get_colors(_mas_back, _mas_fore, _con_back, _con_fore);
|
||||||
_mas_back = conf.get_color("ColorMB", NULL, -1, REQUIRED_BACK_COLOR);
|
|
||||||
_mas_fore = conf.get_color("ColorMF", NULL, -1, FOCUS_COLOR);
|
|
||||||
_con_back = conf.get_color("ColorCB", NULL, -1, NORMAL_BACK_COLOR);
|
|
||||||
_con_fore = conf.get_color("ColorCF", NULL, -1, NORMAL_COLOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TMastrini_grid::save_colors()
|
|
||||||
{
|
|
||||||
TConfig conf(CONFIG_GUI, "cg3600b");
|
|
||||||
conf.set_color("ColorMB", _mas_back);
|
|
||||||
conf.set_color("ColorMF", _mas_fore);
|
|
||||||
conf.set_color("ColorCB", _con_back);
|
|
||||||
conf.set_color("ColorCF", _con_fore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMastrini_grid::set_colors()
|
void TMastrini_grid::set_colors()
|
||||||
{
|
{
|
||||||
TColor_mask m(_mas_back, _mas_fore, _con_back, _con_fore);
|
if (_colmsk.run() == K_ENTER)
|
||||||
if (m.run() == K_ENTER)
|
load_colors();
|
||||||
{
|
|
||||||
m.get_colors(_mas_back, _mas_fore, _con_back, _con_fore);
|
|
||||||
save_colors();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -16,7 +16,7 @@ END
|
|||||||
BUTTON DLG_CONFIG 10 2
|
BUTTON DLG_CONFIG 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -25 -11 "Opzioni"
|
PROMPT -25 -11 "Opzioni"
|
||||||
PICTURE TOOL_PRPERTIES
|
PICTURE TOOL_CONFIG
|
||||||
END
|
END
|
||||||
|
|
||||||
#include <helpbar.h>
|
#include <helpbar.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user