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
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;
for (int i = 0 ; i < 3 && !ok; i++)
{

View File

@ -42,6 +42,7 @@ class TManutenzione_app : public TApplication
long _level;
long _history_firm;
TRec_sheet* _rec;
FILE * _log;
protected:
virtual bool menu (MENU_TAG);
@ -65,6 +66,11 @@ protected:
void put_history(const char* firm);
void close_history();
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:
@ -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)
{
const int logicnum = int(riga_sel) + 1;
@ -722,7 +773,7 @@ void TManutenzione_app::delete_riga ()
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 ||
(err > -600 && err <= -300))
@ -732,6 +783,46 @@ bool TManutenzione_app::recover(TSystemisamfile& f, int err)
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()
{
// Particolare significato dei flags oltre i 10000:
@ -806,6 +897,22 @@ void TManutenzione_app::update_dir()
}
}
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)
{
FILE * f = fopen(fs, "r");
@ -815,7 +922,7 @@ void TManutenzione_app::update_dir()
const long size = ftell(f);
fclose(f);
if (size > 0L && d.len() > 0)
if (flags < 10000L && size > 0L && d.len() > 0)
{
TSystemisamfile b(i);
int err = b.is_valid();
@ -830,17 +937,19 @@ void TManutenzione_app::update_dir()
}
if (err != NOERR && flags < 10000L)
{
KEY k = yesnocancel_box("Il file %d non puo' essere aperto: errore %d\n"
"Si desidera tentare il recupero dei dati?\n"
"Rispondendo No l'errore verra' ignorato.",i,err);
if (k == K_YES)
if (err == _istrcerr)
{
repair_file(i);
err = NOERR;
}
if (err != NOERR && flags < 10000L)
{
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
@ -860,6 +969,7 @@ void TManutenzione_app::update_dir()
}
}
}
}
d.get(i, _nolock, _nordir, _sysdirop);
bool cmn_file = FALSE;
@ -1062,25 +1172,24 @@ void TManutenzione_app::convert_dir()
if (err == -60 || err == -64) err=NOERR; // verif.
d.get(i, _nolock, _nordir, _sysdirop);
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"
"Si desidera tentare il recupero dei dati?\n"
"Rispondendo Annulla il programma terminera'",i,err);
if (k == K_YES)
{
if (err == _istrcerr)
{
if (!recover(b, err))
k = yesno_box("Impossibile recuperare i dati\n"
"Si desidera proseguire ugualmente?") ? K_NO : K_ESC;
repair_file(i);
err = NOERR;
}
if (k == K_ESC)
stop_run();
else
continue;
}
if (err != NOERR)
{
if (!recover(b, err))
{
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);
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
// 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)
{
TSystemisamfile f(i);
set_autoload_new_files(actual_create);
// set_autoload_new_files(actual_create);
set_autoload_new_files(FALSE);
f.build(0L,rs);
set_autoload_new_files(TRUE);
// Anche se il file non esisteva, prosegue, perche' possono esserci conversioni
@ -1356,14 +1466,23 @@ void TManutenzione_app::update()
TExternal_app app("bacnv 4 0");
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();
convert_dir();
TSystemisamfile ditte(LF_NDITTE);
ditte.open();
TString80 s("Conversione archivi ditte.");
s = "Conversione archivi ditte.";
TProgind p(ditte.items() ? ditte.items() : 1, s, FALSE, TRUE, 70);
@ -1383,6 +1502,9 @@ void TManutenzione_app::update()
{
ditte.close();
set_firm(codditta);
write_log("");
write_log(mxs);
write_log("");
update_dir();
convert_dir();
ditte.open();
@ -1391,6 +1513,10 @@ void TManutenzione_app::update()
}
ditte.close();
write_log("--------------------");
write_log("");
close_log();
if (firm > 0) set_firm(firm);
else prefix().set(pref);
load_des();

View File

@ -30,8 +30,6 @@ protected:
virtual long get_items() const { return _items; }
virtual void get_row(long n, TToken_string& r);
virtual bool on_key(KEY k);
public:
TDir* dir() const { return _dir; }
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)
{
n++;

View File

@ -113,12 +113,19 @@ void TPackFiles_application::main_loop()
TFilename f_name,d_name;
TString cmd;
TDir d;
TDir ds;
for (int i = 2; i<=items; i++) // Skip LF_DIR
{
if (!_selsheet->checked(i-1))
continue;
d.get(i);
const long flags = d.flags();
d.get(i);
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);
if (flags >= 10000L)
continue; // Skip files with flags over 10000
@ -131,7 +138,7 @@ void TPackFiles_application::main_loop()
do
{
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);
if (f.packfile() == NOERR)
@ -144,8 +151,8 @@ void TPackFiles_application::main_loop()
if (!present || status == -60)
{
if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce
f.build(0L);
// if (!present && d.len() > 0 && has_module(module,CHK_DONGLE))// Se il file non esiste lo costruisce
// f.build(0L);
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

View File

@ -83,7 +83,7 @@ ENDPAGE
PAGE "Permessi" -1 -1 78 20
TREE F_PERMESSI -3 -8
TREE F_PERMESSI -3 -9
BEGIN
PROMPT 0 1 ""
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);
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)
{
@ -1881,7 +1881,7 @@ bool TCreadischi_mask::zip_module(const TString& main_module, bool agg, int patc
{
_stat((const char *)patchfile,&info);
if (lasttime <= info.st_mtime)
aborted = !yesno_box("Il file di patch %s \nrisulta già aggiornato;\nprocedo comunque alla generazione di %s ?",(const char *)patchfile,(const char *)zipfile);
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 <checks.h>
#include "ba2.h"
@ -11,10 +10,8 @@ int main(int argc, char** argv)
{
case 1:
ba2200(argc, argv); break;
#if XVT_OS == XVT_OS_SCOUNIX
case 2:
ba2300(argc, argv) ; break;
#endif
case 3:
ba2400(argc, argv) ; break;
case 4:

View File

@ -1,35 +1,112 @@
#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 <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 "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
///////////////////////////////////////////////////////////
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 ok = TRUE;
@ -42,7 +119,7 @@ bool TArchive_app::create()
if (u != user() && utenti.get_bool("CONNECTED"))
{
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();
@ -53,25 +130,11 @@ bool TArchive_app::create()
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)
{
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);
TArchive_mask m;
const KEY k = m.run();
if (k != K_QUIT)
{
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))
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);
temp = m.get_bool(F_TEMP);
#if XVT_OS == XVT_OS_WIN
zip = m.get_bool(F_ZIP);
#else
zip = TRUE;
#endif
}
return k;
}
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);
}
void TArchive_app::main_loop()
{
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;
int mode;
long firm;
char floppy;
TString desc(80);
bool temp;
bool zip;
TFilename floppy_path;
TString80 desc;
while ((k = query(mode, firm, floppy, desc, temp, zip)) != K_QUIT)
{
while ((k = query(mode, firm, floppy_path, desc)) != K_QUIT)
{
if (mode)
{
if (k == K_SAVE)
{
if (zip)
_arc.zip(firm, floppy, desc);
#if XVT_OS == XVT_OS_WIN
{
const bool use_zip = TRUE;
if (use_zip)
backup(mode, firm, floppy_path, desc);
else
_arc.backup(firm, floppy, desc);
#endif
{
TArchive arc;
arc.backup(mode, firm, floppy_path[0], desc);
}
}
else
{
if (zip)
_arc.unzip(firm, floppy, temp);
#if XVT_OS == XVT_OS_WIN
{
TFilename ini_name; ini_name = floppy_path; ini_name.add("backup.ini");
if (os_is_removable_drive(floppy_path.left(3)))
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
_arc.restore(firm, floppy, temp);
#endif
error_box("Impossibile trovare il file %s", (const char*)ini_name);
}
}
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[])
{
TArchive_app a;

View File

@ -2,15 +2,13 @@
#define F_RAGSOC 102
#define F_FLOPPY 104
#define F_DESCR 105
#define F_TEMP 106
#define F_PATH 106
#define F_SALVA 107
#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"
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
PROMPT 1 1 "Disco "
ITEM "A|A:"
ITEM "B|B:"
ITEM "A|A:" MESSAGE CLEAR,F_PATH
ITEM "B|B:" MESSAGE CLEAR,F_PATH
END
STRING F_PATH 45
BEGIN
PROMPT 15 1 "Percorso "
END
BOOLEAN F_DITTA
BEGIN
PROMPT 20 1 "Dati ditta"
MESSAGE TRUE ENABLE,1@|"X",F_770
PROMPT 1 2 "Dati ditta"
MESSAGE TRUE ENABLE,1@|"X",F_770|"X",F_CESP
MESSAGE FALSE CLEAR,1@
END
BOOLEAN F_COM
BEGIN
PROMPT 20 2 "Dati comuni"
PROMPT 1 3 "Dati comuni"
MESSAGE TRUE "X",F_CONFIG
END
BOOLEAN F_CONFIG
BEGIN
PROMPT 20 3 "File di configurazione"
PROMPT 1 4 "File di configurazione"
END
BOOLEAN F_770
BEGIN
PROMPT 20 4 "Dati 770"
PROMPT 1 5 "Dati 770"
END
BOOLEAN F_CESP
BEGIN
PROMPT 20 5 "Cespiti"
PROMPT 1 6 "Cespiti"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 48 1 "Ditta "
PROMPT 15 2 ""
USE LF_NDITTE
INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA
@ -50,43 +55,21 @@ BEGIN
GROUP 1
END
TEXT DLG_NULL
STRING F_RAGSOC 50 45
BEGIN
PROMPT 48 2 "Non specificata = Tutte"
PROMPT 24 2 ""
FLAGS "D"
END
BUTTON F_ALL 10 2
BEGIN
PROMPT 56 4 "~Tutti"
MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CESP
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
PROMPT 58 4 "~Tutti"
MESSAGE "X",F_DITTA|"X",F_COM|"X",F_CONFIG|"X",F_770|"X",F_CESP|"",F_CODDITTA
END
STRING F_DESCR 50
BEGIN
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"
PROMPT 1 7 "Descrizione "
END
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 MSK_23_LOGIC 101
#define MSK_23_PHYSIC 102
#define MSK_23_FILTER 103
#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
#define DLG_RESET 100
#define F_PATH 101
#define F_STUDENT 102
#define F_SOLUTION 103
#define F_TREE 150

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
cambio = 1936.27 / cambio;
cambio.round(2);
cambio.round(5);
}
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
cambio = 1936.27 / cambio;
cambio.round(2);
cambio.round(5);
}
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_CODICEREG).show();
//}
app()._ragsoc = "SOCIETA' ";
app()._ragsoc << nditte.get(N_RAGSOC);
app()._ragsoc = nditte.get(N_RAGSOC);
m.set(F_RAGSOC,app()._ragsoc);
const TString16 tipoa = nditte.get(N_TIPOA);

View File

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

View File

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

View File

@ -90,7 +90,7 @@ void Stampa_condizioni_pagamento_application::print_header()
reset_header ();
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++, "@47gTp @53gInizio @66gMese @73gGiorni@89gIntervallo@108gScadenze");
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)
{
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"));
set_row(2,"");
}
@ -123,10 +123,20 @@ bool TAnaprint_app::preprocess_page(int file, int counter)
_com = current_cursor()->curr(LF_ANAG).get("COMRES");
if (_com.empty())
_com = current_cursor()->curr(LF_ANAG).get("COMRF");
_phone = current_cursor()->curr(LF_ANAG).get("PTELRF");
_phone.trim();
if (!_phone.empty()) _phone << '/';
_phone << current_cursor()->curr(LF_ANAG).get("TELRF");
if (_pr_what == nditte)
{
_phone = current_cursor()->curr(LF_NDITTE).get("PTEL");
_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);
_com = cc.get("DENCOM");
@ -290,7 +300,7 @@ bool TAnaprint_app::set_print(int)
_pr_type = elenco;
// cio' che e' blu collega al modulo anagrafiche
_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;
case BUT_BA6_SCHEDE:
disable_links();
@ -372,7 +382,7 @@ bool TAnaprint_app::set_print(int)
break;
case BUT_BA6_RUBRICHE:
_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;
break;
}

View File

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

View File

@ -841,7 +841,7 @@ void TAnaprint_app::set_rubriche()
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,"RAGSOC"));
}
@ -879,12 +879,12 @@ void TAnaprint_app::set_elenco()
FLD(LF_ANAG,"RAGSOC"));
}
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,"RAGSOC"));
break;
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,"RAGSOC"),
FLD(LF_NDITTE,"TIPOA"),
@ -918,7 +918,7 @@ void TAnaprint_app::set_headers()
case anagiu:
set_background("W1l{1 2 132 2}W4l{1 5 132 5}");
set_header(1,"@bELENCO PERSONE %s@82gStudio@96gData"
"@101g @< @110g Pag. @#", _pr_what == anafis ? "FISICHE" :
"@101g @> @112g Pag. @#", _pr_what == anafis ? "FISICHE" :
"GIURIDICHE");
set_header(3,"@iCodice@58gCodice");
set_header(4,"@iAnagr. Ragione sociale/cognome e nome@58gDitta"
@ -928,7 +928,7 @@ void TAnaprint_app::set_headers()
case nditte:
set_background("W1l{1 2 132 2}W4l{1 5 132 5}");
set_header(1,"@bELENCO DITTE@82gStudio@96gData"
"@101g @< @110g Pag. @#");
"@101g @> @112g Pag. @#");
set_header(3,"@iCodice@50gT");
set_header(4,"@iAnagr. Denominazione sociale@50gP Codice"
"@61gRagione sociale/Cognome e nome");
@ -943,14 +943,22 @@ void TAnaprint_app::set_headers()
case anafis:
case anagiu:
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");
set_header(3,"@iCodice Cognome e nome");
set_header(5,"");
break;
case nditte:
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(5,"");
break;

View File

