Merge remote-tracking branch 'origin/R_10_00' into R_10_00

This commit is contained in:
Simone Palacino 2020-05-28 16:33:37 +02:00
commit 344b79eb39
25 changed files with 303 additions and 117 deletions

4
cd/test/ba0964.txt Normal file
View File

@ -0,0 +1,4 @@
recdesc\f154.trr
recdesc\f154.dir
Aggiornato tracciato lettere d'intento (sul repository mancavano campi)

32
cd/test/ba0964a.ini Normal file
View File

@ -0,0 +1,32 @@
[Main]
Demo=0
[ba0]
File(219) = recdesc\f154.dir|X
File(220) = recdesc\f154.trr|X
Patch = 0964
Versione = 21511200
[ba99]
Kill(0) = wxmsw240.dll|x
Kill(1) = batbsce.txt|x
Kill(2) = bastfsc.rep|x
Kill(3) = bastfsc.msk|x
Kill(4) = bastcms.msk|x
Kill(5) = bastcms.rep|x
Kill(6) = bastuue.rep|x
Kill(7) = bastuue.msk|x
[ba]
Data = 25-05-2020
Descrizione = Base
Dischi = 1
Moduli = sy
OEM =
Patch = 964
PostProcess = bainst -0 BA
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/ba0964a1.zip Normal file

Binary file not shown.

5
cd/test/ce0962.txt Normal file
View File

@ -0,0 +1,5 @@
ce3.exe
ce3900a.rep
ce3900.msk
Aggiunto salto pagina opzionale nella stampa sintetica per categoria

23
cd/test/ce0962a.ini Normal file
View File

@ -0,0 +1,23 @@
[Main]
Demo=0
[ce3]
File(30) = ce3.exe|X
File(47) = ce3900.msk|X
File(48) = ce3900a.rep|X
Patch = 0962
Versione = 21511200
[ce]
Data = 25-05-2020
Descrizione = Cespiti
Dischi = 1
Moduli = ba,cg
OEM =
Patch = 962
PostProcess = bainst -0 CE
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/ce0962a1.zip Normal file

Binary file not shown.

3
cd/test/ef0962.txt Normal file
View File

@ -0,0 +1,3 @@
ef0.exe
Svuotata la descrizione riga degli abbuoni nei movimenti contabili generati dalle distinte

28
cd/test/ef0962a.ini Normal file
View File

@ -0,0 +1,28 @@
[Main]
Demo=0
[ef0]
Edit_163 = ef0 -1
Edit_5 = ef0 -6
File(0) = ef0.exe|X
Patch = 0962
Versione = 21511200
[ef99]
Kill(0) = eftbbnp.msk|x
Kill(1) = efstbnp.msk|x
Kill(2) = efstbnp.rep|x
[ef]
Data = 25-05-2020
Descrizione = Effetti
Dischi = 1
Moduli = ve
OEM =
Patch = 962
PostProcess = bainst -0 EF
PreProcess =
Prezzo(1) =
Prezzo(2) =
Versione = 21511200

BIN
cd/test/ef0962a1.zip Normal file

Binary file not shown.

View File

@ -1,3 +1,3 @@
154
0
$letint|91|91|114|0|Lettere d'intento|||
$letint|0|0|114|0|Lettere d'intento|||

View File

