Patch level : xx.888

Files correlati     : no patch
Ricompilazione Demo : [ ]
Commento            : Riportata la versione 01.05 patch 888 sul main trunk


git-svn-id: svn://10.65.10.50/trunk@9217 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2000-10-03 13:45:12 +00:00
parent d41a2da1e2
commit b3cd9c64a9
297 changed files with 12417 additions and 6547 deletions

View File

@ -1302,8 +1302,15 @@ bool TMenu_application::check_user()
#endif #endif
TLocalisamfile users(LF_USER); TLocalisamfile users(LF_USER);
TString pwd;
// Se i dati sono gia' convertiti aggiunge filtro sui gruppi
if (users.curr().exist("ISGROUP"))
{
TEdit_field& e = m.efield(F_USER);
e.browse()->set_filter("ISGROUP!=\"X\"");
}
TString pwd;
bool ok = FALSE; bool ok = FALSE;
for (int i = 0 ; i < 3 && !ok; i++) for (int i = 0 ; i < 3 && !ok; i++)
{ {

View File

@ -42,6 +42,7 @@ class TManutenzione_app : public TApplication
long _level; long _level;
long _history_firm; long _history_firm;
TRec_sheet* _rec; TRec_sheet* _rec;
FILE * _log;
protected: protected:
virtual bool menu (MENU_TAG); virtual bool menu (MENU_TAG);
@ -65,6 +66,11 @@ protected:
void put_history(const char* firm); void put_history(const char* firm);
void close_history(); void close_history();
void dump_trc(const char * dir, const bool des_too, const long modules); void dump_trc(const char * dir, const bool des_too, const long modules);
void repair_file(int i);
void open_log();
void write_log(const char * line);
void close_log();
void save_file(const char * file);
public: public:
@ -371,6 +377,51 @@ bool TManutenzione_app::destroy() // releasev e arrmask
} }
void TManutenzione_app::open_log()
{
TFilename log;
log << firm2dir(0L) << '/' << "conv.log";
_log = fopen(log,"a");
if (_log == NULL)
fatal_box("Non posso aprire il file di log della conversione(%s)", (const char *) log);
}
void TManutenzione_app::save_file(const char * file)
{
TFilename n(file);
const TFilename source_path(n.path());
TFilename dest_path(source_path);
n.ext("*");
TString_array files_to_copy;
list_files(n, files_to_copy);
dest_path << "sav";
if (!dest_path.exist())
make_dir(dest_path);
FOR_EACH_ARRAY_ROW_BACK(files_to_copy, row, fname)
{
TFilename source_file(*fname);
TFilename dest_file(dest_path); dest_file << '/' << (const char *) source_file.name();
fcopy((const char *) source_file, dest_file);
}
}
void TManutenzione_app::write_log(const char * line)
{
fprintf(_log,"%s\n", line);
}
void TManutenzione_app::close_log()
{
fclose(_log);
}
void TManutenzione_app::insert_riga (long riga_sel, TToken_string& riga) void TManutenzione_app::insert_riga (long riga_sel, TToken_string& riga)
{ {
const int logicnum = int(riga_sel) + 1; const int logicnum = int(riga_sel) + 1;
@ -722,7 +773,7 @@ void TManutenzione_app::delete_riga ()
r.put(logicnum); r.put(logicnum);
} }
bool TManutenzione_app::recover(TSystemisamfile& f, int err) ool TManutenzione_app::recover(TSystemisamfile& f, int err)
{ {
if (err == -60 || err == -64 || err == _ispatherr || if (err == -60 || err == -64 || err == _ispatherr ||
(err > -600 && err <= -300)) (err > -600 && err <= -300))
@ -732,6 +783,46 @@ bool TManutenzione_app::recover(TSystemisamfile& f, int err)
return err == NOERR; return err == NOERR;
} }
void TManutenzione_app::repair_file(int i)
{
TDir d;
TString80 s;
d.get(i, _nolock, _nordir, _sysdirop);
if (d.eod() == 0)
{
TFilename n(d.filename());
save_file(n);
remove(n);
n.ext("cdx"); remove(n);
n.ext("fpt"); remove(n);
s.format("File n. %d - %s : eliminato file errato", i, (const char *)d.filename());
write_log(s);
}
else
{
d.get(i, _lock, _nordir, _sysdirop);
TFilename n(d.filename());
save_file(n);
TExternisamfile ef(d.filename());
const RecDes* rd = ef.curr().rec_des();
TTrec rec; rec.get(i);
const int oldreclen = rec.len();
const int recsize = sizeof(RecDes);
memcpy(rec.rec(), rd, recsize);
rec.put(i);
const int reclen = rec.len();
d.set_len(reclen);
d.put(i, _nordir, _sysdirop);
s.format("File n. %d - %s : corretto tracciato da %d a %d bytes", i, (const char *)d.filename(), oldreclen, reclen);
write_log(s);
}
}
void TManutenzione_app::update_dir() void TManutenzione_app::update_dir()
{ {
// Particolare significato dei flags oltre i 10000: // Particolare significato dei flags oltre i 10000:
@ -806,6 +897,22 @@ void TManutenzione_app::update_dir()
} }
} }
else else
{
if (is_com)
{
if (old_is_firm && !movable_file(i) && d.eod() == 0L)
{
TString80 s;
TFilename n(d.filename());
save_file(n);
remove(n);
n.ext("cdx"); remove(n);
n.ext("fpt"); remove(n);
s.format("File n. %d - %s : eliminato file non utilizzato", i, (const char *)d.filename());
write_log(s);
}
}
if (i > 2 && is_firm == old_is_firm) if (i > 2 && is_firm == old_is_firm)
{ {
FILE * f = fopen(fs, "r"); FILE * f = fopen(fs, "r");
@ -815,7 +922,7 @@ void TManutenzione_app::update_dir()
const long size = ftell(f); const long size = ftell(f);
fclose(f); fclose(f);
if (size > 0L && d.len() > 0) if (flags < 10000L && size > 0L && d.len() > 0)
{ {
TSystemisamfile b(i); TSystemisamfile b(i);
int err = b.is_valid(); int err = b.is_valid();
@ -830,17 +937,19 @@ void TManutenzione_app::update_dir()
} }
if (err != NOERR && flags < 10000L) if (err != NOERR && flags < 10000L)
{ {
KEY k = yesnocancel_box("Il file %d non puo' essere aperto: errore %d\n" if (err == _istrcerr)
"Si desidera tentare il recupero dei dati?\n" {
"Rispondendo No l'errore verra' ignorato.",i,err); repair_file(i);
if (k == K_YES) err = NOERR;
}
if (err != NOERR && flags < 10000L)
{ {
if (!recover(b, err)) if (!recover(b, err))
k = yesno_box("Impossibile recuperare i dati\n" {
"Si desidera proseguire ugualmente?") ? K_NO : K_ESC; s.format("File n. %d - %s : errore n.ro %d", i, (const char *)d.filename(), err);
write_log(s);
}
} }
if (k == K_ESC)
stop_run();
} }
} }
else else
@ -860,6 +969,7 @@ void TManutenzione_app::update_dir()
} }
} }
} }
}
d.get(i, _nolock, _nordir, _sysdirop); d.get(i, _nolock, _nordir, _sysdirop);
bool cmn_file = FALSE; bool cmn_file = FALSE;
@ -1063,24 +1173,23 @@ void TManutenzione_app::convert_dir()
d.get(i, _nolock, _nordir, _sysdirop); d.get(i, _nolock, _nordir, _sysdirop);
if (i > 2 && err != NOERR && ((is_com && d.is_com()) || (!is_com && d.is_firm()))) if (i > 2 && err != NOERR && ((is_com && d.is_com()) || (!is_com && d.is_firm())))
{ {
KEY k = yesnocancel_box("Il file %d non puo' essere aperto: errore %d\n" if (err == _istrcerr)
"Si desidera tentare il recupero dei dati?\n"
"Rispondendo Annulla il programma terminera'",i,err);
if (k == K_YES)
{ {
if (!recover(b, err)) repair_file(i);
k = yesno_box("Impossibile recuperare i dati\n" err = NOERR;
"Si desidera proseguire ugualmente?") ? K_NO : K_ESC;
} }
if (k == K_ESC) if (err != NOERR)
stop_run(); {
else if (!recover(b, err))
continue; {
} s.format("File n. %d - %s : errore n.ro %d", i, (const char *)d.filename(), err);
write_log(s);
}
}
//d.get(i, _nolock, _nordir, _sysdirop); //d.get(i, _nolock, _nordir, _sysdirop);
bool to_create = (is_com ? d.is_com() : d.is_firm()); bool to_create = (is_com ? d.is_com() : d.is_firm());
const bool actual_create = to_create; // const bool actual_create = to_create;
// I files LF_PCON, LF_CAUS, LF_RCAUS, LF_CLIFO, LF_CFVEN, LF_INDSPED // I files LF_PCON, LF_CAUS, LF_RCAUS, LF_CLIFO, LF_CFVEN, LF_INDSPED
// vanno creati comunque nel direttorio COM, vuoti, (se non esistono gia'). // vanno creati comunque nel direttorio COM, vuoti, (se non esistono gia').
@ -1095,7 +1204,8 @@ void TManutenzione_app::convert_dir()
if (!s.exist() && d.len() > 0) if (!s.exist() && d.len() > 0)
{ {
TSystemisamfile f(i); TSystemisamfile f(i);
set_autoload_new_files(actual_create); // set_autoload_new_files(actual_create);
set_autoload_new_files(FALSE);
f.build(0L,rs); f.build(0L,rs);
set_autoload_new_files(TRUE); set_autoload_new_files(TRUE);
// Anche se il file non esisteva, prosegue, perche' possono esserci conversioni // Anche se il file non esisteva, prosegue, perche' possono esserci conversioni
@ -1357,13 +1467,22 @@ void TManutenzione_app::update()
app.run(); app.run();
} */ } */
open_log();
TString80 s;
s.format("Conversione del %s", (const char *) TDate(TODAY).string());
write_log(s);
write_log("");
s.format("Dati comuni");
write_log(s);
write_log("");
update_dir(); update_dir();
convert_dir(); convert_dir();
TSystemisamfile ditte(LF_NDITTE); TSystemisamfile ditte(LF_NDITTE);
ditte.open(); ditte.open();
TString80 s("Conversione archivi ditte."); s = "Conversione archivi ditte.";
TProgind p(ditte.items() ? ditte.items() : 1, s, FALSE, TRUE, 70); TProgind p(ditte.items() ? ditte.items() : 1, s, FALSE, TRUE, 70);
@ -1383,6 +1502,9 @@ void TManutenzione_app::update()
{ {
ditte.close(); ditte.close();
set_firm(codditta); set_firm(codditta);
write_log("");
write_log(mxs);
write_log("");
update_dir(); update_dir();
convert_dir(); convert_dir();
ditte.open(); ditte.open();
@ -1391,6 +1513,10 @@ void TManutenzione_app::update()
} }
ditte.close(); ditte.close();
write_log("--------------------");
write_log("");
close_log();
if (firm > 0) set_firm(firm); if (firm > 0) set_firm(firm);
else prefix().set(pref); else prefix().set(pref);
load_des(); load_des();

View File

@ -30,8 +30,6 @@ protected:
virtual long get_items() const { return _items; } virtual long get_items() const { return _items; }
virtual void get_row(long n, TToken_string& r); virtual void get_row(long n, TToken_string& r);
virtual bool on_key(KEY k);
public: public:
TDir* dir() const { return _dir; } TDir* dir() const { return _dir; }
TTrec* rec() const { return _rec; } TTrec* rec() const { return _rec; }

View File

@ -54,27 +54,6 @@ TDir_sheet::~TDir_sheet()
} }
bool TDir_sheet::on_key(KEY key)
{
if (key > K_CTRL)
switch (key-K_CTRL)
{
case 'A':
key = K_F8; break;
case 'C':
key = K_F7; break;
case 'E':
key = K_DEL; break;
case 'I':
key = K_F6; break;
case K_F4:
key = K_ESC; break;
default:
break;
}
return TSheet::on_key(key);
}
void TDir_sheet::get_row(long n, TToken_string& l) void TDir_sheet::get_row(long n, TToken_string& l)
{ {
n++; n++;

View File

@ -113,12 +113,19 @@ void TPackFiles_application::main_loop()
TFilename f_name,d_name; TFilename f_name,d_name;
TString cmd; TString cmd;
TDir d; TDir d;
TDir ds;
for (int i = 2; i<=items; i++) // Skip LF_DIR for (int i = 2; i<=items; i++) // Skip LF_DIR
{ {
if (!_selsheet->checked(i-1)) if (!_selsheet->checked(i-1))
continue; continue;
d.get(i); d.get(i);
const long flags = d.flags(); if (d.len() == 0)
continue; // Skip files with flags over 10000
const TString pref(prefix().name());
prefix().set("");
ds.get(i);
prefix().set(pref);
const long flags = ds.flags();
const int module = abs((int)flags); const int module = abs((int)flags);
if (flags >= 10000L) if (flags >= 10000L)
continue; // Skip files with flags over 10000 continue; // Skip files with flags over 10000
@ -131,7 +138,7 @@ void TPackFiles_application::main_loop()
do do
{ {
status = NOERR; status = NOERR;
if (present) // Se il file c'e' prova a compattarlo if (present && flags < 10000L) // Se il file c'e' prova a compattarlo
{ {
search_blanks(f); search_blanks(f);
if (f.packfile() == NOERR) if (f.packfile() == NOERR)
@ -144,8 +151,8 @@ void TPackFiles_application::main_loop()
if (!present || status == -60) if (!present || status == -60)
{ {
if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce // if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce
f.build(0L); // f.build(0L);
continue; // Se il file non esiste e non si ha il modulo abilitato evita inutili controlli continue; // Se il file non esiste e non si ha il modulo abilitato evita inutili controlli
} // Se le pack() hanno ritornato -60 ma il file esiste, allora prosegue con il prossimo } // Se le pack() hanno ritornato -60 ma il file esiste, allora prosegue con il prossimo

View File

@ -83,7 +83,7 @@ ENDPAGE
PAGE "Permessi" -1 -1 78 20 PAGE "Permessi" -1 -1 78 20
TREE F_PERMESSI -3 -8 TREE F_PERMESSI -3 -9
BEGIN BEGIN
PROMPT 0 1 "" PROMPT 0 1 ""
END END

View File

@ -1868,7 +1868,7 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
_stat((const char *)zipfile,&info); _stat((const char *)zipfile,&info);
if (lasttime <= info.st_mtime) if (lasttime <= info.st_mtime)
{ {
aborted = !yesno_box("Il file %s risulta già essere aggiornato. Vuoi rigenerarlo comunque?",(const char *)zipfile); aborted = !yesno_box("Il file %s risulta già aggiornato.\nSi desidera rigenerarlo comunque?",(const char *)zipfile);
} }
if (!aborted && !agg) if (!aborted && !agg)
{ {
@ -1881,7 +1881,7 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
{ {
_stat((const char *)patchfile,&info); _stat((const char *)patchfile,&info);
if (lasttime <= info.st_mtime) if (lasttime <= info.st_mtime)
aborted = !yesno_box("Il file di patch %s \nrisulta già aggiornato;\nprocedo comunque alla generazione di %s ?",(const char *)patchfile,(const char *)zipfile); aborted = !yesno_box("Il file di patch %s \nrisulta già aggiornato.\nSi desidera procedere comunque alla generazione di %s ?",(const char *)patchfile,(const char *)zipfile);
} }
} }
} }

View File

@ -1,5 +1,4 @@
#include <xvt.h> #include <xvt.h>
#include <checks.h>
#include "ba2.h" #include "ba2.h"
@ -11,10 +10,8 @@ int main(int argc, char** argv)
{ {
case 1: case 1:
ba2200(argc, argv); break; ba2200(argc, argv); break;
#if XVT_OS == XVT_OS_SCOUNIX
case 2: case 2:
ba2300(argc, argv) ; break; ba2300(argc, argv) ; break;
#endif
case 3: case 3:
ba2400(argc, argv) ; break; ba2400(argc, argv) ; break;
case 4: case 4:

View File

@ -1,35 +1,112 @@
#include <direct.h> #include <direct.h>
#define XVT_INCL_NATIVE
#include <applicat.h>
#include <config.h>
#include <isam.h>
#include <mask.h>
#include <prefix.h>
#include <archives.h> #include <archives.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <isam.h>
#include <mailbox.h>
#include <os_dep.h>
#include <prefix.h>
#include <progind.h>
#include <utility.h>
#include "ba2200.h" #include "ba2200.h"
#include "ba2201.h"
struct TFile_info : public TObject
{
TFilename _name;
long _size;
int _disk;
int _last_disk;
};
///////////////////////////////////////////////////////////
// Archiving mask
///////////////////////////////////////////////////////////
class TArchive_mask : public TAutomask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TArchive_mask();
};
TArchive_mask::TArchive_mask() : TAutomask("ba2200")
{
#if XVT_OS == XVT_OS_WIN16
TList_field& lf = (TList_field&)field(F_FLOPPY);
TToken_string codes, values;
TString4 str;
int k = 0;
for (int d = 0; d < 26; d++)
{
UINT t = ::GetDriveType(d);
if (t != 0)
{
str.format("%c:", d+'A');
codes.add(str);
values.add(str);
TToken_string& message = *lf.message(k++, TRUE);
if (t == DRIVE_REMOVABLE)
message.format("DISABLE,%d", F_PATH);
else
message.format("ENABLE,%d", F_PATH);
}
}
lf.replace_items(codes, values);
#endif
}
bool TArchive_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_PATH:
if (e == fe_modify)
{
TFilename path = o.get();
if (path[1] == ':')
{
set(F_FLOPPY, path.left(2));
o.set(path.mid(2));
}
}
break;
case F_DITTA:
if (e == fe_modify || e == fe_init)
{
set(F_RAGSOC, (o.get() != "") ? "Tutte le ditte" : "Nessuna ditta");
}
break;
case F_CODDITTA:
if (e == fe_modify)
{
if (o.empty())
set(F_RAGSOC, o.active() ? "Tutte le ditte" : "Nessuna ditta");
}
break;
case F_SALVA:
if (e == fe_button)
{
const long ditta = get_long(F_CODDITTA);
if (ditta > 0L && !prefix().exist(ditta))
return error_box("La ditta %ld non esiste", ditta);
}
default:
break;
}
return TRUE;
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Archiving application // Archiving application
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
class TArchive_app : public TSkeleton_application
{
TArchive _arc;
protected:
virtual bool create();
virtual void main_loop();
static bool test_firm(TMask_field& f, KEY k);
KEY query(int& mode, long& firm, char& floppy, TString& desc, bool& tmp, bool& zip) const;
public:
void stop_job();
TArchive_app() {}
virtual ~TArchive_app() {}
};
bool TArchive_app::create() bool TArchive_app::create()
{ {
bool ok = TRUE; bool ok = TRUE;
@ -42,7 +119,7 @@ bool TArchive_app::create()
if (u != user() && utenti.get_bool("CONNECTED")) if (u != user() && utenti.get_bool("CONNECTED"))
{ {
ok = error_box("L'archiviazione non puo' essere effettuata\n" ok = error_box("L'archiviazione non puo' essere effettuata\n"
"se ci sono altri utenti collegati: %s", (const char*)u); "se ci sono altri utenti collegati (%s)", (const char*)u);
} }
} }
utenti.close(); utenti.close();
@ -53,25 +130,11 @@ bool TArchive_app::create()
return ok; return ok;
} }
bool TArchive_app::test_firm(TMask_field& f, KEY k) KEY TArchive_app::query(int& mode, long& firm, TFilename& floppy_path, TString& desc) const
{ {
if (k == K_SPACE) TArchive_mask m;
{
const long firm = f.mask().get_long(F_CODDITTA);
if (firm > 0 && !prefix().exist(firm))
return f.error_box("La ditta %ld non esiste.", firm);
}
return TRUE;
}
KEY TArchive_app::query(int& mode, long& firm, char& floppy, TString& desc, bool& temp, bool& zip) const
{
TMask m("ba2200");
m.set_handler(F_SALVA,test_firm);
const KEY k = m.run(); const KEY k = m.run();
if (k != K_QUIT) if (k != K_QUIT)
{ {
mode = 0x0; mode = 0x0;
@ -91,50 +154,452 @@ KEY TArchive_app::query(int& mode, long& firm, char& floppy, TString& desc, bool
if (m.get_bool(F_CESP)) if (m.get_bool(F_CESP))
mode |= 0x10; mode |= 0x10;
floppy = m.get(F_FLOPPY)[0]; floppy_path.format("%c:%c", toupper(m.get(F_FLOPPY)[0]), SLASH);
floppy_path.add(m.get(F_PATH));
desc = m.get(F_DESCR); desc = m.get(F_DESCR);
temp = m.get_bool(F_TEMP);
#if XVT_OS == XVT_OS_WIN
zip = m.get_bool(F_ZIP);
#else
zip = TRUE;
#endif
} }
return k; return k;
} }
void TArchive_app::main_loop() void TArchive_app::add_file(const TFilename& name)
{
TFile_info* fi = new TFile_info;
fi->_name = name;
fi->_size = fsize(name);
fi->_disk = fi->_last_disk = 1;
_zip_list.add(fi);
}
bool TArchive_app::split_file(const TFilename& archive, unsigned long max_chunk)
{
TFilename output(archive);
output.ext("z00");
int disk = 0;
unsigned long scritti = 0;
FILE* i = fopen(archive, "rb");
if (i == NULL)
return FALSE;
FILE* o = fopen(output, "wb");
const int BUFSIZE = 1024*16;
TString buf(BUFSIZE);
char* buffer = buf.get_buffer();
bool ok = TRUE;
while (ok)
{
const size_t letti = fread(buffer, 1, BUFSIZE, i);
if (letti == 0)
break;
if (scritti >= max_chunk)
{
fclose(o);
add_file(output);
TString16 ext; ext.format("z%02d", ++disk);
output.ext(ext);
o = fopen(output, "wb");
scritti = 0;
}
ok = fwrite(buffer, letti, 1, o) > 0;
scritti += letti;
}
fclose(i);
fclose(o);
add_file(output);
return ok;
}
bool TArchive_app::zip_dir(const TFilename& name, unsigned long max_chunk)
{
TFilename tmp; tmp.tempdir();
tmp.add(name.name());
tmp.ext("zip");
TFilename filenames = name; filenames.add("*.*");
ofstream o("ziplist.txt");
o << filenames << endl;
o.close();
TString msg;
msg << "Creazione del file temporaneo " << tmp << "...";
TIndwin waitw(100,msg,FALSE,FALSE);
TWait_cursor hourglass;
TFilename cmd;
cmd << "zip.pif " << tmp << ' ' << "ziplist.txt" << " -j"; // -j NON salvare i path
TExternal_app app(cmd);
int err = app.run(FALSE, FALSE, FALSE, FALSE);
remove("ziplist.txt");
if (err == 0 && tmp.exist())
{
if (!split_file(tmp, max_chunk))
err = 1;
remove(tmp);
}
return err == 0;
}
bool TArchive_app::can_save_as(const TFilename& src, const TFilename& dst) const
{
if (dst.exist())
remove(dst);
long s = fsize(src);
return os_test_disk_free_space(dst.left(3), s);
}
void TArchive_app::save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk)
{
// Assegna un disco di destinazione a tutti i files
int disk = 1;
unsigned long written = 0;
for (int i = 0; i < _zip_list.items(); i++)
{
TFile_info& fi = (TFile_info&)_zip_list[i];
if (written > 0 && (written+fi._size) >= max_chunk)
{
disk++;
written = 0;
}
fi._disk = disk;
written += fi._size;
}
bool ok = TRUE;
if (os_is_removable_drive(floppy_path.left(3)))
{
const char* msg = "Si desidera procedere con l'operazione di salvataggio?";
if (disk == 1)
ok = yesno_box("Controllare che il primo disco sia nel drive %c:\n%s", floppy_path[0], msg);
else
ok = yesno_box("Preparare %d dischetti vuoti e controllare che il primo sia nel drive %c:\n%s", disk, floppy_path[0], msg);
if (!ok)
return;
}
const TDate oggi(TODAY);
TFilename name; name = floppy_path; name.add("backup.ini");
remove(name);
TConfig ini(name, "Main");
ini.set("Date", oggi.string());
ini.set("Description", desc);
ini.set("Disks", disk);
ini.set("Format", "zip");
TFilename last_name;
long size = 0;
for (i = 0; i < _zip_list.items(); i++)
{
const TFile_info& fi = (const TFile_info&)_zip_list[i];
name = fi._name.name(); name.ext("");
if (name != last_name)
{
ini.set("FirstDisk", fi._disk, name);
last_name = name;
size = 0;
}
ini.set("LastDisk", fi._disk);
ini.set("Size", size += fi._size);
}
ini.set_paragraph("Main"); // Forza scrittura ultimo paragrafo
int curr_disk = 1;
TProgind pi(_zip_list.items(), "Salvataggio dati in corso...", FALSE, TRUE);
for (i = 0; i < _zip_list.items(); i++)
{
pi.addstatus(1);
const TFile_info& fi = (const TFile_info&)_zip_list[i];
if (fi._disk != curr_disk)
message_box("Inserire il disco vuoto n.%d", curr_disk = fi._disk);
TFilename dest;
dest = floppy_path; dest.add(fi._name.name());
while(!can_save_as(fi._name, dest))
{
if (!yesno_box("Sul disco %d non c'e' spazio sufficiente per il file %s"
"\nSi desidera sostituire il disco e ritentare?", curr_disk, (const char*)dest))
return;
}
fcopy(fi._name, dest);
remove(fi._name);
}
}
void TArchive_app::backup(int mode, long firm, const TFilename& floppy_path, const TString& desc)
{
TPointer_array ditte;
if (firm == 0)
{
TLocalisamfile nditte(LF_NDITTE);
for (int err = nditte.first(); err == NOERR; err = nditte.next())
{
const long f = nditte.get_long("CODDITTA");
ditte.add_long(f);
}
}
else
ditte.add_long(firm);
const TString16 old = prefix().name();
prefix().set(NULL); // Libera tutti i lock
long max_chunk = ~0;
if (os_is_removable_drive(floppy_path))
{
message_box("Inserire un disco vuoto nel drive %c:", floppy_path[0]);
max_chunk = os_get_disk_size(floppy_path) - (1024L*64L);
}
_zip_list.destroy();
bool ok = TRUE;
TFilename name;
if (ok && (mode & 0x1))
{
name = firm2dir(0);
ok = zip_dir(name, max_chunk);
}
if (ok && (mode & 0x2))
{
for (int i = 0; ok && i < ditte.items(); i++)
{
firm = ditte.get_long(i);
if (prefix().exist(firm))
{
name = firm2dir(firm);
ok = zip_dir(name, max_chunk);
}
}
}
if (ok && (mode & 0x4))
{
name = firm2dir(-1); // __ptprf
name.add("config"); // Aggiungi configurazioni
ok = zip_dir(name, max_chunk);
}
if (ok && (mode & 0x8))
{
name = firm2dir(-1); // __ptprf
name.add("m770"); // Aggiungi 770
ok = zip_dir(name, max_chunk);
}
if (ok && (mode & 0x10))
{
name = firm2dir(-1); // __ptprf
name.add("cesp"); // Aggiungi cespiti
ok = zip_dir(name, max_chunk);
}
prefix().set(old); // Ripristina prefix
if (ok)
save_zip_files(floppy_path, desc, max_chunk);
else
error_box("Si è verificato un errore di accesso al disco:\nVerificare lo spazio disponibile");
}
bool TArchive_app::read_paragraph(TConfig& ini, const char* para)
{
const int first = ini.get_int("FirstDisk", para);
const int last = ini.get_int("LastDisk");
const bool ok = first > 0 && last >= first;
if (ok)
{
TFilename dir; dir.tempdir();
TString16 ext;
int e = 0;
for (int d = first; d <= last; d++)
{
TFile_info* fi = new TFile_info;
TFilename& name = fi->_name;
ext.format("z%02d", e++);
name = dir; name.add(para); name.ext(ext);
fi->_disk = d;
fi->_last_disk = last;
fi->_size = ini.get_int("Size");
_zip_list.add(fi);
}
}
return ok;
}
void TArchive_app::load_zip_files(const TFilename& floppy_path)
{
TString msg;
TFilename dir; dir.tempdir();
const int files = _zip_list.items();
TProgind pi(files, "Ripristino dati in corso...", TRUE, TRUE);
int curr_disk = 1;
for (int i = 0; i < files; i++)
{
const TFile_info& info = (const TFile_info&)_zip_list[i];
const int& disk = info._disk;
msg = "Ripristino "; msg << info._name.name() << " in corso...";
pi.set_text(msg);
pi.addstatus(1);
if (pi.iscancelled())
break;
if (os_is_removable_drive(floppy_path.left(3)))
{
if (disk != curr_disk)
{
message_box("Inserire il disco %d del backup", disk);
curr_disk = disk;
}
}
TFilename src; src = floppy_path; src.add(info._name.name());
TFilename dst; dst = dir; dst.add(info._name.name()); dst.ext("zip");
while (!fcopy(src, dst, TRUE))
if (!yesno_box("Si desidera ritentare?"))
return;
if (disk == info._last_disk)
{
TFilename exdir;
exdir = firm2dir(-1); exdir.add(dst.name()); exdir.ext("");
TString cmdline;
cmdline << "unzip.pif -o " << dst << " -d " << exdir;
TExternal_app app(cmdline);
app.run(FALSE, FALSE, FALSE, FALSE);
}
}
}
void TArchive_app::restore(int mode, long firm, const TFilename& floppy_path)
{
_zip_list.destroy();
TFilename name; name = floppy_path; name.add("backup.ini");
TConfig ini(name, "Main");
ini.write_protect();
if (mode & 0x1)
read_paragraph(ini, "com");
if (mode & 0x2)
{
if (firm > 0)
{
TString16 para; para.format("%05lda", firm);
read_paragraph(ini, para);
}
else
{
TString_array para;
ini.list_paragraphs(para);
for (int i = 0; i < para.items(); i++)
{
const TString& n = para.row(i);
if (atol(n) > 0 && n.right(1) == "a")
read_paragraph(ini, n);
}
}
}
if (mode & 0x4)
read_paragraph(ini, "config");
if (mode & 0x8)
read_paragraph(ini, "m770");
if (mode & 0x10)
read_paragraph(ini, "cesp");
const int tot = _zip_list.items();
if (tot > 0)
{
TString fola;
fola = "Verranno ripristinati i seguenti archivi:\n";
for (int i = 0; i < tot; i++)
{
const TFile_info& info = (const TFile_info&)_zip_list[i];
if (info._disk == info._last_disk)
{
TFilename n = info._name.name();
n.ext("");
fola << n << ", ";
}
}
fola.rtrim(2);
fola << ".\nSi desidera continuare?";
if (yesno_box(fola))
{
const TString16 old = prefix().name();
prefix().set(NULL); // Libera tutti i lock
load_zip_files(floppy_path); // Scompatta i files
prefix().set(old); // Ripristina prefix
}
}
else
warning_box("I dati richiesti non sono presenti sul backup");
}
void TArchive_app::interactive_mode()
{ {
KEY k; KEY k;
int mode; int mode;
long firm; long firm;
char floppy; TFilename floppy_path;
TString desc(80); TString80 desc;
bool temp;
bool zip;
while ((k = query(mode, firm, floppy, desc, temp, zip)) != K_QUIT) while ((k = query(mode, firm, floppy_path, desc)) != K_QUIT)
{ {
if (mode) if (mode)
{ {
if (k == K_SAVE) if (k == K_SAVE)
{ {
if (zip) const bool use_zip = TRUE;
_arc.zip(firm, floppy, desc); if (use_zip)
#if XVT_OS == XVT_OS_WIN backup(mode, firm, floppy_path, desc);
else else
_arc.backup(firm, floppy, desc); {
#endif TArchive arc;
arc.backup(mode, firm, floppy_path[0], desc);
}
} }
else else
{ {
if (zip) TFilename ini_name; ini_name = floppy_path; ini_name.add("backup.ini");
_arc.unzip(firm, floppy, temp); if (os_is_removable_drive(floppy_path.left(3)))
#if XVT_OS == XVT_OS_WIN message_box("Inserire il primo disco del backup nel drive %c", floppy_path[0]);
if (ini_name.exist())
{
bool use_zip = FALSE;
{
TConfig ini(ini_name, "Main");
ini.write_protect();
use_zip = ini.get("Format").compare("zip", TRUE) == 0;
}
if (use_zip)
restore(mode, firm, floppy_path);
else
{
TArchive arc;
arc.restore(mode, firm, floppy_path[0], FALSE);
}
}
else else
_arc.restore(firm, floppy, temp); error_box("Impossibile trovare il file %s", (const char*)ini_name);
#endif
} }
} }
else else
@ -142,6 +607,60 @@ void TArchive_app::main_loop()
} }
} }
void TArchive_app::batch_mode(const TString& cmd)
{
const int mode = ~0;
const long firm = 0;
const TFilename floppy_path = cmd;
restore(mode, firm, floppy_path);
}
void TArchive_app::main_loop()
{
TString cmd;
if (argc() > 2)
{
TFilename ini = argv(2);
if (ini.compare("/i", TRUE, 2) == 0)
{
ini.ltrim(2);
TConfig cfg(ini, "Main");
cmd = cfg.get("Action");
if (cmd.compare("Restore ", TRUE, 8) == 0)
{
cmd.ltrim(8);
cmd.trim();
}
else
cmd.cut(0);
}
else
{
if (ini.exist())
cmd = ini;
}
}
if (cmd.empty())
{
TMailbox mail;
TMessage* msg = mail.next_s("RESTORE");
if (msg == NULL)
{
mail.restart();
msg = mail.next_s("Restore");
}
if (msg)
cmd = msg->body();
}
if (cmd.empty())
interactive_mode();
else
batch_mode(cmd);
}
int ba2200(int argc, char* argv[]) int ba2200(int argc, char* argv[])
{ {
TArchive_app a; TArchive_app a;

View File

@ -2,15 +2,13 @@
#define F_RAGSOC 102 #define F_RAGSOC 102
#define F_FLOPPY 104 #define F_FLOPPY 104
#define F_DESCR 105 #define F_DESCR 105
#define F_TEMP 106 #define F_PATH 106
#define F_SALVA 107 #define F_SALVA 107
#define F_RIPR 108 #define F_RIPR 108
#define F_ZIP 109
#define F_ALL 110
#define F_DITTA 111
#define F_COM 112
#define F_CONFIG 113
#define F_770 114
#define F_CESP 115
#define F_ALL 109
#define F_DITTA 110
#define F_COM 111
#define F_CONFIG 112
#define F_770 113
#define F_CESP 114

View File

@ -1,45 +1,50 @@
#include "ba2200.h" #include "ba2200.h"
PAGE "Salvataggio / Ripristino archivi" -1 -1 72 12 PAGE "Salvataggio / Ripristino archivi" -1 -1 72 10
LIST F_FLOPPY 1 5 LIST F_FLOPPY 1 3
BEGIN BEGIN
PROMPT 1 1 "Disco " PROMPT 1 1 "Disco "
ITEM "A|A:" ITEM "A|A:" MESSAGE CLEAR,F_PATH
ITEM "B|B:" ITEM "B|B:" MESSAGE CLEAR,F_PATH
END
STRING F_PATH 45
BEGIN
PROMPT 15 1 "Percorso "
END END
BOOLEAN F_DITTA BOOLEAN F_DITTA
BEGIN BEGIN
PROMPT 20 1 "Dati ditta" PROMPT 1 2 "Dati ditta"
MESSAGE TRUE ENABLE,1@|"X",F_770 MESSAGE TRUE ENABLE,1@|"X",F_770|"X",F_CESP
MESSAGE FALSE CLEAR,1@ MESSAGE FALSE CLEAR,1@
END END
BOOLEAN F_COM BOOLEAN F_COM
BEGIN BEGIN
PROMPT 20 2 "Dati comuni" PROMPT 1 3 "Dati comuni"
MESSAGE TRUE "X",F_CONFIG MESSAGE TRUE "X",F_CONFIG
END END
BOOLEAN F_CONFIG BOOLEAN F_CONFIG
BEGIN BEGIN
PROMPT 20 3 "File di configurazione" PROMPT 1 4 "File di configurazione"
END END
BOOLEAN F_770 BOOLEAN F_770
BEGIN BEGIN
PROMPT 20 4 "Dati 770" PROMPT 1 5 "Dati 770"
END END
BOOLEAN F_CESP BOOLEAN F_CESP
BEGIN BEGIN
PROMPT 20 5 "Cespiti" PROMPT 1 6 "Cespiti"
END END
NUMBER F_CODDITTA 5 NUMBER F_CODDITTA 5
BEGIN BEGIN
PROMPT 48 1 "Ditta " PROMPT 15 2 ""
USE LF_NDITTE USE LF_NDITTE
INPUT CODDITTA F_CODDITTA INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA DISPLAY "Codice" CODDITTA
@ -50,43 +55,21 @@ BEGIN
GROUP 1 GROUP 1
END END
TEXT DLG_NULL STRING F_RAGSOC 50 45
BEGIN BEGIN
PROMPT 48 2 "Non specificata = Tutte" PROMPT 24 2 ""
FLAGS "D"
END END
BUTTON F_ALL 10 2 BUTTON F_ALL 10 2
BEGIN BEGIN
PROMPT 56 4 "~Tutti" PROMPT 58 4 "~Tutti"
MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CESP MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CESP|"",F_CODDITTA
END
STRING F_RAGSOC 50
BEGIN
PROMPT 1 6 "Ragione Sociale "
USE LF_NDITTE KEY 2
INPUT RAGSOC F_RAGSOC
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Codice@10" CODDITTA
COPY OUTPUT F_CODDITTA
CHECKTYPE NORMAL
GROUP 1
END END
STRING F_DESCR 50 STRING F_DESCR 50
BEGIN BEGIN
PROMPT 1 7 "Descrizione " PROMPT 1 7 "Descrizione "
END
BOOLEAN F_ZIP
BEGIN
PROMPT 1 4 "Usare compressione compatibile PKZIP"
END
BOOLEAN F_TEMP
BEGIN
PROMPT 1 8 "Usare direttorio temporaneo durante il ripristino"
END END
BUTTON F_SALVA 15 2 BUTTON F_SALVA 15 2

45
ba/ba2201.h Executable file
View File

@ -0,0 +1,45 @@
#ifndef __BA2201_H
#define __BA2201_H
#ifndef __APPLICAT_H
#include <applicat.h>
#endif
#ifndef __CONFIG_H
class TConfig;
#endif
class TArchive_app : public TSkeleton_application
{
TArray _zip_list;
protected:
virtual bool create();
virtual void main_loop();
KEY query(int& mode, long& firm, TFilename& floppy_path, TString& desc) const;
bool split_file(const TFilename& archive, unsigned long max_chunk);
bool zip_dir(const TFilename& name, unsigned long max_chunk);
bool read_paragraph(TConfig& ini, const char* para);
void backup(int mode, long firm, const TFilename& floppy_path, const TString& desc);
void restore(int mode, long firm, const TFilename& floppy_path);
void add_file(const TFilename& name);
void save_zip_files(const TFilename& floppy_path, const TString& desc, unsigned long max_chunk);
void load_zip_files(const TFilename& floppy_path);
bool can_save_as(const TFilename& src, const TFilename& dst) const;
void interactive_mode();
void batch_mode(const TString& cmd);
public:
void stop_job();
TArchive_app() {}
virtual ~TArchive_app() {}
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +1,5 @@
#define MSK_1_SELECTED 101 #define DLG_RESET 100
#define F_PATH 101
#define MSK_23_LOGIC 101 #define F_STUDENT 102
#define MSK_23_PHYSIC 102 #define F_SOLUTION 103
#define MSK_23_FILTER 103 #define F_TREE 150
#define MSK_23_TYPE 104
#define MSK_23_NORMAL 105
#define MSK_23_BOLD 106
#define MSK_23_ITALIC 107
#define MSK_23_UNDERLINED 108
#define MSK_23_NAMES 111
#define MSK_23_CODES 112
#define MSK_2_ADD 113
#define MSK_3_PREVIOUS 109
#define MSK_3_NEXT 110
#define MSK_4_MESSAGE -1 // It is A Static Field!
#define MSK_4_CODE 101
#define MSK_1 "ba2300a.msk"
#define MSK_2 "ba2300b.msk"
#define MSK_3 "ba2300c.msk"
#define MSK_4 "ba2300d.msk"
#define FILE_PRINTERS "prn.epf"
#define MSK_PRINTERS prn.epf
#define MSK_NAMES nms.epf
#define FILE_NAMES "nms.epf"
#define FILE_DEF_NAMES "dnms.epf"
#define FILE_DEF_CODES "dcds.epf"
#define FILE_CODES "cds.epf"
#ifdef __BA2300_CPP
#define EXTENSION "ini"
#define OPEN TRUE
#define SAVE FALSE
#define NEW_FILE 14101
#define OPEN_FILE 14102
#define SAVE_FILE 14103
#define SAVE_FILE_AS 14104
#define QUIT_EPF 14105
#define INSERT_PRINTER 1201
#define MODIFY_PRINTER 1202
#define SHOW_PRINTER 1204
#define DELETE_PRINTER 1203
bool build_code_files (FILE* iput, TFilename& outcdfile, TFilename& outnmfile, TString& printer);
void build_list_box (FILE* names, TMask& mask, short field);
void build_list_file (FILE* inputfile, TFilename& outputfile);
bool change_default_printer (TFilename& inputfilename, FILE* inputfile, TString& newdefprinter);
bool erase_file (TFilename& filename);
bool is_present (FILE* inputfile, TString& printer);
void item2prname (TString& item, TString& mame);
void place_codes_on_file (FILE* names, FILE* codes, FILE* output);
bool seek_default_printer (FILE* inputfile, TString& newprinter, long* position, bool justafter=TRUE);
bool seek_first_printer (FILE* input, TString& printer, long* pos, bool justafter=TRUE);
bool seek_printer (FILE* inputfile, TString& printer, long* position, bool justafter=TRUE);
bool seek_printer_no (FILE* inputfile, int number, TString& printer, long* position, bool justafter=TRUE);
#endif

48
ba/ba2300.uml Executable file
View File

@ -0,0 +1,48 @@
#include "ba2300.h"
TOOLBAR "" 0 -2 0 3
BUTTON DLG_SELECT 10 2
BEGIN
PROMPT -13 -11 "~Selezione"
MESSAGE EXIT,K_ENTER
PICTURE BMP_SELECT
END
BUTTON DLG_RESET 20 2
BEGIN
PROMPT -23 -11 "~Azzera"
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -11 ""
END
ENDPAGE
PAGE "Autoformazione" 0 0 0 -3
STRING F_PATH 50
BEGIN
PROMPT 1 1 "Cartella corsi "
END
STRING F_STUDENT 50
BEGIN
PROMPT 1 2 "Area studente "
END
STRING F_SOLUTION 50
BEGIN
PROMPT 1 3 "Area soluzioni "
END
TREE F_TREE 78 -1
BEGIN
PROMPT 1 4 ""
END
ENDPAGE
ENDMASK

View File

@ -470,7 +470,7 @@ bool TGeneric_table_app::valute_decimals_handler(TMask_field& f, KEY k)
{ {
// Se il cambio e' espresso in EURO metto in R10 il valore in lire // Se il cambio e' espresso in EURO metto in R10 il valore in lire
cambio = 1936.27 / cambio; cambio = 1936.27 / cambio;
cambio.round(2); cambio.round(5);
} }
m.set(VAL_CHANGE_OLD, cambio); m.set(VAL_CHANGE_OLD, cambio);
} }
@ -500,7 +500,7 @@ bool TGeneric_table_app::change_decimals_handler(TMask_field& f, KEY k)
{ {
// Se il cambio e' espresso in EURO metto in R10 il valore in lire // Se il cambio e' espresso in EURO metto in R10 il valore in lire
cambio = 1936.27 / cambio; cambio = 1936.27 / cambio;
cambio.round(2); cambio.round(5);
} }
m.set(FLD_TABCAM_R10, cambio); m.set(FLD_TABCAM_R10, cambio);
} }

View File

@ -253,8 +253,7 @@ static bool codditta_handler(TMask_field& field, KEY key)
//m.field(F_ANNOREG).show(); //m.field(F_ANNOREG).show();
//m.field(F_CODICEREG).show(); //m.field(F_CODICEREG).show();
//} //}
app()._ragsoc = "SOCIETA' "; app()._ragsoc = nditte.get(N_RAGSOC);
app()._ragsoc << nditte.get(N_RAGSOC);
m.set(F_RAGSOC,app()._ragsoc); m.set(F_RAGSOC,app()._ragsoc);
const TString16 tipoa = nditte.get(N_TIPOA); const TString16 tipoa = nditte.get(N_TIPOA);

View File

@ -13,8 +13,6 @@
#include "ba3600.h" #include "ba3600.h"
#include "ba3601.h" #include "ba3601.h"
static TString256 tmp;
class TStampa_indici : public TPrint_application class TStampa_indici : public TPrint_application
{ {
struct ind_lib struct ind_lib
@ -55,6 +53,7 @@ class TStampa_indici : public TPrint_application
TString _ind_dta,_civ_dta,_cap_dta,_com_dta,_prov_dta; TString _ind_dta,_civ_dta,_cap_dta,_com_dta,_prov_dta;
bool _ho_stampato_almeno_un_bollato; bool _ho_stampato_almeno_un_bollato;
TString tmp;
public: // TPrint_application public: // TPrint_application
virtual bool user_create() ; virtual bool user_create() ;

View File

@ -174,11 +174,11 @@ END
SPREADSHEET F_SHEET_RPG SPREADSHEET F_SHEET_RPG
BEGIN BEGIN
PROMPT 0 11 "" PROMPT 1 11 ""
ITEM "N.ro giorni rata" ITEM "N.ro giorni rata"
ITEM "Percentuale" ITEM "Percentuale"
ITEM "Tipo@1" ITEM "Tipo@4"
ITEM "Class.@1" ITEM "Class."
ITEM "Descrizione@50" ITEM "Descrizione@50"
END END

View File

@ -90,7 +90,7 @@ void Stampa_condizioni_pagamento_application::print_header()
reset_header (); reset_header ();
set_header (soh++, ""); set_header (soh++, "");
set_header (soh++, "@bCONDIZIONI DI PAGAMENTO @r@109gData @< Pag. @#"); set_header (soh++, "@bCONDIZIONI DI PAGAMENTO @r@107gData @> Pag. @#");
set_header (soh++, ""); set_header (soh++, "");
set_header (soh++, "@47gTp @53gInizio @66gMese @73gGiorni@89gIntervallo@108gScadenze"); set_header (soh++, "@47gTp @53gInizio @66gMese @73gGiorni@89gIntervallo@108gScadenze");
set_header (soh++, "Cod. @12gDescrizione @47gdoc.@53gcalcolo@66gcomm. @73gsc. fissa@92grate@103gNr. gg. %% Td. ult. cl."); set_header (soh++, "Cod. @12gDescrizione @47gdoc.@53gcalcolo@66gcomm. @73gsc. fissa@92grate@103gNr. gg. %% Td. ult. cl.");

View File

@ -73,7 +73,7 @@ void TAnaprint_app::set_page(int file, int cnt)
{ {
if (_pr_what != nditte && file == LF_NDITTE) if (_pr_what != nditte && file == LF_NDITTE)
{ {
set_row(1,"@50g$[r]@pN$[n]@66g@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"), set_row(1,"@58g$[v]@pN$[n]@66g@S", FLD(LF_NDITTE,"CODDITTA","@@@@@"),
FLD(LF_NDITTE,"RAGSOC")); FLD(LF_NDITTE,"RAGSOC"));
set_row(2,""); set_row(2,"");
} }
@ -123,10 +123,20 @@ bool TAnaprint_app::preprocess_page(int file, int counter)
_com = current_cursor()->curr(LF_ANAG).get("COMRES"); _com = current_cursor()->curr(LF_ANAG).get("COMRES");
if (_com.empty()) if (_com.empty())
_com = current_cursor()->curr(LF_ANAG).get("COMRF"); _com = current_cursor()->curr(LF_ANAG).get("COMRF");
_phone = current_cursor()->curr(LF_ANAG).get("PTELRF"); if (_pr_what == nditte)
_phone.trim(); {
if (!_phone.empty()) _phone << '/'; _phone = current_cursor()->curr(LF_NDITTE).get("PTEL");
_phone << current_cursor()->curr(LF_ANAG).get("TELRF"); _phone.trim();
if (!_phone.empty()) _phone << '/';
_phone << current_cursor()->curr(LF_NDITTE).get("TEL");
}
if (_phone.empty() || _pr_what != nditte)
{
_phone = current_cursor()->curr(LF_ANAG).get("PTELRF");
_phone.trim();
if (!_phone.empty()) _phone << '/';
_phone << current_cursor()->curr(LF_ANAG).get("TELRF");
}
const TRectype& cc = look_com(_com); const TRectype& cc = look_com(_com);
_com = cc.get("DENCOM"); _com = cc.get("DENCOM");
@ -290,7 +300,7 @@ bool TAnaprint_app::set_print(int)
_pr_type = elenco; _pr_type = elenco;
// cio' che e' blu collega al modulo anagrafiche // cio' che e' blu collega al modulo anagrafiche
_ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b'); _ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b');
_dit_link = enable_link("Collegamento archivio ditte: ", 'r'); _dit_link = enable_link("Collegamento archivio ditte: ", 'v');
break; break;
case BUT_BA6_SCHEDE: case BUT_BA6_SCHEDE:
disable_links(); disable_links();
@ -372,7 +382,7 @@ bool TAnaprint_app::set_print(int)
break; break;
case BUT_BA6_RUBRICHE: case BUT_BA6_RUBRICHE:
_ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b'); _ana_link = enable_link("Collegamento archivio anagrafiche: ", 'b');
_dit_link = enable_link("Collegamento archivio ditte: ", 'r'); _dit_link = enable_link("Collegamento archivio ditte: ", 'v');
_pr_type = rubriche; _pr_type = rubriche;
break; break;
} }

View File

@ -11,11 +11,11 @@ BEGIN
PROMPT 47 1 "Colonna" PROMPT 47 1 "Colonna"
END END
RADIOBUTTON RDB_BA6B_INDIR 23 RADIOBUTTON RDB_BA6B_INDIR 34
BEGIN BEGIN
PROMPT 4 1 "Indirizzo" PROMPT 4 1 "Indirizzo"
ITEM "1|Residenza" ITEM "1|Residenza"
ITEM "2|Domicilio fiscale" ITEM "2|Domicilio fiscale/Sede legale"
ITEM "3|Corrispondenza" ITEM "3|Corrispondenza"
HELP "Indicare l'indirizzo da includere nelle etichette" HELP "Indicare l'indirizzo da includere nelle etichette"
END END

View File

@ -841,7 +841,7 @@ void TAnaprint_app::set_rubriche()
if (_pr_what == nditte) if (_pr_what == nditte)
{ {
set_row(1,"@b$[r]@pN@r$[n]@3j@50S", set_row(1,"@b$[v]@pN@r$[n]@3j@50S",
FLD(LF_NDITTE,"CODDITTA","@@@@@"), FLD(LF_NDITTE,"CODDITTA","@@@@@"),
FLD(LF_NDITTE,"RAGSOC")); FLD(LF_NDITTE,"RAGSOC"));
} }
@ -879,12 +879,12 @@ void TAnaprint_app::set_elenco()
FLD(LF_ANAG,"RAGSOC")); FLD(LF_ANAG,"RAGSOC"));
} }
if (_inclditte) if (_inclditte)
set_row(1,"@58g$[r]@pN$[n]@66g@S", set_row(1,"@58g$[v]@pN$[n]@66g@S",
FLD(LF_NDITTE,"CODDITTA","@@@@@"), FLD(LF_NDITTE,"CODDITTA","@@@@@"),
FLD(LF_NDITTE,"RAGSOC")); FLD(LF_NDITTE,"RAGSOC"));
break; break;
case nditte: case nditte:
set_row(1,"$[r]@pN$[n]@10g@S@50g@S @pN@3j@S", set_row(1,"$[v]@pN$[n]@10g@S@50g@S @pN@3j@S",
FLD(LF_NDITTE,"CODDITTA","@@@@@"), FLD(LF_NDITTE,"CODDITTA","@@@@@"),
FLD(LF_NDITTE,"RAGSOC"), FLD(LF_NDITTE,"RAGSOC"),
FLD(LF_NDITTE,"TIPOA"), FLD(LF_NDITTE,"TIPOA"),
@ -918,7 +918,7 @@ void TAnaprint_app::set_headers()
case anagiu: case anagiu:
set_background("W1l{1 2 132 2}W4l{1 5 132 5}"); set_background("W1l{1 2 132 2}W4l{1 5 132 5}");
set_header(1,"@bELENCO PERSONE %s@82gStudio@96gData" set_header(1,"@bELENCO PERSONE %s@82gStudio@96gData"
"@101g @< @110g Pag. @#", _pr_what == anafis ? "FISICHE" : "@101g @> @112g Pag. @#", _pr_what == anafis ? "FISICHE" :
"GIURIDICHE"); "GIURIDICHE");
set_header(3,"@iCodice@58gCodice"); set_header(3,"@iCodice@58gCodice");
set_header(4,"@iAnagr. Ragione sociale/cognome e nome@58gDitta" set_header(4,"@iAnagr. Ragione sociale/cognome e nome@58gDitta"
@ -928,7 +928,7 @@ void TAnaprint_app::set_headers()
case nditte: case nditte:
set_background("W1l{1 2 132 2}W4l{1 5 132 5}"); set_background("W1l{1 2 132 2}W4l{1 5 132 5}");
set_header(1,"@bELENCO DITTE@82gStudio@96gData" set_header(1,"@bELENCO DITTE@82gStudio@96gData"
"@101g @< @110g Pag. @#"); "@101g @> @112g Pag. @#");
set_header(3,"@iCodice@50gT"); set_header(3,"@iCodice@50gT");
set_header(4,"@iAnagr. Denominazione sociale@50gP Codice" set_header(4,"@iAnagr. Denominazione sociale@50gP Codice"
"@61gRagione sociale/Cognome e nome"); "@61gRagione sociale/Cognome e nome");
@ -943,14 +943,22 @@ void TAnaprint_app::set_headers()
case anafis: case anafis:
case anagiu: case anagiu:
set_background("W1l{1 2 132 2}W4l{1 4 132 4}"); set_background("W1l{1 2 132 2}W4l{1 4 132 4}");
set_header(1,"@bRUBRICA PERSONE %s@40gStudio@53gData @< pag. @#", #else
set_header(2,(const char*)sep);
set_header(4,(const char*)sep);
#endif
set_header(1,"@bRUBRICA PERSONE %s@40gStudio@53gData @> pag. @#",
_pr_what == anagiu ? "GIURIDICHE" : "FISICHE"); _pr_what == anagiu ? "GIURIDICHE" : "FISICHE");
set_header(3,"@iCodice Cognome e nome"); set_header(3,"@iCodice Cognome e nome");
set_header(5,""); set_header(5,"");
break; break;
case nditte: case nditte:
set_background("W1l{1 2 132 2}W4l{1 4 132 4}"); set_background("W1l{1 2 132 2}W4l{1 4 132 4}");
set_header(1,"@bRUBRICA DITTE@40gStudio@53gData @< pag. @#"); #else
set_header(2,(const char*)sep);
set_header(4,(const char*)sep);
#endif
set_header(1,"@bRUBRICA DITTE@40gStudio@53gData @> pag. @#");
set_header(3,"@iCodice Cognome e nome"); set_header(3,"@iCodice Cognome e nome");
set_header(5,""); set_header(5,"");
break; break;

View File

@ -2,22 +2,25 @@
#include <automask.h> #include <automask.h>
#include <config.h> #include <config.h>
#include <defmask.h> #include <defmask.h>
#include <dongle.h>
#include <execp.h> #include <execp.h>
#include <expr.h> #include <expr.h>
#include <golem.h> #include <golem.h>
#include <tabutil.h> #include <tabutil.h>
#include <prefix.h> #include <prefix.h>
#include <recarray.h> #include <recarray.h>
#include <relation.h>
#include <sheet.h> #include <sheet.h>
#include <utility.h> #include <utility.h>
#include <dongle.h> #include <os_dep.h>
#include <viswin.h>
#define NO_MFC #define NO_MFC
#include <netsock.h> #include <netsock.h>
#include "ba7.h" #include "ba7.h"
#include "ba7100a.h" #include "ba7100a.h"
#define NOT_TRANS -883
#define NOT_GEST -884
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TConfig utilities // TConfig utilities
@ -100,24 +103,27 @@ bool TMail_box::logon(const char* ser, const char* usr, const char* pwd)
if (_connection != 0) if (_connection != 0)
{ {
TString buf; TString buf;
TString req;
ReadLine(_connection, buf); ReadLine(_connection, buf);
if (buf[0] != '+') if (buf[0] != '+')
return error_box("Il server POP3 %s non risponde", return error_box("Il server POP3 %s non risponde\nRisultato : %s",
(const char*)server); (const char*)server, (const char *)buf);
buf = "USER "; buf << user << '\n'; buf = "USER "; buf << user << "\r\n";
WriteLine(_connection, buf); WriteLine(_connection, buf);
req = buf;
ReadLine(_connection, buf); ReadLine(_connection, buf);
if (buf[0] != '+') if (buf[0] != '+')
return error_box("Il server POP3 %s non accetta l'utente %s", return error_box("Il server POP3 %s non accetta l'utente %s\nRichiesta : %sRisultato : %s",
(const char*)server, (const char*)user); (const char*)server, (const char*)user, (const char *) req, (const char *)buf);
buf = "PASS "; buf << password << '\n'; buf = "PASS "; buf << password << "\r\n";
WriteLine(_connection, buf); WriteLine(_connection, buf);
req = buf;
ReadLine(_connection, buf); ReadLine(_connection, buf);
if (buf[0] != '+') if (buf[0] != '+')
return error_box("Il server POP3 %s non accetta l'utente %s", return error_box("Il server POP3 %s non accetta la password dell'utente %s\nRichiesta : %sRisultato : %s",
(const char*)server, (const char*)user); (const char*)server, (const char*)user, (const char *) req, (const char *)buf);
} }
else else
return error_box("Impossibile contattare il server POP3 %s", return error_box("Impossibile contattare il server POP3 %s",
@ -130,7 +136,7 @@ void TMail_box::logoff()
{ {
if (_connection) if (_connection)
{ {
WriteLine(_connection, "QUIT\n"); WriteLine(_connection, "QUIT\r\n");
RemoveConnection(_connection); RemoveConnection(_connection);
_connection = NULL; _connection = NULL;
} }
@ -142,7 +148,7 @@ bool TMail_box::list(TString_array& a)
if (ok) if (ok)
{ {
TString buf; TString buf;
buf = "LIST\n"; buf = "LIST\r\n";
WriteLine(_connection, buf); WriteLine(_connection, buf);
ReadLine(_connection, buf); ReadLine(_connection, buf);
ok = buf[0] == '+'; ok = buf[0] == '+';
@ -197,21 +203,28 @@ int TMail_box::get(TMail_messages& m)
m.add(msgptr); m.add(msgptr);
TMail_message& msg = *msgptr; TMail_message& msg = *msgptr;
buf = "RETR "; buf << *row << '\n'; buf = "RETR "; buf << *row << "\r\n";
WriteLine(_connection, buf); WriteLine(_connection, buf);
ReadLine(_connection, buf); ReadLine(_connection, buf);
bool ok = buf[0] == '+'; bool ok = buf[0] == '+';
EncodingType encoding = enc_plain_text; EncodingType encoding = enc_plain_text;
bool in_body = FALSE; bool in_body = FALSE;
bool in_section = FALSE; bool in_section = FALSE;
bool buf_already_read = FALSE;
boundary.cut(0); boundary.cut(0);
while (ok) while (ok)
{ {
if (!ReadLine(_connection, buf)) if (!buf_already_read)
{ {
ok = FALSE; if (!ReadLine(_connection, buf))
break; // Unexpected EOF {
ok = FALSE;
break; // Unexpected EOF
}
} }
else
buf_already_read = FALSE;
if (buf[0] == '.') if (buf[0] == '.')
{ {
buf.ltrim(1); buf.ltrim(1);
@ -345,6 +358,8 @@ int TMail_box::get(TMail_messages& m)
{ {
ReadLine(_connection, buf); ReadLine(_connection, buf);
bnd = buf.find("oundary="); bnd = buf.find("oundary=");
if (bnd < 0)
buf_already_read = TRUE;
} }
if (bnd > 0) if (bnd > 0)
{ {
@ -367,7 +382,7 @@ bool TMail_box::remove(const char* id)
if (ok) if (ok)
{ {
TString buf; TString buf;
buf << "DELE " << id << '\n'; buf << "DELE " << id << "\r\n";
WriteLine(_connection, buf); WriteLine(_connection, buf);
ReadLine(_connection, buf); ReadLine(_connection, buf);
ok = buf[0] == '+'; ok = buf[0] == '+';
@ -436,7 +451,9 @@ TFilter_expr::TFilter_expr(TAutomask& m, int logicnum, const char* expr)
class TMailer_mask : public TAutomask class TMailer_mask : public TAutomask
{ {
long _timer_id; long _timer_id;
long _secs;
int _mail_semaphore; int _mail_semaphore;
TViswin * _vv;
protected: protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
@ -452,7 +469,8 @@ protected:
public: public:
void test_delete(); void test_delete();
int fill_messages(); int fill_messages();
bool save_curr_line(); bool exec_app(int & err, const char * appname, const char * msg);
bool save_curr_line(int & err);
void save_all_lines(); void save_all_lines();
void auto_save_all(); void auto_save_all();
@ -645,7 +663,38 @@ bool TMailer_mask::file2app(const TString& file, TString& app) const
return ok; return ok;
} }
bool TMailer_mask::save_curr_line() bool TMailer_mask::exec_app(int & err, const char * appname, const char * msg)
{
TFilename tmp; tmp.temp();
{
ofstream outf(tmp);
TString message(msg);
message.replace('\r', '\n');
outf << message;
outf.close();
}
TString command_line(appname);
command_line << " /i" << tmp << " -u" << ::dongle().administrator();
TExternal_app app(command_line);
err = app.run();
os_sleep(1000);
bool ok = err == NOERR;
if (ok)
{
TConfig ini(tmp, "Transaction");
ok = ini.get("Result") == "OK";
if (ok)
err = 0;
else
err = ini.get_int("Error");
}
::remove(tmp);
return ok;
}
bool TMailer_mask::save_curr_line(int & err)
{ {
TMail_lock ml(this); TMail_lock ml(this);
@ -656,29 +705,33 @@ bool TMailer_mask::save_curr_line()
const TString& msg = m.get(F_BODY); const TString& msg = m.get(F_BODY);
if (msg.find("[Transaction]") < 0) if (msg.find("[Transaction]") < 0)
return FALSE; // It's not a transaction
TFilename appname;
if (!file2app(m.get(F_SUBJECT), appname))
return FALSE; // It hasn't a valid application
TFilename tmp; tmp.temp();
ofstream outf(tmp);
outf << msg;
outf.close();
const TString old_mailto = set_ini_var(CONFIG_INSTALL, "Main", "MailTo", "");
appname << " /i" << tmp << " -u" << ::dongle().administrator();
TExternal_app app(appname);
bool ok = app.run() == NOERR;
if (ok)
{ {
TConfig ini(tmp, "Transaction"); err = NOT_TRANS;
ok = ini.get("Result") == "OK"; return FALSE; // It's not a transaction
} }
::remove(tmp);
TFilename appname;
const TString& subj = m.get(F_SUBJECT);
if (!file2app(subj, appname)) // It hasn't a valid application
{
err = NOT_GEST;
return FALSE;
}
const TString old_mailto = set_ini_var(CONFIG_INSTALL, "Main", "MailTo", "");
bool ok = exec_app(err, appname, msg);
if (!ok && err == 204)
{
TString insmsg(msg);
int pos = insmsg.find("MODIFY");
if (pos > 0)
{
insmsg.overwrite("INSERT", pos);
ok = exec_app(err, appname, insmsg);
}
}
if (ok) if (ok)
{ {
@ -698,33 +751,83 @@ bool TMailer_mask::save_curr_line()
if (old_mailto.not_empty()) if (old_mailto.not_empty())
set_ini_var(CONFIG_INSTALL, "Main", "MailTo", old_mailto); set_ini_var(CONFIG_INSTALL, "Main", "MailTo", old_mailto);
return TRUE; return ok;
} }
void TMailer_mask::save_all_lines() void TMailer_mask::save_all_lines()
{ {
TMail_lock ml(this); CHECK(_vv == NULL,"Viswin already open ?");
TWait_cursor hourglass; mail_lock();
TViswin viswin(NULL, "Registrazione documenti", FALSE, TRUE, TRUE);
viswin.open_modal();
_vv = &viswin;
TSheet_field& sf = sfield(F_MESSAGES); TSheet_field& sf = sfield(F_MESSAGES);
TString body; TString body, msg;
time_t tempo;
time(&tempo);
const struct tm* d = localtime(&tempo);
msg.format("Inizio elaborazione: %02d-%02d-%04d %02d:%02d:%02d",
d->tm_mday, d->tm_mon+1, 1900+d->tm_year,
d->tm_hour, d->tm_min, d->tm_sec);
viswin.add_line(msg);
viswin.add_line("");
bool one_saved = FALSE; bool one_saved = FALSE;
FOR_EACH_SHEET_ROW(sf, nrow, row) if (*row->get(0) != 'X') FOR_EACH_SHEET_ROW(sf, nrow, row)
{ {
row->get(sf.cid2index(F_BODY), body); msg.format("Messaggio %d ", nrow+1);
if (body.find("[Transaction]") >= 0) if (*row->get(0) != 'X')
{ {
sf.select(nrow); row->get(sf.cid2index(F_BODY), body);
one_saved |= save_curr_line(); if (body.find("[Transaction]") >= 0)
{
sf.select(nrow);
int err = 0;
const bool yes = save_curr_line(err);
if (yes)
{
msg << "elaborato con successo";
one_saved = TRUE;
}
else
if (err == NOT_GEST)
{
TSheet_field& sf = sfield(F_MESSAGES);
TMask& m = sf.sheet_mask();
msg << " definire il programma gestore del file " << m.get(F_SUBJECT);
}
else
msg << "non elaborato a causa di un errore (n.ro " << err << ")";
}
else
msg << "ignorato in quanto transazione non riconosciuta";
} }
else
msg << "ignorato in quanto già elaborato";
viswin.add_line(msg);
} }
viswin.add_line("");
viswin.add_line("Fine elaborazione");
viswin.close_print();
viswin.close_modal();
mail_unlock();
viswin.run();
#ifdef DBG
if (one_saved && yesno_box("Si desidera eliminare i messaggi processati?")) if (one_saved && yesno_box("Si desidera eliminare i messaggi processati?"))
#else
if (one_saved)
#endif
{ {
test_delete(); test_delete();
fill_messages(); fill_messages();
} }
_vv = NULL;
} }
bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
@ -734,7 +837,7 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
case F_TIMER: case F_TIMER:
if (e == fe_init || e == fe_modify) if (e == fe_init || e == fe_modify)
{ {
if (_timer_id) if (_timer_id != XVT_TIMER_ERROR)
{ {
xvt_timer_destroy(_timer_id); xvt_timer_destroy(_timer_id);
_timer_id = XVT_TIMER_ERROR; _timer_id = XVT_TIMER_ERROR;
@ -742,7 +845,8 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
const long minutes = atol(o.get()); const long minutes = atol(o.get());
if (minutes > 0) if (minutes > 0)
{ {
_timer_id = xvt_timer_create(win(), minutes * 60000L); _timer_id = xvt_timer_create(win(), 1000L);
_secs = 0L;
if (_timer_id == XVT_TIMER_ERROR) if (_timer_id == XVT_TIMER_ERROR)
return error_box("Impossibile impostare il timer"); return error_box("Impossibile impostare il timer");
} }
@ -766,7 +870,24 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
break; break;
case DLG_USER: case DLG_USER:
if (e == fe_button) if (e == fe_button)
save_curr_line(); {
int err = 0;
if (!save_curr_line(err))
{
if (err == NOT_TRANS)
message_box("Messaggio ignorato in quanto transazione non riconosciuta");
else
if (err == NOT_GEST)
{
TSheet_field& sf = sfield(F_MESSAGES);
TMask& m = sf.sheet_mask();
error_box("Definire il programma gestore del file %s", (const char*)m.get(F_SUBJECT));
}
else
message_box("Messaggio non elaborato a causa di un errore (n.ro %d)", err);
}
}
break; break;
case DLG_SAVEREC: case DLG_SAVEREC:
if (e == fe_button) if (e == fe_button)
@ -849,9 +970,10 @@ void TMailer_mask::auto_save_all()
{ {
if (_mail_semaphore == 0) if (_mail_semaphore == 0)
{ {
TMail_lock ml(this); mail_lock();
test_delete(); test_delete();
fill_messages(); fill_messages();
mail_unlock();
if (!field(F_TIMER).empty()) if (!field(F_TIMER).empty())
save_all_lines(); save_all_lines();
} }
@ -864,7 +986,19 @@ void TMailer_mask::handler(WINDOW win, EVENT* ep)
if (ep->type == E_TIMER) if (ep->type == E_TIMER)
{ {
if (ep->v.timer.id == _timer_id && _mail_semaphore == 0) if (ep->v.timer.id == _timer_id && _mail_semaphore == 0)
auto_save_all(); {
_secs++;
if (_secs >= get_long(F_TIMER) * 60)
{
if (_vv)
_vv->stop_run(K_ESC);
else
{
_secs = 0L;
auto_save_all();
}
}
}
} }
TAutomask::handler(win, ep); TAutomask::handler(win, ep);
} }
@ -894,7 +1028,8 @@ void TMailer_mask::load()
TMailer_mask::TMailer_mask() TMailer_mask::TMailer_mask()
: TAutomask("ba7100a"), : TAutomask("ba7100a"),
_timer_id(XVT_TIMER_ERROR), _mail_semaphore(0) _timer_id(XVT_TIMER_ERROR), _mail_semaphore(0),
_vv(NULL)
{ {
load(); load();
if (user() != ::dongle().administrator()) if (user() != ::dongle().administrator())

View File

@ -707,24 +707,18 @@ void TBenchmark_application::test_file_write()
{ {
initializing(); initializing();
start_test("Scrittura/Modifica/Cancellazione"); TTable tab("GUY");
TTable tab("DIK"); start_test("Scrittura della tabella GUY");
int err;
for (long n = 0; n < 200; n++) TString16 codtab;
int err = NOERR;
for (long n = 0; err == NOERR && n < 1000000L; n++)
{ {
tab.zero(); codtab.format("%07ld", n);
tab.put("CODTAB", "MIN"); tab.put("CODTAB", codtab);
tab.put("S0", "BEG"); tab.put("S0", codtab);
err = tab.write(); err = tab.write();
tab.put("S0", "CAZ");
err = tab.rewrite();
tab.zero();
tab.put("CODTAB", "MIN");
err = tab.remove();
update_bar(n); update_bar(n);
} }

View File

@ -187,6 +187,7 @@ public:
void convert_cap() const; void convert_cap() const;
void convert_uue() const; void convert_uue() const;
void convert_pim2prm() const; void convert_pim2prm() const;
void convert_riba_tcf() const;
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {} TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
}; };
@ -333,6 +334,10 @@ bool TConversione_archivi::menu(MENU_TAG)
if (_codditta > 0) if (_codditta > 0)
convert_pim2prm(); convert_pim2prm();
break; break;
case 18:
if (_codditta > 0)
convert_riba_tcf();
break;
default: default:
break; break;
} }
@ -1635,6 +1640,25 @@ void TConversione_archivi::convert_pim2prm() const
} }
} }
// Aggiunge il tipo cliente C alle ricevute bancarie
void TConversione_archivi::convert_riba_tcf() const
{
TLocalisamfile f(LF_EFFETTI);
TRectype& r = f.curr();
long n = f.items();
TProgind p(n, format("Conversione effetti ditta %ld", get_firm()), FALSE, TRUE, 70);
p.setstatus(1L);
for (int err = f.first(); err == NOERR; err = f.next())
{
p.addstatus(1L);
if (r.get("TIPOCF").blank())
{
r.put("TIPOCF","C");
f.rewrite();
}
}
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// Programma di conversione archivi speciale // Programma di conversione archivi speciale
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -1643,7 +1667,7 @@ int main(int argc,char** argv)
{ {
const int r = (argc > 1) ? abs(atoi(argv[1])) : 0; const int r = (argc > 1) ? abs(atoi(argv[1])) : 0;
if (r < 0 || r > 17) if (r < 0 || r > 18)
{ {
error_box(usage); error_box(usage);
return 100; return 100;

View File

@ -558,10 +558,12 @@ int main(int argc,char** argv)
r=bainst31(argc, argv);// pre/post installazione vendite: r=bainst31(argc, argv);// pre/post installazione vendite:
else if (mod == "mg") else if (mod == "mg")
r=bainst32(argc, argv);// pre/post installazione magazzino: r=bainst32(argc, argv);// pre/post installazione magazzino:
else if (mod == "ef")
r=bainst34(argc, argv);// pre/post installazione effetti:
else if (mod == "sv") else if (mod == "sv")
r=bainst38(argc, argv);// pre/post installazione statistiche: r=bainst38(argc, argv);// pre/post installazione statistiche:
else if (mod == "db") else if (mod == "db")
r=bainst35(argc, argv);// pre/post installazione DI.BA. r=bainst35(argc, argv);// pre/post installazione distinta base:
else if (mod == "mr") else if (mod == "mr")
r=bainst39(argc, argv);// pre/post installazione MRP r=bainst39(argc, argv);// pre/post installazione MRP
else else

View File

@ -9,6 +9,7 @@ int bainst17(int argc, char** argv);
int bainst31(int argc, char** argv); int bainst31(int argc, char** argv);
int bainst32(int argc, char** argv); int bainst32(int argc, char** argv);
int bainst35(int argc, char** argv); int bainst35(int argc, char** argv);
int bainst34(int argc, char** argv);
int bainst38(int argc, char** argv); int bainst38(int argc, char** argv);
int bainst39(int argc, char** argv); int bainst39(int argc, char** argv);

View File

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

View File

@ -4,18 +4,21 @@
#include <mask.h> #include <mask.h>
#include <isam.h> #include <isam.h>
#include <config.h> #include <config.h>
#include <tabutil.h>
#include "bainst.h" #include "bainst.h"
#include "bainst07.h" #include "bainst00.h"
class TInstall_BA : public TInstallmodule_app class TInstall_BA : public TInstallmodule_app
{ {
private: private:
protected: protected:
virtual bool modal() const {return FALSE;} virtual bool modal() const {return TRUE;}
virtual int module_number() const {return 0;} virtual int module_number() const {return 0;}
virtual bool install_firm() {return TRUE;} // no firm installation virtual bool install_firm() {return TRUE;} // no firm installation
virtual bool install_com() {return TRUE;} // no com installation // virtual bool install_com() {return TRUE;} // no com installation
virtual bool install_com();
virtual bool load_default_data() const ;
virtual bool post_installer(); virtual bool post_installer();
public: public:
@ -80,6 +83,26 @@ bool TInstall_BA::post_installer()
return TRUE; return TRUE;
} }
bool TInstall_BA ::install_com()
{
bool ok=TRUE;
TStd_filename txtfile;
if (txtfile.check(TRUE,"lfiva.txt"))
{
TSystemisamfile tabcom(LF_TABCOM);
tabcom.load((const char *)txtfile);
}
return ok;
}
bool TInstall_BA ::load_default_data() const
{
TTable iva("%IVA");
const bool empty = iva.first() != NOERR;
return empty;
}
int bainst00(int argc, char** argv) int bainst00(int argc, char** argv)
{ {
TInstall_BA app; TInstall_BA app;

2
ba/bainst00.h Executable file
View File

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

21
ba/bainst00.uml Executable file
View File

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

View File

@ -15,29 +15,15 @@ private:
bool CreaExeIni(const char * exename); bool CreaExeIni(const char * exename);
protected: protected:
virtual bool modal() const {return FALSE;}
virtual int module_number() const {return 7;} virtual int module_number() const {return 7;}
virtual bool install_firm() {return TRUE;} // no firm installation virtual bool install_firm() {return TRUE;} // no firm installation
virtual bool install_com();
virtual bool post_installer(); virtual bool post_installer();
public: public:
virtual ~TInstall_CG () {} virtual ~TInstall_CG () {}
}; };
bool TInstall_CG ::install_com()
{
// modifica per morena da togliere appena c'e' tempo:
// installa fliva.txt che noin c'e' in STD dei programmi,
// quindi la cerca in area dati (come prima)
bool ok=TRUE;
TStd_filename txtfile;
if (txtfile.check(TRUE,"lfiva.txt"))
{
TSystemisamfile tabcom(LF_TABCOM);
tabcom.load((const char *)txtfile);
}
return ok;
}
// crea il .ini per i files exe copiati nella directory di EASYCAMPO // crea il .ini per i files exe copiati nella directory di EASYCAMPO
bool TInstall_CG ::CreaExeIni(const char * exename) bool TInstall_CG ::CreaExeIni(const char * exename)

49
ba/bainst34.cpp Executable file
View File

@ -0,0 +1,49 @@
#include <applicat.h>
#include <mask.h>
#include <config.h>
#include <utility.h>
#include <isam.h>
#include <tabutil.h>
#include "bainst.h"
#include "bainst34.h"
class TInstall_EF : public TInstallmodule_app
{
protected:
// virtual bool load_type() const ;
virtual int module_number() const {return 34;}
virtual bool post_installer();
virtual bool modal() const {return FALSE;}
public:
virtual ~TInstall_EF () {}
};
bool TInstall_EF::post_installer()
{
return TRUE;
}
/*bool TInstall_EF::load_type() const
{
TLocalisamfile f(LF_EFFETTI);
TRectype& r = f.curr();
for (int err = f.first(); err == NOERR; err = f.next())
{
if (r.get("TIPOCF").blank())
{
r.put("TIPOCF","C");
f.rewrite();
}
}
return TRUE;
}
*/
int bainst34(int argc, char** argv)
{
TInstall_EF app;
app.run(argc, argv);
return 0;
}

1
ba/bainst34.h Executable file
View File

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

View File

@ -212,29 +212,30 @@ BEGIN
ITEM "16|Acquisti non soggetti all'imposta effettuati dai terremotati" ITEM "16|Acquisti non soggetti all'imposta effettuati dai terremotati"
END END
STRING FLD_TABIVA_S10 3 STRING FLD_TABIVA_S10 4
BEGIN BEGIN
PROMPT 3 12 "Riga vendite prospetto IVA periodica " PROMPT 3 12 "Riga vendite prospetto IVA periodica "
FIELD S10 FIELD S10
FLAGS "U" FLAGS "U"
SHEET "Riga|Descrizione@60" SHEET "Riga|Descrizione@60"
INPUT FLD_TABIVA_S10 INPUT FLD_TABIVA_S10
ITEM " |Nessuno" ITEM "|Nessuno"
ITEM "VP1|Ammontare complessivo operazioni attive" ITEM "VP1|Operazioni attive"
ITEM "VP2|Ammontare complessivo operazioni intracomunitarie" ITEM "VP1A|Operazioni attive ed anche cessioni intracomunitarie"
OUTPUT FLD_TABIVA_S10 OUTPUT FLD_TABIVA_S10
END END
STRING FLD_TABIVA_S11 3 STRING FLD_TABIVA_S11 4
BEGIN BEGIN
PROMPT 3 13 "Riga acquisti prospetto IVA periodica " PROMPT 3 13 "Riga acquisti prospetto IVA periodica "
FIELD S11 FIELD S11
FLAGS "U" FLAGS "U"
SHEET "Riga|Descrizione@60" SHEET "Riga|Descrizione@60"
INPUT FLD_TABIVA_S11 INPUT FLD_TABIVA_S11
ITEM " |Nessuno" ITEM "|Nessuno"
ITEM "VP3|Ammontare complessivo operazioni passive" ITEM "VP2|Operazioni passive"
ITEM "VP4|Ammontare complessivo operazioni intracomunitarie" ITEM "VP2A|Operazioni passive ed anche acquisti intracomunitari"
ITEM "VP3|Importazioni di oro e argento"
OUTPUT FLD_TABIVA_S11 OUTPUT FLD_TABIVA_S11
END END

View File

@ -26,16 +26,16 @@ END
STRING F_DESCR 50 STRING F_DESCR 50
BEGIN BEGIN
PROMPT 1 4 "Denonimazione " PROMPT 1 4 "Denominazione "
FIELD S0 FIELD S0
KEY 2 KEY 2
USE %RGI KEY 2 USE %RGI KEY 2
INPUT S0 F_DESCR INPUT S0 F_DESCR
DISPLAY "Descrizione @50" S0 DISPLAY "Descrizione @50" S0
DISPLAY "Codice" CODTAB DISPLAY "Codice@10" CODTAB
COPY OUTPUT F_CODREG COPY OUTPUT F_CODREG
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "La denomonazione e' obbligatoria" WARNING "La denominazione e' obbligatoria"
END END
ENDPAGE ENDPAGE

View File

@ -63,7 +63,14 @@ END
STRING FLD_TABSTA_S7_TABVAL_S0 50 STRING FLD_TABSTA_S7_TABVAL_S0 50
BEGIN BEGIN
PROMPT 24 8 "" PROMPT 24 8 ""
FLAGS "D" USE %VAL KEY 2
CHECKTYPE NORMAL
INPUT S0 FLD_TABSTA_S7_TABVAL_S0
DISPLAY "Codice" CODTAB
DISPLAY "Valuta@50" S0
OUTPUT FLD_TABSTA_S7 CODTAB
OUTPUT FLD_TABSTA_S7_TABVAL_S0 S0
HELP "Valuta corrente dello stato"
END END
STRING FLD_TABSTA_S2 10 STRING FLD_TABSTA_S2 10

View File

@ -74,7 +74,7 @@ END
STRING FLD_TABUCS_S6_COMUNI_DENCOM 50 STRING FLD_TABUCS_S6_COMUNI_DENCOM 50
BEGIN BEGIN
PROMPT 1 9 "Nome " PROMPT 1 9 "Denominazione "
USE LF_COMUNI KEY 2 USE LF_COMUNI KEY 2
INPUT DENCOM FLD_TABUCS_S6_COMUNI_DENCOM INPUT DENCOM FLD_TABUCS_S6_COMUNI_DENCOM
#include <comdden.h> #include <comdden.h>

View File

@ -75,7 +75,11 @@ END
STRING FLD_TABUID_S6_COMUNI_DENCOM 50 STRING FLD_TABUID_S6_COMUNI_DENCOM 50
BEGIN BEGIN
PROMPT 3 9 "Denominazione " PROMPT 3 9 "Denominazione "
FLAGS "D" USE LF_COMUNI KEY 2
INPUT DENCOM FLD_TABUID_S6_COMUNI_DENCOM
#include <comdden.h>
COPY OUTPUT FLD_TABUID_S6
CHECKTYPE NORMAL
END END
STRING FLD_TABUID_S6_COMUNI_PROVCOM 2 STRING FLD_TABUID_S6_COMUNI_PROVCOM 2

View File

@ -17,7 +17,7 @@ BEGIN
USE %UIV USE %UIV
INPUT CODTAB FLD_TABUIV_CODTAB INPUT CODTAB FLD_TABUIV_CODTAB
DISPLAY "Codice" CODTAB DISPLAY "Codice" CODTAB
DISPLAY "Dizione@50" S0 DISPLAY "Denominazione@50" S0
OUTPUT FLD_TABUIV_CODTAB CODTAB OUTPUT FLD_TABUIV_CODTAB CODTAB
OUTPUT FLD_TABUIV_S0 S0 OUTPUT FLD_TABUIV_S0 S0
HELP "Inserire il codice dell'ufficio IVA" HELP "Inserire il codice dell'ufficio IVA"
@ -26,12 +26,12 @@ END
STRING FLD_TABUIV_S0 40 STRING FLD_TABUIV_S0 40
BEGIN BEGIN
PROMPT 3 3 "Dizione " PROMPT 3 3 "Denominazione "
FIELD %UIV->S0 FIELD %UIV->S0
KEY 2 KEY 2
USE %UIV KEY 2 USE %UIV KEY 2
INPUT S0 FLD_TABUIV_S0 INPUT S0 FLD_TABUIV_S0
DISPLAY "Dizione@50" S0 DISPLAY "Denominazione@50" S0
DISPLAY "Codice" CODTAB DISPLAY "Codice" CODTAB
OUTPUT FLD_TABUIV_CODTAB CODTAB OUTPUT FLD_TABUIV_CODTAB CODTAB
OUTPUT FLD_TABUIV_S0 S0 OUTPUT FLD_TABUIV_S0 S0

View File

@ -72,7 +72,7 @@ END
STRING FLD_TABURE_S6_COMUNI_DENCOM 50 STRING FLD_TABURE_S6_COMUNI_DENCOM 50
BEGIN BEGIN
PROMPT 3 9 "Nome " PROMPT 3 9 "Denominazione "
USE LF_COMUNI KEY 2 USE LF_COMUNI KEY 2
INPUT DENCOM FLD_TABURE_S6_COMUNI_DENCOM INPUT DENCOM FLD_TABURE_S6_COMUNI_DENCOM
#include <comdden.h> #include <comdden.h>

View File

@ -109,13 +109,15 @@ BEGIN
PROMPT 2 12 "Cambio " PROMPT 2 12 "Cambio "
FIELD S4 FIELD S4
FLAGS "U" FLAGS "U"
CHECKTYPE REQUIRED
WARINING "E' necessario specificare un cambio di riferimento"
END END
NUMBER VAL_CHANGE_OLD 15 5 NUMBER VAL_CHANGE_OLD 15 5
BEGIN BEGIN
PROMPT 2 12 "Cambio " PROMPT 2 80 "Cambio "
FIELD R10 FIELD R10
FLAGS "HU" FLAGS "D"
END END
DATE VAL_LASTDATE DATE VAL_LASTDATE

View File

@ -37,5 +37,7 @@ ACNV(119)=77cnv 1
ACNV(13)=bacnv 16 ACNV(13)=bacnv 16
[199517] [199517]
ACNV(5)=bacnv 17 ACNV(5)=bacnv 17
[199518]
ACNV(31)=bacnv 18
[EOF] [EOF]

View File

@ -1 +1 @@
199517 199518

View File

@ -12,7 +12,7 @@ int main(int argc, char** argv)
case 3: cg0400(argc,argv); break; // Progressivi IVA case 3: cg0400(argc,argv); break; // Progressivi IVA
case 4: cg0500(argc,argv); break; // Causali contabili case 4: cg0500(argc,argv); break; // Causali contabili
case 5: cg0600(argc,argv); break; // Tabelle contabii case 5: cg0600(argc,argv); break; // Tabelle contabii
default: cg0100(argc,argv); break; // Piano deoi conti default: cg0100(argc,argv); break; // Piano dei conti
} }
exit(0); exit(0);
return 0; return 0;

View File

@ -4,11 +4,13 @@
#include <golem.h> #include <golem.h>
#include <msksheet.h> #include <msksheet.h>
#include <relapp.h> #include <relapp.h>
#include <recarray.h>
#include <sheet.h> #include <sheet.h>
#include <validate.h> #include <validate.h>
#include <utility.h> #include <utility.h>
#include <pconti.h> #include <pconti.h>
#include <comuni.h>
#include <clifo.h> #include <clifo.h>
#include <anagr.h> #include <anagr.h>
#include <anafis.h> #include <anafis.h>
@ -166,7 +168,7 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
return ok; return ok;
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ; TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
if ( f.get().not_empty() && !clifo.empty() ) if (f.get().not_empty() && !clifo.empty() )
{ {
clifo.zero() ; clifo.zero() ;
const char t1 = msk.get(F_TIPOCF)[0]; const char t1 = msk.get(F_TIPOCF)[0];
@ -183,8 +185,8 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
if (clifo.good() && (t1 != t || s1 != s)) if (clifo.good() && (t1 != t || s1 != s))
{ {
f.message_box("Partita iva gia' utilizzata per il codice %c/%ld", ok = f.error_box("Partita iva gia' utilizzata per il codice %c/%ld"
t, s); "\nsenza avere indicato il valore 4 nell'inserimento in allegato", t, s);
} }
} }
@ -504,7 +506,11 @@ int TClifo_application::read(TMask& m)
riga.add(rec.get(IND_PFAX)); riga.add(rec.get(IND_PFAX));
riga.add(rec.get(IND_FAX)); riga.add(rec.get(IND_FAX));
riga.add(rec.get(IND_IVARID)); riga.add(rec.get(IND_IVARID));
riga.add(rec.get(IND_CODIND)); TString16 key(rec.get(IND_STATO)); key << "|" << rec.get(IND_COM);
const TRectype & com = cache().get(LF_COMUNI, key);
riga.add(com.get(COM_DENCOM));
// riga.add(rec.get(IND_CODIND));
indsp_sheet().row(i)=riga; indsp_sheet().row(i)=riga;
// Load the sheets of CODINDDOC, CODINDSP, CODINDEFF. // Load the sheets of CODINDDOC, CODINDSP, CODINDEFF.

View File

@ -145,7 +145,7 @@
#define F_CONAIASS 242 #define F_CONAIASS 242
#define F_REFERENTE 243 #define F_REFERENTE 243
#define F_DESBANPR 244 #define F_DESBANPR 244
#define F_TIPODOCFAT 245 #define F_TIPODOCFAT 245
#define F_CODCAUS 246 #define F_CODCAUS 246
#define F_CODVALINTRA 247 #define F_CODVALINTRA 247
#define F_DESVALINTRA 248 #define F_DESVALINTRA 248
@ -173,7 +173,6 @@
#define F_PFAXI 110 #define F_PFAXI 110
#define F_FAXI 111 #define F_FAXI 111
#define F_IVARIDI 112 #define F_IVARIDI 112
//#define F_CODINDI 113 #define F_DENCOMI 113
#define F_DENCOMI 114
#endif // __CG0200_H #endif // __CG0200_H

View File

@ -1098,12 +1098,13 @@ BEGIN
ITEM "Localita@35" ITEM "Localita@35"
ITEM "CAP " ITEM "CAP "
ITEM "Stato" ITEM "Stato"
ITEM "Comune " ITEM "Cod.comune "
ITEM "Prefisso tel." ITEM "Prefisso tel."
ITEM "Numero tel.@30" ITEM "Numero tel.@30"
ITEM "Prefisso fax" ITEM "Prefisso fax"
ITEM "Numero fax@30" ITEM "Numero fax@30"
ITEM "Iva Rid." ITEM "Iva Rid."
ITEM "Comune@50"
END END
NUMBER F_CODINDDOC 3 NUMBER F_CODINDDOC 3

View File

@ -5,7 +5,6 @@
#include <mask.h> #include <mask.h>
#include <printapp.h> #include <printapp.h>
#include <tabutil.h> #include <tabutil.h>
//#include <utility.h>
#include <prefix.h> #include <prefix.h>
#include "cg0.h" #include "cg0.h"
@ -19,8 +18,6 @@
#include <nditte.h> #include <nditte.h>
HIDDEN TString80 TMP;
enum liste { enum liste {
visualizza=1, visualizza=1,
stampa=2, stampa=2,
@ -135,6 +132,8 @@ class TProgressivi_iva : public TPrintapp
Importi _mesi[13]; Importi _mesi[13];
liste _tipo_lista; liste _tipo_lista;
TString TMP; // Ex HIDDEN: bestie!
protected: protected:
static bool tipo_handler(TMask_field& f, KEY k); static bool tipo_handler(TMask_field& f, KEY k);
static bool selection_handler(TMask_field& f, KEY k); static bool selection_handler(TMask_field& f, KEY k);
@ -347,6 +346,11 @@ void TProgressivi_iva::look_pim()
if (tipoiva == "VE") continue; //i codici iva di tipo "VE" if (tipoiva == "VE") continue; //i codici iva di tipo "VE"
//Fine //non devono essere stampati //Fine //non devono essere stampati
bool soggetto = TRUE;
tabiva.put("CODTAB",codiva);
if (tabiva.read() == NOERR)
soggetto = tabiva.get("S1") != "NS"; // I non soggetti non vanno sempre considerati
reg.put("CODTAB",codreg); reg.put("CODTAB",codreg);
if (reg.read() != NOERR) reg.zero(); if (reg.read() != NOERR) reg.zero();
const bool corrisp = reg.get_bool("B0"); const bool corrisp = reg.get_bool("B0");
@ -412,25 +416,29 @@ void TProgressivi_iva::look_pim()
_gen1_array.add_riga(codiva,ZERO,ZERO,ZERO,ZERO,imponibile,imposta); _gen1_array.add_riga(codiva,ZERO,ZERO,ZERO,ZERO,imponibile,imposta);
break; break;
case acq_amm_ultdetr: case acq_amm_ultdetr:
{ if (soggetto)
real detr = imponibile * real(0.06); {
if (_mese != 13) const real detr = imponibile * real(0.06);
_iva_array.add_riga(tipo,imponibile,imposta,detr); if (_mese != 13)
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) _iva_array.add_riga(tipo,imponibile,imposta,detr);
_iva1_array.add_riga(tipo,imponibile,imposta,detr); if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
} _iva1_array.add_riga(tipo,imponibile,imposta,detr);
}
break; break;
case acq_simp:
case vend_simp:
case cess_amm:
case acq_beni_riv: case acq_beni_riv:
tabiva.put("CODTAB",codiva); case acq_beni_ammort:
if (tabiva.read() == NOERR) case acq_beni_ammort_nd:
// I non soggetti non vanno considerati nel totale acq. beni rivendita case acq_beni_leasing:
if (tabiva.get("S1") != "NS") if (soggetto)
{ {
if (_mese != 13) if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,ZERO); _iva_array.add_riga(tipo,imponibile,imposta,ZERO);
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13) if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
_iva1_array.add_riga(tipo,imponibile,imposta,ZERO); _iva1_array.add_riga(tipo,imponibile,imposta,ZERO);
} }
break; break;
default: default:
if (sosp_imp == normale || sosp_imp == nessuna) // Esclude quelli valevoli solo liq o solo vol.aff. dai riepiloghi altri dati if (sosp_imp == normale || sosp_imp == nessuna) // Esclude quelli valevoli solo liq o solo vol.aff. dai riepiloghi altri dati
@ -482,18 +490,27 @@ void TProgressivi_iva::cerca_i_pim()
codiva = codtab.mid(16,4); codiva = codtab.mid(16,4);
tipoiva = pim.get("S5"); tipoiva = pim.get("S5");
if (anno != _annoiva) continue; if (anno != _annoiva)
continue;
//Modifica del 12/07/1995 //Modifica del 12/07/1995
if (tipoiva == "VE") continue; if (tipoiva == "VE")
continue;
//Fine //Fine
if (_livelloprog == 1) //riepilogo per aliquota if (_livelloprog == 1) //riepilogo per aliquota
{ {
codiva = codiva.trim(); codiva = codiva.trim();
if (codiva != _codivamsk) continue; if (codiva != _codivamsk)
continue;
} }
// I non soggetti non vanno considerati
bool soggetto = TRUE;
tabiva.put("CODTAB",codiva);
if (tabiva.read() == NOERR)
soggetto = tabiva.get("S1") != "NS";
if (_livelloprog == 2) //riepilogo per attivita' if (_livelloprog == 2) //riepilogo per attivita'
{ {
codatt = codatt.trim(); codatt = codatt.trim();
@ -506,6 +523,14 @@ void TProgressivi_iva::cerca_i_pim()
if (reg.read() != NOERR) reg.zero(); if (reg.read() != NOERR) reg.zero();
const bool corrisp = reg.get_bool("B0"); const bool corrisp = reg.get_bool("B0");
if (_livelloprog == 1 && _tipoprog == 1 && _sospmsk == 2) // CM500309
{
const bool sosp = reg.get_bool("B1");
const int tipo_sosp = reg.get_int("I9");
if (sosp && tipo_sosp > 1)
continue;
}
while (classify_pim(pim.curr(), imponibile, imposta, tipo, FALSE)) while (classify_pim(pim.curr(), imponibile, imposta, tipo, FALSE))
{ {
switch(tipo) switch(tipo)
@ -533,6 +558,7 @@ void TProgressivi_iva::cerca_i_pim()
} }
break; break;
case vend_simp: case vend_simp:
if (!soggetto) break;
if (_tipoprog == 2) break; //acquisti if (_tipoprog == 2) break; //acquisti
if (_sospmsk == 2) //nella maschera e' stato richiesto if (_sospmsk == 2) //nella maschera e' stato richiesto
{ //vendite in sospensione d'imposta { //vendite in sospensione d'imposta
@ -582,6 +608,7 @@ void TProgressivi_iva::cerca_i_pim()
} }
break; break;
case acq_simp: case acq_simp:
if (!soggetto) break;
if (_tipoprog == 1) break; if (_tipoprog == 1) break;
if (_tipo_aliq == 7) if (_tipo_aliq == 7)
{ {
@ -590,18 +617,16 @@ void TProgressivi_iva::cerca_i_pim()
} }
break; break;
case acq_beni_riv: case acq_beni_riv:
if (!soggetto) break;
if (_tipoprog == 1) break; if (_tipoprog == 1) break;
tabiva.put("CODTAB",codiva); if (_tipo_attiv == 1)
if (tabiva.read() == NOERR) {
// I non soggetti non vanno considerati nel totale acq. beni rivendita impo += imponibile;
if (tabiva.get("S1") != "NS") impos += imposta;
if (_tipo_attiv == 1) }
{
impo += imponibile;
impos += imposta;
}
break; break;
case acq_beni_ammort: case acq_beni_ammort:
if (!soggetto) break;
if (_tipoprog == 1) break; if (_tipoprog == 1) break;
if (_tipo_attiv == 2) if (_tipo_attiv == 2)
{ {
@ -610,6 +635,7 @@ void TProgressivi_iva::cerca_i_pim()
} }
break; break;
case acq_beni_ammort_nd: case acq_beni_ammort_nd:
if (!soggetto) break;
if (_tipoprog == 1) break; if (_tipoprog == 1) break;
if (_tipo_attiv == 3) if (_tipo_attiv == 3)
{ {
@ -618,6 +644,7 @@ void TProgressivi_iva::cerca_i_pim()
} }
break; break;
case acq_beni_leasing: case acq_beni_leasing:
if (!soggetto) break;
if (_tipoprog == 1) break; if (_tipoprog == 1) break;
if (_tipo_attiv == 4) if (_tipo_attiv == 4)
{ {
@ -626,6 +653,7 @@ void TProgressivi_iva::cerca_i_pim()
} }
break; break;
case acq_amm_ultdetr: case acq_amm_ultdetr:
if (!soggetto) break;
if (_tipoprog == 1) break; if (_tipoprog == 1) break;
if (_tipo_attiv == 5) if (_tipo_attiv == 5)
{ {
@ -634,6 +662,7 @@ void TProgressivi_iva::cerca_i_pim()
} }
break; break;
case cess_amm: case cess_amm:
if (!soggetto) break;
if (_tipoprog == 2) break; if (_tipoprog == 2) break;
if (_livelloprog == 2) //Nel caso di vendite per attivita' il tipo costo/ricavo if (_livelloprog == 2) //Nel caso di vendite per attivita' il tipo costo/ricavo
{ //viene forzato a 4 => cessione beni ammortizzabili { //viene forzato a 4 => cessione beni ammortizzabili
@ -969,11 +998,7 @@ void TProgressivi_iva::prospetto_pagina(TGen_array& gen, TIva_array& iva)
set_row(r++, "Totale generale IVA@24g%r@40g%r@62g%r@78g%r@100g%r@116g%r", set_row(r++, "Totale generale IVA@24g%r@40g%r@62g%r@78g%r@100g%r@116g%r",
&t_impov,&t_imposv,&t_impoa,&t_imposa,&t_impobd,&t_imposbd); &t_impov,&t_imposv,&t_impoa,&t_imposa,&t_impobd,&t_imposbd);
r+=3; r+=3;
int kk = r; const int kk = r; // memorizza riga in cui scrivere "altri dati relativi alla dichiarazione"
/*
set_row(r++, "ALTRI DATI RELATIVI ALLA DICHIARAZIONE@54gImponibile@74gImposta@91gDetrazione");
r++;
*/
r+=2; r+=2;
st_riga = FALSE; st_riga = FALSE;
@ -1204,19 +1229,13 @@ void TProgressivi_iva::preprocess_header()
int soh = 1; int soh = 1;
TString sep(132); TString sep(132);
TString ragsoc(50); TString ragsoc(50);
//TString attprev(5);
TString16 descf; TString16 descf;
TLocalisamfile nditte(LF_NDITTE); TLocalisamfile nditte(LF_NDITTE);
nditte.zero(); nditte.zero();
nditte.put(NDT_CODDITTA, _codditta); nditte.put(NDT_CODDITTA, _codditta);
if (nditte.read() == NOERR) if (nditte.read() == NOERR)
{
ragsoc = nditte.get(NDT_RAGSOC); ragsoc = nditte.get(NDT_RAGSOC);
//attprev = nditte.get(NDT_CODATTPREV);
}
//TString80 descr = desc_attivita(attprev);
TString80 descr = desc_attivita(_cod_att); TString80 descr = desc_attivita(_cod_att);
@ -1250,10 +1269,6 @@ void TProgressivi_iva::preprocess_header()
const char* pro_des = _tipo_prog_reg == 'L' ? "liquidazione IVA" : "Volume Affari"; const char* pro_des = _tipo_prog_reg == 'L' ? "liquidazione IVA" : "Volume Affari";
/*
set_header (soh++, "Riepilogo progressivi IVA del periodo %s %d Cod. Att. %s %s", itom(_mese), _anno, (const char*) _cod_att, (const char*) descr);
set_header (soh++, (const char *) sep);
*/
TString periodo; TString periodo;
if (f == 'M') if (f == 'M')

View File

@ -738,10 +738,10 @@ void CG1100_application::set_con_IV()
} }
} }
} }
set_row (_i,"@58g$[r]%3d$[n]", _gruppo); set_row (_i,"@58g$[b]%3d$[n]", _gruppo);
set_row (_i,"@62g$[r]%3d$[n]", _conto); set_row (_i,"@62g$[b]%3d$[n]", _conto);
if (_sottoc != 0) if (_sottoc != 0)
set_row (_i,"@66g$[r]%6ld$[n]", _sottoc); set_row (_i,"@66g$[b]%6ld$[n]", _sottoc);
set_row (_i,"@73g%.40s", (const char*) descr); set_row (_i,"@73g%.40s", (const char*) descr);
if (sez_opp != '0') if (sez_opp != '0')
@ -811,7 +811,7 @@ void CG1100_application::set_senza_IV_ana()
_stampa_riga_vuota = FALSE; _stampa_riga_vuota = FALSE;
} }
set_row (i, "$[r]@pn$[n] $[r]@pn$[n] $[r]@pn$[n]", set_row (i, "$[b]@pn$[n] $[b]@pn$[n] $[b]@pn$[n]",
FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"), FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"),
FLD(LF_PCON, PCN_SOTTOCONTO, "######")); FLD(LF_PCON, PCN_SOTTOCONTO, "######"));
@ -869,13 +869,13 @@ void CG1100_application::set_con_ana()
set_row (_i,"@11g%s", (const char*) descrizione); set_row (_i,"@11g%s", (const char*) descrizione);
} }
set_row (_i,"@62g$[r]%3d$[n]", _gruppo); set_row (_i,"@62g$[b]%3d$[n]", _gruppo);
if (_conto != 0) if (_conto != 0)
set_row (_i,"@66g$[r]%3d$[n]", _conto); set_row (_i,"@66g$[b]%3d$[n]", _conto);
if (_sottoc != 0) if (_sottoc != 0)
set_row (_i,"@70g$[r]%6ld$[n]", _sottoc); set_row (_i,"@70g$[b]%6ld$[n]", _sottoc);
if (_gruppo > 99 || _conto > 99) if (_gruppo > 99 || _conto > 99)
set_row(_i,"@76g*"); set_row(_i,"@76g*");
@ -896,7 +896,7 @@ void CG1100_application::set_senza_ana()
{ {
reset_row (1); reset_row (1);
set_row (1, "$[r]@pn$[n] $[r]@pn$[n] $[r]@pn$[n]", set_row (1, "$[b]@pn$[n] $[b]@pn$[n] $[b]@pn$[n]",
FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"), FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"),
FLD(LF_PCON, PCN_SOTTOCONTO, "######")); FLD(LF_PCON, PCN_SOTTOCONTO, "######"));
@ -944,7 +944,7 @@ void CG1100_application::set_completa()
reset_print (); reset_print ();
set_row (i, "$[r]@pn$[n] $[r]@pn$[n] $[r]@pn$[n]", set_row (i, "$[b]@pn$[n] $[b]@pn$[n] $[b]@pn$[n]",
FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"), FLD(LF_PCON, PCN_GRUPPO, "###"), FLD(LF_PCON,PCN_CONTO, "###"),
FLD(LF_PCON, PCN_SOTTOCONTO, "######")); FLD(LF_PCON, PCN_SOTTOCONTO, "######"));
@ -1224,11 +1224,11 @@ bool CG1100_application::set_print(int)
if (tasto == K_ENTER) if (tasto == K_ENTER)
{ {
_tipo_stampa = (stampe)_msk->get_int(F_SCELTA_STAMPA); _tipo_stampa = (stampe)_msk->get_int(F_SCELTA_STAMPA);
_salto_pag = _msk->get_bool (F_SALTO_PAGINA); _salto_pag = _msk->get_bool(F_SALTO_PAGINA);
_data_stampa = _msk->get (F_DATA_STAMPA); _data_stampa = _msk->get(F_DATA_STAMPA);
// scegli_cur(); // scegli_cur();
enable_link("Collegamento Piano dei conti : ", 'r'); enable_link("Collegamento Piano dei conti: ", 'b');
set_multiple_link(TRUE); set_multiple_link(TRUE);
_sez_stamp = ' '; _sez_stamp = ' ';

View File

@ -620,7 +620,7 @@ void TPrintclifo_app::header_rubriche()
void TPrintclifo_app::set_elenco() void TPrintclifo_app::set_elenco()
{ {
// body // body
set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF),
FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name); FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name);
set_row(2,"@9g#t@56g@s@63g#t @s @s", &_indir, FLD(LF_CLIFO, CLI_CAPCF), set_row(2,"@9g#t@56g@s@63g#t @s @s", &_indir, FLD(LF_CLIFO, CLI_CAPCF),
&_localita, FLD(-COMRF_ALIAS,COM_DENCOM), FLD(-COMRF_ALIAS,COM_PROVCOM)); &_localita, FLD(-COMRF_ALIAS,COM_DENCOM), FLD(-COMRF_ALIAS,COM_PROVCOM));
@ -638,7 +638,7 @@ void TPrintclifo_app::header_rubriche()
//modifica del 27/04/1995 //modifica del 27/04/1995
void TPrintclifo_app::set_elenco() void TPrintclifo_app::set_elenco()
{ {
set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF),
FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name); FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name);
set_row(2,"@9g#t@56g@s@63g#t", &_indir, FLD(LF_CLIFO, CLI_CAPCF),&_comprov); set_row(2,"@9g#t@56g@s@63g#t", &_indir, FLD(LF_CLIFO, CLI_CAPCF),&_comprov);
set_row(3,"@9g#t@90g#t@115g#t", &_telefono, &_fax, &_telex); set_row(3,"@9g#t@90g#t@115g#t", &_telefono, &_fax, &_telex);
@ -655,7 +655,7 @@ void TPrintclifo_app::set_elenco()
void TPrintclifo_app::set_rubriche() void TPrintclifo_app::set_rubriche()
{ {
// body // body
set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO,CLI_TIPOCF), set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO,CLI_TIPOCF),
FLD(LF_CLIFO,CLI_CODCF,"@@@@@@"), &_name); FLD(LF_CLIFO,CLI_CODCF,"@@@@@@"), &_name);
//set_row(1,"@60g#t@100g@s@106g#t@127g@s", &_indir, FLD(LF_CLIFO, CLI_CAPCF), //set_row(1,"@60g#t@100g@s@106g#t@127g@s", &_indir, FLD(LF_CLIFO, CLI_CAPCF),
// &_localita, FLD(-COMRF_ALIAS,COM_PROVCOM)); // &_localita, FLD(-COMRF_ALIAS,COM_PROVCOM));
@ -740,7 +740,7 @@ void TPrintclifo_app::set_vendite(int f, int c)
set_header(11,"@9gRaggr. ordini @25gImporto Minimo @46gImporto Massimo @63gPriorita ev. @76gTipo Evasione"); set_header(11,"@9gRaggr. ordini @25gImporto Minimo @46gImporto Massimo @63gPriorita ev. @76gTipo Evasione");
set_header(12, (const char *)(TString(132).fill('-'))); set_header(12, (const char *)(TString(132).fill('-')));
set_row(1,"$[r]@1s$[n] $[r]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF), set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF),
FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name); FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name);
set_row(2,"@9g@2s @25g@2s @46g@2s @63g@2s @76g@2s @93g@2s @101g@3s @112g@n", set_row(2,"@9g@2s @25g@2s @46g@2s @63g@2s @76g@2s @93g@2s @101g@3s @112g@n",
@ -897,7 +897,7 @@ bool TPrintclifo_app::set_print(int)
if (_pr_type != etichette) if (_pr_type != etichette)
{ {
set_multiple_link(TRUE); set_multiple_link(TRUE);
enable_link("Collegamento clienti e fornitori : ", 'r'); enable_link("Collegamento clienti e fornitori : ", 'b');
} }
_sort = mask.get_int(RDB_CG12_SORT); _sort = mask.get_int(RDB_CG12_SORT);
@ -988,7 +988,7 @@ bool TPrintclifo_app::ges_ven()
bool TPrintclifo_app::user_create() bool TPrintclifo_app::user_create()
{ {
// set relation and cursors // set relation and cursors
_rel = new TRelation(LF_CLIFO); _rel = new TRelation(LF_CLIFO);
_rel->add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1, 0, COMRF_ALIAS); _rel->add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1, 0, COMRF_ALIAS);
_rel->add(LF_COMUNI, "STATO==STATONASC|COM==COMNASC", 1, 0, COMNASC_ALIAS); _rel->add(LF_COMUNI, "STATO==STATONASC|COM==COMNASC", 1, 0, COMNASC_ALIAS);
if (ges_ven()) if (ges_ven())

View File

@ -6,8 +6,6 @@
#include <relation.h> #include <relation.h>
#include <tabutil.h> #include <tabutil.h>
#include <progind.h> #include <progind.h>
#include <urldefid.h>
#include <prefix.h>
#include <mov.h> #include <mov.h>
#include <rmoviva.h> #include <rmoviva.h>
@ -23,35 +21,29 @@
#include "cg1308.h" #include "cg1308.h"
#include "cglib01.h" #include "cglib01.h"
class TAgg_attiv : public TApplication class TAgg_attiv : public TSkeleton_application
{ {
TLocalisamfile* _pcon,* _attiv; TLocalisamfile* _pcon,* _attiv;
TTable* _reg; TTable* _reg;
public: protected:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual bool menu(MENU_TAG m); virtual void main_loop();
public:
void elabora_mov(); void elabora_mov();
TAgg_attiv() {};
virtual ~TAgg_attiv() {};
}; };
HIDDEN TAgg_attiv& app() { return (TAgg_attiv&)main_app(); } HIDDEN TAgg_attiv& app() { return (TAgg_attiv&)main_app(); }
bool TAgg_attiv::create() bool TAgg_attiv::create()
{ {
TApplication::create();
_pcon = new TLocalisamfile(LF_PCON); _pcon = new TLocalisamfile(LF_PCON);
_attiv = new TLocalisamfile(LF_ATTIV); _attiv = new TLocalisamfile(LF_ATTIV);
_reg = new TTable("REG"); _reg = new TTable("REG");
dispatch_e_menu (BAR_ITEM(1)); return TSkeleton_application::create();
return TRUE;
} }
bool TAgg_attiv::destroy() bool TAgg_attiv::destroy()
@ -60,20 +52,17 @@ bool TAgg_attiv::destroy()
delete _attiv; delete _attiv;
delete _reg; delete _reg;
return TApplication::destroy(); return TSkeleton_application::destroy();
} }
bool TAgg_attiv::menu(MENU_TAG m) void TAgg_attiv::main_loop()
{ {
TMask msk("cg1300a"); TMask msk("cg1300a");
while (msk.run() == K_ENTER) while (msk.run() == K_ENTER)
{ {
elabora_mov(); elabora_mov();
message_box("Aggiornamento completato"); message_box("Aggiornamento completato");
//return TRUE;
} }
return FALSE;
} }
void TAgg_attiv::elabora_mov() void TAgg_attiv::elabora_mov()
@ -163,7 +152,7 @@ int cg1300(int argc, char* argv[])
case 'T': case 'T':
{ {
TAgg_tconto a; TAgg_tconto a;
a.run(argc, argv, "Aggiornamento tipo conto"); a.run(argc, argv, "Aggiornamento tipo conto"); // cg1302
} }
break; break;
case 'Z': case 'Z':

View File

@ -53,15 +53,15 @@ BEGIN
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END
RADIOBUTTON F_MODE 1 60 RADIOBUTTON F_MODE 1 24
BEGIN BEGIN
PROMPT 1 6 "@bRiparti da " PROMPT 1 6 "@bRiparti da "
ITEM "U|Ultima stampa" ITEM "U|Ultima stampa"
MESSAGE CLEAR,F_PROT MESSAGE CLEAR,F_PROT
ITEM "N|Numero specificato" ITEM "N|Numero specificato"
MESSAGE ENABLE,F_PROT MESSAGE ENABLE,F_PROT
ITEM "A|Inizio anno" ITEM "A|Inizio anno"
MESSAGE CLEAR,F_PROT MESSAGE CLEAR,F_PROT
END END
DATE F_DA DATE F_DA

View File

@ -1,15 +1,20 @@
//**************************** //****************************
//* Aggiornamento Tipo Conto * //* Aggiornamento Tipo Conto *
//**************************** //****************************
#include <recarray.h>
#include <mov.h> #include <mov.h>
#include <rmoviva.h> #include <rmoviva.h>
#include <nditte.h> #include <nditte.h>
#include "cg1300.h"
#include "cg1302.h" #include "cg1302.h"
#include "cglib01.h" #include "cglib01.h"
const int TAgg_tconto::look_reg (const char* cod, int anno) const int TAgg_tconto::look_reg (const char* cod, int anno)
{ {
/*
TTable tab_reg("REG"); TTable tab_reg("REG");
TString codtab; TString codtab;
codtab.format("%4d%-3s", anno, cod); codtab.format("%4d%-3s", anno, cod);
@ -23,13 +28,18 @@ const int TAgg_tconto::look_reg (const char* cod, int anno)
tipo_reg = 0; tipo_reg = 0;
return tipo_reg; return tipo_reg;
*/
TString16 codtab;
codtab.format("%4d%-3s", anno, cod);
int tipo_reg = cache().get("REG", codtab).get_int("I0");
return tipo_reg;
} }
bool TAgg_tconto::user_create() bool TAgg_tconto::user_create()
{ {
_rel = new TRelation(LF_MOV); _rel = new TRelation(LF_MOV);
_rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1); _rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
_cur = new TCursor(_rel,"",1); _cur = new TCursor(_rel, "", 1);
add_cursor(_cur); add_cursor(_cur);
add_file (LF_MOV); add_file (LF_MOV);
@ -68,7 +78,7 @@ bool TAgg_tconto::set_print(int)
void TAgg_tconto::postclose_print() void TAgg_tconto::postclose_print()
{ {
message_box("Aggiornamento tipo conto completato"); message_box("Aggiornamento tipo conto completato:\nE' necessario ricalcolare la liquidazione.");
} }
bool TAgg_tconto::preprocess_page(int file,int counter) bool TAgg_tconto::preprocess_page(int file,int counter)
@ -78,7 +88,7 @@ bool TAgg_tconto::preprocess_page(int file,int counter)
TCursor* cur = current_cursor(); TCursor* cur = current_cursor();
if (file == LF_MOV) if (file == LF_MOV)
{ {
TString16 reg = cur->curr().get(MOV_REG); const TString& reg = cur->curr().get(MOV_REG);
if (reg.empty()) return FALSE; if (reg.empty()) return FALSE;
} }
else if (file == LF_RMOVIVA) else if (file == LF_RMOVIVA)
@ -150,8 +160,7 @@ void TAgg_tconto::setta_intestazione()
set_header (soh++, (const char*) sep); set_header (soh++, (const char*) sep);
sep = ""; sep = "";
sep << "Data @< Pag. @#"; sep << "Data @> Pag. @#";
sep.right_just(127); sep.right_just(127);
sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori"); sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori");

View File

@ -108,7 +108,7 @@ bool TAgg_nprot::rinumera_prot(char mode, long last_prot)
} }
} }
if (last_prot > 0) if (last_prot > 0 && mode == 'N')
{ {
if (protiva != last_prot && uprotiva != last_prot) //sono alla fine del file if (protiva != last_prot && uprotiva != last_prot) //sono alla fine del file
return error_box("Non esiste la registrazione con protocollo %ld:\nrinumerazione non avvenuta", last_prot); return error_box("Non esiste la registrazione con protocollo %ld:\nrinumerazione non avvenuta", last_prot);

View File

@ -1,5 +1,6 @@
// sistema il codice esercizio di tutti i movimenti // sistema il codice esercizio di tutti i movimenti
#include <mask.h>
#include <progind.h>
#include <recarray.h> #include <recarray.h>
#include <relation.h> #include <relation.h>
@ -15,12 +16,10 @@ inline TAgg_codes& app() { return (TAgg_codes&) main_app(); }
bool TAgg_codes::create() bool TAgg_codes::create()
{ {
TApplication::create();
_mov = new TLocalisamfile(LF_MOV); _mov = new TLocalisamfile(LF_MOV);
_rmov = new TLocalisamfile(LF_RMOV); _rmov = new TLocalisamfile(LF_RMOV);
_rmoviva = new TLocalisamfile(LF_RMOVIVA); _rmoviva = new TLocalisamfile(LF_RMOVIVA);
dispatch_e_menu (BAR_ITEM(1)); return TSkeleton_application::create();
return TRUE;
} }
bool TAgg_codes::destroy() bool TAgg_codes::destroy()
@ -29,19 +28,17 @@ bool TAgg_codes::destroy()
delete _rmov; delete _rmov;
delete _rmoviva; delete _rmoviva;
return TApplication::destroy(); return TSkeleton_application::destroy();
} }
bool TAgg_codes::menu(MENU_TAG m) void TAgg_codes::main_loop()
{ {
TMask msk("cg1300d"); TMask msk("cg1300d");
if (msk.run() == K_ENTER) if (msk.run() == K_ENTER)
return calcola_codes(); calcola_codes();
else
return FALSE;
} }
bool TAgg_codes::calcola_codes() void TAgg_codes::calcola_codes()
{ {
TLocalisamfile& mov = get_mov(); TLocalisamfile& mov = get_mov();
TEsercizi_contabili esercizi; TEsercizi_contabili esercizi;
@ -73,7 +70,7 @@ bool TAgg_codes::calcola_codes()
righe.read(riga); righe.read(riga);
righeiva.read(rigaiva); righeiva.read(rigaiva);
righe.renum_key(RMV_ANNOES,newcodes); righe.renum_key(RMV_ANNOES,newcodes);
s_codes = format("%04d",newcodes); s_codes.format("%04d",newcodes);
righeiva.renum_key(RMI_ANNOES,s_codes); righeiva.renum_key(RMI_ANNOES,s_codes);
if (err == NOERR) if (err == NOERR)
{ {
@ -85,7 +82,9 @@ bool TAgg_codes::calcola_codes()
} }
} }
} }
if (err != NOERR) warning_box("Aggiornamento codice esercizio interrotta. Rilevato errore %d in riscrittura",err); if (err != NOERR)
else message_box("Aggiornamento codice esercizio completata. Modificati %ld movimenti.",modified_recs); warning_box("Aggiornamento codice esercizio interrotta. Rilevato errore %d in riscrittura",err);
return FALSE; else
message_box("Aggiornamento codice esercizio completata. Modificati %ld movimenti.\n"
"E' necessario procedere col ricalcolo saldi", modified_recs);
} }

View File

@ -1,24 +1,18 @@
#include <applicat.h> #include <applicat.h>
#include <mask.h> #include <isam.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
class TAgg_codes : public TApplication class TAgg_codes : public TSkeleton_application
{ {
TLocalisamfile* _mov; TLocalisamfile* _mov;
TLocalisamfile* _rmov; TLocalisamfile* _rmov;
TLocalisamfile* _rmoviva; TLocalisamfile* _rmoviva;
public: protected:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual bool menu(MENU_TAG m); virtual void main_loop();
public:
TLocalisamfile& get_mov() { return *_mov; } TLocalisamfile& get_mov() { return *_mov; }
void calcola_codes();
bool calcola_codes();
TAgg_codes() {};
virtual ~TAgg_codes() {};
}; };

View File

@ -1411,33 +1411,51 @@ bool TStampa_bilanci::bil_verifica()
saldi.put(SLD_SOTTOCONTO, s); saldi.put(SLD_SOTTOCONTO, s);
if (saldi.read() == NOERR) if (saldi.read() == NOERR)
{ {
real ss = saldi.get_real(SLD_SALDO); const real ss = saldi.get_real(SLD_SALDO);
if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) if (ss.is_zero())
if (ss == ZERO && _annoes != 0) {
if (_annoes != 0 && (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5))
{ {
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s); saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/95 //modifica del 21/11/95
if (saldo_iniziale > ZERO) if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale; _saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale; else
_saldo_ini_avere = -saldo_iniziale;
//fine //fine
} }
}
else
{
const char fsi = saldi.get_char(SLD_FLAGSALINI);
if (fsi == 'D')
{
saldo_iniziale = ss;
_saldo_ini_dare = ss;
}
else
{
saldo_iniziale = -ss;
_saldo_ini_avere = ss;
}
}
} }
} }
} }
if (!movimentato) //_mov_ap e' di sicuro FALSE else // !movimentato -> _mov_ap e' di sicuro FALSE
if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5) {
if (_annoes != 0) if (_annoes != 0 && (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5))
{ {
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/95 //modifica del 21/11/95
if (saldo_iniziale > ZERO) if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale; _saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale; else _saldo_ini_avere = -saldo_iniziale;
//fine //fine
if (_stampav == 1 && sld.significativo()) if (_stampav == 1 && sld.significativo())
movimentato = TRUE; movimentato = TRUE;
} }
}
} }
//if (movimentato) //if (movimentato)
@ -1747,8 +1765,11 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
conto_mov = TRUE; conto_mov = TRUE;
if (sezione == 'D') if (sezione == 'D')
_mov_periodo_dare += importo; _mov_periodo_dare += importo;
else _mov_periodo_avere += importo; else
_mov_periodo_avere += importo;
_u_max = fnc_max(_u_max, data); _u_max = fnc_max(_u_max, data);
if (causap == 'A')
_mov_ap = TRUE;
} }
//il saldo inizio es. e' dato dall'importo dare - importo avere di quei movimenti che hanno causale == apertura e data reg >= data inizio es. e <= data limite sup. //il saldo inizio es. e' dato dall'importo dare - importo avere di quei movimenti che hanno causale == apertura e data reg >= data inizio es. e <= data limite sup.
@ -1760,7 +1781,8 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
{ {
if (sezione == 'D') if (sezione == 'D')
_saldo_ini_dare += importo; _saldo_ini_dare += importo;
else _saldo_ini_avere += importo; else
_saldo_ini_avere += importo;
_u_max = fnc_max(_u_max, data); _u_max = fnc_max(_u_max, data);
conto_mov = _mov_ap = TRUE; conto_mov = _mov_ap = TRUE;
} }
@ -1771,7 +1793,8 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
{ {
if (sezione == 'D') if (sezione == 'D')
_prg_prec_dare += importo; _prg_prec_dare += importo;
else _prg_prec_avere += importo; else
_prg_prec_avere += importo;
_u_max = fnc_max(_u_max, data); _u_max = fnc_max(_u_max, data);
conto_mov = TRUE; conto_mov = TRUE;
} }
@ -1819,9 +1842,10 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
{ {
if (movimentato) if (movimentato)
{ {
//modifica del 21/11/1995
if (_mov_ap) if (_mov_ap)
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere; {
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
}
else else
{ {
TLocalisamfile saldi(LF_SALDI); TLocalisamfile saldi(LF_SALDI);
@ -1835,32 +1859,51 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
{ {
//se il saldo iniziale e' diverso da zero non lo devo considerare //se il saldo iniziale e' diverso da zero non lo devo considerare
//perche' l'ho gia' considerato nella funzione calcola //perche' l'ho gia' considerato nella funzione calcola
real ss = saldi.get_real(SLD_SALDO); const real ss = saldi.get_real(SLD_SALDO);
if (ib == 1 || ib == 2 || ib == 5) if (ss.is_zero())
if (ss == ZERO && _annoes != 0) //competenza!!! {
if (_annoes != 0 && (ib == 1 || ib == 2 || ib == 5))
{ {
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s); saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/1995 //modifica del 21/11/1995
if (saldo_iniziale > ZERO) if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale; _saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale; else
_saldo_ini_avere = -saldo_iniziale;
//fine //fine
} }
}
else
{
const char fsi = saldi.get_char(SLD_FLAGSALINI);
if (fsi == 'D')
{
saldo_iniziale = ss;
_saldo_ini_dare = ss;
}
else
{
saldo_iniziale = -ss;
_saldo_ini_avere = ss;
}
}
} }
} }
} }
if (!movimentato) else
if (ib == 1 || ib == 2 || ib == 5) {
if (_annoes != 0) //cioe' se sto ragionando per competenza if (_annoes != 0 && (ib == 1 || ib == 2 || ib == 5))
{ {
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s); saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/1995 //modifica del 21/11/1995
if (saldo_iniziale > ZERO) if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale; _saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale; else
//fine _saldo_ini_avere = -saldo_iniziale;
movimentato = sld.significativo(); //fine
} movimentato = sld.significativo();
}
}
} }
if (!movimentato) if (!movimentato)
@ -3214,15 +3257,14 @@ void TStampa_bilanci::stampa_riga_totali(int r)
if (_saldo_finale_tot != ZERO) if (_saldo_finale_tot != ZERO)
set_row(r,"@131g%c", app); set_row(r,"@131g%c", app);
} }
else if (app == 'D')
{
set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot,
&_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot);
}
else else
{ {
set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!@132g%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot, if (app == 'D')
set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot,
&_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot); &_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot);
else
set_row(r,"***@8gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&_saldo_dare_tot,&_saldo_avere_tot,
&_mov_dare_tot,&_mov_avere_tot,&_saldo_finale_tot);
} }
} }
else else
@ -3248,22 +3290,20 @@ void TStampa_bilanci::stampa_riga_totali(int r)
{ {
if (app == 'D') if (app == 'D')
{ {
set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!%r@148g!",&_saldo_dare_tot, set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!%r@148g!",&_saldo_dare_tot,
&_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_finale_tot);
&_saldo_finale_tot);
} }
else else
{ {
set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!@132g%r@148g!",&_saldo_dare_tot, set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&_saldo_dare_tot,
&_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_finale_tot);
&_saldo_finale_tot);
} }
if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2) if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2)
{ {
if (_tipo_stampa1 == 2) if (_tipo_stampa1 == 2)
set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@100g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@98g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
else else
set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@100g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@98g%r@114g!@148g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
} }
} }
} }
@ -3418,14 +3458,14 @@ void TStampa_bilanci::stampa_prima_colonna(int g, int c, long s,
if (!_totali) if (!_totali)
{ {
if (c != 0 && s == 0) if (c != 0 && s == 0)
set_row(_i, "%-.44s @44g *** @49g%r @68g%c", desc, &saldo, dep); set_row(_i, "%-.44s @44g @49g%r @68g%c", desc, &saldo, dep);
else else
set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep); set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep);
} }
else if ( !(c == 0 && s == 0) ) //se cioe' non e' un gruppo else if ( !(c == 0 && s == 0) ) //se cioe' non e' un gruppo
{ {
if (s == 0) //se e' un conto if (s == 0) //se e' un conto
set_row(_i, "%-.44s @44g *** @49g%r @68g%c", desc, &saldo, dep); set_row(_i, "%-.44s @44g @49g%r @68g%c", desc, &saldo, dep);
else else
set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep); set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep);
} }
@ -3851,8 +3891,8 @@ int TStampa_bilanci::stampa_intestazione_ditta()
(const char*)_provfis); (const char*)_provfis);
r++; r++;
printer().setdate(_data); printer().setdate(_data);
riga = "Data @< Pag. @#"; riga = "Data @> Pag. @#";
riga.right_just(_stampa_width-6); riga.right_just(_stampa_width-10);
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi)); riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
set_header (r, "%s", (const char*) riga); set_header (r, "%s", (const char*) riga);

View File

@ -2,14 +2,14 @@
TOOLBAR "" 0 20 0 2 TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 9 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -11 ""
END END
BUTTON DLG_QUIT 9 2 BUTTON DLG_QUIT 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -11 ""
END END
ENDPAGE ENDPAGE
@ -68,7 +68,7 @@ BEGIN
MESSAGE HIDE,F_DATAA|RESET,F_DATAA|HIDE,F_SITUAZIONE|RESET,F_SITUAZIONE MESSAGE HIDE,F_DATAA|RESET,F_DATAA|HIDE,F_SITUAZIONE|RESET,F_SITUAZIONE
MESSAGE HIDE,F_ORDINAMENTO|RESET,F_ORDINAMENTO|HIDE,F_STAMPAC|RESET,F_STAMPAC MESSAGE HIDE,F_ORDINAMENTO|RESET,F_ORDINAMENTO|HIDE,F_STAMPAC|RESET,F_STAMPAC
MESSAGE HIDE,96|HIDE,97|HIDE,98|HIDE,99 MESSAGE HIDE,96|HIDE,97|HIDE,98|HIDE,99
//MESSAGE HIDE,F_MODULO|RESET,F_MODULO MESSAGE CLEAR,F_MODULO
MESSAGE SHOW,F_STAMPA|K_SPACE,F_STAMPA MESSAGE SHOW,F_STAMPA|K_SPACE,F_STAMPA
ITEM "2|Bilancio di verifica" ITEM "2|Bilancio di verifica"
MESSAGE HIDE,F_STAMPA|RESET,F_STAMPA MESSAGE HIDE,F_STAMPA|RESET,F_STAMPA
@ -76,7 +76,7 @@ BEGIN
MESSAGE HIDE,F_CODICI|RESET,F_CODICI|HIDE,F_SALDO|RESET,F_SALDO MESSAGE HIDE,F_CODICI|RESET,F_CODICI|HIDE,F_SALDO|RESET,F_SALDO
MESSAGE HIDE,F_STAMPAV|RESET,F_STAMPAV MESSAGE HIDE,F_STAMPAV|RESET,F_STAMPAV
MESSAGE SHOW,F_VERIFICA|K_SPACE,F_VERIFICA|SHOW,F_STAMPA1|K_SPACE,F_STAMPA1 MESSAGE SHOW,F_VERIFICA|K_SPACE,F_VERIFICA|SHOW,F_STAMPA1|K_SPACE,F_STAMPA1
//MESSAGE SHOW,F_MODULO|K_SPACE,F_MODULO MESSAGE ENABLE,F_MODULO
MESSAGE SHOW,96|SHOW,97|SHOW,98|SHOW,99 MESSAGE SHOW,96|SHOW,97|SHOW,98|SHOW,99
END END
@ -174,12 +174,12 @@ BEGIN
ITEM "3|Solo provvisori" ITEM "3|Solo provvisori"
END END
LIST F_MODULO 8 LIST F_MODULO 1 12
BEGIN BEGIN
PROMPT 2 12 "Dimensione modulo " PROMPT 2 12 "Dimensione modulo "
HELP "Indicare il numero di caratteri del foglio (larghezza)" HELP "Indicare il numero di caratteri del foglio (larghezza)"
ITEM "1|132 crt." ITEM "1|132 colonne"
ITEM "2|198 crt." ITEM "2|198 colonne"
END END
BOOLEAN F_QUADRATURA BOOLEAN F_QUADRATURA

View File

@ -119,8 +119,8 @@ int CG1700_application::stampa_intestazione_ditta()
(const char*)_provfis); (const char*)_provfis);
r++; r++;
printer().setdate(_data); printer().setdate(_data);
riga = "Data @< Pag. @#"; riga = "Data @> Pag. @#";
riga.right_just(127); riga.right_just(125);
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi)); riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
set_header (r, "%s", (const char*) riga); set_header (r, "%s", (const char*) riga);
r++; r++;
@ -269,6 +269,10 @@ bool CG1700_application::set_print(int)
if (tasto == K_ENTER) if (tasto == K_ENTER)
{ {
_data = _msk->get(F_DATASTAMPA); _data = _msk->get(F_DATASTAMPA);
TRectype dacaus(LF_CAUSALI), acaus(LF_CAUSALI);
dacaus.put("CODCAUS",_msk->get(F_DACAU));
acaus.put("CODCAUS",_msk->get(F_ACAU));
current_cursor()->setregion(dacaus, acaus);
printer().footerlen(3); printer().footerlen(3);
return TRUE; return TRUE;
} }

View File

@ -1,9 +1,13 @@
#ifndef __CG1700_H #ifndef __CG1700_H
#define __CG1700_H #define __CG1700_H
#define F_CODDITTA 101 #define F_CODDITTA 101
#define F_DATASTAMPA 102 #define F_DATASTAMPA 102
#define F_RAGSOC 104 #define F_RAGSOC 104
#define F_DACAU 105
#define F_ACAU 106
#define F_DDESCR 107
#define F_ADESCR 108
#endif // __CG1700_H #endif // __CG1700_H

View File

@ -1,18 +1,18 @@
#include "cg1700.h" #include "cg1700.h"
PAGE "Stampa causali" -1 -1 70 8 PAGE "Stampa causali" -1 -1 70 9
NUMBER F_CODDITTA 5 NUMBER F_CODDITTA 5
BEGIN BEGIN
PROMPT 1 1 "Ditta " PROMPT 1 1 "Ditta "
FLAGS "FRD" FLAGS "FRD"
USE LF_NDITTE KEY 1 USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA DISPLAY "Codice" CODDITTA
DISPLAY "Ragione sociale @50" RAGSOC DISPLAY "Ragione sociale @50" RAGSOC
OUTPUT F_CODDITTA CODDITTA OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC OUTPUT F_RAGSOC RAGSOC
END END
STRING F_RAGSOC 50 STRING F_RAGSOC 50
@ -28,6 +28,52 @@ BEGIN
FLAGS "A" FLAGS "A"
END END
STRING F_DACAU 3
BEGIN
PROMPT 1 6 "Da "
FLAGS "UZ"
USE LF_CAUSALI
INPUT CODCAUS F_DACAU
DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione@60" DESCR
OUTPUT F_DACAU CODCAUS
OUTPUT F_DDESCR DESCR
CHECKTYPE SEARCH
END
STRING F_DDESCR 50 43
BEGIN
PROMPT 12 6 "Descrizione "
USE LF_CAUSALI KEY 2
INPUT DESCR F_DDESCR
DISPLAY "Descrizione@60" DESCR
DISPLAY "Codice" CODCAUS
COPY OUTPUT F_DACAU
CHECKTYPE SEARCH
END
STRING F_ACAU 3
BEGIN
PROMPT 1 7 "A "
FLAGS "UZ"
COPY USE F_DACAU
INPUT CODCAUS F_ACAU
COPY DISPLAY F_DACAU
OUTPUT F_ACAU CODCAUS
OUTPUT F_ADESCR DESCR
CHECKTYPE SEARCH
END
STRING F_ADESCR 50 43
BEGIN
PROMPT 12 7 "Descrizione "
USE LF_CAUSALI KEY 2
INPUT DESCR F_ADESCR
COPY DISPLAY F_DDESCR
COPY OUTPUT F_ACAU
CHECKTYPE SEARCH
END
BUTTON DLG_PRINT 10 2 BUTTON DLG_PRINT 10 2
BEGIN BEGIN
PROMPT -12 -1 "~Stampa" PROMPT -12 -1 "~Stampa"

View File

@ -305,7 +305,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
if (rcaus == NULL) continue; // Evita eventuali righe nulle if (rcaus == NULL) continue; // Evita eventuali righe nulle
const int nriga = rcaus->get_int(RCA_NRIGA); const int nriga = rcaus->get_int(RCA_NRIGA);
if (nriga < 1) continue; // Considera solo righe reali (non riempimenti) if (nriga <= 0) continue; // Considera solo righe reali (non riempimenti)
TBill tc; causale().bill(nriga, tc); TBill tc; causale().bill(nriga, tc);
if (tc.gruppo() <= 0) continue; // Considera solo gruppi validi if (tc.gruppo() <= 0) continue; // Considera solo gruppi validi
@ -318,14 +318,16 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
} }
int err = 0; int err = 0;
if (tc.descrizione() == "Sconosciuto") err = 1; if (tc.descrizione() == "Sconosciuto")
else if (tc.sospeso()) err = 2; err = 1; else
if (tc.sospeso())
err = 2;
if (err) if (err)
{ {
error_box("Il conto della riga %d della causale e' %s", error_box("Il conto della riga %d della causale e' %s",
i, err == 1 ? "sconosciuto" : "sospeso"); i, err == 1 ? "sconosciuto" : "sospeso");
continue; // continue; // Continua ugualmente
} }
const char sezione = rcaus->get_char(RCA_SEZIONE); const char sezione = rcaus->get_char(RCA_SEZIONE);
@ -456,7 +458,6 @@ void TPrimanota_application::init_mask(TMask& m)
disable_menu_item(M_FONT); disable_menu_item(M_FONT);
read_caus(NULL, 0); // Setta campi obbligatori read_caus(NULL, 0); // Setta campi obbligatori
fill_sheet(m);
if (_iva == nessuna_iva) if (_iva == nessuna_iva)
{ {
@ -518,6 +519,8 @@ void TPrimanota_application::init_mask(TMask& m)
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3) // Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3)
const bool valuta = _ges_val && is_saldaconto() && causale().valuta(); const bool valuta = _ges_val && is_saldaconto() && causale().valuta();
m.show(-3, valuta); m.show(-3, valuta);
fill_sheet(m); // Riempe righe contabili coi conti della causale
} }
void TPrimanota_application::init_query_mode(TMask& m) void TPrimanota_application::init_query_mode(TMask& m)

View File

@ -96,7 +96,7 @@ BEGIN
USE LF_COMUNI KEY 2 USE LF_COMUNI KEY 2
INPUT DENCOM O_DENCOM INPUT DENCOM O_DENCOM
DISPLAY "Denominazione@50" DENCOM DISPLAY "Denominazione@50" DENCOM
DISPLAY "Codice" COM DISPLAY "Codice@10" COM
COPY OUTPUT O_COMUNE COPY OUTPUT O_COMUNE
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
@ -160,9 +160,9 @@ BEGIN
CHECKTYPE NORMAL CHECKTYPE NORMAL
END END
BUTTON DLG_OK 9 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -11 -1 "Conferma" PROMPT -11 -1 ""
END END
ENDPAGE ENDPAGE

View File

@ -207,6 +207,7 @@ BEGIN
OUTPUT S_DESCRCONTO DESCR OUTPUT S_DESCRCONTO DESCR
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "Contropartita assente" WARNING "Contropartita assente"
ADD RUN cg0 -0
GROUP 2 GROUP 2
END END

View File

@ -101,7 +101,7 @@ real TPrimanota_application::totale_documento()
// Certified 99% // Certified 99%
bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k) bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k)
{ {
if (f.to_check(k)) if (f.to_check(k) && !f.empty())
{ {
const TEdit_field& c = (const TEdit_field&)f; const TEdit_field& c = (const TEdit_field&)f;
const TBrowse* b = c.browse(); const TBrowse* b = c.browse();
@ -628,6 +628,8 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
const TBill c(r, 3, 0x0); const TBill c(r, 3, 0x0);
if (!c.ok()) if (!c.ok())
return f.error_box("Il conto della riga %d non e' completo", i+1); return f.error_box("Il conto della riga %d non e' completo", i+1);
if (m.insert_mode() && c.sospeso())
return f.error_box("Il conto della riga %d e' sospeso", i+1);
const TBill co(r, 10, 0x0); const TBill co(r, 10, 0x0);
if (!co.empty() && !co.ok()) if (!co.empty() && !co.ok())
{ {
@ -978,8 +980,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
if (row_type(row) != 'K') if (row_type(row) != 'K')
{ {
cg.swap_rows(r, i); cg.swap_rows(r, i);
cg.force_update(); cg.post_select(i);
cg.select(i, FALSE);
break; break;
} }
} }
@ -1629,8 +1630,7 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
if ((k == K_TAB && f.focusdirty()) || (gruppo == 0 && conto == 0)) if ((k == K_TAB && f.focusdirty()) || (gruppo == 0 && conto == 0))
{ {
TBill c(0, 0, codice, f.dlg() > 300 ? 'F' : 'C'); TBill c(0, 0, codice, f.dlg() > 300 ? 'F' : 'C');
c.find(); // Carica descrizione, gruppo e conto c.find(); // Carica gruppo e conto
m.set(f.dlg()+1, c.descrizione());
if (c.ok()) if (c.ok())
{ {
m.set(gid-1, c.tipo() == 'C' ? "C" : "F"); m.set(gid-1, c.tipo() == 'C' ? "C" : "F");
@ -2155,16 +2155,24 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
a._conto_ricavo.set(clifo.get_int(CLI_GRUPPORIC), a._conto_ricavo.set(clifo.get_int(CLI_GRUPPORIC),
clifo.get_int(CLI_CONTORIC), clifo.get_int(CLI_CONTORIC),
clifo.get_long(CLI_SOTTOCRIC)); clifo.get_long(CLI_SOTTOCRIC));
if (a._conto_ricavo.find())
{
if (a._conto_ricavo.sospeso())
{
f.error_box("Il conto di ricavo e' sospeso");
a._conto_ricavo.set(0,0,0);
}
}
const int alleg = clifo.get_int(CLI_ALLEG); const int alleg = clifo.get_int(CLI_ALLEG);
TEdit_field& upi = m.efield(F_RIEPILOGO); TEdit_field& upi = m.efield(F_RIEPILOGO);
upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL); upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL);
const TString& oldpag = m.get(F_CODPAG); if (f.focusdirty() && m.is_running())
if (m.is_running())
{ {
const TString& oldpag = m.get(F_CODPAG);
const TString& s = clifo.get(CLI_CODPAG); const TString& s = clifo.get(CLI_CODPAG);
if (/* s.not_empty() && */ s != oldpag) if (s != oldpag)
{ {
TEdit_field& cp = m.efield(F_CODPAG); TEdit_field& cp = m.efield(F_CODPAG);
if (cp.active()) // Se il campo F_CODPAG e' attivo if (cp.active()) // Se il campo F_CODPAG e' attivo
@ -2494,12 +2502,12 @@ bool TPrimanota_application::ritsoc_handler(TMask_field& f, KEY key)
bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key) bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
{ {
TMask& m = f.mask(); TMask& m = f.mask();
TMask_field& cv = m.field(F_CORRVALUTA);
if (key == K_ENTER && f.get().empty()) if (key == K_ENTER && f.get().empty())
{ {
if (m.get(F_CORRVALUTA).not_empty()) if (!cv.empty())
{ {
TMask_field& cv = m.field(F_CORRVALUTA);
cv.set_focusdirty(); cv.set_focusdirty();
cv.on_hit(); cv.on_hit();
} }
@ -2511,17 +2519,19 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
{ {
f.set(m.get(F_IMPONIBILI)); f.set(m.get(F_IMPONIBILI));
f.set_dirty(); f.set_dirty();
m.reset(F_CORRVALUTA); cv.set("");
key = K_TAB; key = K_TAB;
} }
if (key == K_TAB && f.focusdirty()) if (key == K_TAB && f.focusdirty())
{ {
if (m.get(F_CORRVALUTA).empty()) if (cv.empty())
{ {
const TValuta cambio(m, F_VALUTAINTRA, SK_DATACAMBIO, F_CAMBIOINTRA, SK_CONTROEURO); const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA));
const real corrlit = f.get(); TCurrency imp(real(f.get()));
real corrval = cambio.lit2val(corrlit); imp.change_value(cambio);
m.set(F_CORRVALUTA, corrval); cv.set(imp.string());
if (m.field(F_CAMBIOINTRA).empty() && !cambio.is_firm_value()) // CM500208
m.set(F_CAMBIOINTRA, cambio.get_base_change());
} }
} }
@ -2544,24 +2554,29 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
// Certified 99% // Certified 99%
bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key) bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key)
{ {
TMask& m = f.mask();
TMask_field& cl = m.field(F_CORRLIRE);
if (key == K_TAB && f.focusdirty()) if (key == K_TAB && f.focusdirty())
{ {
TMask& m = f.mask(); if (cl.empty())
if (m.get(F_CORRLIRE).empty())
{ {
const TValuta cambio(m, F_VALUTAINTRA, SK_DATACAMBIO, F_CAMBIOINTRA, SK_CONTROEURO); const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA));
const real corrval = f.get(); TCurrency imp(real(f.get()), cambio);
real corrlit = cambio.val2lit(corrval); imp.change_to_firm_val();
m.set(F_CORRLIRE, corrlit); cl.set(imp.string());
if (m.field(F_CAMBIOINTRA).empty() && !cambio.is_firm_value()) // CM500208
m.set(F_CAMBIOINTRA, cambio.get_base_change());
} }
} else }
else
{
if (key == K_ENTER && f.get().empty()) if (key == K_ENTER && f.get().empty())
{ {
TMask_field& cl = f.mask().field(F_CORRLIRE);
cl.set_dirty(); cl.set_dirty();
cl.on_hit(); cl.on_hit();
} }
}
return TRUE; return TRUE;
} }

View File

@ -707,7 +707,7 @@ bool TGame_mask::numpart_handler(TMask_field& f, KEY k)
for (int i = 0; i < sheet.items(); i++) for (int i = 0; i < sheet.items(); i++)
{ {
TToken_string& row = sheet.row(i); TToken_string& row = sheet.row(i);
if (anno == row.get_int(0)) // Se corrisponde l'anno e ... if (anno == row.get_int(0)) // Se corrisponde l'anno e ...
{ {
const long dist = m.number_distance(key, row.get()); const long dist = m.number_distance(key, row.get());
if (i == 0 || dist < min_dist) if (i == 0 || dist < min_dist)
@ -719,7 +719,7 @@ bool TGame_mask::numpart_handler(TMask_field& f, KEY k)
} }
} }
} }
sheet.select(best_match); // seleziona la partita sheet.post_select(best_match);
} }
} }
return TRUE; return TRUE;

View File

@ -170,7 +170,7 @@ BEGIN
COPY OUTPUT 206 COPY OUTPUT 206
MESSAGE COPY,107 MESSAGE COPY,107
ADD RUN cg0 -1 C ADD RUN cg0 -1 C
CHECKTYPE NORMAL CHECKTYPE SEARCH
WARNING "Cliente inesistente sulla riga contabile" WARNING "Cliente inesistente sulla riga contabile"
END END
@ -188,7 +188,7 @@ BEGIN
COPY OUTPUT 306 COPY OUTPUT 306
MESSAGE COPY,107 MESSAGE COPY,107
ADD RUN cg0 -1 F ADD RUN cg0 -1 F
CHECKTYPE NORMAL CHECKTYPE SEARCH
WARNING "Fornitore inesistente sulla riga contabile" WARNING "Fornitore inesistente sulla riga contabile"
END END

View File

@ -161,8 +161,6 @@ BEGIN
INPUT CODCF 309 INPUT CODCF 309
DISPLAY "Codice" CODCF DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale Fornitore@50" RAGSOC DISPLAY "Ragione Sociale Fornitore@50" RAGSOC
OUTPUT 107 GRUPPO
OUTPUT 108 CONTO
OUTPUT 309 CODCF OUTPUT 309 CODCF
OUTPUT 310 RAGSOC OUTPUT 310 RAGSOC
CHECKTYPE NORMAL CHECKTYPE NORMAL
@ -202,7 +200,7 @@ BEGIN
COPY OUTPUT 209 COPY OUTPUT 209
MESSAGE COPY,110 MESSAGE COPY,110
ADD RUN cg0 -1 C ADD RUN cg0 -1 C
CHECKTYPE NORMAL CHECKTYPE SEARCH
END END
STRING 310 50 STRING 310 50
@ -219,7 +217,7 @@ BEGIN
COPY OUTPUT 309 COPY OUTPUT 309
MESSAGE COPY,110 MESSAGE COPY,110
ADD RUN cg0 -1 F ADD RUN cg0 -1 F
CHECKTYPE NORMAL CHECKTYPE SEARCH
END END
LIST 105 1 51 LIST 105 1 51

View File

@ -237,9 +237,9 @@ BEGIN
ITEM "Non cancellabile" ITEM "Non cancellabile"
END END
BUTTON FS_RESET 7 1 BUTTON FS_RESET 8 1
BEGIN BEGIN
PROMPT 1 -1 "Reset" PROMPT 1 -1 "Rese~t"
END END
ENDPAGE ENDPAGE

View File

@ -1,6 +1,7 @@
#include <applicat.h> #include <applicat.h>
#include <mask.h> #include <automask.h>
#include <progind.h> #include <progind.h>
#include <sheet.h>
#include <tabutil.h> #include <tabutil.h>
#include <urldefid.h> #include <urldefid.h>
@ -34,33 +35,232 @@ TString& add_plural(TString& s, long num, const char* name)
return s; return s;
} }
class TProvvisori_app : public TApplication class TProvvisori_msk : public TAutomask
{ {
TLocalisamfile* _sal;
TLocalisamfile* _cau;
TTable* _reg;
char _provv; // Tipo provvisori da cancellare char _provv; // Tipo provvisori da cancellare
TString16 _from_date, _to_date; // Range date da considerare
TString16 _from_caus, _to_caus; // Causali movimenti da considerare TString16 _from_caus, _to_caus; // Causali movimenti da considerare
long _from_numreg, _to_numreg; // Range movimenti da considerare
TRelation* _rel;
TCursor* _cur;
TCursor_sheet* _sheet;
bool _update_cursor;
static TProvvisori_msk* _msk;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
static bool filter(const TRelation* rel);
void update_search(short id, const TString& fil);
public:
TCursor& update_cursor(bool use_argv = FALSE);
TCursor_sheet* get_selection_sheet();
TCursor& get_cursor() { return _cur ? *_cur : update_cursor(); }
void notify_update_needed() { _update_cursor = TRUE; }
TProvvisori_msk();
~TProvvisori_msk();
};
TProvvisori_msk* TProvvisori_msk::_msk = NULL;
bool TProvvisori_msk::filter(const TRelation* rel)
{
TProvvisori_msk& a = *_msk;
const TRectype& mov = rel->curr();
const char provv = mov.get_char(MOV_PROVVIS);
bool ok = (a._provv <= ' ' && provv > ' ') || (a._provv > ' ' && a._provv == provv);
if (ok)
{
const char* caus = mov.get(MOV_CODCAUS);
ok = a._from_caus <= caus && (a._to_caus.empty() || a._to_caus >= caus);
}
if (ok)
{
const long numreg = mov.get_long(MOV_NUMREG);
ok = numreg >= a._from_numreg && (a._to_numreg == 0 || numreg <= a._to_numreg);
}
return ok;
}
// Filtra il cursore in base ai campi della maschera o i parametri da linea di comando
TCursor& TProvvisori_msk::update_cursor(bool use_argv)
{
_provv = ' ';
_from_date = _to_date = "";
_from_caus = _to_caus = "";
_from_numreg = _to_numreg = 0;
if (!use_argv)
{
_provv = get(F_PROVV)[0];
_from_date = get(F_FROMDATE);
_to_date = get(F_TODATE);
_from_caus = get(F_FROMCAUS);
_to_caus = get(F_TOCAUS);
_from_numreg = get_long(F_FROMREG);
_to_numreg = get_long(F_TOREG);
}
else
{
if (main_app().argc() > 2)
_provv = main_app().argv(2)[0];
}
if (_rel == NULL)
_rel = new TRelation(LF_MOV);
if (_cur == NULL)
_cur = new TCursor(_rel, "", 2);
TRectype from_rec(LF_MOV), to_rec(LF_MOV);
if (_from_date.not_empty())
from_rec.put(MOV_DATAREG, _from_date);
if (_to_date.not_empty())
to_rec.put(MOV_DATAREG, _to_date);
_cur->freeze(FALSE);
_cur->set_filterfunction(filter);
_cur->setregion(from_rec, to_rec);
_cur->items();
_cur->freeze(TRUE);
_update_cursor = FALSE;
if (_sheet)
_sheet->uncheck(-1); // Annulla la selezione corrente
return *_cur;
}
// Ritorma lo sheet con i movimenti selezionati
// Se non si seleziona nulla equivale ad aver selezionato tutto e torna NULL
// come quando non si fa nessuna selezione
// Aggiorna anche il campo F_SELECTED
TCursor_sheet* TProvvisori_msk::get_selection_sheet()
{
if (_sheet && _update_cursor)
update_cursor(); // Update cursor and uncheck all selection
const long total = get_cursor().items(); // Numero totale di movimenti provvisori
long sel_items = total; // Per default li considero tutti selezionati
if (_sheet) // Controllo se c'e' selezione parziale
sel_items = _sheet->checked();
if (sel_items == 0L || sel_items > total) // Nessuna selezione = tutti selezionati
sel_items = total;
set(F_SELECTED, sel_items); // Aggiorno campo a video
return sel_items < total ? _sheet : NULL; // Ritorno NULL se tutti selezionati
}
void TProvvisori_msk::update_search(short id, const TString& fil)
{
TBrowse* b = efield(id).browse();
b->set_filter(fil);
b->cursor()->update();
}
bool TProvvisori_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_PROVV:
if (e == fe_init || e == fe_modify)
{
TString16 fil = "PROVVIS";
switch (o.get()[0])
{
case 'C': fil << "=\"C\""; break;
case 'P': fil << "=\"P\""; break;
default : fil << "!=\"\""; break;
}
update_search(F_FROMDATE, fil);
update_search(F_TODATE, fil);
update_search(F_FROMREG, fil);
update_search(F_TOREG, fil);
notify_update_needed();
}
break;
case F_FROMDATE:
case F_TODATE:
if (e == fe_modify)
{
notify_update_needed();
} else
if (e == fe_close)
{
// Non è carino lasciare vuote le date se non si seleziona nulla esplicitamente
if (get(F_TODATE).empty() && get(F_FROMDATE).empty() && get_long(F_SELECTED) == 0L)
return error_box("E' necessario specificare almeno una data");
}
break;
case DLG_SELECT:
if (e == fe_button)
{
if (_sheet == NULL) // Devo creare sheet di delezione
{
TBrowse* br = efield(F_FROMREG).browse(); // Copia intestazione dal campo della maschera!
TToken_string head = br->head(); head.insert("@1|"); // Aggiunge prima colonna di selezione
TToken_string flds = br->items(); flds.insert(" |"); // Aggiunge prima colonna vuota
_sheet = new TCursor_sheet(&get_cursor(), flds, "Selezione", head, 0, 1);
}
if (_update_cursor) // Aggiorna filtri cursore se necessario
update_cursor();
_sheet->run(); // Mostra sheet di selezione
get_selection_sheet(); // Aggiorna F_SELECTED
return FALSE;
}
break;
default:
if (e == fe_modify) // Se viene modificato un campo qualsiasi ...
notify_update_needed(); // ... ricorda che devi aggiornare il cursore la prossima volta
break;
}
return TRUE;
}
TProvvisori_msk::TProvvisori_msk()
: TAutomask("cg2200a"), _sheet(NULL), _rel(NULL), _cur(NULL), _update_cursor(TRUE)
{
_msk = this;
}
TProvvisori_msk::~TProvvisori_msk()
{
_msk = NULL;
if (_sheet != NULL)
delete _sheet;
if (_cur)
delete _cur;
if (_rel)
delete _rel;
}
class TProvvisori_app : public TSkeleton_application
{
TSaldo_agg _saldi; TSaldo_agg _saldi;
protected: // TApplication protected: // TApplication
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual bool menu(MENU_TAG m); virtual void main_loop();
protected: protected:
static bool date_handler(TMask_field& f, KEY k); TCursor& create_cursor(TMask* m);
public: public:
void inizia_saldi(const TRectype& mov); void inizia_saldi(const TRectype& mov);
void aggiungi_saldi(const TRectype& rmov, bool lettura); void aggiungi_saldi(const TRectype& rmov, bool lettura);
void aggiorna_saldi(); void aggiorna_saldi();
bool confirm_provv(TCursor& cur, TProgind& pi); bool confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL);
bool delete_provv(TCursor& cur, TProgind& pi); bool delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL);
static bool filter(const TRelation* rel);
void auto_delete(TCursor& cur); void auto_delete(TCursor& cur);
@ -74,23 +274,13 @@ inline TProvvisori_app& app()
bool TProvvisori_app::create() bool TProvvisori_app::create()
{ {
TApplication::create(); open_files(LF_TAB, LF_MOV, LF_CAUSALI, LF_SALDI, NULL);
return TSkeleton_application::create();
_cau = new TLocalisamfile(LF_CAUSALI);
_sal = new TLocalisamfile(LF_SALDI);
_reg = new TTable("REG");
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
} }
bool TProvvisori_app::destroy() bool TProvvisori_app::destroy()
{ {
delete _reg; return TSkeleton_application::destroy();
delete _sal;
delete _cau;
return TApplication::destroy();
} }
void TProvvisori_app::inizia_saldi(const TRectype& r) void TProvvisori_app::inizia_saldi(const TRectype& r)
@ -100,14 +290,15 @@ void TProvvisori_app::inizia_saldi(const TRectype& r)
_saldi.reset(); _saldi.reset();
tiposal tsal = normale; tiposal tsal = normale;
const TString& c = r.get(MOV_CODCAUS); const TString16 c = r.get(MOV_CODCAUS);
if (c.not_empty()) if (c.not_empty())
{ {
_cau->put(CAU_CODCAUS, c); const TRectype& cau = cache().get(LF_CAUSALI, c);
if (_cau->read() == NOERR) if (!cau.empty())
{ {
if (_cau->get_char(CAU_MOVAP) == 'A') tsal = apertura; const char movap = cau.get_char(CAU_MOVAP);
else if (_cau->get_char(CAU_MOVAP) == 'C') tsal = chiusura; if (movap == 'A') tsal = apertura; else
if (movap == 'C') tsal = chiusura;
} }
} }
_saldi.set_tipo_saldo(tsal); _saldi.set_tipo_saldo(tsal);
@ -133,13 +324,19 @@ void TProvvisori_app::aggiorna_saldi()
_saldi.registra(); _saldi.registra();
} }
bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi) bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet)
{ {
TLocalisamfile& mov = cur.file(LF_MOV); TLocalisamfile& mov = cur.file(LF_MOV);
TLocalisamfile rmov(LF_RMOV); TLocalisamfile rmov(LF_RMOV);
if (sheet && sheet->checked() == 0)
sheet = NULL;
for (cur = 0; cur.pos() < cur.items(); ++cur) for (cur = 0; cur.pos() < cur.items(); ++cur)
{ {
if (sheet && !sheet->checked(cur.pos()))
continue;
const long numreg = mov.get_long(MOV_NUMREG); const long numreg = mov.get_long(MOV_NUMREG);
inizia_saldi(mov.curr()); inizia_saldi(mov.curr());
@ -171,16 +368,22 @@ bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi)
return TRUE; return TRUE;
} }
bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi) bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet)
{ {
TLocalisamfile& mov = cur.file(LF_MOV); TLocalisamfile& mov = cur.file(LF_MOV);
TLocalisamfile rmov(LF_RMOV); TLocalisamfile rmov(LF_RMOV);
TLocalisamfile rmoviva(LF_RMOVIVA); TLocalisamfile rmoviva(LF_RMOVIVA);
TString256 error; if (sheet && sheet->checked() == 0)
sheet = NULL;
TString error(256);
for (cur = 0; cur.pos() < cur.items(); ++cur) for (cur = 0; cur.pos() < cur.items(); ++cur)
{ {
if (sheet && !sheet->checked(cur.pos()))
continue;
const long numreg = mov.get_long(MOV_NUMREG); const long numreg = mov.get_long(MOV_NUMREG);
mov.setkey(1); // Isam bug on remove with key != 1 mov.setkey(1); // Isam bug on remove with key != 1
@ -223,6 +426,8 @@ bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi)
{ {
aggiorna_saldi(); aggiorna_saldi();
pi.addstatus(1); pi.addstatus(1);
if (pi.iscancelled())
return warning_box("Procedura interrotta dall'utente");
} }
else else
return error_box("Errore %d nella cancellazione della %s del movimento %ld", return error_box("Errore %d nella cancellazione della %s del movimento %ld",
@ -232,85 +437,32 @@ bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi)
return TRUE; return TRUE;
} }
bool TProvvisori_app::filter(const TRelation* rel)
{
TProvvisori_app& a = app();
const TRectype& mov = rel->curr();
const char provv = mov.get_char(MOV_PROVVIS);
bool ok = (a._provv <= ' ' && provv > ' ' || a._provv == provv);
if (ok)
{
const char* caus = mov.get(MOV_CODCAUS);
ok = a._from_caus <= caus && a._to_caus >= caus;
}
return ok;
}
// Deve essere specificata almeno una data (inizio o fine)
bool TProvvisori_app::date_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (k == K_ENTER && f.get().empty())
{
const TMask& m = f.mask();
if (m.get(F_TODATE).empty())
ok = f.error_box("E' necessario specificare almeno una data");
}
return ok;
}
void TProvvisori_app::auto_delete(TCursor& cur) void TProvvisori_app::auto_delete(TCursor& cur)
{ {
_from_caus = "";
_to_caus = "ZZZ";
_provv = argv(2)[0];
cur.set_filterfunction(filter);
const long total = cur.items(); const long total = cur.items();
TProgind pi(total, "Cancellazione", FALSE, TRUE, 24); TProgind pi(total, "Cancellazione movimenti provvisori", TRUE, TRUE);
cur.freeze(TRUE);
delete_provv(cur, pi); delete_provv(cur, pi);
cur.freeze(FALSE);
} }
bool TProvvisori_app::menu(MENU_TAG) void TProvvisori_app::main_loop()
{ {
TMask m("cg2200a"); TProvvisori_msk m;
m.set_handler(F_FROMDATE, date_handler);
TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor();
if (argc() > 2) if (argc() > 2)
{ {
TCursor& cur = m.update_cursor(TRUE);
auto_delete(cur); auto_delete(cur);
return FALSE; return;
} }
m.reset();
while (TRUE) while (TRUE)
{ {
TRectype from(LF_MOV), to(LF_MOV);
cur.setregion(from, to);
cur.set_filterfunction(NULL);
m.reset();
KEY key = m.run(); KEY key = m.run();
if (key != K_ENTER && key != K_DEL) if (key != K_ENTER && key != K_DEL)
break; break;
TString16 from_d = m.get(F_FROMDATE); TString16 from_d = m.get(F_FROMDATE);
TString16 to_d = m.get(F_TODATE);
if (from_d.empty() && to_d.empty())
{
error_box("E' nessario specificare almeno una data.");
continue;
}
if (key == K_ENTER) if (key == K_ENTER)
{ {
const TDate da(from_d); const TDate da(from_d);
@ -319,70 +471,41 @@ bool TProvvisori_app::menu(MENU_TAG)
if (da < lp) if (da < lp)
{ {
from_d = lp.string(); from_d = lp.string();
const bool ok = yesno_box("Il libro giornale e stato stampato il %s:\n" error_box("Il libro giornale e stato stampato il %s:\n"
"Si desidera modificare la data iniziale?", "La data inizio elaborazione deve essere almeno il %s",
(const char*)from_d); (const char*)from_d, (const char*)from_d);
if (!ok) continue; m.set(F_FROMDATE, from_d);
continue;
} }
} }
if (from_d.not_empty()) // Recupera sheet dei selezionati ed aggiorna F_SELECTED
from.put(MOV_DATAREG, from_d); TCursor_sheet* sheet = m.get_selection_sheet();
const long total = m.get_long(F_SELECTED);
const TString& from_r = m.get(F_FROMREG); if (total <= 0)
if (from_r.not_empty()) from.put(MOV_NUMREG, from_r); {
warning_box("Nessun movimento selezionato");
_from_caus = m.get(F_FROMCAUS); continue;
}
if (to_d.not_empty()) to.put(MOV_DATAREG, to_d);
const TString& to_r = m.get(F_TOREG);
if (to_r.not_empty()) to.put(MOV_NUMREG, to_r);
_to_caus = m.get(F_TOCAUS);
_provv = m.get(F_PROVV)[0];
cur.setregion(from, to);
cur.set_filterfunction(filter);
const TRecnotype total = cur.items();
TString action(key == K_ENTER ? "conferma" : "cancellazione"); TString action(key == K_ENTER ? "conferma" : "cancellazione");
action << " di "; add_plural(action, total, "movimento"); action << " di "; add_plural(action, total, "movimento");
TString caption("E' stata richiesta la "); TString caption;
caption << action << '.'; caption << "E' stata richiesta la " << action << ".\nSi desidera continuare?";
if (!yesno_box(caption))
if (total > 0)
{
caption << "\nSi desidera continuare?";
if (!yesno_box(caption)) continue;
}
else
{
warning_box("Nessun movimento nella selezione effettuata");
continue; continue;
}
action[0] = toupper(action[0]); action[0] = toupper(action[0]);
TProgind pi(total, action, FALSE, TRUE, 24); TProgind pi(total, action, TRUE, TRUE);
cur.freeze(TRUE);
if (key == K_ENTER) if (key == K_ENTER)
confirm_provv(cur, pi); confirm_provv(m.get_cursor(), pi, sheet);
else else
delete_provv(cur, pi); delete_provv(m.get_cursor(), pi, sheet);
cur.freeze(FALSE);
} }
return FALSE;
} }
int cg2200(int argc, char** argv) int cg2200(int argc, char** argv)
{ {
TProvvisori_app a; TProvvisori_app a;

View File

@ -7,3 +7,4 @@
#define F_TOREG 112 #define F_TOREG 112
#define F_TOCAUS 113 #define F_TOCAUS 113
#define F_TOCAUSDESC 114 #define F_TOCAUSDESC 114
#define F_SELECTED 115

View File

@ -1,19 +1,25 @@
#include "cg2200.h" #include "cg2200.h"
PAGE "Gestione Movimenti Provvisori" -1 -1 52 12 PAGE "Gestione Movimenti Provvisori" -1 -1 52 14
GROUPBOX DLG_NULL 50 4 LIST F_PROVV 10
BEGIN BEGIN
PROMPT 1 1 "Dalla data/causale" PROMPT 1 0 "@bTipo movimenti provvisori "
ITEM "P|Contabili"
ITEM " |Tutti"
ITEM "C|Cespiti"
END
GROUPBOX DLG_NULL 50 3
BEGIN
PROMPT 1 1 "@bDalla data/Alla data"
END END
DATE F_FROMDATE DATE F_FROMDATE
BEGIN BEGIN
PROMPT 2 2 "Data " PROMPT 2 2 "Dal "
HELP "Data del primo movimento provvisorio"
USE LF_MOV KEY 2 SELECT PROVVIS!="" USE LF_MOV KEY 2 SELECT PROVVIS!=""
INPUT DATAREG F_FROMDATE INPUT DATAREG F_FROMDATE
INPUT NUMREG F_FROMREG
DISPLAY "Data@10" DATAREG DISPLAY "Data@10" DATAREG
DISPLAY "Numero@6" NUMREG DISPLAY "Numero@6" NUMREG
DISPLAY "Causale" CODCAUS DISPLAY "Causale" CODCAUS
@ -21,18 +27,26 @@ BEGIN
DISPLAY "Tipo" PROVVIS DISPLAY "Tipo" PROVVIS
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
OUTPUT F_FROMDATE DATAREG OUTPUT F_FROMDATE DATAREG
OUTPUT F_FROMREG NUMREG
END END
NUMBER F_FROMREG 5 DATE F_TODATE
BEGIN BEGIN
PROMPT 32 2 "Operazione " PROMPT 25 2 "Al "
FLAGS "DR" COPY USE F_FROMDATE
INPUT DATAREG F_TODATE
INPUT NUMREG F_TOREG
COPY DISPLAY F_FROMDATE
OUTPUT F_TODATE DATAREG
END
GROUPBOX DLG_NULL 50 4
BEGIN
PROMPT 1 4 "@bDalla causale/Alla causale"
END END
STRING F_FROMCAUS 3 STRING F_FROMCAUS 3
BEGIN BEGIN
PROMPT 2 3 "Causale " PROMPT 2 5 "Dalla "
FLAGS "U" FLAGS "U"
USE LF_CAUSALI SELECT REG=="" USE LF_CAUSALI SELECT REG==""
INPUT CODCAUS F_FROMCAUS INPUT CODCAUS F_FROMCAUS
@ -45,7 +59,7 @@ END
STRING F_FROMCAUSDESC 50 30 STRING F_FROMCAUSDESC 50 30
BEGIN BEGIN
PROMPT 16 3 "" PROMPT 16 5 ""
USE LF_CAUSALI KEY 2 SELECT REG=="" USE LF_CAUSALI KEY 2 SELECT REG==""
INPUT DESCR F_FROMCAUSDESC INPUT DESCR F_FROMCAUSDESC
DISPLAY "Descrizione@60" DESCR DISPLAY "Descrizione@60" DESCR
@ -53,31 +67,9 @@ BEGIN
COPY OUTPUT F_FROMCAUS COPY OUTPUT F_FROMCAUS
END END
GROUPBOX DLG_NULL 50 4
BEGIN
PROMPT 1 5 "Alla data/causale"
END
DATE F_TODATE
BEGIN
PROMPT 2 6 "Data "
COPY USE F_FROMDATE
INPUT DATAREG F_TODATE
INPUT NUMREG F_TOREG
COPY DISPLAY F_FROMDATE
OUTPUT F_TODATE DATAREG
OUTPUT F_TOREG NUMREG
END
NUMBER F_TOREG 5
BEGIN
PROMPT 32 6 "Operazione "
FLAGS "DR"
END
STRING F_TOCAUS 3 STRING F_TOCAUS 3
BEGIN BEGIN
PROMPT 2 7 "Causale " PROMPT 2 6 "Alla "
FLAGS "U" FLAGS "U"
COPY USE F_FROMCAUS COPY USE F_FROMCAUS
INPUT CODCAUS F_TOCAUS INPUT CODCAUS F_TOCAUS
@ -89,19 +81,52 @@ END
STRING F_TOCAUSDESC 50 30 STRING F_TOCAUSDESC 50 30
BEGIN BEGIN
PROMPT 16 7 "" PROMPT 16 6 ""
COPY USE F_FROMCAUSDESC COPY USE F_FROMCAUSDESC
INPUT DESCR F_TOCAUSDESC INPUT DESCR F_TOCAUSDESC
COPY DISPLAY F_FROMCAUSDESC COPY DISPLAY F_FROMCAUSDESC
COPY OUTPUT F_TOCAUS COPY OUTPUT F_TOCAUS
END END
LIST F_PROVV 10 GROUPBOX DLG_NULL 50 3
BEGIN BEGIN
PROMPT 2 9 "Tipo " PROMPT 1 8 "@bDal movimento/Al movimento"
ITEM "P|Contabili" END
ITEM " |Tutti"
ITEM "C|Cespiti" NUMBER F_FROMREG 5
BEGIN
PROMPT 2 9 "Dal "
USE LF_MOV SELECT PROVVIS!=""
INPUT NUMREG F_FROMREG
DISPLAY "Numero@6" NUMREG
DISPLAY "Data@10" DATAREG
DISPLAY "Causale" CODCAUS
DISPLAY "Documento" NUMDOC
DISPLAY "Tipo" PROVVIS
DISPLAY "Descrizione@50" DESCR
OUTPUT F_FROMREG NUMREG
CHECKTYPE SEARCH
END
NUMBER F_TOREG 5
BEGIN
PROMPT 25 9 "Al "
COPY USE F_FROMREG
INPUT NUMREG F_TOREG
COPY DISPLAY F_FROMREG
OUTPUT F_TOREG NUMREG
CHECKTYPE SEARCH
END
NUMBER F_SELECTED 7
BEGIN
PROMPT 2 11 "Documenti selezionati "
FLAGS "D"
END
BUTTON DLG_SELECT 10 2
BEGIN
PROMPT -33 -3 ""
END END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2
@ -115,7 +140,6 @@ BEGIN
MESSAGE EXIT,K_DEL MESSAGE EXIT,K_DEL
END END
BUTTON DLG_QUIT 10 2 BUTTON DLG_QUIT 10 2
BEGIN BEGIN
PROMPT -33 -1 "" PROMPT -33 -1 ""

View File

@ -1,6 +1,7 @@
// //
//Lista movimenti //Lista movimenti
// //
#include <currency.h>
#include <mask.h> #include <mask.h>
#include <printapp.h> #include <printapp.h>
#include <recarray.h> #include <recarray.h>
@ -116,6 +117,8 @@ protected:
virtual bool set_print(int m); virtual bool set_print(int m);
void init_print(const TMask& m); void init_print(const TMask& m);
void print_intra(int& rr);
public: public:
bool user_create(); bool user_create();
@ -146,7 +149,7 @@ HIDDEN inline TListaMov_application & app()
bool annoes_handler(TMask_field& f, KEY k) bool annoes_handler(TMask_field& f, KEY k)
{ {
if (k == K_TAB) if (k == K_TAB && f.focusdirty())
{ {
const int anno = atoi(f.get()); const int anno = atoi(f.get());
TEsercizi_contabili esc; TEsercizi_contabili esc;
@ -713,7 +716,7 @@ void TListaMov_application::stampa_errori_iva(int* nr, const char* cod, const in
set_row(++(*nr), "@11gCodice IVA sospeso"); set_row(++(*nr), "@11gCodice IVA sospeso");
if (_stampa_mess_alleg_iva) if (_stampa_mess_alleg_iva)
if (allc == 0 || allf == 0) if (allc == 0 || allf == 0)
set_row(++(*nr), "@11gSul Codice IVA non e' stato attivato l'indicatore per allegato"); set_row(++(*nr), "@11gSul Codice IVA non e' stato indicato un valore per allegato");
} }
else else
set_row(++(*nr), "@11gCodice IVA non presente in tabella"); set_row(++(*nr), "@11gCodice IVA non presente in tabella");
@ -1201,6 +1204,27 @@ bool TListaMov_application::preprocess_page(int file,int counter)
return FALSE; return FALSE;
} }
void TListaMov_application::print_intra(int& rr)
{
const TRectype& mov = current_cursor()->curr(LF_MOV);
const real corrval = mov.get(MOV_CORRVALUTA);
if (corrval != ZERO)
{
const TString16 codval = mov.get(MOV_CODVALI);
TString80 str;
const TCurrency cl(mov.get_real(MOV_CORRLIRE));
str = cl.string(TRUE); str.right_just(19);
set_row(rr,"Corr.in lire@14g%s", (const char*)str);
const TCurrency cv(corrval, codval);
str = cv.string(TRUE); str.right_just(19);
set_row(rr,"@34gCorr.in valuta@49g%s", (const char*)str);
set_row(rr++,"@70g%-3s", (const char*)codval);
}
}
print_action TListaMov_application::postprocess_page(int file,int count) print_action TListaMov_application::postprocess_page(int file,int count)
{ {
if (count) if (count)
@ -1265,15 +1289,7 @@ print_action TListaMov_application::postprocess_page(int file,int count)
if (!_esiste_riga_iva && ! _nonesiste_riga_iva) if (!_esiste_riga_iva && ! _nonesiste_riga_iva)
stampa_errori_iva(&r, riga._codiva, riga._tipodet, riga._tipocr); stampa_errori_iva(&r, riga._codiva, riga._tipodet, riga._tipocr);
} }
real corrval = current_cursor()->file(LF_MOV).get_real(MOV_CORRVALUTA); print_intra(r);
real corrlire = current_cursor()->file(LF_MOV).get_real(MOV_CORRLIRE);
TString vall (corrval.string("###.###.###.###,@@@"));
if (corrval != ZERO)
{
set_row(++r,"Corr.in lire@14g%r", &corrlire);
set_row(r,"@34gCorr.in valuta@49g%s", (const char*)vall);
set_row(r,"@70g%-3s", (const char *)_codval);
}
if (_esiste_riga_iva) if (_esiste_riga_iva)
set_row(++r, "@11gPresenti righe IVA in una registrazione senza IVA"); set_row(++r, "@11gPresenti righe IVA in una registrazione senza IVA");
if (_nonesiste_riga_iva) if (_nonesiste_riga_iva)
@ -1348,15 +1364,7 @@ break;
reset_print(); reset_print();
TCursor* cur = current_cursor(); TCursor* cur = current_cursor();
int rr = 1; int rr = 1;
real corrval = cur->file(LF_MOV).get_real(MOV_CORRVALUTA); print_intra(rr);
real corrlire = cur->file(LF_MOV).get_real(MOV_CORRLIRE);
if (corrval != ZERO)
{
TString vall (corrval.string("###.###.###.###,@@@"));
set_row(rr,"Corr.in lire@14g%r", &corrlire);
set_row(rr,"@34gCorr.in valuta@49g%s", (const char*) vall);
set_row(rr++,"@70g%-3s", (const char *)_codval);
}
_totdocumenti += _totdoc; _totdocumenti += _totdoc;
TRecnotype pos, items; TRecnotype pos, items;
bool FINITO = FALSE; bool FINITO = FALSE;
@ -1919,12 +1927,10 @@ bool TListaMov_application::set_print(int m)
_tipo_lista = fatture; _tipo_lista = fatture;
break; break;
case 'M': case 'M':
default :
masc = "cg3100a"; masc = "cg3100a";
_tipo_lista = movimenti; _tipo_lista = movimenti;
break; break;
default:
NFCHECK("Specificare C o M");
return FALSE;
} }
TMask msk(masc); TMask msk(masc);
@ -2272,11 +2278,8 @@ void TListaMov_application::preprocess_header()
set_header (soh++, (const char*) sep); set_header (soh++, (const char*) sep);
//sep = "Studio "; sep.cut(0) << "Data @> Pag. @#";
sep = ""; sep.right_just(122);
sep << "Data @< Pag. @#";
sep.right_just(126);
switch (_tipo_lista) switch (_tipo_lista)
{ {

View File

@ -34,6 +34,7 @@
#define F_RAGSOCFIN1 130 #define F_RAGSOCFIN1 130
#define F_SEPARATOR 131 #define F_SEPARATOR 131
#define F_CODVAL 132 #define F_CODVAL 132
#define F_DESVAL 133
#define ST_DATA 0x0001 #define ST_DATA 0x0001
#define ST_NUMERO 0x0002 #define ST_NUMERO 0x0002

View File

@ -240,10 +240,23 @@ BEGIN
DISPLAY "Codice" CODTAB DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0 DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAL CODTAB OUTPUT F_CODVAL CODTAB
OUTPUT F_DESVAL S0
CHECKTYPE NORMAL CHECKTYPE NORMAL
FLAGS "U" FLAGS "U"
END END
STRING F_DESVAL 50
BEGIN
PROMPT 20 18 ""
USE %VAL KEY 2
INPUT S0 F_DESVAL
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_CODVAL
CHECKTYPE NORMAL
END
ENDPAGE ENDPAGE
ENDMASK ENDMASK

View File

@ -163,8 +163,8 @@ public:
int ricerca_clifo(int riga); int ricerca_clifo(int riga);
int ricerca_gruppo(int riga); int ricerca_gruppo(int riga);
void calcola_progressivi(); void calcola_progressivi(bool finali = FALSE);
void calcola_progressivi_al(); void calcola_progressivi_al(const TDate& data);
void stampa_progressivi(); void stampa_progressivi();
int stampa_progressivi(int start_riga); int stampa_progressivi(int start_riga);
void stampa_progre_riporto(); void stampa_progre_riporto();
@ -265,22 +265,14 @@ void TMastrini_application::process_link(int id, const char* txt)
bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key) bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key)
{ {
const TMask& m = f.mask();
const short id = f.dlg(); const short id = f.dlg();
bool warning = FALSE; bool warning = FALSE;
const int gruppo = f.mask().get_int(F_GRUPPOINI); const int gruppo = m.get_int(F_GRUPPOINI);
const int conto = m.get_int(F_CONTOINI_CONTO);
int conto; const long sottoconto = m.get_long(id);
if (id == F_SOTTOCINI_CONTO)
conto = f.mask().get_int(F_CONTOINI_CONTO);
else
if (id == F_SOTTOCINI_CLIENTE)
conto = f.mask().get_int(F_CONTOINI_CLIENTE);
else
if (id == F_SOTTOCINI_FORN)
conto = f.mask().get_int(F_CONTOINI_FORN);
const long sottoconto = f.mask().get_long(id);
if ( key == K_ENTER ) if ( key == K_ENTER )
{ {
@ -291,7 +283,7 @@ bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key)
return f.warning_box("Manca il GRUPPO"); return f.warning_box("Manca il GRUPPO");
} }
if (key == K_TAB && f.mask().is_running()) if (key == K_TAB && m.is_running())
{ {
TString ds; TString ds;
if (id == F_SOTTOCINI_CONTO && (gruppo != 0 || conto != 0 || sottoconto != 0L)) if (id == F_SOTTOCINI_CONTO && (gruppo != 0 || conto != 0 || sottoconto != 0L))
@ -352,29 +344,22 @@ bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key)
} }
} }
} }
return TRUE; return TRUE;
} }
bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key) bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key)
{ {
const TMask& m = f.mask();
const short id = f.dlg(); const short id = f.dlg();
int conto;
TString ds; TString ds;
TString80 rs; TString80 rs;
bool warning; bool warning;
const int gruppo = f.mask().get_int(F_GRUPPOFINE); const int gruppo = m.get_int(F_GRUPPOFINE);
const int conto = m.get_int(F_CONTOFINE_CONTO);
if (id == F_SOTTOCFINE_CONTO) const long sottoconto = m.get_long(id);
conto = f.mask().get_int(F_CONTOFINE_CONTO);
else
if (id == F_SOTTOCFINE_CLIENTE)
conto = f.mask().get_int(F_CONTOFINE_CLIENTE);
else
if (id == F_SOTTOCFINE_FORN)
conto = f.mask().get_int(F_CONTOFINE_FORN);
const long sottoconto = f.mask().get_long(id);
if ( key == K_ENTER ) if ( key == K_ENTER )
{ {
@ -388,7 +373,7 @@ bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key)
return FALSE; return FALSE;
} }
if ( key == K_TAB && f.mask().is_running()) if ( key == K_TAB && m.is_running())
{ {
if (id == F_SOTTOCFINE_CONTO && (gruppo != 0 || conto != 0 || sottoconto != 0L)) if (id == F_SOTTOCFINE_CONTO && (gruppo != 0 || conto != 0 || sottoconto != 0L))
{ {
@ -535,25 +520,15 @@ bool TMastrini_application::contof_hnd (TMask_field& f, KEY k)
if (gruppof == 0) if (gruppof == 0)
return TRUE; return TRUE;
char tipo = f.mask().get(F_TIPOCF_INI)[0];
int gruppoi = f.mask().get_int(F_GRUPPOINI); int gruppoi = f.mask().get_int(F_GRUPPOINI);
if (gruppoi < gruppof) if (gruppoi < gruppof)
return TRUE; return TRUE;
int contof = f.mask().get_int(id); int contof = f.mask().get_int(id);
int contoi; int contoi = f.mask().get_int(F_CONTOINI_CONTO);
char tipo = f.mask().get(F_TIPOCF_INI)[0];
if (tipo == '\0')
contoi = f.mask().get_int(F_CONTOINI_CONTO);
else
if (tipo == 'C')
contoi = f.mask().get_int(F_CONTOINI_CLIENTE);
else
if (tipo == 'F')
contoi = f.mask().get_int(F_CONTOINI_FORN);
if (contoi > contof) if (contoi > contof)
return f.error_box("Il conto di partenza deve essere inferiore o uguale al conto di arrivo"); return f.error_box("Il conto di partenza deve essere inferiore o uguale al conto di arrivo");
@ -931,7 +906,7 @@ void TMastrini_application::fai_stampa132()
set_row (_rw,"@0g#t", &_dataregs); set_row (_rw,"@0g#t", &_dataregs);
if (_stampanum == 1) if (_stampanum == 1)
set_row (_rw,"@11g$[r]#7ld$[n]", &_numreg); set_row (_rw,"@11g$[b]#7ld$[n]", &_numreg);
else else
if (_stampanum == 2) if (_stampanum == 2)
{ {
@ -942,7 +917,7 @@ void TMastrini_application::fai_stampa132()
set_row (_rw,"@30g#7t", &_numdoc); set_row (_rw,"@30g#7t", &_numdoc);
set_row (_rw,"@38g#3t", &_codcaus); set_row (_rw,"@38g#3t", &_codcaus);
set_row (_rw,"@117g#3t #3t #6t", &_g_contr, &_c_contr, &_s_contr); set_row (_rw,"@117g#t #t #t", &_g_contr, &_c_contr, &_s_contr);
} }
void TMastrini_application::fai_stampa198() void TMastrini_application::fai_stampa198()
@ -1015,7 +990,7 @@ void TMastrini_application::fai_stampa198()
set_row (_rw,"@0g#t", &_dataregs); set_row (_rw,"@0g#t", &_dataregs);
if (_stampanum == 1) if (_stampanum == 1)
{ {
set_row (_rw,"@11g$[r]#7ld$[n]", &_numreg); set_row (_rw,"@11g$[b]#7ld$[n]", &_numreg);
set_row (_rw,"@18g/#3d", &_numrig); set_row (_rw,"@18g/#3d", &_numrig);
} }
else if (_stampanum == 2) else if (_stampanum == 2)
@ -1028,7 +1003,7 @@ void TMastrini_application::fai_stampa198()
// Stampa saldo movimenti // Stampa saldo movimenti
set_row (_rw,"@151g#t", &_saldo_movimenti_str); set_row (_rw,"@151g#t", &_saldo_movimenti_str);
set_row (_rw,"@168g#3t #3t #6t", &_g_contr, &_c_contr, &_s_contr); set_row (_rw,"@168g#t #t #t", &_g_contr, &_c_contr, &_s_contr);
} }
void TMastrini_application::stampa_totali132() void TMastrini_application::stampa_totali132()
@ -1485,8 +1460,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_tipostampa == 2) if (_tipostampa == 2)
{ {
// saldi_zero(); // saldi_zero();
calcola_progressivi(); calcola_progressivi(TRUE);
_totale_saldo = _totprogre_dare_al - _totprogre_avere_al; _totale_saldo = _saldo_progre_prec;
} }
// else // else
// _totale_saldo = 1.0; // _totale_saldo = 1.0;
@ -1624,7 +1599,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_stampa_mov_prov && provvis.trim().not_empty()) if (_stampa_mov_prov && provvis.trim().not_empty())
if (_numcarat == 1) if (_numcarat == 1)
set_row(_rw, "@129gP"); set_row(_rw, "@130gP");
else else
set_row(_rw, "@195gP"); set_row(_rw, "@195gP");
@ -2278,6 +2253,7 @@ print_action TMastrini_application::postprocess_print(int file, int counter)
{ {
if (file == LF_SALDI) if (file == LF_SALDI)
{ {
/* Cazzata tremenda
_msk->reset(F_TIPOCF_INI); _msk->reset(F_TIPOCF_INI);
_msk->reset(F_GRUPPOINI); _msk->reset(F_GRUPPOINI);
@ -2309,6 +2285,8 @@ print_action TMastrini_application::postprocess_print(int file, int counter)
_msk->reset(F_DESCRFINE_CONTO); _msk->reset(F_DESCRFINE_CONTO);
_msk->reset(F_DESCRFINE_CLIENTE); _msk->reset(F_DESCRFINE_CLIENTE);
_msk->reset(F_DESCRFINE_FORN); _msk->reset(F_DESCRFINE_FORN);
*/
_msk->reset(-9);
} }
return NEXT_PAGE; return NEXT_PAGE;
} }
@ -2494,8 +2472,6 @@ bool TMastrini_application::set_print(int)
ricerca_dati_ditta(); ricerca_dati_ditta();
int formato = _msk->get_int(F_FORMATO); // Molto scenografico!
if (_nummast == 1 || _nummast == 3) if (_nummast == 1 || _nummast == 3)
printer().footerlen(4); printer().footerlen(4);
else else
@ -2547,7 +2523,7 @@ bool TMastrini_application::set_print(int)
} }
enable_print_menu(); enable_print_menu();
enable_link("Collegamento prima nota: ", 'r'); enable_link("Collegamento prima nota: ", 'b');
return TRUE; return TRUE;
} }
@ -2810,7 +2786,7 @@ void TMastrini_application::crea_intestazione()
set_header (7,"%s@19g%s@117g%s@131g%s", set_header (7,"%s@19g%s@117g%s@131g%s",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A")); trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
if (_stampa_mov_prov) if (_stampa_mov_prov)
set_header(7,"@129gM"); set_header(7,"@130gM");
set_header (8, trans("Data")); set_header (8, trans("Data"));
if (_stampanum < 3) if (_stampanum < 3)
set_header (8,"@11g%s", trans("Numero")); set_header (8,"@11g%s", trans("Numero"));
@ -2818,7 +2794,7 @@ void TMastrini_application::crea_intestazione()
trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"), trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"),
trans("Dare"), trans("Avere"), trans("Partita"), trans("C")); trans("Dare"), trans("Avere"), trans("Partita"), trans("C"));
if (_stampa_mov_prov) if (_stampa_mov_prov)
set_header(8,"@129g%s", trans("P")); set_header(8,"@130g%s", trans("P"));
sep.fill('-'); sep.fill('-');
set_header (9, (const char *) sep); set_header (9, (const char *) sep);
} }
@ -2994,13 +2970,13 @@ int TMastrini_application::crea_intestazione(int start_riga)
set_row (r++,"%s@19g%s@117g%s@131g%s", set_row (r++,"%s@19g%s@117g%s@131g%s",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A")); trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
if (_stampa_mov_prov) if (_stampa_mov_prov)
set_header(r-1,"@129g%s", trans("M")); set_header(r-1,"@130g%s", trans("M"));
set_row (r, trans("Data")); set_row (r, trans("Data"));
if (_stampanum < 3) if (_stampanum < 3)
set_row (r,"@11g%s", trans("Numero")); set_row (r,"@11g%s", trans("Numero"));
set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@95gDare@111gAvere@117gPartita@131gC"); set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@95gDare@111gAvere@117gPartita@131gC");
if (_stampa_mov_prov) if (_stampa_mov_prov)
set_header(r-1,"@129gP"); set_header(r-1,"@130gP");
sep.fill('-'); sep.fill('-');
set_row (r++,"@1g%s", (const char*)sep); set_row (r++,"@1g%s", (const char*)sep);
} }
@ -3130,7 +3106,7 @@ int TMastrini_application::stampa_progre_riporto(int start_riga)
return r; return r;
} }
void TMastrini_application::calcola_progressivi_al() void TMastrini_application::calcola_progressivi_al(const TDate& data_fin)
{ {
long record,sottoc,annoes; long record,sottoc,annoes;
int gruppo,conto; int gruppo,conto;
@ -3183,17 +3159,21 @@ void TMastrini_application::calcola_progressivi_al()
sottoc = rmov.get_long(RMV_SOTTOCONTO); sottoc = rmov.get_long(RMV_SOTTOCONTO);
if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc))
break; break;
else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale else
if (sezione == 'D') {
_totale_prima_dare += importo; //Legge movimenti con data > inizio esercizio e < data_fin
else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg <= data_fin))
_totale_prima_avere += importo; if (sezione == 'D')
_totale_prima_dare += importo;
else
_totale_prima_avere += importo;
}
} // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) } // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty())))
} }
rmov.readat(record); rmov.readat(record);
} }
void TMastrini_application::calcola_progressivi() void TMastrini_application::calcola_progressivi(bool finali)
{ {
/* fv 20/3/96: aggiustato per nuova struttura saldi - modificata ricerca /* fv 20/3/96: aggiustato per nuova struttura saldi - modificata ricerca
* record scaricati e assegnazione dare/avere relativo - Controllare che * record scaricati e assegnazione dare/avere relativo - Controllare che
@ -3311,7 +3291,7 @@ void TMastrini_application::calcola_progressivi()
} }
} }
calcola_progressivi_al(); calcola_progressivi_al(finali ? _data_fine : _data_ini);
//Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov //Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov
//che hanno la data di registrazione inferiore alla data di inizio stampa, //che hanno la data di registrazione inferiore alla data di inizio stampa,
@ -3931,11 +3911,11 @@ void TMastrini_application::set_handlers(TMask* msk) const
msk->set_handler(F_DATAFINE, data_fine); msk->set_handler(F_DATAFINE, data_fine);
msk->set_handler(F_GRUPPOFINE, gruppo_hnd); msk->set_handler(F_GRUPPOFINE, gruppo_hnd);
msk->set_handler(F_CONTOINI_CONTO, contoi_hnd); msk->set_handler(F_CONTOINI_CONTO, contoi_hnd);
msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd); // msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd);
msk->set_handler(F_CONTOINI_FORN, contoi_hnd); // msk->set_handler(F_CONTOINI_FORN, contoi_hnd);
msk->set_handler(F_CONTOFINE_CONTO, contof_hnd); msk->set_handler(F_CONTOFINE_CONTO, contof_hnd);
msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd); // msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd);
msk->set_handler(F_CONTOFINE_FORN, contof_hnd); // msk->set_handler(F_CONTOFINE_FORN, contof_hnd);
msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini); msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini);
msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini); msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini);

View File

@ -43,7 +43,6 @@
#define F_MEMORIZZA 500 #define F_MEMORIZZA 500
#define F_NUMCARAT 501 #define F_NUMCARAT 501
#define F_NUMMAST 502 #define F_NUMMAST 502
#define F_FORMATO 503
#define F_CODDITTA 504 #define F_CODDITTA 504
#define F_RAGSOC 505 #define F_RAGSOC 505
#define F_SCELTE 506 #define F_SCELTE 506

View File

@ -82,11 +82,11 @@ LIST F_TIPOCF_INI 25
BEGIN BEGIN
PROMPT 4 4 "Ricerca " PROMPT 4 4 "Ricerca "
ITEM " |Gruppo/conto/sottoconto" ITEM " |Gruppo/conto/sottoconto"
MESSAGE HIDE,2@|HIDE,3@|RESET,2@|RESET,3@|RESET,1@|SHOW,1@|RESET,F_GRUPPOINI MESSAGE HIDE,2@|HIDE,3@|SHOW,1@
ITEM "C|Clienti" ITEM "C|Clienti"
MESSAGE HIDE,1@|HIDE,3@|RESET,1@|RESET,3@|RESET,2@|SHOW,2@|RESET,F_GRUPPOINI MESSAGE HIDE,1@|HIDE,3@|SHOW,2@
ITEM "F|Fornitori" ITEM "F|Fornitori"
MESSAGE HIDE,1@|HIDE,2@|RESET,1@|RESET,2@|RESET,3@|SHOW,3@|RESET,F_GRUPPOINI MESSAGE HIDE,1@|HIDE,2@|SHOW,3@
END END
NUMBER F_GRUPPOINI 3 NUMBER F_GRUPPOINI 3
@ -98,58 +98,20 @@ END
NUMBER F_CONTOINI_CONTO 3 NUMBER F_CONTOINI_CONTO 3
BEGIN BEGIN
PROMPT 41 5 "" PROMPT 41 5 ""
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO="")
INPUT GRUPPO F_GRUPPOINI INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_CONTO INPUT CONTO F_CONTOINI_CONTO
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPOINI GRUPPO
OUTPUT F_CONTOINI_CONTO CONTO
CHECKTYPE NORMAL
WARNING "Conto inesistente o mancante"
// MESSAGE DIRTY,F_SOTTOCINI_CONTO
VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CONTO
GROUP 1 9
END
NUMBER F_CONTOINI_CLIENTE 3
BEGIN
PROMPT 41 5 ""
USE LF_PCON SELECT TMCF="C"
INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_CLIENTE
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TMCF DISPLAY "Tipo" TMCF
OUTPUT F_GRUPPOINI GRUPPO OUTPUT F_GRUPPOINI GRUPPO
OUTPUT F_CONTOINI_CLIENTE CONTO OUTPUT F_CONTOINI_CONTO CONTO
OUTPUT F_TIPOCF_INI TMCF
CHECKTYPE NORMAL CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CLIENTE
WARNING "Conto inesistente o mancante" WARNING "Conto inesistente o mancante"
MESSAGE DIRTY,F_SOTTOCINI_CLIENTE VALIDATE REQIF_FUNC 1 F_SOTTOCINI_CONTO
MESSAGE COPY,F_CONTOINI_CONTO GROUP 9
GROUP 2 9
END
NUMBER F_CONTOINI_FORN 3
BEGIN
PROMPT 41 5 ""
USE LF_PCON SELECT TMCF="F"
INPUT GRUPPO F_GRUPPOINI
INPUT CONTO F_CONTOINI_FORN
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPOINI GRUPPO
OUTPUT F_CONTOINI_FORN CONTO
CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 1 F_SOTTOCINI_FORN
WARNING "Conto inesistente o mancante"
MESSAGE DIRTY,F_SOTTOCINI_FORN
MESSAGE COPY,F_CONTOINI_CONTO
GROUP 3 9
END END
NUMBER F_SOTTOCINI_CONTO 6 NUMBER F_SOTTOCINI_CONTO 6
@ -255,11 +217,11 @@ LIST F_TIPOCF_FINE 25
BEGIN BEGIN
PROMPT 4 7 "Ricerca " PROMPT 4 7 "Ricerca "
ITEM " |Gruppo/conto/sottoconto" ITEM " |Gruppo/conto/sottoconto"
MESSAGE HIDE,5@|HIDE,6@|RESET,5@|RESET,6@|RESET,4@|SHOW,4@|RESET,F_GRUPPOFINE MESSAGE HIDE,5@|HIDE,6@|SHOW,4@
ITEM "C|Clienti" ITEM "C|Clienti"
MESSAGE HIDE,4@|HIDE,6@|RESET,4@|RESET,6@|RESET,5@|SHOW,5@|RESET,F_GRUPPOFINE MESSAGE HIDE,4@|HIDE,6@|SHOW,5@
ITEM "F|Fornitori" ITEM "F|Fornitori"
MESSAGE HIDE,4@|HIDE,5@|RESET,4@|RESET,5@|RESET,6@|SHOW,6@|RESET,F_GRUPPOFINE MESSAGE HIDE,4@|HIDE,5@|SHOW,6@
END END
NUMBER F_GRUPPOFINE 3 NUMBER F_GRUPPOFINE 3
@ -271,21 +233,25 @@ END
NUMBER F_CONTOFINE_CONTO 3 NUMBER F_CONTOFINE_CONTO 3
BEGIN BEGIN
PROMPT 41 8 "" PROMPT 41 8 ""
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="") USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO="") /* &&(TMCF="") */
INPUT GRUPPO F_GRUPPOFINE INPUT GRUPPO F_GRUPPOFINE
INPUT CONTO F_CONTOFINE_CONTO INPUT CONTO F_CONTOFINE_CONTO
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
DISPLAY "Tipo" TMCF
OUTPUT F_GRUPPOFINE GRUPPO OUTPUT F_GRUPPOFINE GRUPPO
OUTPUT F_CONTOFINE_CONTO CONTO OUTPUT F_CONTOFINE_CONTO CONTO
OUTPUT F_TIPOCF_FINE TMCF
CHECKTYPE NORMAL CHECKTYPE NORMAL
VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CONTO VALIDATE REQIF_FUNC 1 F_SOTTOCFINE_CONTO
WARNING "Conto inesistente o mancante" WARNING "Conto inesistente o mancante"
// MESSAGE DIRTY,F_SOTTOCFINE_CONTO // GROUP 4 9
GROUP 4 9 GROUP 9
END END
/*
NUMBER F_CONTOFINE_CLIENTE 3 NUMBER F_CONTOFINE_CLIENTE 3
BEGIN BEGIN
PROMPT 41 8 "" PROMPT 41 8 ""
@ -324,6 +290,8 @@ BEGIN
GROUP 6 9 GROUP 6 9
END END
*/
NUMBER F_SOTTOCFINE_CONTO 6 NUMBER F_SOTTOCFINE_CONTO 6
BEGIN BEGIN
PROMPT 48 8 "" PROMPT 48 8 ""
@ -509,21 +477,14 @@ PAGE "Parametri" -1 -1 78 20
LIST F_NUMCARAT 10 LIST F_NUMCARAT 10
BEGIN BEGIN
PROMPT 4 2 "Numero caratteri " PROMPT 4 1 "Numero caratteri "
ITEM "1|132 crt." ITEM "1|132 crt."
ITEM "2|198 crt." ITEM "2|198 crt."
END END
LIST F_FORMATO 23
BEGIN
PROMPT 4 4 "Formato modulo di stampa "
ITEM "66|11 pollici (27,94 cm)"
ITEM "72|12 pollici (30,48 cm)"
END
LIST F_NUMMAST 10 LIST F_NUMMAST 10
BEGIN BEGIN
PROMPT 4 6 "Numero mastrini per pagina " PROMPT 4 2 "Numero mastrini per pagina "
ITEM "1|Uno" ITEM "1|Uno"
ITEM "2|Due" ITEM "2|Due"
ITEM "3|Continua" ITEM "3|Continua"
@ -531,7 +492,7 @@ END
SPREADSHEET F_SCELTE SPREADSHEET F_SCELTE
BEGIN BEGIN
PROMPT 0 8 "" PROMPT 0 4 ""
ITEM "Anno" ITEM "Anno"
ITEM "Tipo@4" ITEM "Tipo@4"
ITEM "Gr." ITEM "Gr."

View File

@ -221,7 +221,6 @@ public:
const char* get_descr_caus (const char * codcaus); const char* get_descr_caus (const char * codcaus);
const TRectype& look_com (const char* cod, const char* stato = ""); const TRectype& look_com (const char* cod, const char* stato = "");
const TString& get_codiva_des(const char* codiva); const TString& get_codiva_des(const char* codiva);
void get_date_aep(int aep, TDate* in, TDate* fin);
void update_totals (char sezione, real& importo); void update_totals (char sezione, real& importo);
void set_reg_filter(TMask& m); void set_reg_filter(TMask& m);
@ -245,7 +244,7 @@ bool TStampa_giornale::filtra_reg(const TRelation * r)
bool TStampa_giornale::filter_func(const TRelation * r) bool TStampa_giornale::filter_func(const TRelation * r)
{ {
const TRectype& recmov = r->lfile().curr(); const TRectype& recmov = r->curr();
// Scarto SEMPRE i provvisori // Scarto SEMPRE i provvisori
const TString& provvis = recmov.get(MOV_PROVVIS); const TString& provvis = recmov.get(MOV_PROVVIS);
@ -253,7 +252,8 @@ bool TStampa_giornale::filter_func(const TRelation * r)
return FALSE; return FALSE;
// Scarto i movimenti che hanno il registro ai soli fini della liquidazione // Scarto i movimenti che hanno il registro ai soli fini della liquidazione
const tipo_sospensione ts = r->lfile("REG").get_bool("B1") ? (tipo_sospensione) r->lfile("REG").get_int("I9") : nessuna; const TRectype& reg = r->lfile("REG").curr();
const tipo_sospensione ts = reg.get_bool("B1") ? (tipo_sospensione) reg.get_int("I9") : nessuna;
if (ts == liquidazione) if (ts == liquidazione)
return FALSE; return FALSE;
@ -261,7 +261,7 @@ bool TStampa_giornale::filter_func(const TRelation * r)
if (!app()._libro_giornale_iva_unico) if (!app()._libro_giornale_iva_unico)
{ {
const long numreg = recmov.get_long("NUMREG"); const long numreg = recmov.get_long("NUMREG");
TRectype& recrmov = r->lfile(LF_RMOV).curr(); TRectype& recrmov = r->curr(LF_RMOV);
recrmov.zero(); recrmov.zero();
recrmov.put("NUMREG", numreg); recrmov.put("NUMREG", numreg);
recrmov.put("NUMRIG", 1); recrmov.put("NUMRIG", 1);
@ -318,27 +318,28 @@ void TStampa_giornale::get_dati_ditta ()
_cofi = _anag->get(ANA_COFI); _cofi = _anag->get(ANA_COFI);
_paiva = _anag->get(ANA_PAIV); _paiva = _anag->get(ANA_PAIV);
_comunefis = _anag->get(ANA_COMRF); _comunefis = _anag->get(ANA_COMRF);
_cap = _anag->get(ANA_CAPRF);
if (_comunefis.empty()) if (_comunefis.empty())
_comunefis = _anag->get(ANF_COMRES); _comunefis = _anag->get(ANF_COMRES);
const TRectype& dep = look_com (_comunefis); const TRectype& dep = look_com(_comunefis);
_comunefis = dep.get(COM_DENCOM);
_comunefis = dep.get(COM_DENCOM); _provfis = dep.get(COM_PROVCOM);
_provfis = dep.get(COM_PROVCOM); if (_cap.empty())
_cap = dep.get(COM_CAPCOM); _cap = dep.get(COM_CAPCOM);
if (_comunefis.empty()) if (_comunefis.empty())
{ {
_viafis = _anag->get(ANA_INDRF); _viafis = _anag->get(ANA_INDRF);
_viafis.rtrim(); _viafis.rtrim();
_viafis << " " << _anag->curr().get (ANA_CIVRF); _viafis << ' ' << _anag->curr().get (ANA_CIVRF);
} }
else else
{ {
_viafis = _anag->get(ANA_INDRES); _viafis = _anag->get(ANA_INDRES);
_viafis.rtrim(); _viafis.rtrim();
_viafis << " " << _anag->get (ANA_CIVRES); _viafis << ' ' << _anag->get (ANA_CIVRES);
} }
} }
@ -365,14 +366,14 @@ bool TStampa_giornale::user_create()
_causali = new TDecoder(LF_CAUSALI, "DESCR"); _causali = new TDecoder(LF_CAUSALI, "DESCR");
_rel = new TRelation (LF_MOV); _rel = new TRelation (LF_MOV);
_rel->add (LF_RMOV, "NUMREG=NUMREG"); _rel->add (LF_RMOV, "NUMREG==NUMREG");
_rel->add (LF_RMOVIVA, "NUMREG=NUMREG"); _rel->add (LF_RMOVIVA, "NUMREG==NUMREG");
_rel->add ("REG", "CODTAB[1,4]=ANNOIVA|CODTAB[5,7]=REG"); _rel->add ("REG", "CODTAB[1,4]==ANNOIVA|CODTAB[5,7]==REG"); // CM500302 senza == si incasina con registri vuoti!
_cur = new TCursor (_rel, "", 2); // usa la chiave 2: DATAREG+NUMREG _cur = new TCursor (_rel, "", 2); // usa la chiave 2: DATAREG+NUMREG
_RecPartoDa = new TRectype(_cur->file(LF_MOV).curr()); _RecPartoDa = new TRectype(_cur->curr());
_RecArrivoA = new TRectype(_cur->file(LF_MOV).curr()); _RecArrivoA = new TRectype(_cur->curr());
add_cursor (_cur); add_cursor (_cur);
@ -405,9 +406,10 @@ void TStampa_giornale::aggiorna_mov()
TLocalisamfile& mov = _cur->file(LF_MOV); TLocalisamfile& mov = _cur->file(LF_MOV);
long nprog = _nprog_da + 1; long nprog = _nprog_da + 1;
const TRectype da(*_RecPartoDa); // const TRectype da(*_RecPartoDa);
const TRectype a(*_RecArrivoA); // const TRectype a(*_RecArrivoA);
_cur->setregion(da, a); // _cur->setregion(da, a);
_cur->setregion(*_RecPartoDa, *_RecArrivoA);
const long items = _cur->items(); const long items = _cur->items();
TProgind prnd (items, "Aggiornamento movimenti ...", FALSE, TRUE); TProgind prnd (items, "Aggiornamento movimenti ...", FALSE, TRUE);
@ -829,7 +831,7 @@ bool TStampa_giornale::preprocess_print(int file, int counter)
_nuovo_mese = FALSE; _nuovo_mese = FALSE;
_iva_array.destroy(); _iva_array.destroy();
_nprog_mov = _nprog_da; _nprog_mov = _nprog_da;
*_RecPartoDa = _cur->file(LF_MOV).curr(); *_RecPartoDa = _cur->curr();
break; break;
default: default:
break; break;
@ -1518,7 +1520,8 @@ void TStampa_giornale::aggiorna_tabreg(int partito_da, int stampate)
if (_tabreg->good()) if (_tabreg->good())
{ {
// _tabreg->put ("I8", (long)partito_da); // partito_da = -1 se stampa OK // _tabreg->put ("I8", (long)partito_da); // partito_da = -1 se stampa OK
_tabreg->put ("I1", (long)_pagine_stampate + stampate); // pagine stampate // _tabreg->put ("I1", (long)_pagine_stampate + stampate); // pagine stampate
_tabreg->put ("I1", (long)_pagina_da + stampate); // pagine stampate
_tabreg->put ("I6", _nprog_mov); // ultimo numero di riga _tabreg->put ("I6", _nprog_mov); // ultimo numero di riga
_tabreg->put ("R1", _tot_dare_generale); _tabreg->put ("R1", _tot_dare_generale);
_tabreg->put ("R2", _tot_avere_generale); _tabreg->put ("R2", _tot_avere_generale);
@ -1527,56 +1530,45 @@ void TStampa_giornale::aggiorna_tabreg(int partito_da, int stampate)
} }
} }
void TStampa_giornale::get_date_aep(int aep, TDate* in, TDate* fin)
{
*in = TDate(1,1,aep);
*fin = TDate(31,12,aep);
}
const int es_prec(const int es_corr)
{
return es_corr-1;
}
bool TStampa_giornale::controlla_mov_aep() bool TStampa_giornale::controlla_mov_aep()
{ {
TWait_cursor hourglass; TWait_cursor hourglass;
const int aep = es_prec(_ae); TEsercizi_contabili esc;
const int aep = esc.pred(_ae);
TDate inizio_ep, fine_ep; TDate inizio_ep, fine_ep;
if (aep > 0)
if (aep == 0) // = e' il primo esercizio {
return TRUE; inizio_ep = esc[aep].inizio();
fine_ep = esc[aep].fine();
}
else else
get_date_aep(aep,&inizio_ep, &fine_ep); return TRUE; // = e' il primo esercizio
TRectype da (LF_MOV); TRectype da(LF_MOV), a(LF_MOV);
TRectype a (LF_MOV);
da.put(MOV_DATAREG, inizio_ep); da.put(MOV_DATAREG, inizio_ep);
a.put (MOV_DATAREG, fine_ep); a.put (MOV_DATAREG, fine_ep);
_cur->setregion(da, a); _cur->setregion(da, a);
_cur->setfilter("");
_cur->set_filterfunction(filter_func, TRUE); _cur->set_filterfunction(filter_func, TRUE);
// _cur->setfilter(format("ANNOES=%04d && STAMPATO!=\"X\"", aep));
const TRecnotype items = _cur->items();
_cur->freeze();
TProgind pi(items, "Controllo movimenti esercizio precedente", FALSE, TRUE);
bool gia_stampati = TRUE; bool gia_stampati = TRUE;
for (*_cur = 0L ; _cur->ok(); ++(*_cur)) for (*_cur = 0L ; _cur->pos() < items; ++(*_cur))
{ {
pi.addstatus(1);
gia_stampati = _cur->file().get_bool("STAMPATO"); gia_stampati = _cur->file().get_bool("STAMPATO");
if (!gia_stampati) break; // basta trovarne uno ancora da stampare if (!gia_stampati) break; // basta trovarne uno ancora da stampare
} }
_cur->freeze(FALSE);
if (_cur->items() > 0L && !gia_stampati) if (!gia_stampati)
{ error_box("Impossibile proseguire con la stampa:\n"
_cur->setfilter(""); "Esistono movimenti nell'esercizio precedente\n"
warning_box("Impossibile proseguire con la stampa:\n" "che non sono ancora stati stampati su bollato.");
"Esistono movimenti nell'esercizio precedente\n" return gia_stampati;
"che non sono ancora stati stampati su bollato.");
return FALSE;
}
_cur->setfilter("");
return TRUE;
} }
bool TStampa_giornale::leggi_tabreg(const char * reg_cod, int reg_anno) bool TStampa_giornale::leggi_tabreg(const char * reg_cod, int reg_anno)
@ -1636,9 +1628,11 @@ bool TStampa_giornale::data_a_hndl (TMask_field& f, KEY k)
return TRUE; return TRUE;
TEsercizi_contabili esc; TEsercizi_contabili esc;
if (esc.date2esc(data_a) <= 0)
return f.error_box("La data non appartiene a nessun esercizio");
app()._ae_solare = data_a.year(); app()._ae_solare = data_a.year();
app()._ae = esc.date2esc(data_a);//app()._ae_solare; app()._ae = esc.date2esc(data_a);
m.set(ANNO_ESER, app()._ae_solare); m.set(ANNO_ESER, app()._ae_solare);
m.send_key(K_TAB, CODREG); m.send_key(K_TAB, CODREG);
@ -1873,7 +1867,7 @@ bool TStampa_giornale::init_cursor()
if (_cur->items() == 0L) if (_cur->items() == 0L)
{ {
_cur->setfilter(""); _cur->setfilter("");
return warning_box ("Non ci sono movimenti da stampare nel periodo selezionato.\nLa stampa e' annullata"); return warning_box("Non ci sono movimenti da stampare nel periodo selezionato.\nLa stampa e' annullata");
} }
return TRUE; return TRUE;
@ -1910,7 +1904,9 @@ bool TStampa_giornale::set_print(int)
if (_stampa_definitiva) if (_stampa_definitiva)
{ {
TEsercizi_contabili esc; TEsercizi_contabili esc;
_data_da = esc.esercizio(_ae).inizio();//TDate(1,1,_ae); _ae_solare = _data_a.year();
_ae = esc.date2esc(_data_a);
_data_da = esc[_ae].inizio();
// Controlla che non siano rimasti movimenti ancora da stampare dell'es.prec. // Controlla che non siano rimasti movimenti ancora da stampare dell'es.prec.
if (_stampa_stesso_registro) if (_stampa_stesso_registro)

View File

@ -532,8 +532,9 @@ class TMastrino : public TObject
TBill _conto; // Conto del mastrino TBill _conto; // Conto del mastrino
int _esercizio; // Esercizio di riferimento (eventualmente 0) int _esercizio; // Esercizio di riferimento (eventualmente 0)
TDate _da_data, _a_data; TDate _da_data, _a_data; // Date limite
TString _da_caus, _a_caus; TString _da_caus, _a_caus; // Causali limite
bool _provvis; // Includi provvisori
real _pdare_ini, _pavere_ini; real _pdare_ini, _pavere_ini;
real _pdare_per, _pavere_per; real _pdare_per, _pavere_per;
@ -555,7 +556,7 @@ public:
void read(const TBill& conto, void read(const TBill& conto,
int annoes, const TDate& dd, const TDate& ad, int annoes, const TDate& dd, const TDate& ad,
const TString& dc, const TString& ac); const TString& dc, const TString& ac, bool provvis);
void reread(); void reread();
TRiga_mastrino& operator[](long n) const { return row(n); } TRiga_mastrino& operator[](long n) const { return row(n); }
@ -607,8 +608,7 @@ TMastrino::TMastrino()
if (_instances == 0L) if (_instances == 0L)
{ {
_rel = new TRelation(LF_RMOV); _rel = new TRelation(LF_RMOV);
_rel->add(LF_MOV, "NUMREG=NUMREG"); _rel->add(LF_MOV, "NUMREG==NUMREG");
_cur = new TCursor(_rel);
_rmov = &_rel->lfile(); _rmov = &_rel->lfile();
_mov = &_rel->lfile(LF_MOV); _mov = &_rel->lfile(LF_MOV);
} }
@ -662,7 +662,8 @@ long TMastrino::last(tipo_riga_mastrino tipo) const
void TMastrino::read(const TBill& conto, void TMastrino::read(const TBill& conto,
int ae, const TDate& dd, const TDate& ad, int ae, const TDate& dd, const TDate& ad,
const TString& dc, const TString& ac) const TString& dc, const TString& ac,
bool provvis)
{ {
TEsercizi_contabili esercizi; TEsercizi_contabili esercizi;
@ -691,6 +692,7 @@ void TMastrino::read(const TBill& conto,
const bool test_caus = !(dc.blank() && ac.blank()); const bool test_caus = !(dc.blank() && ac.blank());
_da_caus = dc; _da_caus = dc;
_a_caus = ac.blank() ? "zzz" : ac; // Se vuota sceglie la massima causale _a_caus = ac.blank() ? "zzz" : ac; // Se vuota sceglie la massima causale
_provvis = provvis;
TDate max_data_reg = _a_data; TDate max_data_reg = _a_data;
long num_giorni = _a_data - inizio_esercizio + 1; long num_giorni = _a_data - inizio_esercizio + 1;
@ -706,11 +708,6 @@ void TMastrino::read(const TBill& conto,
max_data_reg = esercizi[ae].fine(); max_data_reg = esercizi[ae].fine();
} }
TString caption(80);
caption.format("Caricamento mastrino %03d.%03d.%06ld",
_conto.gruppo(), _conto.conto(), _conto.sottoconto());
TProgind pi(num_giorni, caption, FALSE, TRUE);
// Stima dimensione mastrino // Stima dimensione mastrino
_riga.choose_step(num_giorni); _riga.choose_step(num_giorni);
@ -736,10 +733,6 @@ void TMastrino::read(const TBill& conto,
// limiti della stampa // limiti della stampa
_pdare_per = _pavere_per = ZERO; _pdare_per = _pavere_per = ZERO;
rmov_rec.zero();
conto.put(rmov_rec);
rmov_rec.put(RMV_DATAREG, inizio_esercizio);
const TRecfield rmov_datareg (rmov_rec, RMV_DATAREG); const TRecfield rmov_datareg (rmov_rec, RMV_DATAREG);
const TRecfield rmov_numreg (rmov_rec, RMV_NUMREG); const TRecfield rmov_numreg (rmov_rec, RMV_NUMREG);
const TRecfield rmov_gruppo (rmov_rec, RMV_GRUPPO); const TRecfield rmov_gruppo (rmov_rec, RMV_GRUPPO);
@ -757,21 +750,23 @@ void TMastrino::read(const TBill& conto,
const clock_t clock_start = clock(); const clock_t clock_start = clock();
#endif #endif
TDate ultimo_giorno; // memorizza ultima data registrazione utilizzata rmov_rec.zero();
conto.put(rmov_rec);
TRectype darow(rmov_rec), arow(rmov_rec);
darow.put(RMV_DATAREG, inizio_esercizio);
arow.put(RMV_DATAREG, max_data_reg);
TCursor cur(&rel(), "", 2, &darow, &arow);
const TRecnotype totrows = cur.items();
cur.freeze();
for (int err = rel().read(_isgteq); err == NOERR; err = rel().next()) TString caption(80);
caption.format("Caricamento mastrino %03d.%03d.%06ld",
_conto.gruppo(), _conto.conto(), _conto.sottoconto());
TProgind pi(totrows, caption, FALSE, TRUE);
for (cur = 0L; cur.pos() < totrows; ++cur)
{ {
// Controlla di non aver superato la data limite pi.addstatus(1);
const TDate data_reg((const char*)rmov_datareg);
if (data_reg > max_data_reg)
break;
// Controlla che il conto sia ancora quello selezionato
if (_conto.sottoconto() != long(rmov_sottoconto) ||
_conto.conto() != int(rmov_conto) ||
_conto.gruppo() != int(rmov_gruppo))
break;
#ifdef DBG #ifdef DBG
num_rec++; num_rec++;
if ((num_rec & 0x7F) == 0) if ((num_rec & 0x7F) == 0)
@ -786,23 +781,18 @@ void TMastrino::read(const TBill& conto,
} }
#endif #endif
// Ignora i movimenti provvisori // Ignora eventualmente i movimenti provvisori
const char provvis = *(const char*)mov_provvis; if (!_provvis)
if (provvis > ' ') {
continue; const char is_provvis = *(const char*)mov_provvis;
if (is_provvis > ' ')
continue;
}
const TDate data_corrente = _esercizio <= 0 ? data_reg : TDate((const char*)mov_datacomp); const TDate data_corrente = _esercizio <= 0 ? rmov_datareg : TDate((const char*)mov_datacomp);
if (data_corrente > _a_data) if (data_corrente > _a_data)
continue; continue;
// Aggiorna la barra solo una volta al giorno
if (data_reg > ultimo_giorno)
{
const long giorno = data_reg - inizio_esercizio + 1;
pi.setstatus(giorno);
ultimo_giorno = data_reg;
}
const char sezione = *((const char*)rmov_sezione); const char sezione = *((const char*)rmov_sezione);
const real importo((const char*)rmov_importo); const real importo((const char*)rmov_importo);
@ -833,19 +823,17 @@ void TMastrino::read(const TBill& conto,
TRiga_mastrino* r = new TRiga_mastrino(riga_mastrino, TRiga_mastrino* r = new TRiga_mastrino(riga_mastrino,
rmov().recno(), mov().recno(), rmov().recno(), mov().recno(),
_pdare_per, _pavere_per, data_reg); _pdare_per, _pavere_per, rmov_datareg);
_riga.append(r); _riga.append(r);
} }
} }
pi.setstatus(num_giorni); // Raramente arriva in fondo!
} }
void TMastrino::reread() void TMastrino::reread()
{ {
read(_conto, _esercizio, _da_data, _a_data, _da_caus, _a_caus); read(_conto, _esercizio, _da_data, _a_data, _da_caus, _a_caus, _provvis);
} }
void TMastrino::position_rel(long n) void TMastrino::position_rel(long n)
{ {
const TRiga_mastrino& r = row(n); const TRiga_mastrino& r = row(n);
@ -1202,9 +1190,12 @@ TGrid_control::TGrid_control(
XI_OBJ* itf = get_interface(parent); XI_OBJ* itf = get_interface(parent);
long list_attr = XI_ATR_ENABLED | XI_ATR_VISIBLE;
// if (_read_only) list_attr |= XI_ATR_NAVIGATE;
XI_OBJ_DEF* listdef = xi_add_list_def(NULL, cid, XI_OBJ_DEF* listdef = xi_add_list_def(NULL, cid,
rct.top, rct.left, rct.bottom-rct.top, rct.top, rct.left, rct.bottom-rct.top,
XI_ATR_ENABLED | XI_ATR_VISIBLE, list_attr,
NORMAL_COLOR, NORMAL_BACK_COLOR, // normal NORMAL_COLOR, NORMAL_BACK_COLOR, // normal
DISABLED_COLOR, DISABLED_BACK_COLOR, // disabled DISABLED_COLOR, DISABLED_BACK_COLOR, // disabled
FOCUS_COLOR, // active FOCUS_COLOR, // active
@ -1228,9 +1219,13 @@ TGrid_control::TGrid_control(
l->rule_color = MASK_DARK_COLOR; l->rule_color = MASK_DARK_COLOR;
if (_read_only) if (_read_only)
{
l->single_select = TRUE; l->single_select = TRUE;
}
else else
{
l->active_back_color = FOCUS_BACK_COLOR; l->active_back_color = FOCUS_BACK_COLOR;
}
// Definizione della prima colonna (numero di riga) // Definizione della prima colonna (numero di riga)
const long attr = XI_ATR_VISIBLE | XI_ATR_RJUST | XI_ATR_SELECTABLE; const long attr = XI_ATR_VISIBLE | XI_ATR_RJUST | XI_ATR_SELECTABLE;
@ -1464,10 +1459,12 @@ void TGrid_control::update_selection(XI_EVENT* xiev)
const bool is_curr = xiev->v.rec_request.data_rec == _cur_rec; const bool is_curr = xiev->v.rec_request.data_rec == _cur_rec;
if (_read_only) if (_read_only)
{ {
/*
if (is_curr) if (is_curr)
xiev->v.rec_request.attrib |= XI_ATR_SELECTED; xiev->v.rec_request.attrib |= XI_ATR_SELECTED;
else else
xiev->v.rec_request.attrib &= ~XI_ATR_SELECTED; xiev->v.rec_request.attrib &= ~XI_ATR_SELECTED;
*/
} }
else else
xiev->v.rec_request.has_focus = is_curr; xiev->v.rec_request.has_focus = is_curr;
@ -1550,6 +1547,8 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
_cur_rec = rec; // Assegno subito il record corrente _cur_rec = rec; // Assegno subito il record corrente
_grid->on_record_button(rec); _grid->on_record_button(rec);
#endif #endif
if (_read_only)
refused = TRUE;
} }
else else
{ {
@ -1557,6 +1556,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
{ {
const short cid = col2cid(xiev->v.select.column); const short cid = col2cid(xiev->v.select.column);
_grid->on_dbl_cell(rec, cid); _grid->on_dbl_cell(rec, cid);
refused = TRUE;
} }
_cur_rec = rec; // Assegno solo ora il record corrente _cur_rec = rec; // Assegno solo ora il record corrente
} }
@ -2172,7 +2172,7 @@ public:
void destroy(); void destroy();
void read(const TBill& conto, void read(const TBill& conto,
int annoes, const TDate& dd, const TDate& ad, int annoes, const TDate& dd, const TDate& ad,
const TString& dc, const TString& ac); const TString& dc, const TString& ac, bool provv);
void reread(); void reread();
TMastrino& mastrino() { return _mastrino; } TMastrino& mastrino() { return _mastrino; }
@ -2235,8 +2235,16 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
const TRectype& mov = _mastrino.testata(rec); const TRectype& mov = _mastrino.testata(rec);
const int anno = _esercizi.date2esc(riga.data()); const int anno = _esercizi.date2esc(riga.data());
const int eser = mov.get_int(MOV_ANNOES); const int eser = mov.get_int(MOV_ANNOES);
const comp = anno != eser; TString8 str;
cell.set_icon(comp ? ICO_CHECK_ON : ICO_CHECK_OFF); if (anno != eser)
str = "C"; // Di competenza vecchia
if (mov.get(MOV_PROVVIS).not_empty())
{
if (str.not_empty())
str << '/';
str << 'P';
}
cell = str;
} }
break; break;
case 103: case 103:
@ -2257,20 +2265,6 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
case 104: case 104:
if (riga.tipo() == riga_mastrino) if (riga.tipo() == riga_mastrino)
{ {
/* Invertire l'ordine
const TRectype& mov = _mastrino.testata(rec);
cell.set(mov.get(MOV_DESCR));
if (cell.empty())
{
const TRectype& rmov = _mastrino.riga(rec);
cell.set(rmov.get(RMV_DESCR));
if (cell.empty())
{
TBill uncle(rmov,TRUE);
cell.set(uncle.descrizione());
}
}
*/
const TRectype& rmov = _mastrino.riga(rec); const TRectype& rmov = _mastrino.riga(rec);
cell.set(rmov.get(RMV_DESCR)); cell.set(rmov.get(RMV_DESCR));
if (cell.empty()) if (cell.empty())
@ -2480,10 +2474,10 @@ bool TMastrini_grid::on_resize_column(short cid, int new_size)
void TMastrini_grid::read(const TBill& conto, void TMastrini_grid::read(const TBill& conto,
int annoes, const TDate& dd, const TDate& ad, int annoes, const TDate& dd, const TDate& ad,
const TString& dc, const TString& ac) const TString& dc, const TString& ac, bool provv)
{ {
destroy(); destroy();
_mastrino.read(conto, annoes, dd, ad, dc, ac); _mastrino.read(conto, annoes, dd, ad, dc, ac, provv);
update(); update();
update_mask(); update_mask();
} }
@ -2839,9 +2833,11 @@ void TQuery_mask::do_query(TGrid_mask& gm)
const TString& da_caus = get(F_DACAUSALE); const TString& da_caus = get(F_DACAUSALE);
const TString& a_caus = get(F_ACAUSALE); const TString& a_caus = get(F_ACAUSALE);
const bool provv = get_bool(F_PROVVIS);
conto.set(gm, F_GRUPPO, F_CONTO, F_SOTTOCONTO, 0, F_DESSOTTOC); conto.set(gm, F_GRUPPO, F_CONTO, F_SOTTOCONTO, 0, F_DESSOTTOC);
gm.grid().read(conto, annoes, da_data, a_data, da_caus, a_caus); gm.grid().read(conto, annoes, da_data, a_data, da_caus, a_caus, provv);
gm.run(); gm.run();
} }

View File

@ -18,6 +18,8 @@
#define F_DADESCAUS 114 #define F_DADESCAUS 114
#define F_ACAUSALE 115 #define F_ACAUSALE 115
#define F_ADESCAUS 116 #define F_ADESCAUS 116
#define F_PROVVIS 117
#define F_MASTRINI 200 #define F_MASTRINI 200
#define F_TOTRIG_SAL 201 #define F_TOTRIG_SAL 201
#define F_TOTRIG_DAR 202 #define F_TOTRIG_DAR 202

View File

@ -201,7 +201,7 @@ BEGIN
GROUP 3 4 GROUP 3 4
END END
GROUPBOX DLG_NULL 76 3 GROUPBOX DLG_NULL 76 4
BEGIN BEGIN
PROMPT 1 10 "@bPeriodo" PROMPT 1 10 "@bPeriodo"
FLAGS "R" FLAGS "R"
@ -233,15 +233,20 @@ BEGIN
WARNING "La data finale deve essere maggiore di quella iniziale" WARNING "La data finale deve essere maggiore di quella iniziale"
END END
BOOLEAN F_PROVVIS
BEGIN
PROMPT 2 12 "Includi movimenti provvisori"
END
GROUPBOX DLG_NULL 76 4 GROUPBOX DLG_NULL 76 4
BEGIN BEGIN
PROMPT 1 13 "@bCausali" PROMPT 1 14 "@bCausali"
FLAGS "R" FLAGS "R"
END END
STRING F_DACAUSALE 3 STRING F_DACAUSALE 3
BEGIN BEGIN
PROMPT 2 14 "Da causale " PROMPT 2 15 "Da causale "
FLAGS "UZ" FLAGS "UZ"
USE LF_CAUSALI USE LF_CAUSALI
INPUT CODCAUS F_DACAUSALE INPUT CODCAUS F_DACAUSALE
@ -257,7 +262,7 @@ END
STRING F_DADESCAUS 50 STRING F_DADESCAUS 50
BEGIN BEGIN
PROMPT 23 14 "" PROMPT 23 15 ""
USE LF_CAUSALI KEY 2 USE LF_CAUSALI KEY 2
INPUT DESCR F_DADESCAUS INPUT DESCR F_DADESCAUS
DISPLAY "Descrizione@50" DESCR DISPLAY "Descrizione@50" DESCR
@ -269,7 +274,7 @@ END
STRING F_ACAUSALE 3 STRING F_ACAUSALE 3
BEGIN BEGIN
PROMPT 2 15 "A causale " PROMPT 2 16 "A causale "
FLAGS "UZ" FLAGS "UZ"
COPY USE F_DACAUSALE COPY USE F_DACAUSALE
INPUT CODCAUS F_ACAUSALE INPUT CODCAUS F_ACAUSALE
@ -284,7 +289,7 @@ END
STRING F_ADESCAUS 50 STRING F_ADESCAUS 50
BEGIN BEGIN
PROMPT 23 15 "" PROMPT 23 16 ""
COPY USE F_DADESCAUS COPY USE F_DADESCAUS
INPUT DESCR F_ADESCAUS INPUT DESCR F_ADESCAUS
COPY DISPLAY F_DADESCAUS COPY DISPLAY F_DADESCAUS

View File

@ -4,7 +4,7 @@ TOOLBAR "" 0 20 0 0
BUTTON DLG_LINK 10 2 BUTTON DLG_LINK 10 2
BEGIN BEGIN
PROMPT -12 -11 "~Collega" PROMPT -12 -11 "Colle~ga"
PICTURE BMP_LINK PICTURE BMP_LINK
END END
@ -64,7 +64,7 @@ BEGIN
PROMPT 1 2 "Mastrini" PROMPT 1 2 "Mastrini"
FLAGS "DM2" FLAGS "DM2"
ITEM "Data Op. \nData Doc.@10" ITEM "Data Op. \nData Doc.@10"
ITEM "C@1" ITEM "C/P"
ITEM "Causale@20" ITEM "Causale@20"
ITEM "Descrizione@20" ITEM "Descrizione@20"
ITEM "Dare@15R" ITEM "Dare@15R"

View File

@ -685,7 +685,7 @@ void TLista_fatture::set_page(int file, int counter)
{ {
set_row(nriga,"@ld@12g@5,rs@18g@ld@29g@7,rs",FLD(LF_MOV,MOV_DATAREG),FLD(LF_MOV,MOV_PROTIVA), set_row(nriga,"@ld@12g@5,rs@18g@ld@29g@7,rs",FLD(LF_MOV,MOV_DATAREG),FLD(LF_MOV,MOV_PROTIVA),
FLD(LF_MOV,MOV_DATADOC),FLD(LF_MOV,MOV_NUMDOC)); FLD(LF_MOV,MOV_DATADOC),FLD(LF_MOV,MOV_NUMDOC));
set_row(nriga,"@37g@6,rn@44g#-18t@63g@3s@67g@2,rn",FLD(LF_MOV,MOV_CODCF),&_ragsoc,FLD(LF_MOV,MOV_REG), FLD(LF_MOV,MOV_MESELIQ)); set_row(nriga,"@37g@6,rn@44g#-18.18t@63g@3s@67g@2,rn",FLD(LF_MOV,MOV_CODCF),&_ragsoc,FLD(LF_MOV,MOV_REG), FLD(LF_MOV,MOV_MESELIQ));
set_row(nriga,"@70g@2s@73g@15n",FLD(LF_MOV,MOV_TIPODOC),FLD(LF_MOV,MOV_TOTDOC)); set_row(nriga,"@70g@2s@73g@15n",FLD(LF_MOV,MOV_TIPODOC),FLD(LF_MOV,MOV_TOTDOC));
set_row(nriga,"@125g@7,rn",FLD(LF_MOV,MOV_NUMREG)); set_row(nriga,"@125g@7,rn",FLD(LF_MOV,MOV_NUMREG));
} }
@ -729,7 +729,6 @@ bool TLista_fatture::set_print(int m)
default: default:
break; break;
} }
while (msk.run() == K_ENTER) while (msk.run() == K_ENTER)
{ {
_from_cf = msk.get_long(FLD_FROM_FOR); _from_cf = msk.get_long(FLD_FROM_FOR);
@ -800,6 +799,7 @@ bool TLista_fatture::set_print(int m)
// Ripristina la ditta // Ripristina la ditta
pref.set_codditta(save_firm); pref.set_codditta(save_firm);
msk.reset();
} }
return FALSE; return FALSE;
} }

View File

@ -57,7 +57,7 @@ bool TLiquidazione_app::recalc_all()
_nditte->curr().put("CODDITTA",nomeditta.get_long(1)); _nditte->curr().put("CODDITTA",nomeditta.get_long(1));
_nditte->read(); _nditte->read();
_freqviva = nomeditta.get(3); _freqviva = nomeditta.get(3);
bool mens = _freqviva == "M"; bool mens = _freqviva == "M";
// determina attivita' prevalente e istanzia cazzuole // determina attivita' prevalente e istanzia cazzuole
// per vedere che Kazzo di liquidazione calcolare // per vedere che Kazzo di liquidazione calcolare
@ -103,8 +103,8 @@ bool TLiquidazione_app::recalc_all()
} }
if (need_refresh && yesno_box("Alcuni mesi precedenti non " if (need_refresh && yesno_box("Alcuni mesi precedenti non "
"risultano ricalcolati. E' consigliabile il ricalcolo. " "risultano ricalcolati. E' consigliabile il ricalcolo. "
"Si desidera eseguirlo?")) "Si desidera eseguirlo?"))
_recalc = ever; _recalc = ever;
} }
@ -186,7 +186,6 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
TToken_string atts; TToken_string atts;
TToken_string cattivs; TToken_string cattivs;
// casini per stampa minchie in coda ai registri // casini per stampa minchie in coda ai registri
bool riepliq = _isregis ? _riepilogo : FALSE; bool riepliq = _isregis ? _riepilogo : FALSE;
bool stliq = TRUE; bool stliq = TRUE;
@ -228,7 +227,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
for (int tipoatt = 1; tipoatt <= (_mixed ? 2 : 1); tipoatt++) for (int tipoatt = 1; tipoatt <= (_mixed ? 2 : 1); tipoatt++)
{ {
TString cattiv(codatt); bool waspla; TString8 cattiv(codatt); bool waspla;
cattiv << tipoatt; cattiv << tipoatt;
if (tipoatt == 1 && (waspla = look_pla(cattiv, FALSE))) if (tipoatt == 1 && (waspla = look_pla(cattiv, FALSE)))
@ -421,8 +420,6 @@ bool TLiquidazione_app::update_att(int month, const char* codatt,
// saranno solo quelli di dicembre per data <= 20/12; // saranno solo quelli di dicembre per data <= 20/12;
// il ricalcolo e' FORZATO da _recalc messo a one // il ricalcolo e' FORZATO da _recalc messo a one
{ {
look_plm(month, codatt, TRUE); look_plm(month, codatt, TRUE);
bool ok = _plm->get_bool("B0"); bool ok = _plm->get_bool("B0");
if (_recalc_regis) if (_recalc_regis)
@ -561,9 +558,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
real esenti_b4 = 0.0; real esenti_b4 = 0.0;
real esenti_b14 = 0.0; real esenti_b14 = 0.0;
real vendite_vp1 = 0.0; real vendite_vp1 = 0.0;
real vendite_vp2 = 0.0; real vendite_vp1a = 0.0;
real acquisti_vp2 = 0.0;
real acquisti_vp2a = 0.0;
real acquisti_vp3 = 0.0; real acquisti_vp3 = 0.0;
real acquisti_vp4 = 0.0; real imposta_vp3 = 0.0;
real esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso real esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso
real corr_CEE = 0.0; real corr_CEE = 0.0;
real corr_noCEE = 0.0; real corr_noCEE = 0.0;
@ -647,7 +646,9 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
// non viene applicato lo stesso metodo delle ditte normali perche' si deve // non viene applicato lo stesso metodo delle ditte normali perche' si deve
// tenere conto della DATA74TER se presente. // tenere conto della DATA74TER se presente.
if (!_isviaggio) if (!_isviaggio)
{
f.set_month(month == 13 ? 1 : month); f.set_month(month == 13 ? 1 : month);
}
if (year_int < 1998 || _recalc_regis) // Vecchia selezione o calcolo progoressivi per stampa registri bollati if (year_int < 1998 || _recalc_regis) // Vecchia selezione o calcolo progoressivi per stampa registri bollati
{ {
@ -664,25 +665,26 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
from.put(MOV_DATAREG, f); from.put(MOV_DATAREG, f);
to.put(MOV_DATAREG, t); to.put(MOV_DATAREG, t);
_cur->freeze(FALSE);
_cur->setregion(from, to); _cur->setregion(from, to);
const long items = _cur->items();
_cur->freeze();
*_cur = 0; *_cur = 0;
long items = _cur->items();
TString trueatt(codatt); TString trueatt(codatt);
int tipatt = atoi(trueatt.sub(5)); int tipatt = atoi(trueatt.sub(5));
//trueatt = trueatt.left(5); //trueatt = trueatt.left(5);
trueatt.cut(5); trueatt.cut(5);
#ifdef DBG
TString msgdbg;
long freespace;
#endif
for (; _cur->pos() < items; ++(*_cur)) for (; _cur->pos() < items; ++(*_cur))
{ {
if ((_cur->pos() & 0x7F) == 0) if ((_cur->pos() & 0x7F) == 0)
{ {
#ifdef DBG #ifdef DBG
TString msgdbg;
long freespace;
msgdbg.format("Ricalcolo attivita': %ld/%ld",_cur->pos(),items); msgdbg.format("Ricalcolo attivita': %ld/%ld",_cur->pos(),items);
freespace = os_get_free_memory(); freespace = os_get_free_memory();
msgdbg << " Memoria libera: " << freespace/1024 << " Kbytes."; msgdbg << " Memoria libera: " << freespace/1024 << " Kbytes.";
@ -692,12 +694,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
} }
TDate date(_mov->get(MOV_DATAREG)); TDate date(_mov->get(MOV_DATAREG));
const int liqmonth = _mov->get_int(MOV_MESELIQ); const int liqmonth = _mov->get_int(MOV_MESELIQ);
TString16 reg = _mov->get("REG"); const TString8 reg = _mov->get("REG");
bool isreg = look_reg(_mov->get("REG")); const bool isreg = look_reg(_mov->get("REG"));
TString16 tipodoc = _mov->get(MOV_TIPODOC); const TString8 tipodoc = _mov->get(MOV_TIPODOC);
bool corrisp = _reg->get_bool("B0"); const bool corrisp = _reg->get_bool("B0");
tiporeg tipomov = (tiporeg)_reg->get_long("I0"); const tiporeg tipomov = (tiporeg)_reg->get_long("I0");
// Controlla se la data del documento si riferisce all'anno precedente (PRORATA 1998) // Controlla se la data del documento si riferisce all'anno precedente (PRORATA 1998)
TDate datedoc(_mov->get(MOV_DATADOC)); TDate datedoc(_mov->get(MOV_DATADOC));
@ -765,18 +767,18 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
real nin_imp = 0.0; // imponibile non incassati real nin_imp = 0.0; // imponibile non incassati
real nin_iva = 0.0; // imposta non incassati real nin_iva = 0.0; // imposta non incassati
TString16 codiva = _iva->get("CODTAB"); TString8 codiva = _iva->get("CODTAB");
TString16 tipoiva = _iva->get("S1"); TString8 tipoiva = _iva->get("S1");
TString16 tipoes_v = _iva->get("S2"); TString8 tipoes_v = _iva->get("S2");
TString16 tipoes_a = _iva->get("S9"); TString8 tipoes_a = _iva->get("S9");
TString16 iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11"); TString8 iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
int tipoagr = atoi(_iva->get("S4")); int tipoagr = atoi(_iva->get("S4"));
int tipoag = atoi(_iva->get("S5")); int tipoag = atoi(_iva->get("S5"));
int tipopla = atoi(_iva->get("S3")); int tipopla = atoi(_iva->get("S3"));
int tipodet = atoi(_rmoviva->get(RMI_TIPODET)); int tipodet = atoi(_rmoviva->get(RMI_TIPODET));
int isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI int isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI
int ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media int ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media
TString tipocr_s = _rmoviva->get(RMI_TIPOCR); TString8 tipocr_s = _rmoviva->get(RMI_TIPOCR);
int tipocr = atoi(tipocr_s); int tipocr = atoi(tipocr_s);
real imponibile = _rmoviva->get_real(RMI_IMPONIBILE); real imponibile = _rmoviva->get_real(RMI_IMPONIBILE);
const real imposta = _rmoviva->get_real(RMI_IMPOSTA); const real imposta = _rmoviva->get_real(RMI_IMPOSTA);
@ -814,18 +816,24 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
if (iva_vpn.not_empty() && !fattrit) if (iva_vpn.not_empty() && !fattrit)
switch (tipomov) switch (tipomov)
{ {
case vendita: // VP1 o VP2 case vendita: // VP1, VP1A
if (!corrisp) if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
sosp_imp != normale && sosp_imp != liquidazione)
{ {
vendite_vp1 += imponibile; vendite_vp1 += imponibile;
if (cau_valintra && iva_vpn == "VP2") if (cau_valintra && iva_vpn == "VP1A")
vendite_vp2 += imponibile; vendite_vp1a += imponibile;
} }
break; break;
case acquisto: // VP3 o VP4 case acquisto: // VP2, VP2A, VP3
acquisti_vp3 += imponibile; acquisti_vp2 += imponibile;
if (cau_intra && iva_vpn == "VP4") if (cau_intra && iva_vpn == "VP2A")
acquisti_vp4 += imponibile; acquisti_vp2a += imponibile;
if (iva_vpn == "VP3")
{
acquisti_vp3 += imponibile;
imposta_vp3 += imposta;
}
break; break;
default: default:
break; break;
@ -920,7 +928,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
{ {
ammort_6 += imponibile; ammort_6 += imponibile;
ammort_6_iva += imposta; ammort_6_iva += imposta;
ult_detr += imponibile * real(DETRAZIONE_6PERCENTO); // ult_detr += imponibile * real(DETRAZIONE_6PERCENTO); // CM500159
} }
else if (tipocr == 8) else if (tipocr == 8)
// Acquisto beni strum. acquisiti in leasing // Acquisto beni strum. acquisiti in leasing
@ -989,17 +997,20 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
{ {
if (tipomov == vendita) if (tipomov == vendita)
{ {
if (tipoes_v == "B1") if (sosp_imp != normale && sosp_imp != vol_affari) // CM500308
esenti_b1 += imponibile; {
else if (tipoes_v == "B2") if (tipoes_v == "B1")
esenti_b2 += imponibile; esenti_b1 += imponibile;
else if (tipoes_v == "B3") else if (tipoes_v == "B2")
esenti_b3 += imponibile; esenti_b2 += imponibile;
else if (tipoes_v == "B4") else if (tipoes_v == "B3")
esenti_b4 += imponibile; esenti_b3 += imponibile;
// se e' il caso sommare esenti per rimborso else if (tipoes_v == "B4")
if (isrimbinfr) esenti_b4 += imponibile;
esni_rimb += imponibile; // se e' il caso sommare esenti per rimborso
if (isrimbinfr)
esni_rimb += imponibile;
}
} }
else if (tipoes_a == "14") else if (tipoes_a == "14")
esenti_b14 += imponibile; esenti_b14 += imponibile;
@ -1511,7 +1522,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
} // for per tabelle } // for per tabelle
} }
while (_cur->next_match(LF_RMOVIVA)); while (_cur->next_match(LF_RMOVIVA));
} // fine calcolo progressivi IVA } // fine calcolo progressivi IVA
if (!_recalc_regis) if (!_recalc_regis)
@ -1722,9 +1733,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
_pum->put("R7", esenti_b14); _pum->put("R7", esenti_b14);
_pum->put("R12", esni_rimb); _pum->put("R12", esni_rimb);
_pum->put("R14", vendite_vp1); _pum->put("R14", vendite_vp1);
_pum->put("R15", vendite_vp2); _pum->put("R15", vendite_vp1a);
_pum->put("R16", acquisti_vp3); _pum->put("R16", acquisti_vp2);
_pum->put("R17", acquisti_vp4); _pum->put("R17", acquisti_vp2a);
_pum->put("R18", acquisti_vp3);
_pum->put("R19", imposta_vp3);
_pam->put("R0", acquisti); _pam->put("R0", acquisti);
_pam->put("R1", vendite); _pam->put("R1", vendite);
_pam->put("R6", assp_imp); _pam->put("R6", assp_imp);
@ -1771,7 +1784,6 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
const bool is_vendita = tipomov == vendita; const bool is_vendita = tipomov == vendita;
const bool is_acquisto = tipomov == acquisto; const bool is_acquisto = tipomov == acquisto;
const bool is_key = _iva11_arr.is_key(codatt); const bool is_key = _iva11_arr.is_key(codatt);
if (!is_key) // Aggiunge l'elemento se non c'e' if (!is_key) // Aggiunge l'elemento se non c'e'
_iva11_arr.add(codatt,(_Iva11Array*)new _Iva11Array,is_key); _iva11_arr.add(codatt,(_Iva11Array*)new _Iva11Array,is_key);
@ -2691,7 +2703,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
if (_isviaggio) if (_isviaggio)
{ {
// calcolo credito costo, debito mensile, perc. ripart. // calcolo credito costo, debito mensile, perc. ripart.
perc_r = (a_mCEE * CENTO)/(a_mCEE + a_meCEE); perc_r.round(2); perc_r = a_mCEE.is_zero() ? ZERO : (a_mCEE * CENTO)/(a_mCEE + a_meCEE); perc_r.round(2);
real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA); real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA);
real tc = (c_iCEE + ivm); real tc = (c_iCEE + ivm);
real ta = (a_iCEE + a_mCEE); real ta = (a_iCEE + a_mCEE);
@ -2701,7 +2713,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
// credito di costo // credito di costo
{ {
cred_cost = abs(bi); cred_cost = abs(bi);
cred_cost.round(ROUND_LIRA); if (atoi(_year) < 2000)
cred_cost.round(ROUND_LIRA);
else
round_mille_lire(cred_cost);
} }
else else
{ {
@ -2719,7 +2734,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
real perc; // percentuale di deducibilita' real perc; // percentuale di deducibilita'
real iva_ded; // iva deducibile real iva_ded; // iva deducibile
perc = imp_agr2 /(imp_agr1 + imp_agr2); perc = imp_agr2.is_zero() ? ZERO : imp_agr2 / (imp_agr1 + imp_agr2);
perc.round(2); perc.round(2);
iva_ded = acq_noCEE * perc; iva_ded = acq_noCEE * perc;
iva_ded.round(ROUND_LIRA); iva_ded.round(ROUND_LIRA);
@ -2869,7 +2884,14 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
_pla->rewrite(); _pla->rewrite();
if (look_lia(0l, TRUE)) if (look_lia(0l, TRUE))
{ {
_lia->put("R5", cred_cost); if (atoi(_year) >= 2000)
{
real cc = cred_cost;
round_mille_lire(cc);
_lia->put("R5", cc);
}
else
_lia->put("R5", cred_cost);
_lia->rewrite(); _lia->rewrite();
} }
_year = yr; _year = yr;
@ -2994,7 +3016,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|| (month == 13 && !(_isbenzinaro && _gest4)) )) || (month == 13 && !(_isbenzinaro && _gest4)) ))
{ {
const real interesse = interesse_trimestrale(_month); const real interesse = interesse_trimestrale(_month);
real ivi = risultato.sign() > 0 ? (risultato * interesse / CENTO) : ZERO; const real r = risultato - imposta_non_versata; // CM 26-09-2000
real ivi = r.sign() > 0 ? (r * interesse / CENTO) : ZERO;
ivi.ceil(ROUND_LIRA); ivi.ceil(ROUND_LIRA);
_lim->put("R14", ivi); _lim->put("R14", ivi);
} }

View File

@ -111,28 +111,32 @@ bool TLiquidazione_app::is_date_ok(const TDate& d, int month, int liqmonth, int
// selezionati. Vedi cg4301.cpp per maggiori informazioni // selezionati. Vedi cg4301.cpp per maggiori informazioni
// sul nuovo filtro di selezione movimenti. // sul nuovo filtro di selezione movimenti.
{ {
bool ok; bool ok;
if (year < 1998 || _recalc_regis) // Vecchia selezione o calcolo progressivi per stampa registri bollati if (year < 1998 || _recalc_regis) // Vecchia selezione o calcolo progressivi per stampa registri bollati
{ {
if (d.month() > month || d.year() != atoi(_year)) if (d.month() > month || d.year() != atoi(_year))
return FALSE; return ok = FALSE;
if (month == 13) if (month == 13)
ok = d.month() <= month; ok = d.month() <= month;
else else
ok = d.month() == month; {
if (_freqviva == "M") // Guy!!!
ok = d.month() == month;
else
ok = d.month() >= month-2 && d.month() <= month;
}
} }
else // Nuova selezione dal 1998 in poi else // Nuova selezione dal 1998 in poi
{ {
const int regmonth = d.month(); const int regmonth = d.month();
const int regyear = d.year(); const int regyear = d.year();
if (month <= 12) if (month <= 12)
ok = (regmonth == month && liqmonth == 0) || (liqmonth == month); ok = (regmonth == month && liqmonth == 0) || (liqmonth == month);
else // Annuale, month == 13 else // Annuale, month == 13
ok = (regyear == year && liqmonth != 12) || (regyear == year + 1 && liqmonth == 12); ok = (regyear == year && liqmonth != 12) || (regyear == year + 1 && liqmonth == 12);
} }
return ok; return ok;
} }
@ -519,8 +523,10 @@ bool TLiquidazione_app::look_lam(int m, bool create)
bool TLiquidazione_app::look_pla(const char* a, bool create) bool TLiquidazione_app::look_pla(const char* a, bool create)
{ {
_pla_r->zero();
// forza il tipoatt a 1 // forza il tipoatt a 1
TString buf(a); TString16 buf(a);
buf.ltrim(); buf.ltrim();
buf.rtrim(1); buf.rtrim(1);
buf << "1"; buf << "1";

View File

@ -107,7 +107,7 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
// Aggiorna il totale IVA periodica VP1 // Aggiorna il totale IVA periodica VP1
if (look_iva(ci->_codiva)) if (look_iva(ci->_codiva))
{ {
if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP2 lo consideriamo in VP1 if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP1A lo consideriamo in VP1
{ {
real vp1 = _pum->get_real("R14"); real vp1 = _pum->get_real("R14");
vp1 += imponibile; vp1 += imponibile;
@ -348,7 +348,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
// Aggiorna il totale IVA periodica VP1 // Aggiorna il totale IVA periodica VP1
if (look_iva(vv->_codiva)) if (look_iva(vv->_codiva))
{ {
if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP2 lo consideriamo in VP1 if (_iva->get("S10").not_empty()) // Solo VP1 ha senso coi corrispettivi... se c'è VP1A lo consideriamo in VP1
{ {
real vp1 = _pum->get_real("R14"); real vp1 = _pum->get_real("R14");
vp1 += imponibile; vp1 += imponibile;
@ -409,7 +409,7 @@ void TLiquidazione_app::recalc_viaggio(int month, const char* codatt)
a_mfCEE += _plm->get_real("R11"); // acquisti misti parte fuori CEE a_mfCEE += _plm->get_real("R11"); // acquisti misti parte fuori CEE
} }
// calcolo debito mensile da aggiornare su tabella POM // calcolo debito mensile da aggiornare su tabella POM
real perc_r = (a_mCEE * CENTO)/(a_mCEE + a_mfCEE); perc_r.round(2); real perc_r = a_mCEE.is_zero() ? ZERO : (a_mCEE * CENTO)/(a_mCEE + a_mfCEE); perc_r.round(2);
real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA); real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA);
real tc = (c_CEE + ivm); real tc = (c_CEE + ivm);
real ta = (a_CEE + a_mCEE); real ta = (a_CEE + a_mCEE);

View File

@ -15,11 +15,11 @@
class _vDesc : public TObject class _vDesc : public TObject
{ {
public: public:
TString _codiva; TString4 _codiva;
real _acq; real _acq;
real _vnd; real _vnd;
real _viv; real _viv;
_vDesc() : _codiva(5) {} _vDesc() {}
virtual ~_vDesc() {} virtual ~_vDesc() {}
}; };
@ -425,7 +425,7 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
d->_r8 = credito_costo_prec(month); d->_r8 = credito_costo_prec(month);
// Solita minchiatina dell'arrotondamento alle 1000 lirette se siamo in annuale // Solita minchiatina dell'arrotondamento alle 1000 lirette se siamo in annuale
if (month == 13) if (month == 13 || atoi(_year) >= 2000) // CM500314 e CM500315
{ {
round_mille_lire(d->_r0); round_mille_lire(d->_r0);
round_mille_lire(d->_r1); round_mille_lire(d->_r1);
@ -437,7 +437,7 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
round_mille_lire(d->_r8); round_mille_lire(d->_r8);
} }
d->_r7 = (d->_r4 * CENTO)/(d->_r4 + d->_r6); d->_r7.round(2); // percentuale d->_r7 = d->_r4.is_zero() ? ZERO : (d->_r4 * CENTO)/(d->_r4 + d->_r6); d->_r7.round(2); // percentuale
d->_r9 = (d->_r1 * d->_r7)/CENTO; d->_r9 = (d->_r1 * d->_r7)/CENTO;
if (month==13) if (month==13)
@ -649,8 +649,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
// Giochiamo sopra la particolarita' che se non e' un registro di corrispettivi // Giochiamo sopra la particolarita' che se non e' un registro di corrispettivi
// allora se R5 o R6 sono <> 0 significa che trattasi di documento FS, // allora se R5 o R6 sono <> 0 significa che trattasi di documento FS,
// che pertanto va stornato dal totale corrispettivi. (Cosi' volle Vladimiro) // che pertanto va stornato dal totale corrispettivi. (Cosi' volle Vladimiro)
real ifs(tab->get_real("R5")); // imp. fatture con scontrino const real ifs(tab->get_real("R5")); // imp. fatture con scontrino
real vfs(tab->get_real("R6")); // iva fatture con scontrino const real vfs(tab->get_real("R6")); // iva fatture con scontrino
if (!corrisp) if (!corrisp)
{ {
if (sosp_imp != vol_affari) if (sosp_imp != vol_affari)
@ -667,7 +667,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
} }
} }
if (corrisp) if (corrisp)
{ {
cvi -= cfi; cvi -= cfi;
@ -834,7 +833,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
{ {
d->_r11 = rt0; d->_r12 = rt1; d->_r11 = rt0; d->_r12 = rt1;
d->_r13 = rt2; d->_r14 = rt3; d->_r13 = rt2; d->_r14 = rt3;
d->_s2 = rt4.string(); d->_s3 = rt5.string(); d->_s2 = rt4.string(); d->_s3 = rt5.string();
} }
// aggiunge dati ptm // aggiunge dati ptm
@ -947,6 +946,14 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
} // while (attivita') } // while (attivita')
} // for (mese ok) } // for (mese ok)
// Cazzata orrenda ma necessaria CM500308
if (issosp)
{
rt4 += d->_r7; rt5 += d->_r8; // Det 1
rt4 += d->_r9; rt5 += d->_r10; // Det 3
rt4 += real(d->_s0); rt5 += real(d->_s1); // Det 9
d->_s2 = rt4.string(); d->_s3 = rt5.string();
}
// annual follows in _arr // annual follows in _arr
if (month == 13 && ref != "ALL") if (month == 13 && ref != "ALL")
@ -956,7 +963,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
if (look_pla(codatt)) if (look_pla(codatt))
{ {
real v1 = _pla->get_real("R14"); real v1 = _pla->get_real("R14");
real v2(_pla->get("S1")); real v2 = _pla->get_real("S1");
real ris = v1 + v2; real ris = v1 + v2;
real e1 = _pla->get_real("R1"); real e1 = _pla->get_real("R1");
real e2 = _pla->get_real("R2"); real e2 = _pla->get_real("R2");
@ -987,7 +994,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
//if (pr != _prorata.current()) //if (pr != _prorata.current())
{ {
// calcolo conguaglio -- se positivo e' a debito // calcolo conguaglio -- se positivo e' a debito
if (pr > 0.0) if (pr > ZERO)
{ {
topay = (iaq + ppg) * (pr / CENTO); topay = (iaq + ppg) * (pr / CENTO);
round_mille_lire(topay); round_mille_lire(topay);
@ -1009,7 +1016,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
dd->_f0 |= IS_PRORATA; dd->_f0 |= IS_PRORATA;
dd->_r0 = ris; dd->_r0 = ris;
dd->_r1 = e1; dd->_r1 = e1;
dd->_r2 = pr > 0.0 ? pr : 0.0 ; dd->_r2 = pr > ZERO ? pr : ZERO ;
dd->_r3 = co; dd->_r3 = co;
dd->_r4 = e2; dd->_r4 = e2;
dd->_r5 = e3; dd->_r5 = e3;
@ -1221,7 +1228,7 @@ void TLiquidazione_app::set_firm(_DescrItem& d)
int soh = 1; int soh = 1;
if (!_isregis) if (!_isregis)
{ {
set_header(soh++,"Ditta %s %s@109gData @<@125gPag. @#", set_header(soh++,"Ditta %s %s@107gData @>@125gPag. @#",
(const char*)(d._s0), (const char*)(d._s1)); (const char*)(d._s0), (const char*)(d._s1));
set_header(soh++,""); set_header(soh++,"");
} }
@ -1302,7 +1309,7 @@ void TLiquidazione_app::set_att(_DescrItem& d)
int soh = 1; int soh = 1;
if (!_isregis) if (!_isregis)
{ {
set_header(soh++,"Ditta %s %s@109gData @<@125gPag. @#", set_header(soh++,"Ditta %s %s@107gData @>@125gPag. @#",
(const char*)(d._s0), (const char*)(d._s1)); (const char*)(d._s0), (const char*)(d._s1));
set_header(soh++,""); set_header(soh++,"");
} }
@ -1665,12 +1672,9 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
if (!(d._r2.is_zero() && d._r3.is_zero())) if (!(d._r2.is_zero() && d._r3.is_zero()))
{ {
printed = TRUE; printed = TRUE;
real rn = d._r2 * real(DETRAZIONE_6PERCENTO); // real rn = d._r2 * real(DETRAZIONE_6PERCENTO); // Detrazione obsoleta CM500344
set_row(row++, "Acquisto beni soggetti a detrazione (6%%)" set_row(row++, "Acquisto beni soggetti a detrazione (6%%)"
"@50g%r@69g%r@86g%r", "@50g%r@69g%r", &(d._r2), &(d._r3));
&(d._r2),
&(d._r3),
&rn);
} }
if (!(spgn.is_zero() && spgn_iva.is_zero())) if (!(spgn.is_zero() && spgn_iva.is_zero()))
{ {
@ -1984,8 +1988,11 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
if (debt_prec > ZERO) if (debt_prec > ZERO)
set_row(rw++,"@11gDebito o credito da liquidazione precedente@75g%r", &debt_prec); set_row(rw++,"@11gDebito o credito da liquidazione precedente@75g%r", &debt_prec);
else else
{
cred_prec -= rimborso;
if (cred_prec > ZERO) if (cred_prec > ZERO)
set_row(rw++,"@11gDebito o credito da liquidazione precedente@58g%r", &cred_prec); set_row(rw++,"@11gDebito o credito da liquidazione precedente@58g%r", &cred_prec);
}
set_row(rw++,"%s@11gRimborsi%s@75g%r", set_row(rw++,"%s@11gRimborsi%s@75g%r",
_is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rimborso); _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rimborso);
set_row(rw++,"@11gCredito IVA compensabile detratto@58g%r", &credito_utilizzato_iva); set_row(rw++,"@11gCredito IVA compensabile detratto@58g%r", &credito_utilizzato_iva);
@ -1995,15 +2002,6 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw)
print_importo(rw++, "IVA dovuta o a credito per il periodo", cre_deb_per); print_importo(rw++, "IVA dovuta o a credito per il periodo", cre_deb_per);
#ifdef DBG
TRACE("Risultato = %s +", risultato.string("###.###.###.###"));
TRACE("Crediti speciali = %s +", crediti_speciali.string("###.###.###.###"));
TRACE("Accantonamenti = %s +", acc_dec.string("###.###.###.###"));
TRACE("Versamenti = %s +", versamenti.string("###.###.###.###"));
TRACE("Vers int = %s +", vers_int.string("###.###.###.###"));
TRACE("IVA dov o cre = %s\n", cre_deb_per.string("###.###.###.###"));
#endif
if (crediti_speciali != ZERO || _is_visliq) if (crediti_speciali != ZERO || _is_visliq)
set_row(rw++,"%s@11gCrediti speciali%s@58g%r", set_row(rw++,"%s@11gCrediti speciali%s@58g%r",
_is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &crediti_speciali); _is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &crediti_speciali);
@ -2272,18 +2270,19 @@ bool TLiquidazione_app::set_annual(_DescrItem& d)
set_row(row++,""); set_row(row++,"");
if (year_int > 1997) if (year_int > 1997)
{ {
const real perc_det = CENTO - d._r2; const real perc_det = CENTO - d._r2;
const TString s(perc_det.string()); const TString16 s1 = perc_det.string();
const TString16 s2 = d._r2.string();
set_row(row++, "%% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r", set_row(row++, "%% PRO-RATA (%s%%) ed IVA non detraibile (%s%%)@69g%r",
(const char*) s, (const char*)(d._r2.string()), &(d._r6)); (const char*)s1, (const char*)s2, &(d._r6));
set_row(row++,"C1 - Operazioni esenti escluse da nr. 1 a 9 e 11 art. 10 @69g%r", &(d._r1)); set_row(row++,"C1 - Operazioni esenti escluse da nr. 1 a 9 e 11 art. 10 @69g%r", &(d._r1));
set_row(row++,"C2 - Operazioni esenti di cui nr. 11 art. 10 @69g%r", &(d._r4)); 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++,"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++,"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++,"@6gdi cui cessione beni ammortizzabili");
set_row(row++,"Volume d'affari @69g%r", &(d._r0)); set_row(row++,"Volume d'affari @69g%r", &(d._r0));
set_row(row++,"Detraibilita' @69g%r%%", &(perc_det)); set_row(row++,"Detraibilita' @69g%r%%", &perc_det);
} }
else else
{ {
@ -2293,7 +2292,7 @@ bool TLiquidazione_app::set_annual(_DescrItem& d)
set_row(row++,"B2 - Operazioni esenti, di cui nr. 11 art. 10 @69g%r", &(d._r4)); set_row(row++,"B2 - Operazioni esenti, di cui nr. 11 art. 10 @69g%r", &(d._r4));
set_row(row++,"B3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r", &(d._r5)); set_row(row++,"B3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r", &(d._r5));
set_row(row++,"Volume d'affari - B3 @69g%r", &(d._r0)); set_row(row++,"Volume d'affari - B3 @69g%r", &(d._r0));
set_row(row++,"Indetraibilita'@69g%r%%", &(d._r2)); set_row(row++,"Indetraibilita'@69g%r%%", &(d._r2));
} }
/* Prorata delle mie brame... /* Prorata delle mie brame...
* chi e' il piu' sfatto del reame ? * chi e' il piu' sfatto del reame ?
@ -2699,7 +2698,7 @@ void TLiquidazione_app::set_acconto_p(_DescrItem& d)
void TLiquidazione_app::set_acchead_p(_DescrItem& d) void TLiquidazione_app::set_acchead_p(_DescrItem& d)
{ {
reset_header(); reset_header();
set_header(1,"Gestione IVA@109gData @<@125gPag. @#"); set_header(1,"Gestione IVA@107gData @>@125gPag. @#");
set_header(3,sep); set_header(3,sep);
if (d._f0) // base anno in corso if (d._f0) // base anno in corso
@ -2749,7 +2748,7 @@ void TLiquidazione_app::set_deltab(_DescrItem& d, bool iscred)
if (iscred) if (iscred)
{ {
// set header // set header
set_header(1,"ELENCO DITTE A CREDITO@30g%s %s@109gData @<@125gPag. @#", set_header(1,"ELENCO DITTE A CREDITO@30g%s %s@107gData @>@125gPag. @#",
d._f0 == 13 ? "Annuale " : itom(d._f0), (const char*)_year); d._f0 == 13 ? "Annuale " : itom(d._f0), (const char*)_year);
set_header(2,sep); set_header(2,sep);
set_header(3,"@40gF@60gImporto a"); set_header(3,"@40gF@60gImporto a");
@ -2779,7 +2778,7 @@ void TLiquidazione_app::set_deltab(_DescrItem& d, bool iscred)
else else
{ {
// set header // set header
set_header(1,"ELENCO DITTE A DEBITO@30g%s %s@109gData @<@125gPag. @#", set_header(1,"ELENCO DITTE A DEBITO@30g%s %s@107gData @>@125gPag. @#",
d._f0 == 13 ? "Annuale " : itom(d._f0), (const char*)_year); d._f0 == 13 ? "Annuale " : itom(d._f0), (const char*)_year);
set_header(2,sep); set_header(2,sep);
set_header(3,"@40gF@60gImporto da@73gCodice@83gCod."); set_header(3,"@40gF@60gImporto da@73gCodice@83gCod.");

View File

@ -4,6 +4,7 @@
// Nemico ed Oscuro Messo di Malvagita'... // Nemico ed Oscuro Messo di Malvagita'...
#include <currency.h> #include <currency.h>
#include <os_dep.h> #include <os_dep.h>
#include <recarray.h>
#include "cg4.h" #include "cg4.h"
#include "cg4400.h" #include "cg4400.h"
@ -39,7 +40,7 @@ inline TStampa_registri_app& app() { return (TStampa_registri_app&)main_app(); }
bool TStampa_registri_app::filter_func (const TRelation * r) bool TStampa_registri_app::filter_func (const TRelation * r)
{ {
TLocalisamfile& mov = r->lfile(LF_MOV); const TRectype& mov = r->curr(LF_MOV);
TString16 codreg = mov.get(MOV_REG); TString16 codreg = mov.get(MOV_REG);
TDate datareg = mov.get_date(MOV_DATAREG); TDate datareg = mov.get_date(MOV_DATAREG);
int annoiva = mov.get_int(MOV_ANNOIVA); int annoiva = mov.get_int(MOV_ANNOIVA);
@ -155,11 +156,12 @@ const char* TStampa_registri_app::desc_attivita(const TString& cod)
attiv.put("CODATT", cod); attiv.put("CODATT", cod);
if (attiv.read() == NOERR) if (attiv.read() == NOERR)
TMP = attiv.get("DESCR"); TMP = attiv.get("DESCR");
else TMP = ""; else
TMP = "";
return TMP; return TMP;
} }
TRectype& TStampa_registri_app::ricerca_cf(char tipocf, long codcf) const TRectype& TStampa_registri_app::ricerca_cf(char tipocf, long codcf)
{ {
_clifo->zero(); _clifo->zero();
_clifo->put(CLI_TIPOCF, tipocf); _clifo->put(CLI_TIPOCF, tipocf);
@ -167,43 +169,44 @@ TRectype& TStampa_registri_app::ricerca_cf(char tipocf, long codcf)
_clifo->read(); _clifo->read();
if (_clifo->bad()) if (_clifo->bad())
_clifo->zero(); _clifo->zero();
return _clifo->curr(); return _clifo->curr();
} }
TRectype& TStampa_registri_app::ricerca_occ(const char * occ) const TRectype& TStampa_registri_app::ricerca_occ(const char* occ)
{ {
/*
TLocalisamfile occas (LF_OCCAS); TLocalisamfile occas (LF_OCCAS);
occas.zero(); occas.zero();
occas.put(OCC_CFPI, occ); occas.put(OCC_CFPI, occ);
occas.read(); occas.read();
if (occas.bad()) if (occas.bad())
occas.zero(); occas.zero();
return occas.curr(); return occas.curr();
*/
return cache().get(LF_OCCAS, occ);
} }
TRectype& TStampa_registri_app::look_comuni (const TString& stato, const TString& cod) const TRectype& TStampa_registri_app::look_comuni(const TString& stato, const TString& cod)
{ {
/*
_com->zero(); _com->zero();
_com->put(COM_STATO, stato); _com->put(COM_STATO, stato);
_com->put(COM_COM, cod); _com->put(COM_COM, cod);
_com->read(); _com->read();
if (_com->bad()) if (_com->bad())
_com->zero(); _com->zero();
return _com->curr(); return _com->curr();
*/
TString16 key;
key << stato << '|' << cod;
return cache().get(LF_COMUNI, key);
} }
TRectype& TStampa_registri_app::look_comuni (const char* cod) const TRectype& TStampa_registri_app::look_comuni (const char* cod)
{ {
_com->zero(); const TString16 stato;
_com->put(COM_COM, cod); const TString16 comune = cod;
_com->read(); return look_comuni(stato, comune);
if (_com->bad())
_com->zero();
return _com->curr();
} }
void TStampa_registri_app::get_dati_ditta() void TStampa_registri_app::get_dati_ditta()
@ -234,15 +237,17 @@ void TStampa_registri_app::get_dati_ditta()
_cofi = anag.get(ANA_COFI); _cofi = anag.get(ANA_COFI);
_paiva = anag.get(ANA_PAIV); _paiva = anag.get(ANA_PAIV);
_comunefis = anag.get(ANA_COMRF); _comunefis = anag.get(ANA_COMRF);
_cap = anag.get(ANA_CAPRF);
if (_comunefis.empty()) if (_comunefis.empty())
_comunefis = anag.get(ANA_COMRES); _comunefis = anag.get(ANA_COMRES);
if (_cap.empty())
_cap = anag.get(ANA_CAPRES);
TRectype dep = look_comuni (_comunefis); const TRectype& dep = look_comuni (_comunefis);
_comunefis = dep.get(COM_DENCOM); _comunefis = dep.get(COM_DENCOM);
_provfis = dep.get(COM_PROVCOM); _provfis = dep.get(COM_PROVCOM);
_cap = dep.get(COM_CAPCOM);
if (_comunefis.empty()) if (_comunefis.empty())
{ {
_viafis = anag.get(ANA_INDRF); _viafis = anag.get(ANA_INDRF);
@ -253,7 +258,7 @@ void TStampa_registri_app::get_dati_ditta()
{ {
_viafis = anag.get(ANA_INDRES); _viafis = anag.get(ANA_INDRES);
_viafis.rtrim(); _viafis.rtrim();
_viafis << " " << anag.get (ANA_CIVRES); _viafis << ' ' << anag.get (ANA_CIVRES);
} }
if (_cod_un_loc) if (_cod_un_loc)
@ -264,13 +269,13 @@ void TStampa_registri_app::get_dati_ditta()
unloc.read(); unloc.read();
if (unloc.read() == NOERR) if (unloc.read() == NOERR)
{ {
TRectype & dep =look_comuni (unloc.get(ULC_COMULC)); const TRectype & dep =look_comuni (unloc.get(ULC_COMULC));
_comunefis = dep.get(COM_DENCOM); _comunefis = dep.get(COM_DENCOM);
_provfis = dep.get(COM_PROVCOM); _provfis = dep.get(COM_PROVCOM);
_cap = dep.get(COM_CAPCOM); _cap = unloc.get(ULC_CAPULC);
_viafis = unloc.get(ULC_INDULC); _viafis = unloc.get(ULC_INDULC);
_viafis.rtrim(); _viafis.rtrim();
_viafis << " " << unloc.get(ULC_CIVULC); _viafis << ' ' << unloc.get(ULC_CIVULC);
} }
} }
} }
@ -434,13 +439,12 @@ bool TStampa_registri_app::compila_reg(const TMask& m)
} }
if (_tipo_stampa == rif_giornale) //stampa con riferimenti al libro giornale if (_tipo_stampa == rif_giornale) //stampa con riferimenti al libro giornale
{ {
TString16 datas; TDate datas;
bool good; bool good;
bool ok = cerca_libro_gio(datas,&good); bool found = cerca_libro_gio(datas, good);
if (!ok) if (!found || !good)
{ {
if (!good) warning_box ("Ditta %ld: la data indicata non deve essere superiore al %s (ultima data di stampa del libro giornale)", _ditta, (const char*)datas.string());
warning_box ("Ditta %ld: la data indicata non deve essere superiore al %s (ultima data di stampa del libro giornale)", _ditta, (const char*)datas);
return FALSE; return FALSE;
} }
} }
@ -487,16 +491,19 @@ bool TStampa_registri_app::compila_lib()
return FALSE; return FALSE;
} }
bool TStampa_registri_app::cerca_libro_gio(TString& datas, bool* good) bool TStampa_registri_app::cerca_libro_gio(TDate& datas, bool& good)
{ {
/*
TString app(4); TString app(4);
app.format("%04d", _annoes); app.format("%04d", _annoes);
*good = TRUE; good = FALSE;
TRecnotype rec = _tabreg->recno(); bool found = FALSE;
const TRecnotype rec = _tabreg->recno();
_tabreg->zero(); _tabreg->zero();
_tabreg->put ("CODTAB", app); _tabreg->put ("CODTAB", app);
TRectype r (_tabreg->curr()); const TRectype r (_tabreg->curr());
_tabreg->read(_isgteq); _tabreg->read(_isgteq);
for (; !_tabreg->eof(); _tabreg->next()) for (; !_tabreg->eof(); _tabreg->next())
{ {
@ -505,19 +512,35 @@ bool TStampa_registri_app::cerca_libro_gio(TString& datas, bool* good)
tiporeg tipo_reg = (tiporeg)_tabreg->get_int("I0"); tiporeg tipo_reg = (tiporeg)_tabreg->get_int("I0");
if (tipo_reg == giornale) //libro giornale if (tipo_reg == giornale) //libro giornale
{ {
const TDate& data = _tabreg->get_date("D3"); datas = _tabreg->get_date("D3"); // Data ultima stampa
if (data < _data_a) // if (datas < _data_a)
{ if (datas.month() < _data_a.month()) // CM000027
datas = data; good = FALSE;
*good = FALSE; else
return FALSE; good = TRUE;
} found = TRUE;
_tabreg->readat(rec);
return TRUE;
} }
} }
_tabreg->readat(rec); _tabreg->readat(rec);
return FALSE; return found;
*/
TRelation reg("REG");
TRectype& curr = reg.curr();
TString16 filter;
filter.format("%04d", _annoes);
curr.put("CODTAB", filter);
filter.format("I0=%d", giornale);
TCursor cur(&reg, filter, 1, &curr, &curr);
const bool found = cur.items() > 0;
good = FALSE;
if (found)
{
cur = 0L;
datas = curr.get_date("D3"); // Data ultima stampa
// good = datas >= _data_a;
good = datas.month() >= _data_a.month(); // CM000027
}
return found;
} }
bool TStampa_registri_app::is_mese_ok(int x, int month) bool TStampa_registri_app::is_mese_ok(int x, int month)
@ -548,10 +571,9 @@ bool TStampa_registri_app::mask_azzera (TMask_field& f, KEY k)
bool TStampa_registri_app::mask_tipo_stampa(TMask_field& f, KEY k) bool TStampa_registri_app::mask_tipo_stampa(TMask_field& f, KEY k)
{ {
TMask& m = f.mask();
if (k == K_SPACE) if (k == K_SPACE)
{ {
TMask& m = f.mask();
int tipo_stampa = m.get_int(TIPO_STAMPA); int tipo_stampa = m.get_int(TIPO_STAMPA);
if (tipo_stampa == 3) //stampa su libro unico if (tipo_stampa == 3) //stampa su libro unico
{ {
@ -1198,19 +1220,19 @@ int TStampa_registri_app::riga_rmoviva()
const int mese_liq = _cur->file(LF_MOV).get_int(MOV_MESELIQ); const int mese_liq = _cur->file(LF_MOV).get_int(MOV_MESELIQ);
int nrec = 0; int nrec = 0;
TRecnotype nr = rmoviva.recno(); const TRecnotype nr = rmoviva.recno();
while (ok) while (ok)
{ {
nrec++; nrec++;
TRectype iva (rmoviva.curr()); const TRectype& iva = rmoviva.curr();
tipodet = iva.get_int (RMI_TIPODET); tipodet = iva.get_int(RMI_TIPODET);
tipocr = iva.get_int (RMI_TIPOCR); tipocr = iva.get_int(RMI_TIPOCR);
impo = iva.get_real(RMI_IMPONIBILE); impo = iva.get_real(RMI_IMPONIBILE);
impos = iva.get_real(RMI_IMPOSTA); impos = iva.get_real(RMI_IMPOSTA);
codiva = iva.get(RMI_CODIVA); codiva = iva.get(RMI_CODIVA);
intra = iva.get_bool(RMI_INTRA); intra = iva.get_bool(RMI_INTRA);
tipoatt = iva.get_int("TIPOATT"); tipoatt = iva.get_int(RMI_TIPOATT);
_riga_rmi.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,tipocr,intra,tipoatt); _riga_rmi.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,tipocr,intra,tipoatt);
@ -1382,7 +1404,7 @@ bool TStampa_registri_app::controlla_mov()
TRecnotype rec = _tabreg->recno(); TRecnotype rec = _tabreg->recno();
for (mov.first(); !mov.eof(); mov.next()) for (mov.first(); !mov.eof(); mov.next())
{ {
TString16 reg = mov.get(MOV_REG); const TString16 reg = mov.get(MOV_REG);
if (reg.empty()) continue; //non e' un movimento iva if (reg.empty()) continue; //non e' un movimento iva
TDate datareg = mov.get_date(MOV_DATAREG); TDate datareg = mov.get_date(MOV_DATAREG);
if (_stampa_tutti_i_registri) if (_stampa_tutti_i_registri)
@ -1417,20 +1439,15 @@ tiporeg TStampa_registri_app::cerca_reg(const TString& c)
return t; return t;
} }
/*
bool TStampa_registri_app::ventilazione(const char* iva) bool TStampa_registri_app::ventilazione(const char* iva)
{ {
TTable tabiva ("%IVA"); const TString16 chiave = iva;
TString16 chiave = ""; const TRectype& rec = cache().get("%IVA", chiave);
chiave << iva; const TString& vent = rec.get("S1");
tabiva.put("CODTAB", chiave); return vent == "VE";
if (tabiva.read()==NOERR)
{
TString16 vent = tabiva.get("S1");
if (vent == "VE")
return TRUE;
}
return FALSE;
} }
*/
int TStampa_registri_app::stampa_prospetto(int rr, bool print_prec) int TStampa_registri_app::stampa_prospetto(int rr, bool print_prec)
{ {
@ -2081,11 +2098,8 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
if (_tipo_stampa != libro_unico && _liquidazione) if (_tipo_stampa != libro_unico && _liquidazione)
{ {
int da; const int da = (_tipo_stampa == prova) ? _data_da.month() : 1;
if (_tipo_stampa == prova) const int a = _datareg.month();
da = _data_da.month();
else da = 1;
int a = _datareg.month();
for (int m = da; m < a; m++) for (int m = da; m < a; m++)
{ {
if (!_st_liq[m]) if (!_st_liq[m])
@ -2201,7 +2215,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
} }
else else
{ {
TRectype dep = ricerca_occ(ocfpi); const TRectype& dep = ricerca_occ(ocfpi);
ragsoc = dep.get (OCC_RAGSOC); ragsoc = dep.get (OCC_RAGSOC);
viacf = dep.get (OCC_INDIR); viacf = dep.get (OCC_INDIR);
civcf = dep.get (OCC_CIV); civcf = dep.get (OCC_CIV);
@ -2209,7 +2223,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
comcf = dep.get (OCC_COM); comcf = dep.get (OCC_COM);
stacf = dep.get (OCC_STATO); stacf = dep.get (OCC_STATO);
} }
TRectype com = look_comuni(stacf,comcf); const TRectype& com = look_comuni(stacf,comcf);
if (!com.empty()) if (!com.empty())
{ {
comune = com.get(COM_DENCOM); comune = com.get(COM_DENCOM);
@ -2511,7 +2525,7 @@ int TStampa_registri_app::stampa_intestazione()
r++; r++;
if (_tipo_stampa == prova) if (_tipo_stampa == prova)
{ {
riga = "REGISTRO DI PROVA Data @<"; riga = "REGISTRO DI PROVA Data @>";
riga.right_just(_stampa_width-6); riga.right_just(_stampa_width-6);
} }
@ -2778,8 +2792,7 @@ void TStampa_registri_app::liq_other_case()
//aggiusta il mese al trimestre a cui appartiene //aggiusta il mese al trimestre a cui appartiene
if (_frequiva == 'T') if (_frequiva == 'T')
mese += 2 - ((mese-1) % 3); mese += 2 - ((mese-1) % 3);
send_message(calc_reg ? 'R' : 'C', app, calc_reg ? _datareg.month() : mese);
send_message(calc_reg ? 'R' : 'C', app, calc_reg ? _datareg.month()/*_fino_a_mese*/ : mese);
} }
} }
} }
@ -3093,84 +3106,94 @@ void TStampa_registri_app::no_movimenti()
//se la frequenza e' trimestrale //se la frequenza e' trimestrale
//aggiusta il mese al trimestre a cui appartiene //aggiusta il mese al trimestre a cui appartiene
if (_frequiva == 'T') if (_frequiva == 'T')
{
mese += 2 - ((mese-1) % 3); mese += 2 - ((mese-1) % 3);
if (calc)
{
send_message('R', app, mese-2); // Guy!!!
send_message('R', app, mese-1); // Guy!!!
}
}
send_message(calc ? 'R' : 'C', app, calc ? a : mese); send_message(calc ? 'R' : 'C', app, calc ? a : mese);
} }
if (_tipo_reg == riepilogativo || _liquidazione || _stampa_plafonds) if (_tipo_reg == riepilogativo || _liquidazione || _stampa_plafonds)
{ {
for (int m = da; m <= a; m++) for (int m = da; m <= a; m++)
{
if (_tipo_reg == riepilogativo)
{ {
bool stsbol = FALSE; if (_tipo_reg == riepilogativo)
if (_tipo_stampa != prova) //stampa su bollato
if (_u_data.ok())
if (m <= _u_data.month()) stsbol = TRUE;
if (!stsbol) //cioe' se il mese che sto considerando e'
//maggiore dell'ultima data di stampa del registro
if (_freq_riepilogo == 'M' ||
(m == 3 || m == 6 || m == 9 || m == 12))
{
_datareg = TDate(1, m, _annoes);
if (stampa_riepilogo(m))
printer().formfeed();
}
}
// In prova va stampato per ogni mese (sia Mensile che Trimestrale; in bollato, solo per i mesi che ancora mancano)
const bool print_plafond_bollato = _tipo_stampa != prova && _u_data.ok() && m > _u_data.month();
if (_stampa_plafonds && (_tipo_stampa == prova || print_plafond_bollato))
{
if (! printer().isopen())
printer().open();
_datareg = TDate(1, m, _annoes);
if (stampa_plafonds(-1)) // Con -1 compone e stampa printrows all'istante
printer().formfeed();
}
//la funzione stampo_liquidazione non stampera' la liquidazione sul
//registro il cui mese di stampa ultima liq. e' > del mese in esame
//caso a parte il mese 12 (che posso ristampare 2 volte)
if (_liquidazione)
if (stampo_liquidazione(m))
{ {
if (_tipo_reg == riepilogativo) bool stsbol = FALSE;
{ if (_tipo_stampa != prova) //stampa su bollato
if (!(_freq_riepilogo == 'M' || if (_u_data.ok())
(m == 3 || m == 6 || m == 9 || m == 12))) continue; if (m <= _u_data.month()) stsbol = TRUE;
}
if (! printer().isopen()) if (!stsbol) //cioe' se il mese che sto considerando e'
printer().open(); //maggiore dell'ultima data di stampa del registro
TFilename f; {
f.temp("rgp"); if (_freq_riepilogo == 'M' ||
_datareg = TDate(1, m, _annoes); // serve alla preprocess_header (m == 3 || m == 6 || m == 9 || m == 12))
if (_scelta == B0_settato || _scelta == prosegui_stampa) {
{ _datareg = TDate(1, m, _annoes);
if (_tipo_stampa == prova) if (stampa_riepilogo(m))
send_message('S',f, m); printer().formfeed();
else }
send_message('s',f, m); }
}
else //_scelta == prosegui_cal_stampa
{
if (_tipo_stampa == prova)
send_message('L', f, m);
else
send_message('l', f, m);
}
if (fexist(f))
{
_intesta_liq = TRUE;
merge_export_file(f,FALSE,TRUE);
printer().formfeed();
_intesta_liq = FALSE;
remove(f);
}
} }
}//for
// In prova va stampato per ogni mese (sia Mensile che Trimestrale;
// in bollato, solo per i mesi che ancora mancano)
const bool print_plafond_bollato = _tipo_stampa != prova && (m == 1 || m > _u_data.month());
if (_stampa_plafonds && (_tipo_stampa == prova || print_plafond_bollato))
{
if (! printer().isopen())
printer().open();
_datareg = TDate(1, m, _annoes);
if (stampa_plafonds(-1)) // Con -1 compone e stampa printrows all'istante
printer().formfeed();
}
//la funzione stampo_liquidazione non stampera' la liquidazione sul
//registro il cui mese di stampa ultima liq. e' > del mese in esame
//caso a parte il mese 12 (che posso ristampare 2 volte)
if (_liquidazione)
if (stampo_liquidazione(m))
{
if (_tipo_reg == riepilogativo)
{
if (!(_freq_riepilogo == 'M' ||
(m == 3 || m == 6 || m == 9 || m == 12))) continue;
}
if (! printer().isopen())
printer().open();
TFilename f;
f.temp("rgp");
_datareg = TDate(1, m, _annoes); // serve alla preprocess_header
if (_scelta == B0_settato || _scelta == prosegui_stampa)
{
if (_tipo_stampa == prova)
send_message('S',f, m);
else
send_message('s',f, m);
}
else //_scelta == prosegui_cal_stampa
{
if (_tipo_stampa == prova)
send_message('L', f, m);
else
send_message('l', f, m);
}
if (fexist(f))
{
_intesta_liq = TRUE;
merge_export_file(f,FALSE,TRUE);
printer().formfeed();
_intesta_liq = FALSE;
remove(f);
}
}
}//for
} }
_tabreg->readat(rec); _tabreg->readat(rec);
@ -3293,7 +3316,7 @@ bool TStampa_registri_app::set_print(int n)
_tipo_stampa = (tipo_stampa) m.get_int(TIPO_STAMPA); _tipo_stampa = (tipo_stampa) m.get_int(TIPO_STAMPA);
_stampa_width = m.get_int(STAMPA_WIDTH); _stampa_width = m.get_int(STAMPA_WIDTH);
_stampa_len = m.get_int(STAMPA_LEN); _stampa_len = m.get_int(STAMPA_LEN);
_table = (_annoes > 1997) ? _tabprm : _tabpim; // Dal 1998 in poi utilizza i PRM e non i PIM _table = (_annoes > 1997) ? _tabprm : _tabpim; // Dal 1998 in poi utilizza i PRM e non i PIM
if (_stampa_width == 1) if (_stampa_width == 1)
_stampa_width = 132; _stampa_width = 132;
else _stampa_width = 198; else _stampa_width = 198;
@ -3392,7 +3415,7 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m)
if (!controlla_mov()) if (!controlla_mov())
{ {
TApplication::set_firm(__firm); TApplication::set_firm(__firm);
return fatal_box("Finire di stampare registri anno precedente"); return error_box("Finire di stampare registri anno precedente");
} }
if (!_stampa_tutti_i_registri) if (!_stampa_tutti_i_registri)
{ {
@ -3487,14 +3510,13 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m)
} }
if (_tipo_stampa == rif_giornale) //stampa con riferimenti al libro giornale if (_tipo_stampa == rif_giornale) //stampa con riferimenti al libro giornale
{ {
TString16 d; TDate d;
bool good; bool good;
TRecnotype rec = _tabreg->recno(); bool trovato = cerca_libro_gio(d, good);
bool trovato = cerca_libro_gio(d, &good); if (trovato)
_tabreg->readat(rec); one_printed = TRUE;
if (!trovato) else
continue; continue;
else one_printed = TRUE;
} }
if (_tipo_stampa == libro_unico) //stampa su libro unico if (_tipo_stampa == libro_unico) //stampa su libro unico
{ {
@ -3587,8 +3609,6 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m)
//Stampa registro riepilogativo //Stampa registro riepilogativo
bool TStampa_registri_app::stampa_riepilogo(int m) bool TStampa_registri_app::stampa_riepilogo(int m)
{ {
int a;
tiporeg tipo;
TString80 chiave,ctab; TString80 chiave,ctab;
TString16 codtab, codreg, creg, codatt, codiva; TString16 codtab, codreg, creg, codatt, codiva;
TRiga_array vect, vect_prec; TRiga_array vect, vect_prec;
@ -3598,12 +3618,13 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
for (_tabreg->first(); !_tabreg->eof(); _tabreg->next()) // Scorre i registri for (_tabreg->first(); !_tabreg->eof(); _tabreg->next()) // Scorre i registri
{ {
tipo = (tiporeg)_tabreg->get_int("I0");
codtab = _tabreg->get("CODTAB"); codtab = _tabreg->get("CODTAB");
a = atoi(codtab.mid(0,4)); const int a = atoi(codtab.mid(0,4));
if (a > _annoes) break; if (a > _annoes) break;
const tiporeg tipo = (tiporeg)_tabreg->get_int("I0");
if (a == _annoes && (tipo == vendita || tipo == acquisto)) if (a == _annoes && (tipo == vendita || tipo == acquisto))
{ {
codreg = codtab.mid(4,3); codreg = codtab.mid(4,3);
@ -3613,7 +3634,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
vect.destroy(); vect.destroy();
vect_prec.destroy(); vect_prec.destroy();
vect_det.destroy(); vect_det.destroy();
chiave = ""; chiave.cut(0);
chiave << _annoes << _tabreg->get("S8"); chiave << _annoes << _tabreg->get("S8");
// Calcolo riepilogo del periodo e progressivi in caso di stampa su bollato // Calcolo riepilogo del periodo e progressivi in caso di stampa su bollato
@ -3630,15 +3651,15 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
TTable* tabula = calc_prp ? _tabprp : _table ; TTable* tabula = calc_prp ? _tabprp : _table ;
tabula->zero(); tabula->zero();
tabula->put("CODTAB", chiave); tabula->put("CODTAB", chiave);
TRectype r (tabula->curr()); const TRectype r(tabula->curr());
tabula->read(_isgteq); tabula->read(_isgteq);
for (; !tabula->eof(); tabula->next()) for (; !tabula->eof(); tabula->next())
{ {
if (tabula->curr() != r) break; if (tabula->curr() != r) break;
ctab = tabula->get("CODTAB"); ctab = tabula->get("CODTAB");
creg = ctab.mid(10,3); creg = ctab.mid(10,3); creg.trim();
int mese = atoi(ctab.mid(13,2)); const int mese = atoi(ctab.mid(13,2));
if (codreg == creg.trim() && mese == i) if (codreg == creg && mese == i)
{ {
codiva = ctab.mid(16,4); codiva = ctab.mid(16,4);
int tipodet = atoi(ctab.mid(20,1)); int tipodet = atoi(ctab.mid(20,1));
@ -3666,7 +3687,8 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
{ {
if (!calc_prp && _tipo_stampa != prova) if (!calc_prp && _tipo_stampa != prova)
vect.add_riga(ZERO, ZERO, ZERO, impon,impos,impol,codiva); vect.add_riga(ZERO, ZERO, ZERO, impon,impos,impol,codiva);
if (mese == m)
if (mese == m || (_frequiva == 'T' && mese >= m-2 && mese <= m)) // Guy!!!
if (calc_prp) if (calc_prp)
vect_prec.add_riga(impon,impos,impol,ZERO,ZERO,ZERO,codiva); vect_prec.add_riga(impon,impos,impol,ZERO,ZERO,ZERO,codiva);
else else
@ -3678,7 +3700,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
{ {
if (_tipo_stampa != prova) if (_tipo_stampa != prova)
vect_det.add_riga(ZERO,ZERO,impon,impos,codiva,tipodet,0,TRUE); vect_det.add_riga(ZERO,ZERO,impon,impos,codiva,tipodet,0,TRUE);
if (mese == m) if (mese == m || (_frequiva == 'T' && mese >= m-2 && mese <= m)) // Guy!!!
vect_det.add_riga(impon,impos,ZERO,ZERO,codiva,tipodet,0,TRUE); vect_det.add_riga(impon,impos,ZERO,ZERO,codiva,tipodet,0,TRUE);
} }
} }

View File

@ -90,10 +90,10 @@ public:
const char* tipo_attivita (); const char* tipo_attivita ();
const char* descr_doc (); const char* descr_doc ();
const char* descr_iva (const char*); const char* descr_iva (const char*);
TRectype& ricerca_occ(const char*); const TRectype& ricerca_occ(const char*);
TRectype& ricerca_cf (char, long); const TRectype& ricerca_cf (char, long);
TRectype& look_comuni(const TString& stato, const TString& cod); const TRectype& look_comuni(const TString& stato, const TString& cod);
TRectype& look_comuni(const char* cod); const TRectype& look_comuni(const char* cod);
TArray_sheet* get_ditte_sheet() { return _ditte; } TArray_sheet* get_ditte_sheet() { return _ditte; }
int setta_riga (int, const TRigaiva&, real&, real&, real&, real&); int setta_riga (int, const TRigaiva&, real&, real&, real&, real&);
int riga_rmoviva(); int riga_rmoviva();
@ -107,7 +107,7 @@ public:
bool controlla_mov(); bool controlla_mov();
bool stampo_liquidazione(int); bool stampo_liquidazione(int);
bool ventilazione(const char*); bool ventilazione(const char*);
bool cerca_libro_gio(TString&, bool*); bool cerca_libro_gio(TDate&, bool&);
bool look_reg (int, int, TString&, int, const char*, int*, long); bool look_reg (int, int, TString&, int, const char*, int*, long);
bool look_regs(int, TString&, int, int*, long, TProgind*); bool look_regs(int, TString&, int, int*, long, TProgind*);
bool stampa_totali_finali(); bool stampa_totali_finali();

View File

@ -25,13 +25,12 @@ END
STRING F_CHIUSURA 3 STRING F_CHIUSURA 3
BEGIN BEGIN
PROMPT 2 4 "Codice causale chiusura " PROMPT 2 4 "Codice causale chiusura "
HELP "Codice causale che genera il movimento di chiusura"
USE LF_CAUSALI KEY 1 SELECT MOVAP="C" USE LF_CAUSALI KEY 1 SELECT MOVAP="C"
FLAGS "UZ" FLAGS "UZ"
INPUT CODCAUS F_CHIUSURA
DISPLAY "Codice" CODCAUS DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione @50" DESCR DISPLAY "Descrizione @50" DESCR
OUTPUT F_CHIUSURA CODCAUS OUTPUT F_CHIUSURA CODCAUS
INPUT CODCAUS F_CHIUSURA
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
ADD RUN CG0 -4 ADD RUN CG0 -4
END END
@ -39,29 +38,29 @@ END
STRING F_APERTURA 3 STRING F_APERTURA 3
BEGIN BEGIN
PROMPT 2 5 "Codice causale apertura " PROMPT 2 5 "Codice causale apertura "
HELP "Codice causale che genera il movimento di apertura"
USE LF_CAUSALI KEY 1 SELECT MOVAP="A" USE LF_CAUSALI KEY 1 SELECT MOVAP="A"
FLAGS "UZ" FLAGS "UZ"
INPUT CODCAUS F_APERTURA INPUT CODCAUS F_APERTURA
COPY DISPLAY F_CHIUSURA COPY DISPLAY F_CHIUSURA
OUTPUT F_APERTURA CODCAUS OUTPUT F_APERTURA CODCAUS
ADD RUN CG0 -4 ADD RUN CG0 -4
END CHECKTYPE REQUIRED
DATE F_DATAAP
BEGIN
PROMPT 36 4 "Data/Anno apertura "
HELP "Data in cui effettuare il movimento di apertura"
WARNING "Inserire una data non inferiore alla data di chiusura"
VALIDATE DATE_CMP_FUNC >= F_DATAC
END END
DATE F_DATAC DATE F_DATAC
BEGIN BEGIN
PROMPT 36 5 "Data/Anno chiusura " PROMPT 36 4 "Data/Anno chiusura "
HELP "Data in cui effettuare il movimento di chiusura" HELP "Data in cui effettuare il movimento di chiusura"
END END
DATE F_DATAAP
BEGIN
PROMPT 36 5 "Data/Anno apertura "
HELP "Data in cui effettuare il movimento di apertura"
WARNING "Inserire una data non inferiore alla data di chiusura"
VALIDATE DATE_CMP_FUNC >= F_DATAC
END
NUMBER F_ANNOCH 4 NUMBER F_ANNOCH 4
BEGIN BEGIN
PROMPT 69 4 "" PROMPT 69 4 ""
@ -96,7 +95,7 @@ END
GROUPBOX DLG_NULL 60 10 GROUPBOX DLG_NULL 60 10
BEGIN BEGIN
PROMPT 2 7 "Codici sottoconto" PROMPT 2 7 "@bCodici sottoconto"
END END
NUMBER F_BILCHG 3 NUMBER F_BILCHG 3
@ -104,7 +103,6 @@ BEGIN
PROMPT 3 9 "Bilancio di chiusura " PROMPT 3 9 "Bilancio di chiusura "
HELP "Codice conto di riepilogo del bilancio di chiusura" HELP "Codice conto di riepilogo del bilancio di chiusura"
USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
CHECKTYPE REQUIRED
DISPLAY "Gruppo" GRUPPO DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO DISPLAY "Sottoconto" SOTTOCONTO
@ -122,7 +120,6 @@ BEGIN
PROMPT 44 9 "" PROMPT 44 9 ""
HELP "Codice conto di riepilogo del bilancio di chiusura" HELP "Codice conto di riepilogo del bilancio di chiusura"
COPY ALL F_BILCHG COPY ALL F_BILCHG
CHECKTYPE REQUIRED
END END
NUMBER F_BILCHS 6 NUMBER F_BILCHS 6
@ -139,7 +136,6 @@ BEGIN
PROMPT 3 10 "Profitti e perdite " PROMPT 3 10 "Profitti e perdite "
HELP "Codice conto di riepilogo del Profitti e perdite" HELP "Codice conto di riepilogo del Profitti e perdite"
COPY USE F_BILCHG COPY USE F_BILCHG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
OUTPUT F_PROPERG GRUPPO OUTPUT F_PROPERG GRUPPO
OUTPUT F_PROPERC CONTO OUTPUT F_PROPERC CONTO
@ -154,7 +150,6 @@ BEGIN
PROMPT 44 10 "" PROMPT 44 10 ""
HELP "Codice conto di riepilogo del Profitti e perdite" HELP "Codice conto di riepilogo del Profitti e perdite"
COPY USE F_BILCHG COPY USE F_BILCHG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
COPY OUTPUT F_PROPERG COPY OUTPUT F_PROPERG
COPY INPUT F_PROPERG COPY INPUT F_PROPERG
@ -173,7 +168,6 @@ BEGIN
PROMPT 3 11 "Bilancio di apertura " PROMPT 3 11 "Bilancio di apertura "
HELP "Codice conto di riepilogo del Bilancio di apertura" HELP "Codice conto di riepilogo del Bilancio di apertura"
COPY USE F_BILCHG COPY USE F_BILCHG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
OUTPUT F_BILAPG GRUPPO OUTPUT F_BILAPG GRUPPO
OUTPUT F_BILAPC CONTO OUTPUT F_BILAPC CONTO
@ -188,7 +182,6 @@ BEGIN
PROMPT 44 11 "" PROMPT 44 11 ""
HELP "Codice conto di riepilogo del Bilancio di apertura" HELP "Codice conto di riepilogo del Bilancio di apertura"
COPY USE F_BILCHG COPY USE F_BILCHG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
COPY OUTPUT F_BILAPG COPY OUTPUT F_BILAPG
COPY INPUT F_BILAPG COPY INPUT F_BILAPG
@ -207,7 +200,6 @@ BEGIN
PROMPT 3 12 "Utile d'esercizio c/to patrim. " PROMPT 3 12 "Utile d'esercizio c/to patrim. "
HELP "Codice conto patrimoniale in cui ripilogare l'utile d'esercizio" HELP "Codice conto patrimoniale in cui ripilogare l'utile d'esercizio"
USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="")
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
OUTPUT F_UTILPG GRUPPO OUTPUT F_UTILPG GRUPPO
OUTPUT F_UTILPC CONTO OUTPUT F_UTILPC CONTO
@ -222,7 +214,6 @@ BEGIN
PROMPT 44 12 "" PROMPT 44 12 ""
HELP "Codice conto patrimoniale in cui ripilogare l'utile d'esercizio" HELP "Codice conto patrimoniale in cui ripilogare l'utile d'esercizio"
COPY USE F_UTILPG COPY USE F_UTILPG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
COPY OUTPUT F_UTILPG COPY OUTPUT F_UTILPG
COPY INPUT F_UTILPG COPY INPUT F_UTILPG
@ -241,7 +232,6 @@ BEGIN
PROMPT 3 13 "Perdita d'esercizio c/to patr. " PROMPT 3 13 "Perdita d'esercizio c/to patr. "
HELP "Codice conto patrimoniale in cui ripilogare la perdita d'esercizio" HELP "Codice conto patrimoniale in cui ripilogare la perdita d'esercizio"
USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="")
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
OUTPUT F_PERDPG GRUPPO OUTPUT F_PERDPG GRUPPO
OUTPUT F_PERDPC CONTO OUTPUT F_PERDPC CONTO
@ -256,7 +246,6 @@ BEGIN
PROMPT 44 13 "" PROMPT 44 13 ""
HELP "Codice conto patrimoniale in cui ripilogare la perdita d'esercizio" HELP "Codice conto patrimoniale in cui ripilogare la perdita d'esercizio"
COPY USE F_PERDPG COPY USE F_PERDPG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
COPY OUTPUT F_PERDPG COPY OUTPUT F_PERDPG
COPY INPUT F_PERDPG COPY INPUT F_PERDPG
@ -275,7 +264,6 @@ BEGIN
PROMPT 3 14 "Utile d'esercizio c/to econom. " PROMPT 3 14 "Utile d'esercizio c/to econom. "
HELP "Codice conto economico in cui ripilogare l'utile d'esercizio" HELP "Codice conto economico in cui ripilogare l'utile d'esercizio"
USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="")
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
OUTPUT F_UTILEG GRUPPO OUTPUT F_UTILEG GRUPPO
OUTPUT F_UTILEC CONTO OUTPUT F_UTILEC CONTO
@ -290,7 +278,6 @@ BEGIN
PROMPT 44 14 "" PROMPT 44 14 ""
HELP "Codice conto economico in cui ripilogare l'utile d'esercizio" HELP "Codice conto economico in cui ripilogare l'utile d'esercizio"
COPY USE F_UTILEG COPY USE F_UTILEG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
COPY OUTPUT F_UTILEG COPY OUTPUT F_UTILEG
COPY INPUT F_UTILEG COPY INPUT F_UTILEG
@ -309,7 +296,6 @@ BEGIN
PROMPT 3 15 "Perdita d'esercizio c/to econ. " PROMPT 3 15 "Perdita d'esercizio c/to econ. "
HELP "Codice conto economico in cui ripilogare la perdita d'esercizio" HELP "Codice conto economico in cui ripilogare la perdita d'esercizio"
USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="") USE LF_PCON KEY 1 SELECT (SOTTOCONTO!="")
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
OUTPUT F_PERDEG GRUPPO OUTPUT F_PERDEG GRUPPO
OUTPUT F_PERDEC CONTO OUTPUT F_PERDEC CONTO
@ -325,7 +311,6 @@ BEGIN
PROMPT 44 15 "" PROMPT 44 15 ""
HELP "Codice conto economico in cui ripilogare la perdita d'esercizio" HELP "Codice conto economico in cui ripilogare la perdita d'esercizio"
COPY USE F_PERDEG COPY USE F_PERDEG
CHECKTYPE REQUIRED
COPY DISPLAY F_BILCHG COPY DISPLAY F_BILCHG
COPY OUTPUT F_PERDEG COPY OUTPUT F_PERDEG
COPY INPUT F_PERDEG COPY INPUT F_PERDEG

View File

@ -1,27 +1,26 @@
#include "cg4900a.h" #include "cg4900a.h"
PAGE "Visualizzazione liquidazione acconti" -1 -1 70 6 PAGE "Visualizzazione liquidazione acconti" -1 -1 70 5
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 1 "Codice ditta "
FLAGS "B"
HELP "Codice della ditta da attivare"
END
STRING F_RAGSOC 50 30
BEGIN
PROMPT 25 1 "Rag. soc. "
FLAGS "B"
HELP "Ragione sociale della ditta da selezionare"
END
NUMBER F_YEAR 4 NUMBER F_YEAR 4
BEGIN BEGIN
PROMPT 1 2 "Anno liquidazione " PROMPT 1 1 "Anno liquidazione "
FLAGS "A" FLAGS "A"
VALIDATE FIXLEN_FUNC 4 VALIDATE FIXLEN_FUNC 4
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "B"
END
STRING F_RAGSOC 50
BEGIN
PROMPT 16 2 ""
FLAGS "B"
END END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2

View File

@ -49,17 +49,16 @@ bool cau_filter2 (const TRelation *r)
{ {
bool rt = FALSE; bool rt = FALSE;
const TRectype& rec = r->curr(LF_CAUSALI); const TRectype& rec = r->curr(LF_CAUSALI);
const TString& tipo = rec.get(CAU_TIPODOC);
if (rec.get(CAU_TIPODOC) == "FV") // Solo i tipi documento Fatture Vendita if (tipo == "FV" || tipo == "NC") // Solo i tipi documento Fatture Vendita
{ {
TTable& reg = (TTable&) r->lfile("REG"); TTable& reg = (TTable&) r->lfile("REG");
TString16 cod; TString16 cod;
cod << __anno; cod << __anno;
cod << rec.get(CAU_REG); cod << rec.get(CAU_REG);
reg.put("CODTAB", cod); reg.put("CODTAB", cod);
if (reg.read() == NOERR ) if (reg.read() == NOERR)
rt = ! reg.get_bool("B1"); rt = !reg.get_bool("B1");
} }
return rt; return rt;
@ -235,28 +234,24 @@ bool TGestAutoTrasp_mask::on_field_event(TOperable_field& o, TField_event e, lon
if (e == fe_close) // Controllo sulla presenza dei codici causale nello spreadsheet if (e == fe_close) // Controllo sulla presenza dei codici causale nello spreadsheet
{ {
TSheet_field& sf = sfield(F_SHEET_CAUSALI); TSheet_field& sf = sfield(F_SHEET_CAUSALI);
TString16 c; bool error = TRUE;
bool error = FALSE;
for (int i=0; i < sf.items(); i++) for (int i=0; i < sf.items(); i++)
{ {
TToken_string& tt = sf.row(i); TToken_string& tt = sf.row(i);
c = tt.get(F_CAUDEF - F_CAUMOV); const TString16 c = tt.get(F_CAUDEF - F_CAUMOV);
if (c.empty()) if (!c.blank())
{ {
error = TRUE; error = FALSE;
break; break;
} }
} }
if (sf.items() == 0)
error = TRUE;
if (error) if (error)
{
if (sf.items() == 0) if (sf.items() == 0)
error_box("E' necessario indicare tutte le causali definitive per ogni causale del movimento in sospensione.");
else
error_box("Non vi sono movimenti in sospensione da stornare nel periodo indicato."); error_box("Non vi sono movimenti in sospensione da stornare nel periodo indicato.");
else
error_box("E' necessario indicare almeno una causale definitiva.");
}
return !error; return !error;
} }
@ -377,7 +372,13 @@ void TGestAutoTrasp_mask::write_movs()
// Scorre i movimenti selezionati sul registro in sospensione // Scorre i movimenti selezionati sul registro in sospensione
for (*_cur = 0L; _cur->pos() < cur_items && err == NOERR; ++(*_cur)) for (*_cur = 0L; _cur->pos() < cur_items && err == NOERR; ++(*_cur))
{ {
pi.addstatus(1L); pi.addstatus(1);
const TString16 cod_caus = curr_rec.get(MOV_CODCAUS);
const TString16 cod_caus_def = (TString&)_caudef[cod_caus];
if (cod_caus_def.blank())
continue;
mpn_sosp_rec = curr_rec; mpn_sosp_rec = curr_rec;
if (mpn_sosp.read(_isequal) == NOERR) if (mpn_sosp.read(_isequal) == NOERR)
{ {

View File

@ -170,7 +170,7 @@ BEGIN
OUTPUT F_DESCAUDEF DESCR[1,15] OUTPUT F_DESCAUDEF DESCR[1,15]
OUTPUT F_CAUDEFREG REG OUTPUT F_CAUDEFREG REG
CHECKTYPE NORMAL CHECKTYPE NORMAL
WARNING "La causale definitiva è obbligatoria" WARNING "La causale definitiva e' obbligatoria"
END END
STRING F_DESCAUDEF 15 STRING F_DESCAUDEF 15
@ -191,12 +191,12 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
BUTTON DLG_OK 9 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 9 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END

View File

@ -7,7 +7,7 @@
#include <prefix.h> #include <prefix.h>
#include <relapp.h> #include <relapp.h>
#include <tabutil.h> #include <tabutil.h>
#include <urldefid.h> #include <recarray.h>
#include <utility.h> #include <utility.h>
#include "cg5.h" #include "cg5.h"
@ -273,11 +273,7 @@ void TParaliq_app::init_array(TMask& m, bool update)
if (update) if (update)
{ {
sf.force_update(); sf.force_update();
TString16 freq = cache().get(LF_NDITTE,newditta).get(NDT_FREQVIVA);
TString16 freq;
_ditte->put(NDT_CODDITTA, newditta);
if (_ditte->read() == NOERR)
freq = _ditte->get(NDT_FREQVIVA);
m.set(F_FREQ_VERS, freq); m.set(F_FREQ_VERS, freq);
} }
} }

View File

@ -73,13 +73,13 @@ BEGIN
PROMPT 4 5 "Frequenza versamenti " PROMPT 4 5 "Frequenza versamenti "
HELP "Indicare la frequenza dei versamenti delle liquidazioni IVA" HELP "Indicare la frequenza dei versamenti delle liquidazioni IVA"
ITEM "M|Mensile" MESSAGE ENABLE,F_GELIDI ITEM "M|Mensile" MESSAGE ENABLE,F_GELIDI
ITEM "T|Trimestrale" MESSAGE CLEAR,F_GELIDI ITEM "T|Trimestrale" MESSAGE CLEAR,F_GELIDI
FIELD S7 FIELD S7
END END
BOOLEAN F_GELIDI BOOLEAN F_GELIDI
BEGIN BEGIN
PROMPT 45 5 "Liquidazione differita " PROMPT 47 5 "Liquidazione differita "
FIELD B1 FIELD B1
END END
@ -88,13 +88,12 @@ BEGIN
PROMPT 4 6 "Credito di costo " PROMPT 4 6 "Credito di costo "
HELP "Eventuale credito di costo dell'anno precedente" HELP "Eventuale credito di costo dell'anno precedente"
FIELD R5 FIELD R5
FLAGS "R"
DRIVENBY F_CODVAL DRIVENBY F_CODVAL
END END
BOOLEAN F_AGRMIN BOOLEAN F_AGRMIN
BEGIN BEGIN
PROMPT 45 6 "Agricoltore minimo " PROMPT 47 6 "Agricoltore minimo "
FIELD B2 FIELD B2
END END
@ -111,7 +110,6 @@ BEGIN
PROMPT 4 8 "Credito compensabile inizio anno " PROMPT 4 8 "Credito compensabile inizio anno "
HELP "Eventuale credito di imposta dell'anno precedente" HELP "Eventuale credito di imposta dell'anno precedente"
FIELD R0 FIELD R0
FLAGS "R"
DRIVENBY F_CODVAL DRIVENBY F_CODVAL
END END
@ -119,7 +117,6 @@ CURRENCY F_CRED_RES 18
BEGIN BEGIN
PROMPT 4 9 "Credito in compensaz.utilizzato " PROMPT 4 9 "Credito in compensaz.utilizzato "
FIELD R15 FIELD R15
FLAGS "R"
DRIVENBY F_CODVAL DRIVENBY F_CODVAL
NUM_EXPR #THIS<=#F_CRED_PREC NUM_EXPR #THIS<=#F_CRED_PREC
WARNING "L'importo non puo' essere maggiore del Credito Precedente" WARNING "L'importo non puo' essere maggiore del Credito Precedente"
@ -127,7 +124,7 @@ END
LISTBOX F_MESE_RES_AL 14 LISTBOX F_MESE_RES_AL 14
BEGIN BEGIN
PROMPT 54 9 "A " PROMPT 57 9 "A "
ITEM "0|" ITEM "0|"
FIELD I0 FIELD I0
END END

View File

@ -4,22 +4,20 @@
#include <progind.h> #include <progind.h>
#include <relation.h> #include <relation.h>
#include <tabutil.h> #include <tabutil.h>
#include <urldefid.h>
#include <utility.h>
#include <mov.h> #include <mov.h>
#include "cg5.h" #include "cg5.h"
#include "cg5400.h" #include "cg5400.h"
class TRipristina_stampa : public TApplication class TRipristina_stampa : public TSkeleton_application
{ {
enum TOperation { restore_reg, restore_inl }; enum TOperation { restore_reg, restore_inl };
TOperation _op; TOperation _op;
protected: // TApplication protected: // TApplication
virtual bool create() ; virtual bool create() ;
virtual bool menu(MENU_TAG); virtual void main_loop();
public: public:
void azzera_lim(int year, int month) const; void azzera_lim(int year, int month) const;
@ -34,7 +32,8 @@ public:
void TRipristina_stampa::azzera_lim(int year, int month) const void TRipristina_stampa::azzera_lim(int year, int month) const
{ {
TTable lim("LIM"); // Azzera i flag di stampa liquidazione TTable lim("LIM"); // Azzera i flag di stampa liquidazione
lim.put("CODTAB", format("%04d%02d", year, month)); TString16 cod; cod.format("%04d%02d", year, month);
lim.put("CODTAB", cod);
for (int err = lim.read(_isgteq); err == NOERR; err = lim.next()) for (int err = lim.read(_isgteq); err == NOERR; err = lim.next())
{ {
if (atoi(lim.get("CODTAB").left(4)) != year) break; if (atoi(lim.get("CODTAB").left(4)) != year) break;
@ -106,7 +105,8 @@ bool TRipristina_stampa::reg_restore(const TString& regist,
cursor = 0L; cursor = 0L;
const long nitems = cursor.items(); const long nitems = cursor.items();
TProgind p(nitems ? nitems : 1, format("Ripristino stampa del registro %s", (const char*)regist) , TRUE, TRUE, 70); TString msg; msg.format("Ripristino stampa del registro %s", (const char*)regist);
TProgind p(nitems ? nitems : 1, msg , TRUE, TRUE);
if (giornale) if (giornale)
{ {
@ -137,7 +137,7 @@ bool TRipristina_stampa::reg_restore(const TString& regist,
reg.put("I4", (long)mese); // Ultimo mese di stampa liquidazione reg.put("I4", (long)mese); // Ultimo mese di stampa liquidazione
if (reg.get_int("I8") >= mese) if (reg.get_int("I8") >= mese)
reg.zero("I8"); // Mese di ultima stampa credito precedente reg.zero("I8"); // Mese di ultima stampa credito precedente
// azzera_lim(year, mese+1); // azzera_lim(year, mese+1);
} }
} }
else else
@ -147,7 +147,7 @@ bool TRipristina_stampa::reg_restore(const TString& regist,
{ {
reg.zero("I4"); reg.zero("I4");
reg.zero("I8"); reg.zero("I8");
// azzera_lim(year, 1); // azzera_lim(year, 1);
} }
} }
@ -191,7 +191,8 @@ bool TRipristina_stampa::inl_restore(const TString& lib, int year, int month)
if (ok) // Se e' stato ripristinato almeno un indice e non ci sono stati errori if (ok) // Se e' stato ripristinato almeno un indice e non ci sono stati errori
{ {
TTable lbu("%LBU"); TTable lbu("%LBU");
lbu.put("CODTAB", format("%4d%s", year, (const char*)lib)); TString16 cod; cod.format("%4d%s", year, (const char*)lib);
lbu.put("CODTAB", cod);
ok = lbu.read() == NOERR; ok = lbu.read() == NOERR;
if (ok) if (ok)
{ {
@ -208,17 +209,13 @@ bool TRipristina_stampa::inl_restore(const TString& lib, int year, int month)
bool TRipristina_stampa::create() bool TRipristina_stampa::create()
{ {
TApplication::create();
if (argc() > 2 && stricmp(argv(2), "INL") == 0) if (argc() > 2 && stricmp(argv(2), "INL") == 0)
_op = restore_inl; _op = restore_inl;
return TSkeleton_application::create();
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
} }
bool TRipristina_stampa::menu(MENU_TAG) void TRipristina_stampa::main_loop()
{ {
TMask msk(_op == restore_inl ? "cg5400b" : "cg5400a") ; TMask msk(_op == restore_inl ? "cg5400b" : "cg5400a") ;
@ -268,7 +265,6 @@ bool TRipristina_stampa::menu(MENU_TAG)
else error_box("Gli archivi della ditta %ld non sono stati ancora generati", firm); else error_box("Gli archivi della ditta %ld non sono stati ancora generati", firm);
msk.reset(); msk.reset();
} }
return FALSE;
} }
int cg5400(int argc, char* argv[]) int cg5400(int argc, char* argv[])

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