@ -2,22 +2,25 @@
#include <automask.h>
#include <config.h>
#include <defmask.h>
#include <dongle.h>
#include <execp.h>
#include <expr.h>
#include <golem.h>
#include <tabutil.h>
#include <prefix.h>
#include <recarray.h>
#include <relation.h>
#include <sheet.h>
#include <utility.h>
#include <dongle.h>
#include <os_dep.h>
#include <viswin.h>
#define NO_MFC
#include <netsock.h>
#include "ba7.h"
#include "ba7100a.h"
#define NOT_TRANS -883
#define NOT_GEST -884
///////////////////////////////////////////////////////////
// TConfig utilities
@ -86,7 +89,7 @@ bool TMail_box::logon(const char* ser, const char* usr, const char* pwd)
{
if (_connection)
logoff();
if (!IsOk())
return error_box("Impossibile inizializzare il client POP3");
@ -100,24 +103,27 @@ bool TMail_box::logon(const char* ser, const char* usr, const char* pwd)
if (_connection != 0)
{
TString buf;
TString req;
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box("Il server POP3 %s non risponde",
(const char*)server);
return error_box("Il server POP3 %s non risponde\nRisultato : %s",
(const char*)server, (const char *)buf);
buf = "USER "; buf << user << '\n';
buf = "USER "; buf << user << "\r\n";
WriteLine(_connection, buf);
req = buf;
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box("Il server POP3 %s non accetta l'utente %s",
(const char*)server, (const char*)user);
return error_box("Il server POP3 %s non accetta l'utente %s\nRichiesta : %sRisultato : %s",
(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);
req = buf;
ReadLine(_connection, buf);
if (buf[0] != '+')
return error_box("Il server POP3 %s non accetta l'utente %s",
(const char*)server, (const char*)user);
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 *) req, (const char *)buf);
}
else
return error_box("Impossibile contattare il server POP3 %s",
@ -130,7 +136,7 @@ void TMail_box::logoff()
{
if (_connection)
{
WriteLine(_connection, "QUIT\n");
WriteLine(_connection, "QUIT\r\n");
RemoveConnection(_connection);
_connection = NULL;
}
@ -142,7 +148,7 @@ bool TMail_box::list(TString_array& a)
if (ok)
{
TString buf;
buf = "LIST\n";
buf = "LIST\r\n";
WriteLine(_connection, buf);
ReadLine(_connection, buf);
ok = buf[0] == '+';
@ -197,21 +203,28 @@ int TMail_box::get(TMail_messages& m)
m.add(msgptr);
TMail_message& msg = *msgptr;
buf = "RETR "; buf << *row << '\n';
buf = "RETR "; buf << *row << "\r\n";
WriteLine(_connection, buf);
ReadLine(_connection, buf);
bool ok = buf[0] == '+';
EncodingType encoding = enc_plain_text;
bool in_body = FALSE;
bool in_section = FALSE;
bool buf_already_read = FALSE;
boundary.cut(0);
while (ok)
{
if (!ReadLine(_connection, buf))
{
if (!buf_already_read)
{
ok = FALSE;
break; // Unexpected EOF
if (!ReadLine(_connection, buf))
{
ok = FALSE;
break; // Unexpected EOF
}
}
else
buf_already_read = FALSE;
if (buf[0] == '.')
{
buf.ltrim(1);
@ -345,6 +358,8 @@ int TMail_box::get(TMail_messages& m)
{
ReadLine(_connection, buf);
bnd = buf.find("oundary=");
if (bnd < 0)
buf_already_read = TRUE;
}
if (bnd > 0)
{
@ -367,7 +382,7 @@ bool TMail_box::remove(const char* id)
if (ok)
{
TString buf;
buf << "DELE " << id << '\n';
buf << "DELE " << id << "\r\n";
WriteLine(_connection, buf);
ReadLine(_connection, buf);
ok = buf[0] == '+';
@ -436,7 +451,9 @@ TFilter_expr::TFilter_expr(TAutomask& m, int logicnum, const char* expr)
class TMailer_mask : public TAutomask
{
long _timer_id;
long _secs;
int _mail_semaphore;
TViswin * _vv;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
@ -452,7 +469,8 @@ protected:
public:
void test_delete();
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 auto_save_all();
@ -645,7 +663,38 @@ bool TMailer_mask::file2app(const TString& file, TString& app) const
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);
@ -656,30 +705,34 @@ bool TMailer_mask::save_curr_line()
const TString& msg = m.get(F_BODY);
if (msg.find("[Transaction]") < 0)
{
err = NOT_TRANS;
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");
ok = ini.get("Result") == "OK";
const TString& subj = m.get(F_SUBJECT);
if (!file2app(subj, appname)) // It hasn't a valid application
{
err = NOT_GEST;
return FALSE;
}
::remove(tmp);
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 (m.is_running())
@ -698,33 +751,83 @@ bool TMailer_mask::save_curr_line()
if (old_mailto.not_empty())
set_ini_var(CONFIG_INSTALL, "Main", "MailTo", old_mailto);
return TRUE;
return ok;
}
void TMailer_mask::save_all_lines()
{
TMail_lock ml(this);
TWait_cursor hourglass;
{
CHECK(_vv == NULL,"Viswin already open ?");
mail_lock();
TViswin viswin(NULL, "Registrazione documenti", FALSE, TRUE, TRUE);
viswin.open_modal();
_vv = &viswin;
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;
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);
if (body.find("[Transaction]") >= 0)
msg.format("Messaggio %d ", nrow+1);
if (*row->get(0) != 'X')
{
sf.select(nrow);
one_saved |= save_curr_line();
row->get(sf.cid2index(F_BODY), body);
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?"))
{
#else
if (one_saved)
#endif
{
test_delete();
fill_messages();
}
_vv = NULL;
}
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:
if (e == fe_init || e == fe_modify)
{
if (_timer_id)
if (_timer_id != XVT_TIMER_ERROR)
{
xvt_timer_destroy(_timer_id);
_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());
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)
return error_box("Impossibile impostare il timer");
}
@ -765,8 +869,25 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
}
break;
case DLG_USER:
if (e == fe_button)
save_curr_line();
if (e == fe_button)
{
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;
case DLG_SAVEREC:
if (e == fe_button)
@ -849,9 +970,10 @@ void TMailer_mask::auto_save_all()
{
if (_mail_semaphore == 0)
{
TMail_lock ml(this);
mail_lock();
test_delete();
fill_messages();
mail_unlock();
if (!field(F_TIMER).empty())
save_all_lines();
}
@ -860,11 +982,23 @@ void TMailer_mask::auto_save_all()
}
void TMailer_mask::handler(WINDOW win, EVENT* ep)
{
{
if (ep->type == E_TIMER)
{
if (ep->v.timer.id == _timer_id && _mail_semaphore == 0)
auto_save_all();
{
_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);
}
@ -894,7 +1028,8 @@ void TMailer_mask::load()
TMailer_mask::TMailer_mask()
: TAutomask("ba7100a"),
_timer_id(XVT_TIMER_ERROR), _mail_semaphore(0)
_timer_id(XVT_TIMER_ERROR), _mail_semaphore(0),
_vv(NULL)
{
load();
if (user() != ::dongle().administrator())

View File

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

View File

@ -187,6 +187,7 @@ public:
void convert_cap() const;
void convert_uue() const;
void convert_pim2prm() const;
void convert_riba_tcf() const;
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
};
@ -333,6 +334,10 @@ bool TConversione_archivi::menu(MENU_TAG)
if (_codditta > 0)
convert_pim2prm();
break;
case 18:
if (_codditta > 0)
convert_riba_tcf();
break;
default:
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
///////////////////////////////////////////////////////////
@ -1643,7 +1667,7 @@ int main(int argc,char** argv)
{
const int r = (argc > 1) ? abs(atoi(argv[1])) : 0;
if (r < 0 || r > 17)
if (r < 0 || r > 18)
{
error_box(usage);
return 100;

View File

@ -558,10 +558,12 @@ int main(int argc,char** argv)
r=bainst31(argc, argv);// pre/post installazione vendite:
else if (mod == "mg")
r=bainst32(argc, argv);// pre/post installazione magazzino:
else if (mod == "ef")
r=bainst34(argc, argv);// pre/post installazione effetti:
else if (mod == "sv")
r=bainst38(argc, argv);// pre/post installazione statistiche:
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")
r=bainst39(argc, argv);// pre/post installazione MRP
else

View File

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

View File

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

View File

@ -4,18 +4,21 @@
#include <mask.h>
#include <isam.h>
#include <config.h>
#include <tabutil.h>
#include "bainst.h"
#include "bainst07.h"
#include "bainst00.h"
class TInstall_BA : public TInstallmodule_app
{
private:
protected:
virtual bool modal() const {return FALSE;}
virtual bool modal() const {return TRUE;}
virtual int module_number() const {return 0;}
virtual bool install_firm() {return TRUE;} // no firm installation
virtual bool install_com() {return TRUE;} // no com installation
// virtual bool install_com() {return TRUE;} // no com installation
virtual bool install_com();
virtual bool load_default_data() const ;
virtual bool post_installer();
public:
@ -80,6 +83,26 @@ bool TInstall_BA::post_installer()
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)
{
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);
protected:
virtual bool modal() const {return FALSE;}
virtual int module_number() const {return 7;}
virtual bool install_firm() {return TRUE;} // no firm installation
virtual bool install_com();
virtual bool post_installer();
public:
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
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"
END
STRING FLD_TABIVA_S10 3
STRING FLD_TABIVA_S10 4
BEGIN
PROMPT 3 12 "Riga vendite prospetto IVA periodica "
FIELD S10
FLAGS "U"
SHEET "Riga|Descrizione@60"
INPUT FLD_TABIVA_S10
ITEM " |Nessuno"
ITEM "VP1|Ammontare complessivo operazioni attive"
ITEM "VP2|Ammontare complessivo operazioni intracomunitarie"
ITEM "|Nessuno"
ITEM "VP1|Operazioni attive"
ITEM "VP1A|Operazioni attive ed anche cessioni intracomunitarie"
OUTPUT FLD_TABIVA_S10
END
STRING FLD_TABIVA_S11 3
STRING FLD_TABIVA_S11 4
BEGIN
PROMPT 3 13 "Riga acquisti prospetto IVA periodica "
FIELD S11
FLAGS "U"
SHEET "Riga|Descrizione@60"
INPUT FLD_TABIVA_S11
ITEM " |Nessuno"
ITEM "VP3|Ammontare complessivo operazioni passive"
ITEM "VP4|Ammontare complessivo operazioni intracomunitarie"
ITEM "|Nessuno"
ITEM "VP2|Operazioni passive"
ITEM "VP2A|Operazioni passive ed anche acquisti intracomunitari"
ITEM "VP3|Importazioni di oro e argento"
OUTPUT FLD_TABIVA_S11
END

View File

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

View File

@ -63,7 +63,14 @@ END
STRING FLD_TABSTA_S7_TABVAL_S0 50
BEGIN
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
STRING FLD_TABSTA_S2 10

View File

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

View File

@ -75,7 +75,11 @@ END
STRING FLD_TABUID_S6_COMUNI_DENCOM 50
BEGIN
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
STRING FLD_TABUID_S6_COMUNI_PROVCOM 2

View File

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

View File

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

View File

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

View File

@ -37,5 +37,7 @@ ACNV(119)=77cnv 1
ACNV(13)=bacnv 16
[199517]
ACNV(5)=bacnv 17
[199518]
ACNV(31)=bacnv 18
[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 4: cg0500(argc,argv); break; // Causali contabili
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);
return 0;

View File

@ -4,11 +4,13 @@
#include <golem.h>
#include <msksheet.h>
#include <relapp.h>
#include <recarray.h>
#include <sheet.h>
#include <validate.h>
#include <utility.h>
#include <pconti.h>
#include <comuni.h>
#include <clifo.h>
#include <anagr.h>
#include <anafis.h>
@ -166,7 +168,7 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
return ok;
TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
if ( f.get().not_empty() && !clifo.empty() )
if (f.get().not_empty() && !clifo.empty() )
{
clifo.zero() ;
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))
{
f.message_box("Partita iva gia' utilizzata per il codice %c/%ld",
t, s);
ok = f.error_box("Partita iva gia' utilizzata per il codice %c/%ld"
"\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_FAX));
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;
// Load the sheets of CODINDDOC, CODINDSP, CODINDEFF.

View File

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

View File

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

View File

@ -5,7 +5,6 @@
#include <mask.h>
#include <printapp.h>
#include <tabutil.h>
//#include <utility.h>
#include <prefix.h>
#include "cg0.h"
@ -19,8 +18,6 @@
#include <nditte.h>
HIDDEN TString80 TMP;
enum liste {
visualizza=1,
stampa=2,
@ -135,6 +132,8 @@ class TProgressivi_iva : public TPrintapp
Importi _mesi[13];
liste _tipo_lista;
TString TMP; // Ex HIDDEN: bestie!
protected:
static bool tipo_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"
//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);
if (reg.read() != NOERR) reg.zero();
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);
break;
case acq_amm_ultdetr:
{
real detr = imponibile * real(0.06);
if (_mese != 13)
_iva_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);
}
if (soggetto)
{
const real detr = imponibile * real(0.06);
if (_mese != 13)
_iva_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;
case acq_simp:
case vend_simp:
case cess_amm:
case acq_beni_riv:
tabiva.put("CODTAB",codiva);
if (tabiva.read() == NOERR)
// I non soggetti non vanno considerati nel totale acq. beni rivendita
if (tabiva.get("S1") != "NS")
{
if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,ZERO);
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
_iva1_array.add_riga(tipo,imponibile,imposta,ZERO);
}
case acq_beni_ammort:
case acq_beni_ammort_nd:
case acq_beni_leasing:
if (soggetto)
{
if (_mese != 13)
_iva_array.add_riga(tipo,imponibile,imposta,ZERO);
if ((_st_inizio_anno && is_month_plain(mese, _mese, freq)) || _mese == 13)
_iva1_array.add_riga(tipo,imponibile,imposta,ZERO);
}
break;
default:
if (sosp_imp == normale || sosp_imp == nessuna) // Esclude quelli valevoli solo liq o solo vol.aff. dai riepiloghi altri dati
@ -482,17 +490,26 @@ void TProgressivi_iva::cerca_i_pim()
codiva = codtab.mid(16,4);
tipoiva = pim.get("S5");
if (anno != _annoiva) continue;
if (anno != _annoiva)
continue;
//Modifica del 12/07/1995
if (tipoiva == "VE") continue;
if (tipoiva == "VE")
continue;
//Fine
if (_livelloprog == 1) //riepilogo per aliquota
{
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'
{
@ -506,6 +523,14 @@ void TProgressivi_iva::cerca_i_pim()
if (reg.read() != NOERR) reg.zero();
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))
{
switch(tipo)
@ -532,7 +557,8 @@ void TProgressivi_iva::cerca_i_pim()
impos += imposta;
}
break;
case vend_simp:
case vend_simp:
if (!soggetto) break;
if (_tipoprog == 2) break; //acquisti
if (_sospmsk == 2) //nella maschera e' stato richiesto
{ //vendite in sospensione d'imposta
@ -582,6 +608,7 @@ void TProgressivi_iva::cerca_i_pim()
}
break;
case acq_simp:
if (!soggetto) break;
if (_tipoprog == 1) break;
if (_tipo_aliq == 7)
{
@ -590,18 +617,16 @@ void TProgressivi_iva::cerca_i_pim()
}
break;
case acq_beni_riv:
if (!soggetto) break;
if (_tipoprog == 1) break;
tabiva.put("CODTAB",codiva);
if (tabiva.read() == NOERR)
// I non soggetti non vanno considerati nel totale acq. beni rivendita
if (tabiva.get("S1") != "NS")
if (_tipo_attiv == 1)
{
impo += imponibile;
impos += imposta;
}
if (_tipo_attiv == 1)
{
impo += imponibile;
impos += imposta;
}
break;
case acq_beni_ammort:
if (!soggetto) break;
if (_tipoprog == 1) break;
if (_tipo_attiv == 2)
{
@ -610,6 +635,7 @@ void TProgressivi_iva::cerca_i_pim()
}
break;
case acq_beni_ammort_nd:
if (!soggetto) break;
if (_tipoprog == 1) break;
if (_tipo_attiv == 3)
{
@ -618,6 +644,7 @@ void TProgressivi_iva::cerca_i_pim()
}
break;
case acq_beni_leasing:
if (!soggetto) break;
if (_tipoprog == 1) break;
if (_tipo_attiv == 4)
{
@ -626,6 +653,7 @@ void TProgressivi_iva::cerca_i_pim()
}
break;
case acq_amm_ultdetr:
if (!soggetto) break;
if (_tipoprog == 1) break;
if (_tipo_attiv == 5)
{
@ -634,6 +662,7 @@ void TProgressivi_iva::cerca_i_pim()
}
break;
case cess_amm:
if (!soggetto) break;
if (_tipoprog == 2) break;
if (_livelloprog == 2) //Nel caso di vendite per attivita' il tipo costo/ricavo
{ //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",
&t_impov,&t_imposv,&t_impoa,&t_imposa,&t_impobd,&t_imposbd);
r+=3;
int kk = r;
/*
set_row(r++, "ALTRI DATI RELATIVI ALLA DICHIARAZIONE@54gImponibile@74gImposta@91gDetrazione");
r++;
*/
const int kk = r; // memorizza riga in cui scrivere "altri dati relativi alla dichiarazione"
r+=2;
st_riga = FALSE;
@ -1204,20 +1229,14 @@ void TProgressivi_iva::preprocess_header()
int soh = 1;
TString sep(132);
TString ragsoc(50);
//TString attprev(5);
TString16 descf;
TLocalisamfile nditte(LF_NDITTE);
nditte.zero();
nditte.put(NDT_CODDITTA, _codditta);
if (nditte.read() == NOERR)
{
ragsoc = nditte.get(NDT_RAGSOC);
//attprev = nditte.get(NDT_CODATTPREV);
}
//TString80 descr = desc_attivita(attprev);
TString80 descr = desc_attivita(_cod_att);
reset_header();
@ -1250,10 +1269,6 @@ void TProgressivi_iva::preprocess_header()
const char* pro_des = _tipo_prog_reg == 'L' ? "liquidazione IVA" : "Volume Affari";
/*
set_header (soh++, "Riepilogo progressivi IVA del periodo %s %d Cod. Att. %s %s", itom(_mese), _anno, (const char*) _cod_att, (const char*) descr);
set_header (soh++, (const char *) sep);
*/
TString periodo;
if (f == 'M')

View File

@ -738,10 +738,10 @@ void CG1100_application::set_con_IV()
}
}
}
set_row (_i,"@58g$[r]%3d$[n]", _gruppo);
set_row (_i,"@62g$[r]%3d$[n]", _conto);
set_row (_i,"@58g$[b]%3d$[n]", _gruppo);
set_row (_i,"@62g$[b]%3d$[n]", _conto);
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);
if (sez_opp != '0')
@ -811,7 +811,7 @@ void CG1100_application::set_senza_IV_ana()
_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_SOTTOCONTO, "######"));
@ -869,13 +869,13 @@ void CG1100_application::set_con_ana()
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)
set_row (_i,"@66g$[r]%3d$[n]", _conto);
set_row (_i,"@66g$[b]%3d$[n]", _conto);
if (_sottoc != 0)
set_row (_i,"@70g$[r]%6ld$[n]", _sottoc);
set_row (_i,"@70g$[b]%6ld$[n]", _sottoc);
if (_gruppo > 99 || _conto > 99)
set_row(_i,"@76g*");
@ -896,7 +896,7 @@ void CG1100_application::set_senza_ana()
{
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_SOTTOCONTO, "######"));
@ -944,7 +944,7 @@ void CG1100_application::set_completa()
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_SOTTOCONTO, "######"));
@ -1224,11 +1224,11 @@ bool CG1100_application::set_print(int)
if (tasto == K_ENTER)
{
_tipo_stampa = (stampe)_msk->get_int(F_SCELTA_STAMPA);
_salto_pag = _msk->get_bool (F_SALTO_PAGINA);
_data_stampa = _msk->get (F_DATA_STAMPA);
_salto_pag = _msk->get_bool(F_SALTO_PAGINA);
_data_stampa = _msk->get(F_DATA_STAMPA);
// scegli_cur();
enable_link("Collegamento Piano dei conti : ", 'r');
enable_link("Collegamento Piano dei conti: ", 'b');
set_multiple_link(TRUE);
_sez_stamp = ' ';

View File

@ -620,7 +620,7 @@ void TPrintclifo_app::header_rubriche()
void TPrintclifo_app::set_elenco()
{
// 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);
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));
@ -638,7 +638,7 @@ void TPrintclifo_app::header_rubriche()
//modifica del 27/04/1995
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);
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);
@ -655,7 +655,7 @@ void TPrintclifo_app::set_elenco()
void TPrintclifo_app::set_rubriche()
{
// 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);
//set_row(1,"@60g#t@100g@s@106g#t@127g@s", &_indir, FLD(LF_CLIFO, CLI_CAPCF),
// &_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(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);
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)
{
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);
@ -988,7 +988,7 @@ bool TPrintclifo_app::ges_ven()
bool TPrintclifo_app::user_create()
{
// 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==STATONASC|COM==COMNASC", 1, 0, COMNASC_ALIAS);
if (ges_ven())

View File

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

View File

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

View File

@ -1,15 +1,20 @@
//****************************
//* Aggiornamento Tipo Conto *
//****************************
#include <recarray.h>
#include <mov.h>
#include <rmoviva.h>
#include <nditte.h>
#include "cg1300.h"
#include "cg1302.h"
#include "cglib01.h"
const int TAgg_tconto::look_reg (const char* cod, int anno)
{
/*
TTable tab_reg("REG");
TString codtab;
codtab.format("%4d%-3s", anno, cod);
@ -23,13 +28,18 @@ const int TAgg_tconto::look_reg (const char* cod, int anno)
tipo_reg = 0;
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()
{
_rel = new TRelation(LF_MOV);
_rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
_cur = new TCursor(_rel,"",1);
_cur = new TCursor(_rel, "", 1);
add_cursor(_cur);
add_file (LF_MOV);
@ -68,7 +78,7 @@ bool TAgg_tconto::set_print(int)
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)
@ -78,7 +88,7 @@ bool TAgg_tconto::preprocess_page(int file,int counter)
TCursor* cur = current_cursor();
if (file == LF_MOV)
{
TString16 reg = cur->curr().get(MOV_REG);
const TString& reg = cur->curr().get(MOV_REG);
if (reg.empty()) return FALSE;
}
else if (file == LF_RMOVIVA)
@ -150,8 +160,7 @@ void TAgg_tconto::setta_intestazione()
set_header (soh++, (const char*) sep);
sep = "";
sep << "Data @< Pag. @#";
sep << "Data @> Pag. @#";
sep.right_just(127);
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
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
#include <mask.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
@ -15,12 +16,10 @@ inline TAgg_codes& app() { return (TAgg_codes&) main_app(); }
bool TAgg_codes::create()
{
TApplication::create();
_mov = new TLocalisamfile(LF_MOV);
_rmov = new TLocalisamfile(LF_RMOV);
_rmoviva = new TLocalisamfile(LF_RMOVIVA);
dispatch_e_menu (BAR_ITEM(1));
return TRUE;
return TSkeleton_application::create();
}
bool TAgg_codes::destroy()
@ -29,19 +28,17 @@ bool TAgg_codes::destroy()
delete _rmov;
delete _rmoviva;
return TApplication::destroy();
return TSkeleton_application::destroy();
}
bool TAgg_codes::menu(MENU_TAG m)
void TAgg_codes::main_loop()
{
TMask msk("cg1300d");
if (msk.run() == K_ENTER)
return calcola_codes();
else
return FALSE;
calcola_codes();
}
bool TAgg_codes::calcola_codes()
void TAgg_codes::calcola_codes()
{
TLocalisamfile& mov = get_mov();
TEsercizi_contabili esercizi;
@ -73,7 +70,7 @@ bool TAgg_codes::calcola_codes()
righe.read(riga);
righeiva.read(rigaiva);
righe.renum_key(RMV_ANNOES,newcodes);
s_codes = format("%04d",newcodes);
s_codes.format("%04d",newcodes);
righeiva.renum_key(RMI_ANNOES,s_codes);
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);
else message_box("Aggiornamento codice esercizio completata. Modificati %ld movimenti.",modified_recs);
return FALSE;
if (err != NOERR)
warning_box("Aggiornamento codice esercizio interrotta. Rilevato errore %d in riscrittura",err);
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 <mask.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
#include <isam.h>
class TAgg_codes : public TApplication
class TAgg_codes : public TSkeleton_application
{
TLocalisamfile* _mov;
TLocalisamfile* _rmov;
TLocalisamfile* _rmoviva;
public:
TLocalisamfile* _mov;
TLocalisamfile* _rmov;
TLocalisamfile* _rmoviva;
protected:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
TLocalisamfile& get_mov() { return *_mov; }
bool calcola_codes();
virtual void main_loop();
TAgg_codes() {};
virtual ~TAgg_codes() {};
public:
TLocalisamfile& get_mov() { return *_mov; }
void calcola_codes();
};

View File

@ -1411,33 +1411,51 @@ bool TStampa_bilanci::bil_verifica()
saldi.put(SLD_SOTTOCONTO, s);
if (saldi.read() == NOERR)
{
real ss = saldi.get_real(SLD_SALDO);
if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)
if (ss == ZERO && _annoes != 0)
const real ss = saldi.get_real(SLD_SALDO);
if (ss.is_zero())
{
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
if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale;
else
_saldo_ini_avere = -saldo_iniziale;
//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
if (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5)
if (_annoes != 0)
{
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/95
if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale;
//fine
if (_stampav == 1 && sld.significativo())
movimentato = TRUE;
}
else // !movimentato -> _mov_ap e' di sicuro FALSE
{
if (_annoes != 0 && (indbil_conto == 1 || indbil_conto == 2 || indbil_conto == 5))
{
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/95
if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale;
//fine
if (_stampav == 1 && sld.significativo())
movimentato = TRUE;
}
}
}
//if (movimentato)
@ -1747,8 +1765,11 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
conto_mov = TRUE;
if (sezione == 'D')
_mov_periodo_dare += importo;
else _mov_periodo_avere += importo;
else
_mov_periodo_avere += importo;
_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.
@ -1760,7 +1781,8 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
{
if (sezione == 'D')
_saldo_ini_dare += importo;
else _saldo_ini_avere += importo;
else
_saldo_ini_avere += importo;
_u_max = fnc_max(_u_max, data);
conto_mov = _mov_ap = TRUE;
}
@ -1771,7 +1793,8 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
{
if (sezione == 'D')
_prg_prec_dare += importo;
else _prg_prec_avere += importo;
else
_prg_prec_avere += importo;
_u_max = fnc_max(_u_max, data);
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)
{
//modifica del 21/11/1995
if (_mov_ap)
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
{
saldo_iniziale = _saldo_ini_dare - _saldo_ini_avere;
}
else
{
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
//perche' l'ho gia' considerato nella funzione calcola
real ss = saldi.get_real(SLD_SALDO);
if (ib == 1 || ib == 2 || ib == 5)
if (ss == ZERO && _annoes != 0) //competenza!!!
const real ss = saldi.get_real(SLD_SALDO);
if (ss.is_zero())
{
if (_annoes != 0 && (ib == 1 || ib == 2 || ib == 5))
{
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/1995
if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale;
else
_saldo_ini_avere = -saldo_iniziale;
//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)
if (ib == 1 || ib == 2 || ib == 5)
if (_annoes != 0) //cioe' se sto ragionando per competenza
{
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/1995
if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale;
else _saldo_ini_avere = -saldo_iniziale;
//fine
movimentato = sld.significativo();
}
else
{
if (_annoes != 0 && (ib == 1 || ib == 2 || ib == 5))
{
saldo_iniziale = sld.saldofin_esprec(_annoes,g,c,s);
//modifica del 21/11/1995
if (saldo_iniziale > ZERO)
_saldo_ini_dare = saldo_iniziale;
else
_saldo_ini_avere = -saldo_iniziale;
//fine
movimentato = sld.significativo();
}
}
}
if (!movimentato)
@ -3214,16 +3257,15 @@ void TStampa_bilanci::stampa_riga_totali(int r)
if (_saldo_finale_tot != ZERO)
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
{
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);
}
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
{
@ -3248,22 +3290,20 @@ void TStampa_bilanci::stampa_riga_totali(int r)
{
if (app == 'D')
{
set_row(r++,"@1g****** ********@17gTOTALE 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);
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_finale_tot);
}
else
{
set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@100g%r@114g!@132g%r@148g!",&_saldo_dare_tot,
&_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot,
&_saldo_finale_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_finale_tot);
}
if ((_tipo_stampa1 == 1 && _datada == _dataini) || _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
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 (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
set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep);
}
else if ( !(c == 0 && s == 0) ) //se cioe' non e' un gruppo
{
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
set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep);
}
@ -3851,8 +3891,8 @@ int TStampa_bilanci::stampa_intestazione_ditta()
(const char*)_provfis);
r++;
printer().setdate(_data);
riga = "Data @< Pag. @#";
riga.right_just(_stampa_width-6);
riga = "Data @> Pag. @#";
riga.right_just(_stampa_width-10);
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
set_header (r, "%s", (const char*) riga);

View File

@ -2,14 +2,14 @@
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 9 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
PROMPT -12 -11 ""
END
BUTTON DLG_QUIT 9 2
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
PROMPT -22 -11 ""
END
ENDPAGE
@ -68,7 +68,7 @@ BEGIN
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,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
ITEM "2|Bilancio di verifica"
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_STAMPAV|RESET,F_STAMPAV
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
END
@ -174,12 +174,12 @@ BEGIN
ITEM "3|Solo provvisori"
END
LIST F_MODULO 8
LIST F_MODULO 1 12
BEGIN
PROMPT 2 12 "Dimensione modulo "
HELP "Indicare il numero di caratteri del foglio (larghezza)"
ITEM "1|132 crt."
ITEM "2|198 crt."
ITEM "1|132 colonne"
ITEM "2|198 colonne"
END
BOOLEAN F_QUADRATURA

View File

@ -119,8 +119,8 @@ int CG1700_application::stampa_intestazione_ditta()
(const char*)_provfis);
r++;
printer().setdate(_data);
riga = "Data @< Pag. @#";
riga.right_just(127);
riga = "Data @> Pag. @#";
riga.right_just(125);
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
set_header (r, "%s", (const char*) riga);
r++;
@ -269,6 +269,10 @@ bool CG1700_application::set_print(int)
if (tasto == K_ENTER)
{
_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);
return TRUE;
}

View File

@ -1,9 +1,13 @@
#ifndef __CG1700_H
#define __CG1700_H
#define F_CODDITTA 101
#define F_CODDITTA 101
#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

View File

@ -1,18 +1,18 @@
#include "cg1700.h"
PAGE "Stampa causali" -1 -1 70 8
PAGE "Stampa causali" -1 -1 70 9
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 1 "Ditta "
FLAGS "FRD"
USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA
DISPLAY "Ragione sociale @50" RAGSOC
OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
PROMPT 1 1 "Ditta "
FLAGS "FRD"
USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA
DISPLAY "Ragione sociale @50" RAGSOC
OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
END
STRING F_RAGSOC 50
@ -28,6 +28,52 @@ BEGIN
FLAGS "A"
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
BEGIN
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
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);
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;
if (tc.descrizione() == "Sconosciuto") err = 1;
else if (tc.sospeso()) err = 2;
if (tc.descrizione() == "Sconosciuto")
err = 1; else
if (tc.sospeso())
err = 2;
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");
continue;
// continue; // Continua ugualmente
}
const char sezione = rcaus->get_char(RCA_SEZIONE);
@ -456,7 +458,6 @@ void TPrimanota_application::init_mask(TMask& m)
disable_menu_item(M_FONT);
read_caus(NULL, 0); // Setta campi obbligatori
fill_sheet(m);
if (_iva == nessuna_iva)
{
@ -491,7 +492,7 @@ void TPrimanota_application::init_mask(TMask& m)
*/
m.show(F_CODIVA, m.insert_mode()); // Codice IVA standard
TSheet_field& is = ivas();
is.enable_column(2, _iva == iva_acquisti); // Tipo detrazione
is.enable_column(4, !m.insert_mode()); // Tipo costo ricavo
@ -518,6 +519,8 @@ void TPrimanota_application::init_mask(TMask& m)
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_DATACAMBIO (GROUP 3)
const bool valuta = _ges_val && is_saldaconto() && causale().valuta();
m.show(-3, valuta);
fill_sheet(m); // Riempe righe contabili coi conti della causale
}
void TPrimanota_application::init_query_mode(TMask& m)

View File

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

View File

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

View File

@ -101,7 +101,7 @@ real TPrimanota_application::totale_documento()
// Certified 99%
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 TBrowse* b = c.browse();
@ -628,6 +628,8 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
const TBill c(r, 3, 0x0);
if (!c.ok())
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);
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')
{
cg.swap_rows(r, i);
cg.force_update();
cg.select(i, FALSE);
cg.post_select(i);
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))
{
TBill c(0, 0, codice, f.dlg() > 300 ? 'F' : 'C');
c.find(); // Carica descrizione, gruppo e conto
m.set(f.dlg()+1, c.descrizione());
c.find(); // Carica gruppo e conto
if (c.ok())
{
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),
clifo.get_int(CLI_CONTORIC),
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);
TEdit_field& upi = m.efield(F_RIEPILOGO);
upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL);
const TString& oldpag = m.get(F_CODPAG);
if (m.is_running())
if (f.focusdirty() && m.is_running())
{
const TString& oldpag = m.get(F_CODPAG);
const TString& s = clifo.get(CLI_CODPAG);
if (/* s.not_empty() && */ s != oldpag)
if (s != oldpag)
{
TEdit_field& cp = m.efield(F_CODPAG);
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)
{
TMask& m = f.mask();
TMask_field& cv = m.field(F_CORRVALUTA);
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.on_hit();
}
@ -2511,17 +2519,19 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key)
{
f.set(m.get(F_IMPONIBILI));
f.set_dirty();
m.reset(F_CORRVALUTA);
cv.set("");
key = K_TAB;
}
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 real corrlit = f.get();
real corrval = cambio.lit2val(corrlit);
m.set(F_CORRVALUTA, corrval);
const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA));
TCurrency imp(real(f.get()));
imp.change_value(cambio);
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%
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())
{
TMask& m = f.mask();
if (m.get(F_CORRLIRE).empty())
if (cl.empty())
{
const TValuta cambio(m, F_VALUTAINTRA, SK_DATACAMBIO, F_CAMBIOINTRA, SK_CONTROEURO);
const real corrval = f.get();
real corrlit = cambio.val2lit(corrval);
m.set(F_CORRLIRE, corrlit);
const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA));
TCurrency imp(real(f.get()), cambio);
imp.change_to_firm_val();
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())
{
TMask_field& cl = f.mask().field(F_CORRLIRE);
cl.set_dirty();
cl.on_hit();
}
}
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++)
{
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());
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;

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
#include <applicat.h>
#include <mask.h>
#include <automask.h>
#include <progind.h>
#include <sheet.h>
#include <tabutil.h>
#include <urldefid.h>
@ -34,33 +35,232 @@ TString& add_plural(TString& s, long num, const char* name)
return s;
}
class TProvvisori_app : public TApplication
{
TLocalisamfile* _sal;
TLocalisamfile* _cau;
TTable* _reg;
class TProvvisori_msk : public TAutomask
{
char _provv; // Tipo provvisori da cancellare
TString16 _from_date, _to_date; // Range date 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;
protected: // TApplication
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual void main_loop();
protected:
static bool date_handler(TMask_field& f, KEY k);
TCursor& create_cursor(TMask* m);
public:
void inizia_saldi(const TRectype& mov);
void aggiungi_saldi(const TRectype& rmov, bool lettura);
void aggiorna_saldi();
bool confirm_provv(TCursor& cur, TProgind& pi);
bool delete_provv(TCursor& cur, TProgind& pi);
static bool filter(const TRelation* rel);
bool confirm_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL);
bool delete_provv(TCursor& cur, TProgind& pi, TCursor_sheet* sheet= NULL);
void auto_delete(TCursor& cur);
@ -74,23 +274,13 @@ inline TProvvisori_app& app()
bool TProvvisori_app::create()
{
TApplication::create();
_cau = new TLocalisamfile(LF_CAUSALI);
_sal = new TLocalisamfile(LF_SALDI);
_reg = new TTable("REG");
dispatch_e_menu(BAR_ITEM(1));
return TRUE;
open_files(LF_TAB, LF_MOV, LF_CAUSALI, LF_SALDI, NULL);
return TSkeleton_application::create();
}
bool TProvvisori_app::destroy()
{
delete _reg;
delete _sal;
delete _cau;
return TApplication::destroy();
return TSkeleton_application::destroy();
}
void TProvvisori_app::inizia_saldi(const TRectype& r)
@ -100,14 +290,15 @@ void TProvvisori_app::inizia_saldi(const TRectype& r)
_saldi.reset();
tiposal tsal = normale;
const TString& c = r.get(MOV_CODCAUS);
const TString16 c = r.get(MOV_CODCAUS);
if (c.not_empty())
{
_cau->put(CAU_CODCAUS, c);
if (_cau->read() == NOERR)
const TRectype& cau = cache().get(LF_CAUSALI, c);
if (!cau.empty())
{
if (_cau->get_char(CAU_MOVAP) == 'A') tsal = apertura;
else if (_cau->get_char(CAU_MOVAP) == 'C') tsal = chiusura;
const char movap = cau.get_char(CAU_MOVAP);
if (movap == 'A') tsal = apertura; else
if (movap == 'C') tsal = chiusura;
}
}
_saldi.set_tipo_saldo(tsal);
@ -133,13 +324,19 @@ void TProvvisori_app::aggiorna_saldi()
_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 rmov(LF_RMOV);
if (sheet && sheet->checked() == 0)
sheet = NULL;
for (cur = 0; cur.pos() < cur.items(); ++cur)
{
if (sheet && !sheet->checked(cur.pos()))
continue;
const long numreg = mov.get_long(MOV_NUMREG);
inizia_saldi(mov.curr());
@ -171,16 +368,22 @@ bool TProvvisori_app::confirm_provv(TCursor& cur, TProgind& pi)
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 rmov(LF_RMOV);
TLocalisamfile rmoviva(LF_RMOVIVA);
TString256 error;
if (sheet && sheet->checked() == 0)
sheet = NULL;
TString error(256);
for (cur = 0; cur.pos() < cur.items(); ++cur)
{
{
if (sheet && !sheet->checked(cur.pos()))
continue;
const long numreg = mov.get_long(MOV_NUMREG);
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();
pi.addstatus(1);
if (pi.iscancelled())
return warning_box("Procedura interrotta dall'utente");
}
else
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;
}
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)
{
_from_caus = "";
_to_caus = "ZZZ";
_provv = argv(2)[0];
cur.set_filterfunction(filter);
const long total = cur.items();
TProgind pi(total, "Cancellazione", FALSE, TRUE, 24);
cur.freeze(TRUE);
TProgind pi(total, "Cancellazione movimenti provvisori", TRUE, TRUE);
delete_provv(cur, pi);
cur.freeze(FALSE);
}
bool TProvvisori_app::menu(MENU_TAG)
void TProvvisori_app::main_loop()
{
TMask m("cg2200a");
m.set_handler(F_FROMDATE, date_handler);
TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor();
TProvvisori_msk m;
if (argc() > 2)
{
{
TCursor& cur = m.update_cursor(TRUE);
auto_delete(cur);
return FALSE;
return;
}
m.reset();
while (TRUE)
{
TRectype from(LF_MOV), to(LF_MOV);
cur.setregion(from, to);
cur.set_filterfunction(NULL);
m.reset();
KEY key = m.run();
if (key != K_ENTER && key != K_DEL)
break;
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)
{
const TDate da(from_d);
@ -319,70 +471,41 @@ bool TProvvisori_app::menu(MENU_TAG)
if (da < lp)
{
from_d = lp.string();
const bool ok = yesno_box("Il libro giornale e stato stampato il %s:\n"
"Si desidera modificare la data iniziale?",
(const char*)from_d);
if (!ok) continue;
error_box("Il libro giornale e stato stampato il %s:\n"
"La data inizio elaborazione deve essere almeno il %s",
(const char*)from_d, (const char*)from_d);
m.set(F_FROMDATE, from_d);
continue;
}
}
if (from_d.not_empty())
from.put(MOV_DATAREG, from_d);
const TString& from_r = m.get(F_FROMREG);
if (from_r.not_empty()) from.put(MOV_NUMREG, from_r);
_from_caus = m.get(F_FROMCAUS);
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();
// Recupera sheet dei selezionati ed aggiorna F_SELECTED
TCursor_sheet* sheet = m.get_selection_sheet();
const long total = m.get_long(F_SELECTED);
if (total <= 0)
{
warning_box("Nessun movimento selezionato");
continue;
}
TString action(key == K_ENTER ? "conferma" : "cancellazione");
action << " di "; add_plural(action, total, "movimento");
TString caption("E' stata richiesta la ");
caption << action << '.';
if (total > 0)
{
caption << "\nSi desidera continuare?";
if (!yesno_box(caption)) continue;
}
else
{
warning_box("Nessun movimento nella selezione effettuata");
TString caption;
caption << "E' stata richiesta la " << action << ".\nSi desidera continuare?";
if (!yesno_box(caption))
continue;
}
action[0] = toupper(action[0]);
TProgind pi(total, action, FALSE, TRUE, 24);
cur.freeze(TRUE);
TProgind pi(total, action, TRUE, TRUE);
if (key == K_ENTER)
confirm_provv(cur, pi);
confirm_provv(m.get_cursor(), pi, sheet);
else
delete_provv(cur, pi);
cur.freeze(FALSE);
delete_provv(m.get_cursor(), pi, sheet);
}
return FALSE;
}
int cg2200(int argc, char** argv)
{
TProvvisori_app a;

View File

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

View File

@ -1,19 +1,25 @@
#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
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
DATE F_FROMDATE
BEGIN
PROMPT 2 2 "Data "
HELP "Data del primo movimento provvisorio"
PROMPT 2 2 "Dal "
USE LF_MOV KEY 2 SELECT PROVVIS!=""
INPUT DATAREG F_FROMDATE
INPUT NUMREG F_FROMREG
DISPLAY "Data@10" DATAREG
DISPLAY "Numero@6" NUMREG
DISPLAY "Causale" CODCAUS
@ -21,18 +27,26 @@ BEGIN
DISPLAY "Tipo" PROVVIS
DISPLAY "Descrizione@50" DESCR
OUTPUT F_FROMDATE DATAREG
OUTPUT F_FROMREG NUMREG
END
NUMBER F_FROMREG 5
DATE F_TODATE
BEGIN
PROMPT 32 2 "Operazione "
FLAGS "DR"
PROMPT 25 2 "Al "
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
STRING F_FROMCAUS 3
BEGIN
PROMPT 2 3 "Causale "
PROMPT 2 5 "Dalla "
FLAGS "U"
USE LF_CAUSALI SELECT REG==""
INPUT CODCAUS F_FROMCAUS
@ -45,7 +59,7 @@ END
STRING F_FROMCAUSDESC 50 30
BEGIN
PROMPT 16 3 ""
PROMPT 16 5 ""
USE LF_CAUSALI KEY 2 SELECT REG==""
INPUT DESCR F_FROMCAUSDESC
DISPLAY "Descrizione@60" DESCR
@ -53,31 +67,9 @@ BEGIN
COPY OUTPUT F_FROMCAUS
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
BEGIN
PROMPT 2 7 "Causale "
PROMPT 2 6 "Alla "
FLAGS "U"
COPY USE F_FROMCAUS
INPUT CODCAUS F_TOCAUS
@ -89,19 +81,52 @@ END
STRING F_TOCAUSDESC 50 30
BEGIN
PROMPT 16 7 ""
PROMPT 16 6 ""
COPY USE F_FROMCAUSDESC
INPUT DESCR F_TOCAUSDESC
COPY DISPLAY F_FROMCAUSDESC
COPY OUTPUT F_TOCAUS
END
LIST F_PROVV 10
GROUPBOX DLG_NULL 50 3
BEGIN
PROMPT 2 9 "Tipo "
ITEM "P|Contabili"
ITEM " |Tutti"
ITEM "C|Cespiti"
PROMPT 1 8 "@bDal movimento/Al movimento"
END
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
BUTTON DLG_OK 10 2
@ -115,7 +140,6 @@ BEGIN
MESSAGE EXIT,K_DEL
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -33 -1 ""

View File

@ -1,6 +1,7 @@
//
//Lista movimenti
//
#include <currency.h>
#include <mask.h>
#include <printapp.h>
#include <recarray.h>
@ -116,6 +117,8 @@ protected:
virtual bool set_print(int m);
void init_print(const TMask& m);
void print_intra(int& rr);
public:
bool user_create();
@ -146,7 +149,7 @@ HIDDEN inline TListaMov_application & app()
bool annoes_handler(TMask_field& f, KEY k)
{
if (k == K_TAB)
if (k == K_TAB && f.focusdirty())
{
const int anno = atoi(f.get());
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");
if (_stampa_mess_alleg_iva)
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
set_row(++(*nr), "@11gCodice IVA non presente in tabella");
@ -1201,6 +1204,27 @@ bool TListaMov_application::preprocess_page(int file,int counter)
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)
{
if (count)
@ -1265,15 +1289,7 @@ print_action TListaMov_application::postprocess_page(int file,int count)
if (!_esiste_riga_iva && ! _nonesiste_riga_iva)
stampa_errori_iva(&r, riga._codiva, riga._tipodet, riga._tipocr);
}
real corrval = current_cursor()->file(LF_MOV).get_real(MOV_CORRVALUTA);
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);
}
print_intra(r);
if (_esiste_riga_iva)
set_row(++r, "@11gPresenti righe IVA in una registrazione senza IVA");
if (_nonesiste_riga_iva)
@ -1348,15 +1364,7 @@ break;
reset_print();
TCursor* cur = current_cursor();
int rr = 1;
real corrval = cur->file(LF_MOV).get_real(MOV_CORRVALUTA);
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);
}
print_intra(rr);
_totdocumenti += _totdoc;
TRecnotype pos, items;
bool FINITO = FALSE;
@ -1919,12 +1927,10 @@ bool TListaMov_application::set_print(int m)
_tipo_lista = fatture;
break;
case 'M':
default :
masc = "cg3100a";
_tipo_lista = movimenti;
break;
default:
NFCHECK("Specificare C o M");
return FALSE;
}
TMask msk(masc);
@ -2272,11 +2278,8 @@ void TListaMov_application::preprocess_header()
set_header (soh++, (const char*) sep);
//sep = "Studio ";
sep = "";
sep << "Data @< Pag. @#";
sep.right_just(126);
sep.cut(0) << "Data @> Pag. @#";
sep.right_just(122);
switch (_tipo_lista)
{

View File

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

View File

@ -240,10 +240,23 @@ BEGIN
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODVAL CODTAB
OUTPUT F_DESVAL S0
CHECKTYPE NORMAL
FLAGS "U"
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
ENDMASK

View File

@ -163,8 +163,8 @@ public:
int ricerca_clifo(int riga);
int ricerca_gruppo(int riga);
void calcola_progressivi();
void calcola_progressivi_al();
void calcola_progressivi(bool finali = FALSE);
void calcola_progressivi_al(const TDate& data);
void stampa_progressivi();
int stampa_progressivi(int start_riga);
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)
{
const TMask& m = f.mask();
const short id = f.dlg();
bool warning = FALSE;
const int gruppo = f.mask().get_int(F_GRUPPOINI);
int conto;
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 int gruppo = m.get_int(F_GRUPPOINI);
const int conto = m.get_int(F_CONTOINI_CONTO);
const long sottoconto = f.mask().get_long(id);
const long sottoconto = m.get_long(id);
if ( key == K_ENTER )
{
@ -290,8 +282,8 @@ bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key)
if (conto != 0 && gruppo == 0)
return f.warning_box("Manca il GRUPPO");
}
if (key == K_TAB && f.mask().is_running())
if (key == K_TAB && m.is_running())
{
TString ds;
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;
}
bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key)
{
const TMask& m = f.mask();
const short id = f.dlg();
int conto;
TString ds;
TString80 rs;
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)
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);
const long sottoconto = m.get_long(id);
if ( key == K_ENTER )
{
@ -388,7 +373,7 @@ bool TMastrini_application::sottoc_handler_fine(TMask_field& f, KEY key)
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))
{
@ -535,30 +520,20 @@ bool TMastrini_application::contof_hnd (TMask_field& f, KEY k)
if (gruppof == 0)
return TRUE;
char tipo = f.mask().get(F_TIPOCF_INI)[0];
int gruppoi = f.mask().get_int(F_GRUPPOINI);
if (gruppoi < gruppof)
return TRUE;
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)
return f.error_box("Il conto di partenza deve essere inferiore o uguale al conto di arrivo");
}
if (k == K_TAB && f.focusdirty() && f.mask().is_running())
{
TLocalisamfile pconti (LF_PCON);
@ -931,7 +906,7 @@ void TMastrini_application::fai_stampa132()
set_row (_rw,"@0g#t", &_dataregs);
if (_stampanum == 1)
set_row (_rw,"@11g$[r]#7ld$[n]", &_numreg);
set_row (_rw,"@11g$[b]#7ld$[n]", &_numreg);
else
if (_stampanum == 2)
{
@ -942,7 +917,7 @@ void TMastrini_application::fai_stampa132()
set_row (_rw,"@30g#7t", &_numdoc);
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()
@ -1015,7 +990,7 @@ void TMastrini_application::fai_stampa198()
set_row (_rw,"@0g#t", &_dataregs);
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);
}
else if (_stampanum == 2)
@ -1028,7 +1003,7 @@ void TMastrini_application::fai_stampa198()
// Stampa saldo movimenti
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()
@ -1485,8 +1460,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_tipostampa == 2)
{
// saldi_zero();
calcola_progressivi();
_totale_saldo = _totprogre_dare_al - _totprogre_avere_al;
calcola_progressivi(TRUE);
_totale_saldo = _saldo_progre_prec;
}
// else
// _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 (_numcarat == 1)
set_row(_rw, "@129gP");
set_row(_rw, "@130gP");
else
set_row(_rw, "@195gP");
@ -2275,9 +2250,10 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
}
print_action TMastrini_application::postprocess_print(int file, int counter)
{
{
if (file == LF_SALDI)
{
{
/* Cazzata tremenda
_msk->reset(F_TIPOCF_INI);
_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_CLIENTE);
_msk->reset(F_DESCRFINE_FORN);
*/
_msk->reset(-9);
}
return NEXT_PAGE;
}
@ -2494,8 +2472,6 @@ bool TMastrini_application::set_print(int)
ricerca_dati_ditta();
int formato = _msk->get_int(F_FORMATO); // Molto scenografico!
if (_nummast == 1 || _nummast == 3)
printer().footerlen(4);
else
@ -2547,7 +2523,7 @@ bool TMastrini_application::set_print(int)
}
enable_print_menu();
enable_link("Collegamento prima nota: ", 'r');
enable_link("Collegamento prima nota: ", 'b');
return TRUE;
}
@ -2810,7 +2786,7 @@ void TMastrini_application::crea_intestazione()
set_header (7,"%s@19g%s@117g%s@131g%s",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
if (_stampa_mov_prov)
set_header(7,"@129gM");
set_header(7,"@130gM");
set_header (8, trans("Data"));
if (_stampanum < 3)
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("Dare"), trans("Avere"), trans("Partita"), trans("C"));
if (_stampa_mov_prov)
set_header(8,"@129g%s", trans("P"));
set_header(8,"@130g%s", trans("P"));
sep.fill('-');
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",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
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"));
if (_stampanum < 3)
set_row (r,"@11g%s", trans("Numero"));
set_row (r++,"@19gData@30gNumero@38gCod.Causale@61gDescrizione@95gDare@111gAvere@117gPartita@131gC");
if (_stampa_mov_prov)
set_header(r-1,"@129gP");
set_header(r-1,"@130gP");
sep.fill('-');
set_row (r++,"@1g%s", (const char*)sep);
}
@ -3130,7 +3106,7 @@ int TMastrini_application::stampa_progre_riporto(int start_riga)
return r;
}
void TMastrini_application::calcola_progressivi_al()
void TMastrini_application::calcola_progressivi_al(const TDate& data_fin)
{
long record,sottoc,annoes;
int gruppo,conto;
@ -3183,17 +3159,21 @@ void TMastrini_application::calcola_progressivi_al()
sottoc = rmov.get_long(RMV_SOTTOCONTO);
if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc))
break;
else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale
if (sezione == 'D')
_totale_prima_dare += importo;
else
_totale_prima_avere += importo;
else
{
//Legge movimenti con data > inizio esercizio e < data_fin
if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg <= data_fin))
if (sezione == 'D')
_totale_prima_dare += importo;
else
_totale_prima_avere += importo;
}
} // if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty())))
}
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
* record scaricati e assegnazione dare/avere relativo - Controllare che
@ -3310,8 +3290,8 @@ 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
//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_GRUPPOFINE, gruppo_hnd);
msk->set_handler(F_CONTOINI_CONTO, contoi_hnd);
msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd);
msk->set_handler(F_CONTOINI_FORN, contoi_hnd);
// msk->set_handler(F_CONTOINI_CLIENTE, contoi_hnd);
// msk->set_handler(F_CONTOINI_FORN, contoi_hnd);
msk->set_handler(F_CONTOFINE_CONTO, contof_hnd);
msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd);
msk->set_handler(F_CONTOFINE_FORN, contof_hnd);
// msk->set_handler(F_CONTOFINE_CLIENTE, contof_hnd);
// msk->set_handler(F_CONTOFINE_FORN, contof_hnd);
msk->set_handler(F_SOTTOCINI_CONTO, sottoc_handler_ini);
msk->set_handler(F_SOTTOCINI_CLIENTE, sottoc_handler_ini);