@ -51,8 +51,8 @@ protected: // Relapp
virtual int read(TMask& m);
protected:
void check_registers(int year);
void init_array(TMask& m, bool update);
void check_registers(int year, bool verbose = true);
void init_array(TSheet_field& sf);
static bool sheet_action(TSheet_field& s, int r, KEY k);
public:
@ -148,7 +148,7 @@ bool TParaliq_app::credpreccost_handler(TMask_field& f, KEY k)
return true;
}
void TParaliq_app::check_registers(int year)
void TParaliq_app::check_registers(int year, bool verbose)
{
// controlla che per ogni data attività esistano almeno un registro
// acquisti, vendite e giornale; warning appropriato in caso negativo
@ -185,7 +185,7 @@ void TParaliq_app::check_registers(int year)
break;
}
}
if (flags < R_ALL)
if (verbose && flags < R_ALL)
{
TString wrn(TR("I seguenti registri non esistono per l'attività "));
wrn << att << "(" << year << "):";
@ -193,38 +193,41 @@ void TParaliq_app::check_registers(int year)
if ((flags & R_ACQ) == 0x00) wrn << TR("\n\tregistro acquisti");
warning_box(wrn);
}
}
}
}
void TParaliq_app::init_array(TMask& m, bool update)
void TParaliq_app::init_array(TSheet_field& sf)
{
TSheet_field& sf = m.sfield(F_SHEET_PLA);
const long newditta = m.get_long(F_CODDITTA);
TRelation att(LF_ATTIV);
TRectype & r = att.curr();
TRectype r(LF_ATTIV);
r.put(ATT_CODDITTA, newditta);
r.put(ATT_CODDITTA, sf.mask().get_long(F_CODDITTA));
TCursor cur(&att, "", 1, &r, &r);
TCursor cur(new TRelation(LF_ATTIV), "", 1, &r, &r);
const TRecnotype items = cur.items();
int i = 0;
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur, i++)
{
TToken_string& tt = sf.row(i);
// istanzia array _atts on le attività della ditta corrente
tt = r.get(ATT_CODATT);
tt.add(r.get(ATT_TIPOATT));
}
if (update)
for (cur = 0L; cur.pos() < items; ++cur)
{
sf.force_update();
const TString& freq = cache().get(LF_NDITTE,newditta,NDT_FREQVIVA);
m.set(F_FREQ_VERS, freq);
}
const TString8 codatt = cur.curr().get(ATT_CODATT);
bool found = false;
int j = -1;
for (int i = 0; j < 0 && !found && i < sf.items(); i++) // Cerca riga corrispondente sullo sheet
{
const TString & row_codatt = sf.row(i).get(0);
if (codatt == row_codatt)
found = true;
else
if (codatt < row_codatt)
j = i;
}
if (!found)
{
j = sf.insert(j);
sf.set_row_cell(F_CODATT, cur.curr().get(ATT_CODATT), j);
sf.set_row_cell(F_TIPOATT, cur.curr().get(ATT_TIPOATT), j);
}
}
}
void TParaliq_app::on_config_change()
@ -257,10 +260,41 @@ bool TParaliq_app::user_destroy()
return true;
}
bool exist_reg(const char * att, int year)
{
TRelation reg("REG");
TRectype & r = reg.curr();
TString filter;
filter.format("(S8==\"\")||(S8==\"%s\")", (const char *)att);
r.put("CODTAB", year);
TCursor cur(& reg, filter, 1, &r, &r);
return cur.items() > 0;
}
bool TParaliq_app::sheet_action(TSheet_field& s, int r, KEY k)
{
// non si possono cancellare o aggiungere righe in PLA
return (k != K_DEL && k != K_INS);
switch (k)
{
case K_DEL :
{
const int year = s.mask().get_int(F_YEAR);
const TString & att = s.row(s.selected()).get(F_CODATT);
if (exist_reg(att, year))
return error_box(TR("Esiste almeno un registro su questa attività"));
}
break;
case K_SHIFT + K_INS:
app().init_array(s);
s.force_update();
return false;
break;
}
return true;
}
void TParaliq_app::init_query_mode(TMask& m)
@ -271,8 +305,8 @@ void TParaliq_app::init_query_mode(TMask& m)
void TParaliq_app::init_insert_mode(TMask& m)
{
// Inizializza array delle attività
init_array(m, true);
// Inizializza array delle attività
init_array(m.sfield(F_SHEET_PLA));
m.set(F_ROUNDLIQ, TCurrency::get_firm_dec());
}
@ -292,9 +326,8 @@ int TParaliq_app::rewrite(const TMask& m)
for (int i = 0; err == NOERR && i < sf.items(); i++)
{
TToken_string& tt = sf.row(i);
const TString16 att = tt.get(0);
const TString16 tips = tt.get(1);
const TString16 att = sf.get_str_row_cell(i, F_CODATT);
const TString16 tips = sf.get_str_row_cell(i, F_TIPOATT);
TString16 codtab;
codtab.format("%05ld%4d%s", firm, year, (const char*)att);
@ -313,15 +346,13 @@ int TParaliq_app::rewrite(const TMask& m)
real es_a9 = pla.get_real("R7");
pla.put("CODTAB", codtab);
// scrive i campi (vedi a read() per i nomi)
// in base alla riga sheet
pla.put("S7", tips); // tipo attività
pla.put("R8", tt.get()); // prorata
pla.put("R5", tt.get()); // plafond art. 8
pla.put("R6", tt.get()); // plafond art. 8bis
pla.put("R7", tt.get()); // plafond art. 9
pla.put("R8", sf.get_str_row_cell(i, F_PRORATA)); // prorata
pla.put("R5", sf.get_str_row_cell(i, F_P8)); // plafond art. 8
pla.put("R6", sf.get_str_row_cell(i, F_P8B)); // plafond art. 8bis
pla.put("R7", sf.get_str_row_cell(i, F_P9)); // plafond art. 9
err = (was ? pla.rewrite() : pla.write());
err = pla.rewrite_write();
// se si e' cambiato qualcosa..
if ((prorata != pla.get_real("R8")) ||
@ -339,24 +370,40 @@ int TParaliq_app::rewrite(const TMask& m)
TCursor cur(&rellim, "", 1, &lim, &lim);
const TRecnotype items = cur.items();
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
// const int mese = atoi(lim.get("CODTAB").mid(4,2)); chiedere a cinzia
// if (freq == 'M' || (freq == 'T' && mese == 3))
// {
rellim.lfile().reread(_lock);
lim.zero("B0");
rellim.rewrite();
// break;
// }
}
}
}
TTable& lia = (TTable&)_rel->lfile();
TString16 ct; ct.format("%05ld%04d", firm, year);
lia.put("CODTAB", ct);
TRelation relpla(TAB_PLA);
TRectype & pla = relpla.curr();
TArray rec_to_delete;
pla.put("CODTAB", format("%05ld%4d", firm, year));
TCursor cur(&relpla, "", 1, &pla, &pla);
const TRecnotype items = cur.items();
for (cur = 0L; cur.pos() < items; ++cur)
{
const TString8 codatt = cur.curr().get("CODTAB").mid(9, 5);
bool found = false;
for (int i = 0; !found && i < sf.items(); i++)
found = codatt == sf.get_str_row_cell(i, F_CODATT);
if (!found)
rec_to_delete.add(cur.curr());
}
FOR_EACH_ARRAY_ITEM(rec_to_delete, r, obj)
((TRectype *)obj)->remove(cur.file());
TTable& lia = (TTable&)_rel->lfile();
lia.put("CODTAB", format("%05ld%04d", firm, year));
was = lia.read() == NOERR;
if (!was) lia.zero();
m.autosave(*_rel);
@ -392,34 +439,29 @@ int TParaliq_app::read(TMask& m)
const long firm = m.get_long(F_CODDITTA);
const int year = m.get_int(F_YEAR);
TSheet_field& sf = m.sfield(F_SHEET_PLA);
TString16 ctab;
TToken_string tt(80);
TRelation relpla(TAB_PLA);
TRectype & pla = relpla.curr();
ctab.format("%05ld%4d", firm, year);
pla.put("CODTAB", ctab);
pla.put("CODTAB", format("%05ld%4d", firm, year));
TCursor cur(&relpla, "", 1, &pla, &pla);
const TRecnotype items = cur.items();
init_array(m, false); // Carica tutti i codici attività
cur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
tt = pla.get("CODTAB").mid(9,5); // codice attività
int i;
for (i = 0; i < sf.items(); i++) // Cerca riga corrispondente sullo sheet
if (tt == sf.row(i).get(0)) break;
tt.add(pla.get("S7")); // tipo attività
tt.add(pla.get("R8")); // prorata
tt.add(pla.get("R5")); // plafond art. 8
tt.add(pla.get("R6")); // plafond art. 8bis
tt.add(pla.get("R7")); // plafond art. 9
sf.row(i) = tt;
}
sf.destroy();
if (items == 0)
init_array(sf); // Carica tutti i codici attività
else
for (cur = 0L; cur.pos() < items; ++cur)
{
const int nrow = sf.set_row_cell(F_CODATT, pla.get("CODTAB").mid(9,5)); // codice attività
sf.set_row_cell(F_TIPOATT, pla.get("S7"), nrow); // tipo attività
sf.set_row_cell(F_PRORATA, pla.get("R8"), nrow); // prorata
sf.set_row_cell(F_P8, pla.get("R5"), nrow); // plafond art. 8
sf.set_row_cell(F_P8B, pla.get("R6"), nrow); // plafond art. 8bis
sf.set_row_cell(F_P9, pla.get("R7"), nrow); // plafond art. 9
}
return NOERR;
}
@ -430,20 +472,3 @@ int cg5300(int argc, char* argv[])
a.run(argc, argv, TR("Parametri liquidazione"));
return 0;
}

View File

@ -310,18 +310,24 @@ TOOLBAR "topbar" 0 0 0 2
BUTTON DLG_OK 9 2
BEGIN
PROMPT -13 -1 ""
PROMPT -14 -1 ""
END
BUTTON DLG_NULL 9 2
BEGIN
PROMPT -23 -1 "Azzera"
PROMPT -24 -1 "Azzera"
MESSAGE RESET,1@
END
BUTTON DLG_DELREC 9 2
BEGIN
PROMPT -34 -1 "Elimina"
MESSAGE EXIT,K_DEL
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -33 -1 ""
PROMPT -34 -1 ""
END
ENDPAGE

View File

@ -1170,7 +1170,12 @@ bool TAlex_virtual_machine::execute(const TBytecode& bc)
bool TAlex_virtual_machine::compile(const char* cmd, TBytecode& bc)
{
#ifdef LINUX
string s(cmd);
istringstream instr(s);
#else
istrstream instr((const char*)cmd, strlen(cmd));
#endif
return compile(instr, bc);
}

View File

@ -245,12 +245,14 @@ public:
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
TToken_string& row(int n)
{ return (TToken_string&)operator[](n); }
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
const TToken_string& row(int n) const
{ return (const TToken_string&)operator[](n); }
// @cmember Restituisce il puntatore alla stringa n dell'array (NULL se non esiste)
TToken_string* rowptr(int n)
{ return (TToken_string*)objptr(n); }
// @cmember Ritorna la stringa n dell'array (se non c'e' ritorna errore)
TToken_string& operator[] (int n) const { return (TToken_string&)TArray::operator[](n); }
// @cmember assegnamento di un array
const TString_array& operator=(const TString_array& a);
// @cmember Aggiunge una Token string all'array (chiama <mf TArray::add>)