View File

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

View File

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

View File

@ -221,7 +221,6 @@ public:
const char* get_descr_caus (const char * codcaus);
const TRectype& look_com (const char* cod, const char* stato = "");
const TString& get_codiva_des(const char* codiva);
void get_date_aep(int aep, TDate* in, TDate* fin);
void update_totals (char sezione, real& importo);
void set_reg_filter(TMask& m);
@ -245,7 +244,7 @@ bool TStampa_giornale::filtra_reg(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
const TString& provvis = recmov.get(MOV_PROVVIS);
@ -253,7 +252,8 @@ bool TStampa_giornale::filter_func(const TRelation * r)
return FALSE;
// Scarto i movimenti che hanno il registro ai soli fini della liquidazione
const tipo_sospensione ts = r->lfile("REG").get_bool("B1") ? (tipo_sospensione) r->lfile("REG").get_int("I9") : nessuna;
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)
return FALSE;
@ -261,7 +261,7 @@ bool TStampa_giornale::filter_func(const TRelation * r)
if (!app()._libro_giornale_iva_unico)
{
const long numreg = recmov.get_long("NUMREG");
TRectype& recrmov = r->lfile(LF_RMOV).curr();
TRectype& recrmov = r->curr(LF_RMOV);
recrmov.zero();
recrmov.put("NUMREG", numreg);
recrmov.put("NUMRIG", 1);
@ -318,27 +318,28 @@ void TStampa_giornale::get_dati_ditta ()
_cofi = _anag->get(ANA_COFI);
_paiva = _anag->get(ANA_PAIV);
_comunefis = _anag->get(ANA_COMRF);
_cap = _anag->get(ANA_CAPRF);
if (_comunefis.empty())
_comunefis = _anag->get(ANF_COMRES);
_comunefis = _anag->get(ANF_COMRES);
const TRectype& dep = look_com (_comunefis);
_comunefis = dep.get(COM_DENCOM);
_provfis = dep.get(COM_PROVCOM);
_cap = dep.get(COM_CAPCOM);
const TRectype& dep = look_com(_comunefis);
_comunefis = dep.get(COM_DENCOM);
_provfis = dep.get(COM_PROVCOM);
if (_cap.empty())
_cap = dep.get(COM_CAPCOM);
if (_comunefis.empty())
{
_viafis = _anag->get(ANA_INDRF);
_viafis = _anag->get(ANA_INDRF);
_viafis.rtrim();
_viafis << " " << _anag->curr().get (ANA_CIVRF);
_viafis << ' ' << _anag->curr().get (ANA_CIVRF);
}
else
{
_viafis = _anag->get(ANA_INDRES);
_viafis = _anag->get(ANA_INDRES);
_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");
_rel = new TRelation (LF_MOV);
_rel->add (LF_RMOV, "NUMREG=NUMREG");
_rel->add (LF_RMOVIVA, "NUMREG=NUMREG");
_rel->add ("REG", "CODTAB[1,4]=ANNOIVA|CODTAB[5,7]=REG");
_rel->add (LF_RMOV, "NUMREG==NUMREG");
_rel->add (LF_RMOVIVA, "NUMREG==NUMREG");
_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
_RecPartoDa = new TRectype(_cur->file(LF_MOV).curr());
_RecArrivoA = new TRectype(_cur->file(LF_MOV).curr());
_RecPartoDa = new TRectype(_cur->curr());
_RecArrivoA = new TRectype(_cur->curr());
add_cursor (_cur);
@ -405,9 +406,10 @@ void TStampa_giornale::aggiorna_mov()
TLocalisamfile& mov = _cur->file(LF_MOV);
long nprog = _nprog_da + 1;
const TRectype da(*_RecPartoDa);
const TRectype a(*_RecArrivoA);
_cur->setregion(da, a);
// const TRectype da(*_RecPartoDa);
// const TRectype a(*_RecArrivoA);
// _cur->setregion(da, a);
_cur->setregion(*_RecPartoDa, *_RecArrivoA);
const long items = _cur->items();
TProgind prnd (items, "Aggiornamento movimenti ...", FALSE, TRUE);
@ -829,7 +831,7 @@ bool TStampa_giornale::preprocess_print(int file, int counter)
_nuovo_mese = FALSE;
_iva_array.destroy();
_nprog_mov = _nprog_da;
*_RecPartoDa = _cur->file(LF_MOV).curr();
*_RecPartoDa = _cur->curr();
break;
default:
break;
@ -1518,7 +1520,8 @@ void TStampa_giornale::aggiorna_tabreg(int partito_da, int stampate)
if (_tabreg->good())
{
// _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 ("R1", _tot_dare_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()
{
TWait_cursor hourglass;
const int aep = es_prec(_ae);
TDate inizio_ep, fine_ep;
if (aep == 0) // = e' il primo esercizio
return TRUE;
else
get_date_aep(aep,&inizio_ep, &fine_ep);
TRectype da (LF_MOV);
TRectype a (LF_MOV);
TEsercizi_contabili esc;
const int aep = esc.pred(_ae);
TDate inizio_ep, fine_ep;
if (aep > 0)
{
inizio_ep = esc[aep].inizio();
fine_ep = esc[aep].fine();
}
else
return TRUE; // = e' il primo esercizio
TRectype da(LF_MOV), a(LF_MOV);
da.put(MOV_DATAREG, inizio_ep);
a.put (MOV_DATAREG, fine_ep);
_cur->setregion(da, a);
_cur->setfilter("");
_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;
for (*_cur = 0L ; _cur->ok(); ++(*_cur))
{
for (*_cur = 0L ; _cur->pos() < items; ++(*_cur))
{
pi.addstatus(1);
gia_stampati = _cur->file().get_bool("STAMPATO");
if (!gia_stampati) break; // basta trovarne uno ancora da stampare
}
if (_cur->items() > 0L && !gia_stampati)
{
_cur->setfilter("");
warning_box("Impossibile proseguire con la stampa:\n"
"Esistono movimenti nell'esercizio precedente\n"
"che non sono ancora stati stampati su bollato.");
return FALSE;
}
_cur->setfilter("");
return TRUE;
_cur->freeze(FALSE);
if (!gia_stampati)
error_box("Impossibile proseguire con la stampa:\n"
"Esistono movimenti nell'esercizio precedente\n"
"che non sono ancora stati stampati su bollato.");
return gia_stampati;
}
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;
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 = esc.date2esc(data_a);//app()._ae_solare;
app()._ae = esc.date2esc(data_a);
m.set(ANNO_ESER, app()._ae_solare);
m.send_key(K_TAB, CODREG);
@ -1873,7 +1867,7 @@ bool TStampa_giornale::init_cursor()
if (_cur->items() == 0L)
{
_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;
@ -1910,7 +1904,9 @@ bool TStampa_giornale::set_print(int)
if (_stampa_definitiva)
{
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.
if (_stampa_stesso_registro)

View File

@ -532,8 +532,9 @@ class TMastrino : public TObject
TBill _conto; // Conto del mastrino
int _esercizio; // Esercizio di riferimento (eventualmente 0)
TDate _da_data, _a_data;
TString _da_caus, _a_caus;
TDate _da_data, _a_data; // Date limite
TString _da_caus, _a_caus; // Causali limite
bool _provvis; // Includi provvisori
real _pdare_ini, _pavere_ini;
real _pdare_per, _pavere_per;
@ -555,7 +556,7 @@ public:
void read(const TBill& conto,
int annoes, const TDate& dd, const TDate& ad,
const TString& dc, const TString& ac);
const TString& dc, const TString& ac, bool provvis);
void reread();
TRiga_mastrino& operator[](long n) const { return row(n); }
@ -607,8 +608,7 @@ TMastrino::TMastrino()
if (_instances == 0L)
{
_rel = new TRelation(LF_RMOV);
_rel->add(LF_MOV, "NUMREG=NUMREG");
_cur = new TCursor(_rel);
_rel->add(LF_MOV, "NUMREG==NUMREG");
_rmov = &_rel->lfile();
_mov = &_rel->lfile(LF_MOV);
}
@ -662,7 +662,8 @@ long TMastrino::last(tipo_riga_mastrino tipo) const
void TMastrino::read(const TBill& conto,
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;
@ -691,6 +692,7 @@ void TMastrino::read(const TBill& conto,
const bool test_caus = !(dc.blank() && ac.blank());
_da_caus = dc;
_a_caus = ac.blank() ? "zzz" : ac; // Se vuota sceglie la massima causale
_provvis = provvis;
TDate max_data_reg = _a_data;
long num_giorni = _a_data - inizio_esercizio + 1;
@ -706,11 +708,6 @@ void TMastrino::read(const TBill& conto,
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
_riga.choose_step(num_giorni);
@ -736,10 +733,6 @@ void TMastrino::read(const TBill& conto,
// limiti della stampa
_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_numreg (rmov_rec, RMV_NUMREG);
const TRecfield rmov_gruppo (rmov_rec, RMV_GRUPPO);
@ -756,22 +749,24 @@ void TMastrino::read(const TBill& conto,
long num_rec = 0;
const clock_t clock_start = clock();
#endif
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();
TString caption(80);
caption.format("Caricamento mastrino %03d.%03d.%06ld",
_conto.gruppo(), _conto.conto(), _conto.sottoconto());
TProgind pi(totrows, caption, FALSE, TRUE);
TDate ultimo_giorno; // memorizza ultima data registrazione utilizzata
for (int err = rel().read(_isgteq); err == NOERR; err = rel().next())
for (cur = 0L; cur.pos() < totrows; ++cur)
{
// Controlla di non aver superato la data limite
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;
pi.addstatus(1);
#ifdef DBG
num_rec++;
if ((num_rec & 0x7F) == 0)
@ -786,23 +781,18 @@ void TMastrino::read(const TBill& conto,
}
#endif
// Ignora i movimenti provvisori
const char provvis = *(const char*)mov_provvis;
if (provvis > ' ')
continue;
// Ignora eventualmente i movimenti provvisori
if (!_provvis)
{
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)
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 real importo((const char*)rmov_importo);
@ -833,19 +823,17 @@ void TMastrino::read(const TBill& conto,
TRiga_mastrino* r = new TRiga_mastrino(riga_mastrino,
rmov().recno(), mov().recno(),
_pdare_per, _pavere_per, data_reg);
_pdare_per, _pavere_per, rmov_datareg);
_riga.append(r);
}
}
pi.setstatus(num_giorni); // Raramente arriva in fondo!
}
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)
{
const TRiga_mastrino& r = row(n);
@ -1201,10 +1189,13 @@ TGrid_control::TGrid_control(
fixed_columns = 1;
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,
rct.top, rct.left, rct.bottom-rct.top,
XI_ATR_ENABLED | XI_ATR_VISIBLE,
list_attr,
NORMAL_COLOR, NORMAL_BACK_COLOR, // normal
DISABLED_COLOR, DISABLED_BACK_COLOR, // disabled
FOCUS_COLOR, // active
@ -1226,11 +1217,15 @@ TGrid_control::TGrid_control(
l->scroll_bar_button = TRUE;
l->white_space_color = MASK_DARK_COLOR;
l->rule_color = MASK_DARK_COLOR;
if (_read_only)
{
l->single_select = TRUE;
}
else
{
l->active_back_color = FOCUS_BACK_COLOR;
}
// Definizione della prima colonna (numero di riga)
const long attr = XI_ATR_VISIBLE | XI_ATR_RJUST | XI_ATR_SELECTABLE;
@ -1463,11 +1458,13 @@ void TGrid_control::update_selection(XI_EVENT* xiev)
{
const bool is_curr = xiev->v.rec_request.data_rec == _cur_rec;
if (_read_only)
{
{
/*
if (is_curr)
xiev->v.rec_request.attrib |= XI_ATR_SELECTED;
else
xiev->v.rec_request.attrib &= ~XI_ATR_SELECTED;
*/
}
else
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
_grid->on_record_button(rec);
#endif
if (_read_only)
refused = TRUE;
}
else
{
@ -1557,6 +1556,7 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
{
const short cid = col2cid(xiev->v.select.column);
_grid->on_dbl_cell(rec, cid);
refused = TRUE;
}
_cur_rec = rec; // Assegno solo ora il record corrente
}
@ -2172,7 +2172,7 @@ public:
void destroy();
void read(const TBill& conto,
int annoes, const TDate& dd, const TDate& ad,
const TString& dc, const TString& ac);
const TString& dc, const TString& ac, bool provv);
void reread();
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 int anno = _esercizi.date2esc(riga.data());
const int eser = mov.get_int(MOV_ANNOES);
const comp = anno != eser;
cell.set_icon(comp ? ICO_CHECK_ON : ICO_CHECK_OFF);
TString8 str;
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;
case 103:
@ -2257,20 +2265,6 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
case 104:
if (riga.tipo() == riga_mastrino)
{
/* Invertire l'ordine
const TRectype& mov = _mastrino.testata(rec);
cell.set(mov.get(MOV_DESCR));
if (cell.empty())
{
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);
cell.set(rmov.get(RMV_DESCR));
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,
int annoes, const TDate& dd, const TDate& ad,
const TString& dc, const TString& ac)
const TString& dc, const TString& ac, bool provv)
{
destroy();
_mastrino.read(conto, annoes, dd, ad, dc, ac);
_mastrino.read(conto, annoes, dd, ad, dc, ac, provv);
update();
update_mask();
}
@ -2838,10 +2832,12 @@ void TQuery_mask::do_query(TGrid_mask& gm)
const TString& da_caus = get(F_DACAUSALE);
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);
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();
}

View File

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

View File

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

View File

@ -4,7 +4,7 @@ TOOLBAR "" 0 20 0 0
BUTTON DLG_LINK 10 2
BEGIN
PROMPT -12 -11 "~Collega"
PROMPT -12 -11 "Colle~ga"
PICTURE BMP_LINK
END
@ -64,7 +64,7 @@ BEGIN
PROMPT 1 2 "Mastrini"
FLAGS "DM2"
ITEM "Data Op. \nData Doc.@10"
ITEM "C@1"
ITEM "C/P"
ITEM "Causale@20"
ITEM "Descrizione@20"
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),
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,"@125g@7,rn",FLD(LF_MOV,MOV_NUMREG));
}
@ -729,7 +729,6 @@ bool TLista_fatture::set_print(int m)
default:
break;
}
while (msk.run() == K_ENTER)
{
_from_cf = msk.get_long(FLD_FROM_FOR);
@ -800,6 +799,7 @@ bool TLista_fatture::set_print(int m)
// Ripristina la ditta
pref.set_codditta(save_firm);
msk.reset();
}
return FALSE;
}

View File

@ -57,7 +57,7 @@ bool TLiquidazione_app::recalc_all()
_nditte->curr().put("CODDITTA",nomeditta.get_long(1));
_nditte->read();
_freqviva = nomeditta.get(3);
bool mens = _freqviva == "M";
bool mens = _freqviva == "M";
// determina attivita' prevalente e istanzia cazzuole
// 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 "
"risultano ricalcolati. E' consigliabile il ricalcolo. "
"Si desidera eseguirlo?"))
"risultano ricalcolati. E' consigliabile il ricalcolo. "
"Si desidera eseguirlo?"))
_recalc = ever;
}
@ -185,7 +185,6 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
TToken_string atts;
TToken_string cattivs;
// casini per stampa minchie in coda ai registri
bool riepliq = _isregis ? _riepilogo : FALSE;
@ -228,7 +227,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
for (int tipoatt = 1; tipoatt <= (_mixed ? 2 : 1); tipoatt++)
{
TString cattiv(codatt); bool waspla;
TString8 cattiv(codatt); bool waspla;
cattiv << tipoatt;
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;
// il ricalcolo e' FORZATO da _recalc messo a one
{
look_plm(month, codatt, TRUE);
bool ok = _plm->get_bool("B0");
if (_recalc_regis)
@ -561,9 +558,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
real esenti_b4 = 0.0;
real esenti_b14 = 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_vp4 = 0.0;
real imposta_vp3 = 0.0;
real esni_rimb = 0.0; // ci sommo tutti esenti e ni validi per rimborso
real corr_CEE = 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
// tenere conto della DATA74TER se presente.
if (!_isviaggio)
{
f.set_month(month == 13 ? 1 : month);
}
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);
to.put(MOV_DATAREG, t);
_cur->setregion(from, to);
_cur->freeze(FALSE);
_cur->setregion(from, to);
const long items = _cur->items();
_cur->freeze();
*_cur = 0;
long items = _cur->items();
TString trueatt(codatt);
int tipatt = atoi(trueatt.sub(5));
//trueatt = trueatt.left(5);
trueatt.cut(5);
#ifdef DBG
TString msgdbg;
long freespace;
#endif
for (; _cur->pos() < items; ++(*_cur))
{
if ((_cur->pos() & 0x7F) == 0)
{
#ifdef DBG
TString msgdbg;
long freespace;
msgdbg.format("Ricalcolo attivita': %ld/%ld",_cur->pos(),items);
freespace = os_get_free_memory();
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));
const int liqmonth = _mov->get_int(MOV_MESELIQ);
TString16 reg = _mov->get("REG");
bool isreg = look_reg(_mov->get("REG"));
TString16 tipodoc = _mov->get(MOV_TIPODOC);
bool corrisp = _reg->get_bool("B0");
tiporeg tipomov = (tiporeg)_reg->get_long("I0");
const int liqmonth = _mov->get_int(MOV_MESELIQ);
const TString8 reg = _mov->get("REG");
const bool isreg = look_reg(_mov->get("REG"));
const TString8 tipodoc = _mov->get(MOV_TIPODOC);
const bool corrisp = _reg->get_bool("B0");
const tiporeg tipomov = (tiporeg)_reg->get_long("I0");
// Controlla se la data del documento si riferisce all'anno precedente (PRORATA 1998)
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_iva = 0.0; // imposta non incassati
TString16 codiva = _iva->get("CODTAB");
TString16 tipoiva = _iva->get("S1");
TString16 tipoes_v = _iva->get("S2");
TString16 tipoes_a = _iva->get("S9");
TString16 iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
TString8 codiva = _iva->get("CODTAB");
TString8 tipoiva = _iva->get("S1");
TString8 tipoes_v = _iva->get("S2");
TString8 tipoes_a = _iva->get("S9");
TString8 iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
int tipoagr = atoi(_iva->get("S4"));
int tipoag = atoi(_iva->get("S5"));
int tipopla = atoi(_iva->get("S3"));
int tipodet = atoi(_rmoviva->get(RMI_TIPODET));
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
TString tipocr_s = _rmoviva->get(RMI_TIPOCR);
TString8 tipocr_s = _rmoviva->get(RMI_TIPOCR);
int tipocr = atoi(tipocr_s);
real imponibile = _rmoviva->get_real(RMI_IMPONIBILE);
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)
switch (tipomov)
{
case vendita: // VP1 o VP2
if (!corrisp)
case vendita: // VP1, VP1A
if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
sosp_imp != normale && sosp_imp != liquidazione)
{
vendite_vp1 += imponibile;
if (cau_valintra && iva_vpn == "VP2")
vendite_vp2 += imponibile;
if (cau_valintra && iva_vpn == "VP1A")
vendite_vp1a += imponibile;
}
break;
case acquisto: // VP3 o VP4
acquisti_vp3 += imponibile;
if (cau_intra && iva_vpn == "VP4")
acquisti_vp4 += imponibile;
case acquisto: // VP2, VP2A, VP3
acquisti_vp2 += imponibile;
if (cau_intra && iva_vpn == "VP2A")
acquisti_vp2a += imponibile;
if (iva_vpn == "VP3")
{
acquisti_vp3 += imponibile;
imposta_vp3 += imposta;
}
break;
default:
break;
@ -920,7 +928,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
{
ammort_6 += imponibile;
ammort_6_iva += imposta;
ult_detr += imponibile * real(DETRAZIONE_6PERCENTO);
// ult_detr += imponibile * real(DETRAZIONE_6PERCENTO); // CM500159
}
else if (tipocr == 8)
// Acquisto beni strum. acquisiti in leasing
@ -989,17 +997,20 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
{
if (tipomov == vendita)
{
if (tipoes_v == "B1")
esenti_b1 += imponibile;
else if (tipoes_v == "B2")
esenti_b2 += imponibile;
else if (tipoes_v == "B3")
esenti_b3 += imponibile;
else if (tipoes_v == "B4")
esenti_b4 += imponibile;
// se e' il caso sommare esenti per rimborso
if (isrimbinfr)
esni_rimb += imponibile;
if (sosp_imp != normale && sosp_imp != vol_affari) // CM500308
{
if (tipoes_v == "B1")
esenti_b1 += imponibile;
else if (tipoes_v == "B2")
esenti_b2 += imponibile;
else if (tipoes_v == "B3")
esenti_b3 += imponibile;
else if (tipoes_v == "B4")
esenti_b4 += imponibile;
// se e' il caso sommare esenti per rimborso
if (isrimbinfr)
esni_rimb += imponibile;
}
}
else if (tipoes_a == "14")
esenti_b14 += imponibile;
@ -1511,7 +1522,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
} // for per tabelle
}
while (_cur->next_match(LF_RMOVIVA));
} // fine calcolo progressivi IVA
} // fine calcolo progressivi IVA
if (!_recalc_regis)
@ -1722,9 +1733,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
_pum->put("R7", esenti_b14);
_pum->put("R12", esni_rimb);
_pum->put("R14", vendite_vp1);
_pum->put("R15", vendite_vp2);
_pum->put("R16", acquisti_vp3);
_pum->put("R17", acquisti_vp4);
_pum->put("R15", vendite_vp1a);
_pum->put("R16", acquisti_vp2);
_pum->put("R17", acquisti_vp2a);
_pum->put("R18", acquisti_vp3);
_pum->put("R19", imposta_vp3);
_pam->put("R0", acquisti);
_pam->put("R1", vendite);
_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_acquisto = tipomov == acquisto;
const bool is_key = _iva11_arr.is_key(codatt);
if (!is_key) // Aggiunge l'elemento se non c'e'
_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)
{
// 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 tc = (c_iCEE + ivm);
real ta = (a_iCEE + a_mCEE);
@ -2701,7 +2713,10 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
// credito di costo
{
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
{
@ -2719,7 +2734,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
real perc; // percentuale di deducibilita'
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);
iva_ded = acq_noCEE * perc;
iva_ded.round(ROUND_LIRA);
@ -2868,8 +2883,15 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
_pla->put("R8", prorata);
_pla->rewrite();
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();
}
_year = yr;
@ -2994,7 +3016,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|| (month == 13 && !(_isbenzinaro && _gest4)) ))
{
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);
_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
// sul nuovo filtro di selezione movimenti.
{
bool ok;
if (year < 1998 || _recalc_regis) // Vecchia selezione o calcolo progressivi per stampa registri bollati
{
if (d.month() > month || d.year() != atoi(_year))
return FALSE;
return ok = FALSE;
if (month == 13)
ok = d.month() <= month;
else
ok = d.month() == month;
else
{
if (_freqviva == "M") // Guy!!!
ok = d.month() == month;
else
ok = d.month() >= month-2 && d.month() <= month;
}
}
else // Nuova selezione dal 1998 in poi
{
const int regmonth = d.month();
const int regyear = d.year();
const int regmonth = d.month();
const int regyear = d.year();
if (month <= 12)
ok = (regmonth == month && liqmonth == 0) || (liqmonth == month);
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;
}
@ -519,8 +523,10 @@ bool TLiquidazione_app::look_lam(int m, bool create)
bool TLiquidazione_app::look_pla(const char* a, bool create)
{
_pla_r->zero();
// forza il tipoatt a 1
TString buf(a);
TString16 buf(a);
buf.ltrim();
buf.rtrim(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
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");
vp1 += imponibile;
@ -348,7 +348,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
// Aggiorna il totale IVA periodica VP1
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");
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
}
// 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 tc = (c_CEE + ivm);
real ta = (a_CEE + a_mCEE);

View File

@ -15,11 +15,11 @@
class _vDesc : public TObject
{
public:
TString _codiva;
TString4 _codiva;
real _acq;
real _vnd;
real _viv;
_vDesc() : _codiva(5) {}
_vDesc() {}
virtual ~_vDesc() {}
};
@ -425,7 +425,7 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
d->_r8 = credito_costo_prec(month);
// 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->_r1);
@ -437,7 +437,7 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
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;
if (month==13)
@ -554,12 +554,12 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
// se e' il dettaglio di una attivita' mista non stampa
// gli acquisti, il perche' losalamadonna
if (tipomov == acquisto && skip_acq) continue;
// questi non vanno in liquidazione, i totali sono
// gia' calcolati altrove
if ((tipodet == 1 || tipodet == 3 || tipodet == 9) && !is_rit)
continue;
// se ha tutti gli importi nulli viene da un annullamento di
// progressivi esistenti (achtung fatture con scontrino)
if (tab->get_real("R0").is_zero() &&
@ -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
// allora se R5 o R6 sono <> 0 significa che trattasi di documento FS,
// che pertanto va stornato dal totale corrispettivi. (Cosi' volle Vladimiro)
real ifs(tab->get_real("R5")); // imp. fatture con scontrino
real vfs(tab->get_real("R6")); // iva fatture con scontrino
const real ifs(tab->get_real("R5")); // imp. fatture con scontrino
const real vfs(tab->get_real("R6")); // iva fatture con scontrino
if (!corrisp)
{
if (sosp_imp != vol_affari)
@ -667,7 +667,6 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
}
}
if (corrisp)
{
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->_r13 = rt2; d->_r14 = rt3;
d->_s2 = rt4.string(); d->_s3 = rt5.string();
d->_s2 = rt4.string(); d->_s3 = rt5.string();
}
// aggiunge dati ptm
@ -946,8 +945,16 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
} // while (attivita')
} // 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
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))
{
real v1 = _pla->get_real("R14");
real v2(_pla->get("S1"));
real v2 = _pla->get_real("S1");
real ris = v1 + v2;
real e1 = _pla->get_real("R1");
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())
{
// calcolo conguaglio -- se positivo e' a debito
if (pr > 0.0)
if (pr > ZERO)
{
topay = (iaq + ppg) * (pr / CENTO);
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->_r0 = ris;
dd->_r1 = e1;
dd->_r2 = pr > 0.0 ? pr : 0.0 ;
dd->_r2 = pr > ZERO ? pr : ZERO ;
dd->_r3 = co;
dd->_r4 = e2;
dd->_r5 = e3;
@ -1221,7 +1228,7 @@ void TLiquidazione_app::set_firm(_DescrItem& d)
int soh = 1;
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));
set_header(soh++,"");
}
@ -1302,7 +1309,7 @@ void TLiquidazione_app::set_att(_DescrItem& d)
int soh = 1;
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));
set_header(soh++,"");
}
@ -1665,12 +1672,9 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
if (!(d._r2.is_zero() && d._r3.is_zero()))
{
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%%)"
"@50g%r@69g%r@86g%r",
&(d._r2),
&(d._r3),
&rn);
"@50g%r@69g%r", &(d._r2), &(d._r3));
}
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)
set_row(rw++,"@11gDebito o credito da liquidazione precedente@75g%r", &debt_prec);
else
if (cred_prec > ZERO)
{
cred_prec -= rimborso;
if (cred_prec > ZERO)
set_row(rw++,"@11gDebito o credito da liquidazione precedente@58g%r", &cred_prec);
}
set_row(rw++,"%s@11gRimborsi%s@75g%r",
_is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &rimborso);
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);
#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)
set_row(rw++,"%s@11gCrediti speciali%s@58g%r",
_is_visliq ? "$[r]" : "", _is_visliq ? "$[n]" : "", &crediti_speciali);
@ -2272,18 +2270,19 @@ bool TLiquidazione_app::set_annual(_DescrItem& d)
set_row(row++,"");
if (year_int > 1997)
{
const real perc_det = CENTO - d._r2;
const TString s(perc_det.string());
const real perc_det = CENTO - d._r2;
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",
(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++,"C2 - Operazioni esenti di cui nr. 11 art. 10 @69g%r", &(d._r4));
set_row(row++,"C3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r", &(d._r5));
set_row(row++,"C1A - Operazioni esenti di cui all'art.10 n. 27 quinquies @69g%r", &(d._r7));
set_row(row++,"@6gdi cui cessione beni ammortizzabili");
set_row(row++,"Volume d'affari @69g%r", &(d._r0));
set_row(row++,"Detraibilita' @69g%r%%", &(perc_det));
set_row(row++,"Detraibilita' @69g%r%%", &perc_det);
}
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++,"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++,"Indetraibilita'@69g%r%%", &(d._r2));
set_row(row++,"Indetraibilita'@69g%r%%", &(d._r2));
}
/* Prorata delle mie brame...
* 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)
{
reset_header();
set_header(1,"Gestione IVA@109gData @<@125gPag. @#");
set_header(1,"Gestione IVA@107gData @>@125gPag. @#");
set_header(3,sep);
if (d._f0) // base anno in corso
@ -2749,7 +2748,7 @@ void TLiquidazione_app::set_deltab(_DescrItem& d, bool iscred)
if (iscred)
{
// 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);
set_header(2,sep);
set_header(3,"@40gF@60gImporto a");
@ -2779,7 +2778,7 @@ void TLiquidazione_app::set_deltab(_DescrItem& d, bool iscred)
else
{
// 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);
set_header(2,sep);
set_header(3,"@40gF@60gImporto da@73gCodice@83gCod.");

View File

@ -4,6 +4,7 @@
// Nemico ed Oscuro Messo di Malvagita'...
#include <currency.h>
#include <os_dep.h>
#include <recarray.h>
#include "cg4.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)
{
TLocalisamfile& mov = r->lfile(LF_MOV);
const TRectype& mov = r->curr(LF_MOV);
TString16 codreg = mov.get(MOV_REG);
TDate datareg = mov.get_date(MOV_DATAREG);
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);
if (attiv.read() == NOERR)
TMP = attiv.get("DESCR");
else TMP = "";
else
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->put(CLI_TIPOCF, tipocf);
@ -167,43 +169,44 @@ TRectype& TStampa_registri_app::ricerca_cf(char tipocf, long codcf)
_clifo->read();
if (_clifo->bad())
_clifo->zero();
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);
occas.zero();
occas.put(OCC_CFPI, occ);
occas.read();
if (occas.bad())
occas.zero();
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->put(COM_STATO, stato);
_com->put(COM_COM, cod);
_com->read();
if (_com->bad())
_com->zero();
return _com->curr();
*/
TString16 key;
key << stato << '|' << cod;
return cache().get(LF_COMUNI, key);
}
TRectype& TStampa_registri_app::look_comuni (const char* cod)
{
_com->zero();
_com->put(COM_COM, cod);
_com->read();
if (_com->bad())
_com->zero();
return _com->curr();
const TRectype& TStampa_registri_app::look_comuni (const char* cod)
{
const TString16 stato;
const TString16 comune = cod;
return look_comuni(stato, comune);
}
void TStampa_registri_app::get_dati_ditta()
@ -234,15 +237,17 @@ void TStampa_registri_app::get_dati_ditta()
_cofi = anag.get(ANA_COFI);
_paiva = anag.get(ANA_PAIV);
_comunefis = anag.get(ANA_COMRF);
_cap = anag.get(ANA_CAPRF);
if (_comunefis.empty())
_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);
_provfis = dep.get(COM_PROVCOM);
_cap = dep.get(COM_CAPCOM);
if (_comunefis.empty())
{
_viafis = anag.get(ANA_INDRF);
@ -253,7 +258,7 @@ void TStampa_registri_app::get_dati_ditta()
{
_viafis = anag.get(ANA_INDRES);
_viafis.rtrim();
_viafis << " " << anag.get (ANA_CIVRES);
_viafis << ' ' << anag.get (ANA_CIVRES);
}
if (_cod_un_loc)
@ -264,13 +269,13 @@ void TStampa_registri_app::get_dati_ditta()
unloc.read();
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);
_provfis = dep.get(COM_PROVCOM);
_cap = dep.get(COM_CAPCOM);
_cap = unloc.get(ULC_CAPULC);
_viafis = unloc.get(ULC_INDULC);
_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
{
TString16 datas;
TDate datas;
bool good;
bool ok = cerca_libro_gio(datas,&good);
if (!ok)
bool found = cerca_libro_gio(datas, good);
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);
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());
return FALSE;
}
}
@ -487,16 +491,19 @@ bool TStampa_registri_app::compila_lib()
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);
app.format("%04d", _annoes);
*good = TRUE;
TRecnotype rec = _tabreg->recno();
good = FALSE;
bool found = FALSE;
const TRecnotype rec = _tabreg->recno();
_tabreg->zero();
_tabreg->put ("CODTAB", app);
TRectype r (_tabreg->curr());
const TRectype r (_tabreg->curr());
_tabreg->read(_isgteq);
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");
if (tipo_reg == giornale) //libro giornale
{
const TDate& data = _tabreg->get_date("D3");
if (data < _data_a)
{
datas = data;
*good = FALSE;
return FALSE;
}
_tabreg->readat(rec);
return TRUE;
datas = _tabreg->get_date("D3"); // Data ultima stampa
// if (datas < _data_a)
if (datas.month() < _data_a.month()) // CM000027
good = FALSE;
else
good = TRUE;
found = TRUE;
}
}
_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)
@ -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)
{
TMask& m = f.mask();
if (k == K_SPACE)
{
TMask& m = f.mask();
int tipo_stampa = m.get_int(TIPO_STAMPA);
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);
int nrec = 0;
TRecnotype nr = rmoviva.recno();
const TRecnotype nr = rmoviva.recno();
while (ok)
{
nrec++;
TRectype iva (rmoviva.curr());
tipodet = iva.get_int (RMI_TIPODET);
tipocr = iva.get_int (RMI_TIPOCR);
const TRectype& iva = rmoviva.curr();
tipodet = iva.get_int(RMI_TIPODET);
tipocr = iva.get_int(RMI_TIPOCR);
impo = iva.get_real(RMI_IMPONIBILE);
impos = iva.get_real(RMI_IMPOSTA);
codiva = iva.get(RMI_CODIVA);
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);
@ -1382,7 +1404,7 @@ bool TStampa_registri_app::controlla_mov()
TRecnotype rec = _tabreg->recno();
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
TDate datareg = mov.get_date(MOV_DATAREG);
if (_stampa_tutti_i_registri)
@ -1417,20 +1439,15 @@ tiporeg TStampa_registri_app::cerca_reg(const TString& c)
return t;
}
/*
bool TStampa_registri_app::ventilazione(const char* iva)
{
TTable tabiva ("%IVA");
TString16 chiave = "";
chiave << iva;
tabiva.put("CODTAB", chiave);
if (tabiva.read()==NOERR)
{
TString16 vent = tabiva.get("S1");
if (vent == "VE")
return TRUE;
}
return FALSE;
const TString16 chiave = iva;
const TRectype& rec = cache().get("%IVA", chiave);
const TString& vent = rec.get("S1");
return vent == "VE";
}
*/
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)
{
int da;
if (_tipo_stampa == prova)
da = _data_da.month();
else da = 1;
int a = _datareg.month();
const int da = (_tipo_stampa == prova) ? _data_da.month() : 1;
const int a = _datareg.month();
for (int m = da; m < a; m++)
{
if (!_st_liq[m])
@ -2201,7 +2215,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
}
else
{
TRectype dep = ricerca_occ(ocfpi);
const TRectype& dep = ricerca_occ(ocfpi);
ragsoc = dep.get (OCC_RAGSOC);
viacf = dep.get (OCC_INDIR);
civcf = dep.get (OCC_CIV);
@ -2209,7 +2223,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
comcf = dep.get (OCC_COM);
stacf = dep.get (OCC_STATO);
}
TRectype com = look_comuni(stacf,comcf);
const TRectype& com = look_comuni(stacf,comcf);
if (!com.empty())
{
comune = com.get(COM_DENCOM);
@ -2511,7 +2525,7 @@ int TStampa_registri_app::stampa_intestazione()
r++;
if (_tipo_stampa == prova)
{
riga = "REGISTRO DI PROVA Data @<";
riga = "REGISTRO DI PROVA Data @>";
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
if (_frequiva == 'T')
mese += 2 - ((mese-1) % 3);
send_message(calc_reg ? 'R' : 'C', app, calc_reg ? _datareg.month()/*_fino_a_mese*/ : mese);
send_message(calc_reg ? 'R' : 'C', app, calc_reg ? _datareg.month() : mese);
}
}
}
@ -3093,84 +3106,94 @@ void TStampa_registri_app::no_movimenti()
//se la frequenza e' trimestrale
//aggiusta il mese al trimestre a cui appartiene
if (_frequiva == 'T')
{
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);
}
if (_tipo_reg == riepilogativo || _liquidazione || _stampa_plafonds)
{
for (int m = da; m <= a; m++)
{
if (_tipo_reg == riepilogativo)
for (int m = da; m <= a; m++)
{
bool stsbol = FALSE;
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)
{
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);
}
bool stsbol = FALSE;
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 && (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();
}
}//for
//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);
@ -3293,7 +3316,7 @@ bool TStampa_registri_app::set_print(int n)
_tipo_stampa = (tipo_stampa) m.get_int(TIPO_STAMPA);
_stampa_width = m.get_int(STAMPA_WIDTH);
_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)
_stampa_width = 132;
else _stampa_width = 198;
@ -3392,7 +3415,7 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m)
if (!controlla_mov())
{
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)
{
@ -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
{
TString16 d;
TDate d;
bool good;
TRecnotype rec = _tabreg->recno();
bool trovato = cerca_libro_gio(d, &good);
_tabreg->readat(rec);
if (!trovato)
bool trovato = cerca_libro_gio(d, good);
if (trovato)
one_printed = TRUE;
else
continue;
else one_printed = TRUE;
}
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
bool TStampa_registri_app::stampa_riepilogo(int m)
{
int a;
tiporeg tipo;
TString80 chiave,ctab;
TString16 codtab, codreg, creg, codatt, codiva;
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
{
tipo = (tiporeg)_tabreg->get_int("I0");
codtab = _tabreg->get("CODTAB");
a = atoi(codtab.mid(0,4));
const int a = atoi(codtab.mid(0,4));
if (a > _annoes) break;
const tiporeg tipo = (tiporeg)_tabreg->get_int("I0");
if (a == _annoes && (tipo == vendita || tipo == acquisto))
{
codreg = codtab.mid(4,3);
@ -3613,7 +3634,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
vect.destroy();
vect_prec.destroy();
vect_det.destroy();
chiave = "";
chiave.cut(0);
chiave << _annoes << _tabreg->get("S8");
// 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 ;
tabula->zero();
tabula->put("CODTAB", chiave);
TRectype r (tabula->curr());
const TRectype r(tabula->curr());
tabula->read(_isgteq);
for (; !tabula->eof(); tabula->next())
{
if (tabula->curr() != r) break;
ctab = tabula->get("CODTAB");
creg = ctab.mid(10,3);
int mese = atoi(ctab.mid(13,2));
if (codreg == creg.trim() && mese == i)
creg = ctab.mid(10,3); creg.trim();
const int mese = atoi(ctab.mid(13,2));
if (codreg == creg && mese == i)
{
codiva = ctab.mid(16,4);
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)
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)
vect_prec.add_riga(impon,impos,impol,ZERO,ZERO,ZERO,codiva);
else
@ -3678,7 +3700,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
{
if (_tipo_stampa != prova)
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);
}
}

View File

@ -90,10 +90,10 @@ public:
const char* tipo_attivita ();
const char* descr_doc ();
const char* descr_iva (const char*);
TRectype& ricerca_occ(const char*);
TRectype& ricerca_cf (char, long);
TRectype& look_comuni(const TString& stato, const TString& cod);
TRectype& look_comuni(const char* cod);
const TRectype& ricerca_occ(const char*);
const TRectype& ricerca_cf (char, long);
const TRectype& look_comuni(const TString& stato, const TString& cod);
const TRectype& look_comuni(const char* cod);
TArray_sheet* get_ditte_sheet() { return _ditte; }
int setta_riga (int, const TRigaiva&, real&, real&, real&, real&);
int riga_rmoviva();
@ -107,7 +107,7 @@ public:
bool controlla_mov();
bool stampo_liquidazione(int);
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_regs(int, TString&, int, int*, long, TProgind*);
bool stampa_totali_finali();

View File

@ -88,7 +88,7 @@ void TAp_eser::main_loop()
anno = TabEs.get_int ("CODTAB");
inizio = TabEs.get_date("D0"); //data inizio es. in corso
fine = TabEs.get_date("D1"); //data fine es. in corso
msk.set(F_ANNO, anno);
msk.set(F_DATAINIC, inizio.string());
msk.set(F_DATAFINC, fine.string());

View File

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

View File

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

View File

@ -49,17 +49,16 @@ bool cau_filter2 (const TRelation *r)
{
bool rt = FALSE;
const TRectype& rec = r->curr(LF_CAUSALI);
if (rec.get(CAU_TIPODOC) == "FV") // Solo i tipi documento Fatture Vendita
const TString& tipo = rec.get(CAU_TIPODOC);
if (tipo == "FV" || tipo == "NC") // Solo i tipi documento Fatture Vendita
{
TTable& reg = (TTable&) r->lfile("REG");
TString16 cod;
cod << __anno;
cod << rec.get(CAU_REG);
reg.put("CODTAB", cod);
if (reg.read() == NOERR )
rt = ! reg.get_bool("B1");
if (reg.read() == NOERR)
rt = !reg.get_bool("B1");
}
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
{
TSheet_field& sf = sfield(F_SHEET_CAUSALI);
TString16 c;
bool error = FALSE;
bool error = TRUE;
for (int i=0; i < sf.items(); i++)
{
TToken_string& tt = sf.row(i);
c = tt.get(F_CAUDEF - F_CAUMOV);
if (c.empty())
const TString16 c = tt.get(F_CAUDEF - F_CAUMOV);
if (!c.blank())
{
error = TRUE;
error = FALSE;
break;
}
}
if (sf.items() == 0)
error = TRUE;
if (error)
{
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.");
else
error_box("E' necessario indicare almeno una causale definitiva.");
}
return !error;
}
@ -377,7 +372,13 @@ void TGestAutoTrasp_mask::write_movs()
// Scorre i movimenti selezionati sul registro in sospensione
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;
if (mpn_sosp.read(_isequal) == NOERR)
{

View File

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

View File

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

View File

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

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