View File

@ -204,7 +204,7 @@ TBrowse::TBrowse(TEdit_field* f, TRelation* r, int key, const char* filter, cons
_relation(r), _filter(filter), _secondary(false), _alt_browse(NULL),
_custom_filter_handler(NULL)
{
if (*orderby && *orderby)
if (orderby && *orderby)
_cursor = new TSorted_cursor(r, orderby, "", key);
else
_cursor = new TCursor (r, "", key);
@ -558,7 +558,25 @@ const char* TBrowse::get_input_field_names() const
void TBrowse::add_input_field(const char * id, const char * name, const int pos, bool select)
{
TString strid(id) ;
TString strid(id);
if (select)
strid << '@';
if (pos < 0 || pos >= _items.items())
{
_inp_id.add(strid);
_inp_fn.add(name);
}
else
{
_inp_id.insert_at(strid, pos);
_inp_fn.insert_at(name, pos);
}
}
void TBrowse::add_input_field(short id, const char * name, const int pos, bool select)
{
TString strid; strid << id;
if (select)
strid << '@';
@ -653,6 +671,22 @@ void TBrowse::add_output_field(const char * id, const char * name, const int pos
}
}
void TBrowse::add_output_field(short id, const char * name, const int pos)
{
TString strid; strid << id;
if (pos < 0 || pos >= _items.items())
{
_out_id.add(strid);
_out_fn.add(name);
}
else
{
_out_id.insert_at(strid, pos);
_out_fn.insert_at(name, pos);
}
}
void TBrowse::remove_output_field(const int pos)
{
if (pos < 0)

View File

@ -179,8 +179,10 @@ public:
// @cmember Aggiorna la lista completa dei nomi dei campi di input
void set_input_field_names(const char * inp_names) { _inp_fn = inp_names;}
// @cmember Aggiunge un campo di input alla posizione <pos>
void add_input_field(const char * id, const char * name, const int pos = - 1, bool select = false);
// @cmember Aggiunge un campo di input alla posizione <pos>
void add_input_field(const char * id, const char * name, const int pos = -1, bool select = false);
// @cmember Aggiunge un campo di input alla posizione <pos>
void add_input_field(short id, const char * name, const int pos = -1, bool select = false);
// @cmember Elimina un campo di display alla posizione <pos>
void remove_display_field(const int pos = -1);
@ -221,6 +223,8 @@ public:
// @cmember Aggiunge un campo di output alla posizione <pos>
void add_output_field(const char * id, const char * name, const int pos = -1);
// @cmember Aggiunge un campo di output alla posizione <pos>
void add_output_field(short id, const char * name, const int pos = -1);
// @cmember Elimina un campo di output alla posizione <pos>
void remove_output_field(const int pos = -1);

View File

@ -296,6 +296,6 @@ const TDate& fnc_max(const TDate& a, const TDate& b);
const char* itom(int month);
const char* itow(int dayofweek);
const TDate botime(0,0,0), eotime(31,12,3000);
const TDate botime(0,0,0), eotime(31,12,3000), nulldate(NULLDATE);
#endif // __DATE_H

View File

@ -104,7 +104,7 @@
#define DOC_NOINVIOSDI "NOINVIOSDI"
// Virtuali
#define DOC_PLAFOND "PLAFOND"
// modulo pe
#define DOC_SPESEUPD "SPESEUPD"
#define DOC_USEK "USEK"

View File

@ -2874,9 +2874,8 @@ bool TEdit_field::check(CheckTime t)
void TEdit_field::set_query_button(TBrowse_button * brw)
{
if (_browse)
delete _browse;
_browse=brw;
safe_delete(_browse);
_browse = brw;
}
// @doc EXTERNAL

View File

@ -1371,7 +1371,8 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
}
}
else
add_row_auto();
if (notify(_cur_rec, K_SHIFT + K_INS))
add_row_auto();
}
break;
case XIE_SELECT:
@ -1754,6 +1755,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
notify(_cur_rec, K_DEL))
{
int rec = _cur_rec;
_row_dirty = _cell_dirty = false;
destroy(rec);
if (rec < items())
@ -1771,9 +1773,14 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
}
break;
case K_CTRL + '+': // ********* insert line
add_row_auto();
refused = true;
break;
{
int rec = _cur_rec;
if (notify(rec, K_SHIFT + K_INS))
add_row_auto();
refused = true;
}
break;
case K_CTRL + 'A':
{
_check_enabled = false;
@ -3681,7 +3688,10 @@ bool TSheet_field::on_key(KEY k)
if (k == K_CTRL+'+')
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;
s->add_row_auto();
int rec = s->_cur_rec;
if (s->notify(rec, K_SHIFT + K_INS))
s->add_row_auto();
return true;
}

View File

@ -368,7 +368,12 @@ bool TPostman::dispatch_transaction(const TRectype& rec,
TSocketClient socket;
char * buf = new char[1024 * 256];
#ifdef WIN32
ostrstream stream(buf, 1024 * 256);
#else
ostringstream stream(buf);
#endif
bool ok = true;
item.SetTag("m:CampoTransaction");

View File

@ -495,7 +495,7 @@ const TFilename& TFile_info::load_filedes()
{
_dir = _filedes.SysName[0] != '$' ? _comdir : _nordir;
_name = CAddPref(_filedes.SysName);
strncpy(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
strncpy_s(_filedes.Des, dictionary_translate(_filedes.Des), sizeof(_filedes.Des)-1);
}
else
_name.cut(0);
@ -534,7 +534,7 @@ TFile_info::TFile_info(int logicnum, TFilename& name)
int err = DB_recinfo(_name, &_filedes, (RecDes*)&rec.rec(), keys.get_buffer());
if (err == NOERR && prefix().add_recdes(logicnum, rec, keys))
{
strncpy(_filedes.SysName, _name, sizeof(_filedes.SysName));
strncpy_s(_filedes.SysName, _name, sizeof(_filedes.SysName));
_filedes.SysName[41] = '\0';
}
else
@ -1036,7 +1036,7 @@ void TPrefix::set(
{
const TString saved_prf = __ptprf; // Salvo __ptprf che viene cambiato da CGetPref
char* prfx = (char*)CGetPref(); // Safe non const cast for StPath cprefix
strcpy(__ptprf, saved_prf);
strcpy_s(__ptprf, saved_prf);
xvt_fsys_build_pathname(prfx, NULL, __ptprf, _prefix, NULL, NULL);
}
else
@ -1168,7 +1168,7 @@ bool TPrefix::set_studio(const char* study, long ditta)
const TString old_firm(_prefix);
strcpy_s(__ptprf, sizeof(__ptprf), study);
const word len = strlen(__ptprf);
const word len = (word) strlen(__ptprf);
if (len > 0 && __ptprf[len-1] != '\\' && __ptprf[len-1] != '/')
{
__ptprf[len] = SLASH;

View File

@ -19,7 +19,7 @@ word TIndwin::measure_text(TToken_string& s, word& maxlen) const
word lines = 0;
FOR_EACH_TOKEN(s, t)
{
const word l = strlen(t);
const word l = (word) strlen(t);
if (l > maxlen) maxlen = l;
lines++;
}

View File

@ -444,7 +444,7 @@ void TPrint_preview_window::page_select()
_page = m.get_int(101);
if (_page < 1) _page = 1;
if (_page > _book->pages())
_page = _book->pages();
_page = (word)_book->pages();
}
}
@ -533,8 +533,8 @@ long TPrint_preview_window::handler(WINDOW win, EVENT* ep)
if (processed) _page++;
break;
case POPUP_LAST :
processed = _page < _book->pages();
if (processed) _page = _book->pages();
processed = _page < (word) _book->pages();
if (processed) _page = (word) _book->pages();
break;
case POPUP_ZOOMIN : if (_zoom < SCREENDPI*4) { _zoom += SCREENDPI/8; update_scroll_range(); } break;
case POPUP_ZOOMOUT: if (_zoom > SCREENDPI/4) { _zoom -= SCREENDPI/8; update_scroll_range(); } break;
@ -2452,7 +2452,7 @@ bool TReport_book::open_page()
if (!TBook::open_page())
return false;
_report->set_page(++_rep_page, page());
_report->set_page((word) ++_rep_page, (word) page());
_page_break_allowed = false;
_delta.reset();

View File

@ -24,7 +24,8 @@ bool sirio_codesigning(const TFilename& filename, bool verify = false);
#define SIRIOSIGN(filename) sirio_codesigning((const TFilename&)((filename)), false)
#define SIRIOSIGN_VERIFY(filename) sirio_codesigning((const TFilename&)((filename)), true)
template<typename T> void safe_delete(T*& a) {
template<typename T> void safe_delete(T*& a)
{
delete a;
a = nullptr;
}