Revert "Patch level : 12.0 1118"
This reverts commit 802a74c19e9d52f0267bafbb72a4e1af107594cc.
This commit is contained in:
parent
802a74c19e
commit
d8995358f0
@ -881,10 +881,6 @@
|
||||
<Project>{9c91bacf-9a70-4973-b8cc-fa3d2af9867c}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\src\include\alex.alx" />
|
||||
<None Include="..\src\include\report.alx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@ -14,9 +14,6 @@
|
||||
<Filter Include="Libraries">
|
||||
<UniqueIdentifier>{ad187331-43fa-476b-9ee2-7e0cab5cde0e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Alx">
|
||||
<UniqueIdentifier>{3ac37126-3475-4122-be0b-b16a7b877069}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\xvaga\statbar.h">
|
||||
@ -800,12 +797,4 @@
|
||||
<Filter>Libraries</Filter>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\src\include\alex.alx">
|
||||
<Filter>Alx</Filter>
|
||||
</None>
|
||||
<None Include="..\src\include\report.alx">
|
||||
<Filter>Alx</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
Binary file not shown.
@ -158,21 +158,21 @@
|
||||
<RepCompiler Include="..\src\ci\ci1200e.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1300a.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1300b.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1400a.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1400b.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1300a.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1300ab.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1300b.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
<RepCompiler Include="..\src\ci\ci1300bb.rep">
|
||||
<Filter>Reports</Filter>
|
||||
</RepCompiler>
|
||||
|
Binary file not shown.
BIN
cd/Setup.exe
BIN
cd/Setup.exe
Binary file not shown.
@ -1,11 +1,11 @@
|
||||
#ifdef WIN32
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#include <io.h>
|
||||
#include <share.h>
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#include <io.h>
|
||||
#include <share.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -13,9 +13,11 @@
|
||||
#include "ba1100.h"
|
||||
#include "ba1103.h"
|
||||
|
||||
#include <applicat.h>
|
||||
#include <dongle.h>
|
||||
#include <relapp.h>
|
||||
#include <printer.h>
|
||||
#include <progind.h>
|
||||
#include <reputils.h>
|
||||
#include <utility.h>
|
||||
#include <user.h>
|
||||
|
||||
@ -33,16 +35,69 @@
|
||||
#define Dir_file "dir.gen"
|
||||
#define Trc_file "trc.gen"
|
||||
|
||||
class TManutenzione_app : public TSkeleton_application
|
||||
{
|
||||
TDir_sheet* _browse;
|
||||
TArray _dirs;
|
||||
TArray _recs;
|
||||
TMask* _mask;
|
||||
long _firm;
|
||||
long _level;
|
||||
long _history_firm;
|
||||
TRec_sheet* _rec;
|
||||
TLog_report* _log;
|
||||
bool _print_log;
|
||||
|
||||
bool _superprassi;
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create () ;
|
||||
virtual bool destroy();
|
||||
void insert_riga(long, TToken_string&);
|
||||
void edit_riga(long, TToken_string&);
|
||||
void edit_riga(const TString&);
|
||||
void delete_riga(long);
|
||||
virtual bool extended_firm() const { return true; }
|
||||
|
||||
bool set_converting();
|
||||
bool reset_converting();
|
||||
|
||||
bool try_to_recover(TSystemisamfile& f, int err);
|
||||
void update();
|
||||
void update_dir();
|
||||
void convert_dir();
|
||||
virtual void print();
|
||||
virtual void do_print(TPrinter & p, TRec_sheet & r);
|
||||
const char* dumpfilename(const FileDes& dep) const;
|
||||
void load_des();
|
||||
void open_history();
|
||||
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 save_file(const char * file);
|
||||
|
||||
void open_log();
|
||||
void write_log(const char* line, const int severity = 0);
|
||||
void close_log();
|
||||
|
||||
bool moveable_file(int file) const;
|
||||
public:
|
||||
|
||||
TManutenzione_app();
|
||||
};
|
||||
|
||||
HIDDEN bool browse_file_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_F9)
|
||||
{
|
||||
{
|
||||
FILE_SPEC fs; memset(&fs, 0, sizeof(FILE_SPEC));
|
||||
TFilename fname = f.get(); fname.ext("dbf");
|
||||
xvt_fsys_convert_str_to_fspec(fname, &fs);
|
||||
xvt_fsys_get_default_dir(&fs.dir);
|
||||
if (xvt_dm_post_file_open(&fs, TR("Selezione file")) == FL_OK)
|
||||
{
|
||||
{
|
||||
TFilename n;
|
||||
xvt_fsys_convert_dir_to_str(&fs.dir, n.get_buffer(n.size()), n.size());
|
||||
n.add(fs.name);
|
||||
@ -62,51 +117,51 @@ TManutenzione_app::TManutenzione_app() : _browse(NULL), _mask(NULL), _firm(0), _
|
||||
strncpy_s(fd.SysName, "$dir.gen", sizeof(fd.SysName));
|
||||
strncpy_s(fd.Des, "Directory", sizeof(fd.Des));
|
||||
strncpy_s(fd.FCalc, "0", sizeof(fd.FCalc));
|
||||
strncpy_s(fd.GenPrompt, "", sizeof(fd.GenPrompt));
|
||||
fd.LenR = 160;
|
||||
strncpy_s(fd.GenPrompt,"", sizeof(fd.GenPrompt));
|
||||
fd.LenR =160;
|
||||
fd.EOD = fd.EOX = 1L;
|
||||
fd.Flags = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
int handle = sopen(Dir_file, O_RDWR | O_BINARY | O_CREAT, SH_DENYNO, S_IREAD | S_IWRITE);
|
||||
int handle = sopen(Dir_file, O_RDWR|O_BINARY|O_CREAT,SH_DENYNO,S_IREAD|S_IWRITE);
|
||||
#else
|
||||
int handle = open(Dir_file, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
int handle = open(Dir_file, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
#endif
|
||||
if (handle != -1)
|
||||
{
|
||||
if (write(handle, &fd, sizeof(FileDes)) == -1)
|
||||
fatal_box("Impossibile scrivere il file dir.gen per dati standard: errore %d", errno);
|
||||
if (write( handle, &fd, sizeof(FileDes)) == -1)
|
||||
fatal_box("Impossibile scrivere il file dir.gen per dati standard: errore %d",errno);
|
||||
close(handle);
|
||||
}
|
||||
else
|
||||
fatal_box("Impossibile creare il file dir.gen per dati standard: errore %d", errno);
|
||||
else
|
||||
fatal_box("Impossibile creare il file dir.gen per dati standard: errore %d",errno);
|
||||
}
|
||||
if (!fexist(Trc_file))
|
||||
{
|
||||
TTrec r;
|
||||
RecDes& rd = r.rec();
|
||||
#ifdef WIN32
|
||||
int handle = sopen(Trc_file, O_RDWR | O_BINARY | O_CREAT, SH_DENYNO, S_IREAD | S_IWRITE);
|
||||
int handle = sopen(Trc_file, O_RDWR|O_BINARY|O_CREAT,SH_DENYNO,S_IREAD|S_IWRITE);
|
||||
#else
|
||||
int handle = open(Trc_file, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
int handle = open(Trc_file, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO);
|
||||
#endif
|
||||
if (handle != -1)
|
||||
{
|
||||
if (write(handle, (void*)&rd, sizeof(RecDes)) == -1)
|
||||
fatal_box("Impossibile scrivere il file trc.gen per dati standard: errore %d", errno);
|
||||
if (write( handle, (void*)&rd, sizeof(RecDes)) == -1)
|
||||
fatal_box("Impossibile scrivere il file trc.gen per dati standard: errore %d",errno);
|
||||
close(handle);
|
||||
}
|
||||
else
|
||||
fatal_box("Impossibile creare il file trc.gen per dati standard: errore %d", errno);
|
||||
else
|
||||
fatal_box("Impossibile creare il file trc.gen per dati standard: errore %d",errno);
|
||||
}
|
||||
}
|
||||
|
||||
void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r)
|
||||
|
||||
{
|
||||
const char* table[] = { "", TR("Alfanumerico"), TR("Intero"), TR("Intero Lungo"),
|
||||
const char* table[] = {"", TR("Alfanumerico"), TR("Intero"), TR("Intero Lungo"),
|
||||
TR("Reale"), TR("Data"), TR("Intero"), TR("Carattere"),
|
||||
TR("Booleano"), TR("Intero Zerofilled"), TR("Intero Lungo Zerofilled"),TR("Memo") };
|
||||
TR("Booleano"), TR("Intero Zerofilled"), TR("Intero Lungo Zerofilled"),TR("Memo")};
|
||||
TPrintrow row;
|
||||
TToken_string s;
|
||||
TParagraph_string d("", 25);
|
||||
@ -125,7 +180,7 @@ void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r)
|
||||
|
||||
row.reset();
|
||||
if (istab)
|
||||
row.put(format(FR("Lista tabella %s "), (const char *)tab), 2);
|
||||
row.put(format(FR("Lista tabella %s "), (const char *) tab), 2);
|
||||
else
|
||||
row.put(format(FR("Lista tracciato %s (%s)"), dir.des(), dir.name()), 2);
|
||||
row.put(TR("Pag. @#"), 69);
|
||||
@ -147,7 +202,7 @@ void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r)
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < rec.fields(); i++)
|
||||
for (i = 0; i < rec.fields(); i ++)
|
||||
{
|
||||
row.reset();
|
||||
s = rec.fielddef(i);
|
||||
@ -173,7 +228,7 @@ void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r)
|
||||
}
|
||||
p.print(row);
|
||||
wd = d.get();
|
||||
while (wd != NULL)
|
||||
while(wd != NULL)
|
||||
{
|
||||
row.reset();
|
||||
row.put(wd, 53);
|
||||
@ -181,7 +236,7 @@ void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r)
|
||||
wd = d.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
row.reset();
|
||||
p.print(row);
|
||||
@ -192,14 +247,14 @@ void TManutenzione_app::do_print(TPrinter & p, TRec_sheet & r)
|
||||
|
||||
if (p.rows_left() < 5)
|
||||
p.formfeed();
|
||||
else
|
||||
else
|
||||
{
|
||||
p.print(row);
|
||||
row.put(riga, 1);
|
||||
p.print(row);
|
||||
}
|
||||
p.print(row);
|
||||
}
|
||||
|
||||
for (i = 0; i < rec.keys(); i++)
|
||||
for (i = 0; i < rec.keys(); i ++)
|
||||
{
|
||||
row.reset();
|
||||
s = rec.keydef(i);
|
||||
@ -256,17 +311,18 @@ void TManutenzione_app::print()
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
do_print(p, *_rec);
|
||||
p.close();
|
||||
}
|
||||
|
||||
bool TManutenzione_app::create() // initvar e arrmask
|
||||
{
|
||||
TString sw(argc() > 2 ? argv(2) : "");
|
||||
_firm = get_firm();
|
||||
|
||||
TString sw(argc()>2 ? argv(2) : "");
|
||||
// Posso fare le operazione avanzate solo se sono ammistratore
|
||||
// e NON mi trovo su di una installazione di tipo client
|
||||
|
||||
xvt_vobj_show(TASK_WIN);
|
||||
_superprassi = user() == ::dongle().administrator() && !::dongle().demo();
|
||||
if (_superprassi)
|
||||
@ -300,13 +356,12 @@ bool TManutenzione_app::create() // initvar e arrmask
|
||||
modules = atol(argv(5));
|
||||
prefix().set("");
|
||||
load_des();
|
||||
dump_trc(dir, des_too, modules);
|
||||
dump_trc(dir,des_too,modules);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (!::dongle().demo() && !set_firm())
|
||||
return false;
|
||||
_firm = atol(prefix().name());
|
||||
load_des();
|
||||
|
||||
_mask = new TMask("ba1100a");
|
||||
@ -330,24 +385,6 @@ bool TManutenzione_app::destroy()
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
void TManutenzione_app::show_log()
|
||||
{
|
||||
if (db_log())
|
||||
{
|
||||
if (admin())
|
||||
{
|
||||
TLog_mask m;
|
||||
|
||||
m.run();
|
||||
}
|
||||
else
|
||||
message_box(TR("Il log delle transazioni è visualizzabile dall'amministratore"));
|
||||
}
|
||||
else
|
||||
message_box(TR("Il log delle transazioni è disattivato"));
|
||||
}
|
||||
|
||||
|
||||
void TManutenzione_app::open_log()
|
||||
{
|
||||
_print_log = false;
|
||||
@ -389,21 +426,21 @@ void TManutenzione_app::save_file(const char * file)
|
||||
TString_array files_to_copy;
|
||||
|
||||
list_files(n, files_to_copy);
|
||||
dest_path << "sav";
|
||||
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);
|
||||
TFilename dest_file(dest_path); dest_file << '/' << (const char *) source_file.name();
|
||||
fcopy((const char *) source_file, dest_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TManutenzione_app::insert_riga(long riga_sel, TToken_string& riga)
|
||||
void TManutenzione_app::insert_riga (long riga_sel, TToken_string& riga)
|
||||
{
|
||||
const int logicnum = int(riga_sel) + 1;
|
||||
const int num_files = (int)_browse->items();
|
||||
@ -412,30 +449,30 @@ void TManutenzione_app::insert_riga(long riga_sel, TToken_string& riga)
|
||||
_mask->disable(DLG_RECORD);
|
||||
_mask->disable(DLG_LOAD);
|
||||
_mask->disable(DLG_DUMP);
|
||||
_mask->show(F_TAB, (logicnum >= LF_TABGEN && logicnum <= LF_TAB) || (logicnum == LF_TABMOD));
|
||||
_mask->show(F_TAB, (logicnum >= LF_TABGEN && logicnum <= LF_TAB)||(logicnum == LF_TABMOD));
|
||||
_mask->hide(FLD_EXTEND);
|
||||
_mask->hide(FLD_EOX);
|
||||
_mask->set(FLD_NUM, riga.get(0));
|
||||
_mask->reset(F_TAB);
|
||||
_mask->set (FLD_NUM, riga.get(0));
|
||||
_mask->reset (F_TAB);
|
||||
|
||||
if (_mask->run() == K_ENTER)
|
||||
{
|
||||
/* shift di uno in avanti degli elementi del direttorio partendo dall'ultimo */
|
||||
for (int i = num_files; i >= logicnum; i--)
|
||||
for (int i=num_files; i>=logicnum; i--)
|
||||
{
|
||||
_browse->dir().get(i, _nolock, _nordir, _sysdirop);
|
||||
_browse->dir().put(i + 1, _nordir, _sysdirop);
|
||||
_browse->rec().get(i);
|
||||
_browse->rec().put(i + 1);
|
||||
_browse->dir().get (i, _nolock, _nordir, _sysdirop);
|
||||
_browse->dir().put (i + 1, _nordir, _sysdirop);
|
||||
_browse->rec().get (i);
|
||||
_browse->rec().put (i + 1);
|
||||
}
|
||||
_browse->dir().set(_mask->get(FLD_NOME), _mask->get_long(FLD_EOD),
|
||||
_mask->get_long(FLD_FLAG), _mask->get(FLD_DESC),
|
||||
_mask->get(FLD_FORMULA));
|
||||
_mask->get_long(FLD_FLAG), _mask->get (FLD_DESC),
|
||||
_mask->get (FLD_FORMULA));
|
||||
_browse->dir().put(logicnum, _nordir, _sysdirop);
|
||||
_browse->rec().zero();
|
||||
_browse->rec().put(logicnum);
|
||||
_browse->dir().get(LF_DIR);
|
||||
_browse->dir().set_eod(_browse->dir().eod() + 1);
|
||||
_browse->dir().set_eod(_browse->dir().eod()+1);
|
||||
_browse->set_items(_browse->dir().eod());
|
||||
_browse->dir().put(LF_DIR);
|
||||
}
|
||||
@ -443,32 +480,32 @@ void TManutenzione_app::insert_riga(long riga_sel, TToken_string& riga)
|
||||
|
||||
void TManutenzione_app::open_history()
|
||||
{
|
||||
FILE *fp = fopen(History_file, "r");
|
||||
FILE *fp = fopen(History_file,"r");
|
||||
if (fp != NULL)
|
||||
{
|
||||
char line[16];
|
||||
fgets(line, 16, fp);
|
||||
fgets(line,16,fp);
|
||||
int l = strlen(line);
|
||||
|
||||
line[l > 0 ? l - 1 : 0] = '\0';
|
||||
if (l == 0)
|
||||
line[l > 0 ? l -1 : 0 ] = '\0';
|
||||
if (l==0)
|
||||
_history_firm = -1;
|
||||
else
|
||||
_history_firm = atol(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
fp = fopen(History_file, "w");
|
||||
fp = fopen(History_file,"w");
|
||||
_history_firm = -1;
|
||||
}
|
||||
fclose(fp);
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
void TManutenzione_app::put_history(const char* firm)
|
||||
{
|
||||
FILE * fp = fopen(History_file, "w");
|
||||
fprintf(fp, "%s\n", firm);
|
||||
fclose(fp);
|
||||
FILE * fp = fopen(History_file,"w");
|
||||
fprintf(fp,"%s\n",firm);
|
||||
fclose (fp);
|
||||
}
|
||||
|
||||
void TManutenzione_app::close_history()
|
||||
@ -481,7 +518,7 @@ void TManutenzione_app::dump_trc(const char * dir, const bool des_too, const lon
|
||||
{
|
||||
TDir d;
|
||||
d.get(LF_DIR);
|
||||
const int items = (int)d.eod();
|
||||
const int items = (int) d.eod();
|
||||
const long flags = d.flags(); // livello archivi
|
||||
TFilename fn(dir);
|
||||
fn << "/level.dir";
|
||||
@ -494,7 +531,7 @@ void TManutenzione_app::dump_trc(const char * dir, const bool des_too, const lon
|
||||
s << dir;
|
||||
TProgind p(items ? items : 1, s, false, true);
|
||||
p.setstatus(1);
|
||||
for (int i = 2; i <= items; i++) //Salta il primo (dir.gen)
|
||||
for (int i=2;i<=items;i++) //Salta il primo (dir.gen)
|
||||
{
|
||||
p.addstatus(1);
|
||||
TTrec& rc = (TTrec&)_recs[i];
|
||||
@ -504,16 +541,16 @@ void TManutenzione_app::dump_trc(const char * dir, const bool des_too, const lon
|
||||
TFilename descfname;
|
||||
descfname.format("%s/d%d.des", DESCDIR, i);
|
||||
if (!fexist(descfname)) // crea la descrizione se non esiste
|
||||
{
|
||||
FILE * fd = fopen(descfname, "w");
|
||||
{
|
||||
FILE * fd = fopen(descfname, "w");
|
||||
if (fd != NULL)
|
||||
fclose(fd);
|
||||
}
|
||||
TConfig conf_des(descfname, DESCPAR);
|
||||
TConfig conf_des(descfname,DESCPAR);
|
||||
|
||||
if (des_too) rc.set_des(&conf_des);
|
||||
fn = dir;
|
||||
fn << "/f"; fn << i;
|
||||
fn << "/f";fn << i;
|
||||
fn.ext("trr");
|
||||
ofstream out(fn);
|
||||
out << rc;
|
||||
@ -536,21 +573,21 @@ const char* TManutenzione_app::dumpfilename(const FileDes& dep) const
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void TManutenzione_app::edit_riga(const TString& name)
|
||||
void TManutenzione_app::edit_riga (const TString& name)
|
||||
{
|
||||
const TFilename n(name);
|
||||
TExternisamfile* f = new TExternisamfile(n);
|
||||
|
||||
_mask->set(FLD_NUM, "");
|
||||
_mask->set(FLD_NOME, n);
|
||||
_mask->set(FLD_EOD, f->items());
|
||||
_mask->set(FLD_EOX, f->items());
|
||||
_mask->set(F_LEN, f->curr().len());
|
||||
_mask->set(FLD_DESC, f->description());
|
||||
_mask->set(FLD_FORMULA, "");
|
||||
_mask->set(FLD_FLAG, "");
|
||||
_mask->reset(FLD_EXTEND);
|
||||
_mask->reset(F_TAB);
|
||||
_mask->set (FLD_NUM, "");
|
||||
_mask->set (FLD_NOME, n);
|
||||
_mask->set (FLD_EOD, f->items());
|
||||
_mask->set (FLD_EOX, f->items());
|
||||
_mask->set (F_LEN, f->curr().len());
|
||||
_mask->set (FLD_DESC, f->description());
|
||||
_mask->set (FLD_FORMULA, "");
|
||||
_mask->set (FLD_FLAG, "");
|
||||
_mask->reset (FLD_EXTEND);
|
||||
_mask->reset (F_TAB);
|
||||
_mask->disable(-1);
|
||||
_mask->enable(DLG_RECORD, _superprassi);
|
||||
|
||||
@ -575,7 +612,7 @@ void TManutenzione_app::edit_riga(const TString& name)
|
||||
}
|
||||
}
|
||||
|
||||
void TManutenzione_app::edit_riga(long riga_sel, TToken_string& riga)
|
||||
void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga)
|
||||
{
|
||||
const int logicnum = int(riga_sel) + 1;
|
||||
|
||||
@ -585,16 +622,16 @@ void TManutenzione_app::edit_riga(long riga_sel, TToken_string& riga)
|
||||
_mask->enable(DLG_DUMP);
|
||||
|
||||
_mask->show(F_TAB, logicnum >= LF_TABGEN && logicnum <= LF_TAB);
|
||||
_mask->set(FLD_NUM, riga.get(0));
|
||||
_mask->set(FLD_NOME, riga.get());
|
||||
_mask->set(FLD_EOD, riga.get());
|
||||
_mask->set(FLD_EOX, riga.get());
|
||||
_mask->set(F_LEN, riga.get());
|
||||
_mask->set(FLD_DESC, riga.get());
|
||||
_mask->set(FLD_FORMULA, riga.get());
|
||||
_mask->set(FLD_FLAG, riga.get());
|
||||
_mask->reset(FLD_EXTEND);
|
||||
_mask->reset(F_TAB);
|
||||
_mask->set (FLD_NUM, riga.get(0));
|
||||
_mask->set (FLD_NOME, riga.get());
|
||||
_mask->set (FLD_EOD, riga.get());
|
||||
_mask->set (FLD_EOX, riga.get());
|
||||
_mask->set (F_LEN, riga.get());
|
||||
_mask->set (FLD_DESC, riga.get());
|
||||
_mask->set (FLD_FORMULA, riga.get());
|
||||
_mask->set (FLD_FLAG, riga.get());
|
||||
_mask->reset (FLD_EXTEND);
|
||||
_mask->reset (F_TAB);
|
||||
|
||||
const TRecnotype oldeox = _mask->get_long(FLD_EOX);
|
||||
const bool com = prefix().is_com() || !*prefix().name();
|
||||
@ -631,11 +668,11 @@ void TManutenzione_app::edit_riga(long riga_sel, TToken_string& riga)
|
||||
case K_ENTER:
|
||||
{
|
||||
FileDes dep;
|
||||
strncpy(dep.SysName, _mask->get(FLD_NOME), sizeof(dep.SysName));
|
||||
dep.EOD = atol(_mask->get(FLD_EOD));
|
||||
dep.Flags = atol(_mask->get(FLD_FLAG));
|
||||
strncpy(dep.Des, _mask->get(FLD_DESC), sizeof(dep.Des));
|
||||
strncpy(dep.FCalc, _mask->get(FLD_FORMULA), sizeof(dep.FCalc));
|
||||
strncpy (dep.SysName,_mask->get(FLD_NOME), sizeof(dep.SysName));
|
||||
dep.EOD = atol(_mask->get (FLD_EOD));
|
||||
dep.Flags = atol(_mask->get (FLD_FLAG));
|
||||
strncpy (dep.Des,_mask->get (FLD_DESC), sizeof(dep.Des));
|
||||
strncpy (dep.FCalc,_mask->get (FLD_FORMULA), sizeof(dep.FCalc));
|
||||
const TRecnotype eox = _mask->get_bool(FLD_EXTEND) ? _mask->get_long(FLD_EOX) : oldeox;
|
||||
|
||||
TDir& dir = _browse->dir();
|
||||
@ -652,7 +689,7 @@ void TManutenzione_app::edit_riga(long riga_sel, TToken_string& riga)
|
||||
TFilename f_name(d.name());
|
||||
f_name.ext("dbf");
|
||||
|
||||
if (!f_name.exist())
|
||||
if (!f_name.exist())
|
||||
f.build();
|
||||
|
||||
_browse->dir().get(logicnum, _nolock, _nordir, _sysdirop);
|
||||
@ -661,7 +698,7 @@ void TManutenzione_app::edit_riga(long riga_sel, TToken_string& riga)
|
||||
{
|
||||
f.packfile(true);
|
||||
f.packindex(true);
|
||||
// le 4 righe seguenti servono per allineare i valori di EOD ed EOX dopo una compattazione forzata
|
||||
// le 4 righe seguenti servono per allineare i valori di EOD ed EOX dopo una compattazione forzata
|
||||
dir.get(logicnum, _nolock, _nordir, _sysdirop);
|
||||
dir.set(dep.SysName, dep.EOD, dep.Flags, dep.Des, dep.FCalc);
|
||||
dir.set_eox(_browse->dir().eod());
|
||||
@ -695,8 +732,8 @@ void TManutenzione_app::edit_riga(long riga_sel, TToken_string& riga)
|
||||
const int keyno = m.get_int(FLD_KEYNO);
|
||||
const TString4 tabella(_mask->get(F_TAB));
|
||||
if (tabella.not_empty())
|
||||
{
|
||||
TToken_string filter;
|
||||
{
|
||||
TToken_string filter;
|
||||
filter.add("COD"); filter.add(tabella);
|
||||
f.dump(nout, keyno, fs, fd, rs, true, withdel, filter);
|
||||
}
|
||||
@ -733,19 +770,19 @@ void TManutenzione_app::edit_riga(long riga_sel, TToken_string& riga)
|
||||
}
|
||||
}
|
||||
|
||||
void TManutenzione_app::delete_riga(long riga_sel)
|
||||
void TManutenzione_app::delete_riga (long riga_sel)
|
||||
{
|
||||
const int num_files = (int)_browse->items();
|
||||
const int logicnum = int(riga_sel) + 1;
|
||||
if (riga_sel == num_files - 1 && yesno_box(FR("Si conferma l'eliminazione del file %d"), logicnum))
|
||||
if (riga_sel == num_files-1 && yesno_box(FR("Si conferma l'eliminazione del file %d"), logicnum))
|
||||
{
|
||||
/* shift di uno in avanti degli elementi del direttorio partendo dall'ultimo */
|
||||
for (int i = logicnum + 1; i <= num_files; i++)
|
||||
{
|
||||
_browse->dir().get(i, _nolock, _nordir, _sysdirop);
|
||||
_browse->dir().put(i - 1, _nordir, _sysdirop);
|
||||
_browse->rec().get(i);
|
||||
_browse->rec().put(i - 1);
|
||||
_browse->dir().get (i, _nolock, _nordir, _sysdirop);
|
||||
_browse->dir().put (i - 1, _nordir, _sysdirop);
|
||||
_browse->rec().get (i);
|
||||
_browse->rec().put (i - 1);
|
||||
}
|
||||
|
||||
_browse->dir().get(LF_DIR);
|
||||
@ -753,7 +790,7 @@ void TManutenzione_app::delete_riga(long riga_sel)
|
||||
TTrec r;
|
||||
r.zero();
|
||||
r.put(_browse->dir().eod());
|
||||
_browse->dir().set_eod(_browse->dir().eod() - 1);
|
||||
_browse->dir().set_eod(_browse->dir().eod()-1);
|
||||
_browse->set_items(_browse->dir().eod());
|
||||
_browse->dir().put(LF_DIR);
|
||||
_browse->force_update();
|
||||
@ -773,7 +810,7 @@ void TManutenzione_app::repair_file(int i)
|
||||
{
|
||||
TString s(_MAX_PATH + 50); // Messaggio di log
|
||||
|
||||
TDir d(i);
|
||||
TDir d(i);
|
||||
const char* n = d.filename();
|
||||
|
||||
if (d.eod() == 0)
|
||||
@ -794,10 +831,10 @@ void TManutenzione_app::repair_file(int i)
|
||||
TExternisamfile ef(n);
|
||||
|
||||
const RecDes& rd = ef.curr().rec_des();
|
||||
TTrec rec; rec.get(i);
|
||||
TTrec rec; rec.get(i);
|
||||
const int oldreclen = rec.len();
|
||||
rec.rec() = rd;
|
||||
rec.put(i);
|
||||
rec.put(i);
|
||||
|
||||
const int reclen = rec.len();
|
||||
d.set_len(reclen);
|
||||
@ -832,7 +869,7 @@ void TManutenzione_app::update_dir()
|
||||
safely_close_closeable_isamfiles(); // Serve a premettere la chiamata ad fsize() in sicurezza
|
||||
|
||||
TString prompt(128);
|
||||
if (is_com)
|
||||
if (is_com)
|
||||
prompt << TR("Aggiornamento dati comuni");
|
||||
else
|
||||
prompt << TR("Aggiornamento ditta") << ' ' << atol(pref);
|
||||
@ -846,7 +883,7 @@ void TManutenzione_app::update_dir()
|
||||
if (!p.setstatus(i))
|
||||
break;
|
||||
|
||||
const TDir & ds = (const TDir &)_dirs[i];
|
||||
const TDir & ds = (const TDir &) _dirs[i];
|
||||
const bool is_firm = ds.is_firm();
|
||||
const bool to_create = (is_com ? ds.is_com() : ds.is_firm());
|
||||
|
||||
@ -880,10 +917,10 @@ void TManutenzione_app::update_dir()
|
||||
else
|
||||
{
|
||||
if (is_com)
|
||||
{
|
||||
{
|
||||
if (old_is_firm && !moveable_file(i) && d.eod() == 0L)
|
||||
{
|
||||
const char* n = d.filename();
|
||||
const char* n = d.filename();
|
||||
save_file(n);
|
||||
|
||||
TToken_string names; get_table_names(i, names, 0xF);
|
||||
@ -904,7 +941,7 @@ void TManutenzione_app::update_dir()
|
||||
int err = b.is_valid(true);
|
||||
// Aggiunto err==-60 per errore conversione sui file 98,99,125 in Pharmatex e dintorni
|
||||
if ((err == _istrcerr || err == _ispatherr || err == -60) && (d.eod() == 0) && (size < 4096))
|
||||
{
|
||||
{
|
||||
bool kill = true;
|
||||
//controllo solo all'aga
|
||||
if (is_power_station())
|
||||
@ -938,7 +975,7 @@ void TManutenzione_app::update_dir()
|
||||
}
|
||||
if (err != NOERR && flags < 10000L)
|
||||
{
|
||||
if (!try_to_recover(b, err))
|
||||
if (!try_to_recover(b, err))
|
||||
{
|
||||
msg.format(TR("Impossibile compattare il file %d - %s : errore n.ro %d"),
|
||||
i, (const char*)d.filename(), err);
|
||||
@ -988,10 +1025,10 @@ void TManutenzione_app::update_dir()
|
||||
if (!valid_file)
|
||||
d.set(ds.name(), d.eox(), d.eod(), ds.des(), d.expr());
|
||||
else
|
||||
strcpy((char *)d.des(), ds.des());
|
||||
strcpy((char *) d.des(), ds.des());
|
||||
}
|
||||
}
|
||||
if (is_com && valid_file && d.name()[0] == '$')
|
||||
if (is_com && valid_file && d.name()[0] == '$')
|
||||
{
|
||||
TString name(d.name());
|
||||
name[0] = '%';
|
||||
@ -1005,7 +1042,7 @@ void TManutenzione_app::update_dir()
|
||||
//se il numero totale di files nuovi è inferiore a quello dei files già presenti c'è qualcosa che probabilmente..
|
||||
//..non va (aggiornamento da un cd vecchio ad esempio); comunque ha finito il suo lavoro qui, perchè quello che..
|
||||
//..segue riguarda solo i files nuovi
|
||||
if (last_curr_item >= last_new_item)
|
||||
if (last_curr_item >= last_new_item)
|
||||
return;
|
||||
|
||||
//aggiornatore degli EOX EOD ecc. dei files nuovi
|
||||
@ -1040,10 +1077,10 @@ void TManutenzione_app::convert_dir()
|
||||
|
||||
TString s;
|
||||
s << TR("Aggiornamento archivi ");
|
||||
if (is_com)
|
||||
if (is_com)
|
||||
s << TR("comuni");
|
||||
else
|
||||
s << TR("ditta ") << atol(pref);
|
||||
s << TR("ditta ") << atol (pref);
|
||||
s << ".\n";
|
||||
|
||||
TProgress_monitor p(update_items, s, is_power_station());
|
||||
@ -1053,7 +1090,7 @@ void TManutenzione_app::convert_dir()
|
||||
break;
|
||||
|
||||
const TTrec& rs = (const TTrec&)_recs[i]; // Nuovo tracciato record
|
||||
const TDir& ds = (const TDir&)_dirs[i];
|
||||
const TDir& ds = (const TDir&)_dirs[i];
|
||||
const long flags = ds.flags();
|
||||
|
||||
if (ds.len() > 0)
|
||||
@ -1067,11 +1104,11 @@ void TManutenzione_app::convert_dir()
|
||||
|
||||
const int module = abs((int)ds.flags());
|
||||
TSystemisamfile f(i);
|
||||
int err = f.is_valid(true);
|
||||
int err = f.is_valid(true);
|
||||
switch (err)
|
||||
{
|
||||
case -64:
|
||||
case -60:
|
||||
case -60:
|
||||
err = NOERR; // verif.
|
||||
break;
|
||||
default:
|
||||
@ -1079,7 +1116,7 @@ void TManutenzione_app::convert_dir()
|
||||
}
|
||||
|
||||
if (i > LF_USER && err != NOERR && ((is_com && d.is_com()) || (!is_com && d.is_firm())))
|
||||
{
|
||||
{
|
||||
if (err == _istrcerr || err == _isbadtrc)
|
||||
{
|
||||
repair_file(i);
|
||||
@ -1111,7 +1148,7 @@ void TManutenzione_app::convert_dir()
|
||||
//crea il nuovo file in base al tracciato record nuovo!
|
||||
if (!fname.exist() && ds.len() > 0 && rs.len() > 0)
|
||||
{
|
||||
set_autoload_new_files(false);
|
||||
set_autoload_new_files(false);
|
||||
f.build(rs);
|
||||
set_autoload_new_files(true);
|
||||
// Anche se il file non esisteva, prosegue, perche' possono esserci conversioni
|
||||
@ -1185,10 +1222,10 @@ void TManutenzione_app::load_des()
|
||||
// Cerca in RECDESC i files f[nnn].dir
|
||||
TString ws;
|
||||
TFilename fn;
|
||||
TDir td, new_dir;
|
||||
TDir td,new_dir;
|
||||
TTrec tr;
|
||||
|
||||
int ln = items, last_newln = items;
|
||||
int ln = items,last_newln = items;
|
||||
tr.zero();
|
||||
fn << DESCDIR << "/level.dir";
|
||||
|
||||
@ -1204,7 +1241,7 @@ void TManutenzione_app::load_des()
|
||||
// eventuali "buchi" oltre al numero attuale di items vengono rimpiazzati
|
||||
// con tracciati vuoti.
|
||||
|
||||
fn.format("%s/f*.dir", DESCDIR);
|
||||
fn.format("%s/f*.dir",DESCDIR);
|
||||
|
||||
TString_array list;
|
||||
const int totfiles = list_files(fn, list);
|
||||
@ -1221,36 +1258,36 @@ void TManutenzione_app::load_des()
|
||||
const bool is_new = ln > last_newln; // memorizza l'ultimo record scritto come nuovo
|
||||
if (is_new) // aggiunge i files che mancano
|
||||
{
|
||||
for (int i = last_newln + 1; i < ln; i++)
|
||||
for (int i = last_newln+1; i<ln; i++)
|
||||
{
|
||||
ws.format("$f%d", i);
|
||||
new_dir.set(ws, 0L, -1L, TR("File non presente"), "");
|
||||
new_dir.put(i, _nordir, _sysdirop);
|
||||
tr.put(i);
|
||||
ws.format("$f%d",i);
|
||||
new_dir.set(ws,0L,-1L, TR("File non presente"),"");
|
||||
new_dir.put(i,_nordir,_sysdirop);
|
||||
tr.put(i);
|
||||
}
|
||||
last_newln = ln;
|
||||
}
|
||||
td.put(ln, _nordir, _sysdirop);
|
||||
td.put(ln,_nordir,_sysdirop);
|
||||
if (is_new)
|
||||
tr.put(ln);
|
||||
}
|
||||
}
|
||||
|
||||
d.set_eod(last_newln);
|
||||
d.set_eox(last_newln);
|
||||
d.set_flags(_level = flags);
|
||||
prefix().set_stdlevel(flags);
|
||||
d.put(LF_DIR, _nordir, _sysdirop);
|
||||
d.put(LF_DIR,_nordir,_sysdirop);
|
||||
}
|
||||
|
||||
items = (int)d.eod();
|
||||
items = (int) d.eod();
|
||||
|
||||
TString80 s = TR("Caricamento descrizioni archivi ");
|
||||
if (standard)
|
||||
if (standard)
|
||||
s << "standard";
|
||||
else
|
||||
{
|
||||
if (prefix().is_com()) s << TR("comuni");
|
||||
else s << TR("ditta ") << atol(pref);
|
||||
else s << TR("ditta ") << atol (pref);
|
||||
}
|
||||
|
||||
TProgress_monitor p(items ? items : 1, s, false);
|
||||
@ -1262,7 +1299,7 @@ void TManutenzione_app::load_des()
|
||||
|
||||
if (standard)
|
||||
{
|
||||
TFilename desc_file;
|
||||
TFilename desc_file;
|
||||
desc_file << DESCDIR << "/f" << i;
|
||||
desc_file.ext("trr");
|
||||
if (fexist(desc_file))
|
||||
@ -1274,8 +1311,8 @@ void TManutenzione_app::load_des()
|
||||
descfname.format("%s/d%d.des", DESCDIR, i);
|
||||
|
||||
if (!fexist(descfname))
|
||||
{
|
||||
FILE* fd = fopen(descfname, "w");
|
||||
{
|
||||
FILE* fd = fopen(descfname, "w");
|
||||
if (fd != NULL)
|
||||
fclose(fd);
|
||||
}
|
||||
@ -1284,13 +1321,13 @@ void TManutenzione_app::load_des()
|
||||
|
||||
r.set_des(&descr);
|
||||
in >> r;
|
||||
r.put(i);
|
||||
r.put(i);
|
||||
d.set_len(r.len());
|
||||
d.put(i, _nordir, _sysdirop);
|
||||
r.set_des();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_dirs.add(d, i);
|
||||
_recs.add(r, i);
|
||||
}
|
||||
@ -1368,7 +1405,7 @@ void TManutenzione_app::update()
|
||||
open_history();
|
||||
long firm = get_firm();
|
||||
TString pref;
|
||||
if (firm == 0)
|
||||
if (firm == 0)
|
||||
pref = prefix().name();
|
||||
|
||||
prefix().set("");
|
||||
@ -1378,8 +1415,8 @@ void TManutenzione_app::update()
|
||||
TString mxs; mxs = TR("Conversione dati comuni");
|
||||
|
||||
open_log();
|
||||
write_log(mxs);
|
||||
write_log("");
|
||||
write_log(mxs);
|
||||
write_log("");
|
||||
|
||||
TPointer_array ditte; // Evita di aprire LF_NDITTE
|
||||
const int nditte = prefix().firms(ditte);
|
||||
@ -1393,9 +1430,9 @@ void TManutenzione_app::update()
|
||||
if (codditta > _history_firm && prefix().exist(codditta) && set_firm(codditta))
|
||||
{
|
||||
mxs.cut(0) << TR("Conversione Ditta ") << codditta;
|
||||
write_log("");
|
||||
write_log(mxs);
|
||||
write_log("");
|
||||
write_log("");
|
||||
write_log(mxs);
|
||||
write_log("");
|
||||
update_dir();
|
||||
convert_dir();
|
||||
}
|
||||
@ -1428,7 +1465,7 @@ void TManutenzione_app::main_loop()
|
||||
|
||||
KEY key = _browse->run();
|
||||
|
||||
if (key != K_ENTER && key != K_QUIT && key != K_ESC &&
|
||||
if (key != K_ENTER && key != K_QUIT && key != K_ESC &&
|
||||
!_superprassi)
|
||||
{
|
||||
error_box(FR("Operazione non permessa all'utente %s"), (const char*)user());
|
||||
@ -1452,29 +1489,29 @@ void TManutenzione_app::main_loop()
|
||||
case K_F6:
|
||||
riga_selezionata = _browse->selected();
|
||||
riga = _browse->row();
|
||||
insert_riga(riga_selezionata, riga);
|
||||
insert_riga (riga_selezionata, riga);
|
||||
break;
|
||||
case K_ENTER:
|
||||
riga_selezionata = _browse->selected();
|
||||
riga = _browse->row();
|
||||
edit_riga(riga_selezionata, riga);
|
||||
edit_riga (riga_selezionata, riga);
|
||||
break;
|
||||
case K_DEL:
|
||||
riga_selezionata = _browse->selected();
|
||||
delete_riga(riga_selezionata);
|
||||
break;
|
||||
case K_QUIT:
|
||||
case K_ESC:
|
||||
done = true; close_history();
|
||||
case K_ESC:
|
||||
done = true; close_history();
|
||||
break;
|
||||
case K_F7:
|
||||
update();
|
||||
break;
|
||||
case K_F7:
|
||||
update();
|
||||
break;
|
||||
case K_F8:
|
||||
_browse->add();
|
||||
riga_selezionata = _browse->items() - 1;
|
||||
riga = _browse->row(riga_selezionata);
|
||||
edit_riga(riga_selezionata, riga);
|
||||
edit_riga (riga_selezionata, riga);
|
||||
break;
|
||||
case K_F5: // Other file
|
||||
{
|
||||
@ -1497,3 +1534,4 @@ int ba1100(int argc, char** argv)
|
||||
a.run(argc, argv, TR("Gestione files"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
156
src/ba/ba1100.h
156
src/ba/ba1100.h
@ -1,10 +1,6 @@
|
||||
#ifndef __BA1100_H
|
||||
#define __BA1100_H
|
||||
|
||||
#ifndef __APPLICAT_H
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@ -21,14 +17,6 @@
|
||||
class TMask_field;
|
||||
#endif
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __REPUTILS_H
|
||||
#include <reputils.h>
|
||||
#endif
|
||||
|
||||
#include "ba1100a.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -37,129 +25,71 @@ class TMask_field;
|
||||
|
||||
class TDir_sheet : public TSheet
|
||||
{
|
||||
TTrec _rec;
|
||||
TDir _dir;
|
||||
FileDes _s_dir;
|
||||
long _items;
|
||||
TTrec _rec;
|
||||
TDir _dir;
|
||||
FileDes _s_dir;
|
||||
long _items;
|
||||
|
||||
protected:
|
||||
virtual long get_items() const { return _items; }
|
||||
virtual void get_row(long n, TToken_string& r);
|
||||
virtual long get_items() const { return _items; }
|
||||
virtual void get_row(long n, TToken_string& r);
|
||||
|
||||
public:
|
||||
const TDir& dir() const { return _dir; }
|
||||
TDir& dir() { return _dir; }
|
||||
const TTrec& rec() const { return _rec; }
|
||||
TTrec& rec() { return _rec; }
|
||||
void set_items(long items) { _items = items; }
|
||||
void add();
|
||||
void rebuild() { _items = _dir.items(); }
|
||||
const TDir& dir() const { return _dir; }
|
||||
TDir& dir() { return _dir; }
|
||||
const TTrec& rec() const { return _rec; }
|
||||
TTrec& rec(){ return _rec; }
|
||||
void set_items(long items) { _items = items; }
|
||||
void add();
|
||||
void rebuild() { _items = _dir.items();}
|
||||
|
||||
TDir_sheet(const char* title, bool superprassi);
|
||||
TDir_sheet(const char* title, bool superprassi);
|
||||
};
|
||||
|
||||
class TRec_sheet : public TObject
|
||||
{
|
||||
TTrec _rec;
|
||||
TTrec _rec_old;
|
||||
TDir _dir;
|
||||
bool _comfile;
|
||||
TConfig *_descr;
|
||||
static TMask *_mask;
|
||||
TFilename _descfname;
|
||||
TString16 _tab;
|
||||
bool _external;
|
||||
TTrec _rec;
|
||||
TTrec _rec_old;
|
||||
TDir _dir;
|
||||
bool _comfile;
|
||||
TConfig *_descr;
|
||||
static TMask *_mask;
|
||||
TFilename _descfname;
|
||||
TString16 _tab;
|
||||
bool _external;
|
||||
|
||||
protected:
|
||||
bool check_key_expr(int key, const char* key_expr);
|
||||
static bool key_notify(TSheet_field& s, int r, KEY k);
|
||||
static bool fld_notify(TSheet_field& s, int r, KEY k);
|
||||
void save();
|
||||
void save_desc();
|
||||
bool check_key_expr(int key, const char* key_expr);
|
||||
static bool key_notify(TSheet_field& s, int r, KEY k);
|
||||
static bool fld_notify(TSheet_field& s, int r, KEY k);
|
||||
void save();
|
||||
void save_desc();
|
||||
|
||||
virtual long get_items() const { return _rec.fields(); }
|
||||
virtual long get_items() const { return _rec.fields(); }
|
||||
|
||||
public:
|
||||
const TDir& dir() const { return _dir; }
|
||||
const TTrec& rec() const { return _rec; }
|
||||
const char* descfname() const { return _descfname; }
|
||||
const char* tab() const { return _tab; }
|
||||
void edit();
|
||||
const TDir& dir() const { return _dir; }
|
||||
const TTrec& rec() const { return _rec; }
|
||||
const char* descfname() const { return _descfname;}
|
||||
const char* tab() const { return _tab; }
|
||||
void edit();
|
||||
|
||||
TRec_sheet(int logicnum, const char* tab);
|
||||
TRec_sheet(TExternisamfile* file);
|
||||
virtual ~TRec_sheet();
|
||||
TRec_sheet(int logicnum, const char* tab);
|
||||
TRec_sheet(TExternisamfile* file);
|
||||
virtual ~TRec_sheet();
|
||||
};
|
||||
|
||||
class TEdit_file : public TObject
|
||||
{
|
||||
protected:
|
||||
void edit_record(TRectype& rec);
|
||||
bool browse_cursor(TCursor& cur, const TFilename& name);
|
||||
void edit_record(TRectype& rec);
|
||||
bool browse_cursor(TCursor& cur, const TFilename& name);
|
||||
|
||||
public:
|
||||
bool browse_file(int logicnum, const TFilename& name, const TString& tab, const int selKey = 1);
|
||||
bool browse_file(TExternisamfile* file, const TFilename& name);
|
||||
TEdit_file() {}
|
||||
virtual ~TEdit_file() {}
|
||||
bool browse_file(int logicnum, const TFilename& name, const TString& tab, const int selKey = 1);
|
||||
bool browse_file(TExternisamfile* file, const TFilename& name);
|
||||
TEdit_file() {}
|
||||
virtual ~TEdit_file() {}
|
||||
};
|
||||
|
||||
class TManutenzione_app : public TSkeleton_application
|
||||
{
|
||||
TDir_sheet* _browse;
|
||||
TArray _dirs;
|
||||
TArray _recs;
|
||||
TMask* _mask;
|
||||
long _firm;
|
||||
long _level;
|
||||
long _history_firm;
|
||||
TRec_sheet* _rec;
|
||||
TLog_report* _log;
|
||||
bool _print_log;
|
||||
|
||||
bool _superprassi;
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
void insert_riga(long, TToken_string&);
|
||||
void edit_riga(long, TToken_string&);
|
||||
void edit_riga(const TString&);
|
||||
void delete_riga(long);
|
||||
virtual bool extended_firm() const { return true; }
|
||||
|
||||
bool set_converting();
|
||||
bool reset_converting();
|
||||
|
||||
bool try_to_recover(TSystemisamfile& f, int err);
|
||||
void update();
|
||||
void update_dir();
|
||||
void convert_dir();
|
||||
virtual void print();
|
||||
virtual void do_print(TPrinter & p, TRec_sheet & r);
|
||||
const char* dumpfilename(const FileDes& dep) const;
|
||||
void load_des();
|
||||
void open_history();
|
||||
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 save_file(const char * file);
|
||||
|
||||
virtual void show_log();
|
||||
|
||||
void open_log();
|
||||
void write_log(const char* line, const int severity = 0);
|
||||
void close_log();
|
||||
|
||||
bool moveable_file(int file) const;
|
||||
public:
|
||||
long get_firm() const { return _firm; }
|
||||
|
||||
TManutenzione_app();
|
||||
};
|
||||
|
||||
inline TManutenzione_app & app() { return (TManutenzione_app &)main_app(); }
|
||||
|
||||
#endif
|
||||
|
@ -275,17 +275,9 @@ void TRec_sheet::edit()
|
||||
}
|
||||
f2.set_notify(key_notify);
|
||||
f2.set_append(FALSE);
|
||||
|
||||
int nkeys = _rec.keys();
|
||||
|
||||
for (i = 0; i < nkeys; i++)
|
||||
f2.row(i) = _rec.keydef(i);
|
||||
f2.disable_cell(0, 1);
|
||||
|
||||
const bool enable_save = (_dir.is_com() && app().get_firm() == 0) ||
|
||||
(_dir.is_firm() && app().get_firm() > 0);
|
||||
|
||||
_mask->enable(DLG_SAVEREC, enable_save);
|
||||
int nkeys = _rec.keys();
|
||||
for (i = 0; i < nkeys; i++) f2.row(i) = _rec.keydef(i);
|
||||
f2.disable_cell(0, 1);
|
||||
while (true)
|
||||
{
|
||||
f1.force_update(0); // Non togliere, serve per fare l'update della descrizione quando si fa l'import!!
|
||||
|
@ -859,6 +859,7 @@ bool TMod_composition_msk::obs_handler(TMask_field& f, KEY k)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TMod_composition_msk::deselect_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
@ -1444,10 +1445,8 @@ bool TCreadischi_mask::creazip_handler(TMask_field& f, KEY k)
|
||||
const TString& module = m.get(S_MODULE);
|
||||
const bool agg = f.dlg() == S_CREATEPATCH;
|
||||
TCreadischi_mask& fm = (TCreadischi_mask&)m.get_sheet()->mask();
|
||||
const int patch = m.get_int(S_PATCHLEVEL);
|
||||
const TDate data = m.get_int(S_DATE);
|
||||
|
||||
if (fm.zip_module(module, agg, patch))
|
||||
if (fm.zip_module(module, agg, m.get_int(S_PATCHLEVEL)))
|
||||
{
|
||||
#ifdef __FCONV__
|
||||
// creazione XXfconv.ini (esporta le info di conversione )
|
||||
@ -1459,42 +1458,6 @@ bool TCreadischi_mask::creazip_handler(TMask_field& f, KEY k)
|
||||
TFconv_ini fconv;
|
||||
fconv.export_module(module, fconv_path);
|
||||
#endif
|
||||
TString_array updated_modules ; // ??
|
||||
const int mod_items = updated_modules.items();
|
||||
TArray_sheet& main_sheet = (TArray_sheet&)f.mask();
|
||||
const int items = main_sheet.items();
|
||||
bool some_updated = false;
|
||||
|
||||
TFilename sommario; //e' il file .ini con l'elenco dei files (XX@@@@a.ini)
|
||||
|
||||
sommario.tempdir();
|
||||
sommario.add(format("%s%04da.ini", (const char *) module, patch));
|
||||
sommario.ext("ini");
|
||||
|
||||
TConfig ini(sommario);
|
||||
|
||||
ini.list_paragraphs(updated_modules);
|
||||
for (int m = 0; m < items; m++)
|
||||
{
|
||||
const TToken_string mod_dep(main_sheet.row(m).get(5), ',');
|
||||
|
||||
FOR_EACH_ARRAY_ROW(updated_modules, submod, um)
|
||||
{
|
||||
FOR_EACH_STR_TOKEN(mod_dep, dep)
|
||||
{
|
||||
if (dep == submod)
|
||||
{
|
||||
main_sheet.row(m).add(patch, 3);
|
||||
main_sheet.row(m).add(data, 4);
|
||||
fm.zip_module(main_sheet.row(m).get(1), agg, patch);
|
||||
some_updated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (some_updated)
|
||||
main_sheet.force_update();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -136,7 +136,7 @@ protected:
|
||||
bool dir_gen() const;
|
||||
bool trc_gen() const;
|
||||
bool export_manager(const TString generalErrors) const;
|
||||
bool show_export_log();
|
||||
bool show_log();
|
||||
void log(int severity, const char* msg);
|
||||
|
||||
public:
|
||||
@ -980,7 +980,7 @@ bool TMSSQLExport_app::export_manager(TString generalErrors) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TMSSQLExport_app::show_export_log()
|
||||
bool TMSSQLExport_app::show_log()
|
||||
{
|
||||
if (_log)
|
||||
{
|
||||
@ -1089,7 +1089,7 @@ void TMSSQLExport_app::main_loop()
|
||||
}
|
||||
message_box("Migrazione effettuata correttamente!");
|
||||
} while (loop);
|
||||
show_export_log();
|
||||
show_log();
|
||||
}
|
||||
else
|
||||
message_box("Fallita connessione");
|
||||
|
@ -52,24 +52,26 @@ bool TTestrel_application::user_destroy()
|
||||
// Testmask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TTest_application : public TSkeleton_application
|
||||
class TTest_application : public TApplication
|
||||
{
|
||||
const char* _maskname;
|
||||
|
||||
protected:
|
||||
void main_loop();
|
||||
bool create() { return menu(0); }
|
||||
bool destroy() { return TRUE; }
|
||||
bool menu(MENU_TAG);
|
||||
|
||||
public:
|
||||
TTest_application(const char* name) : _maskname(name) {}
|
||||
};
|
||||
|
||||
void TTest_application::main_loop()
|
||||
bool TTest_application::menu(MENU_TAG)
|
||||
{
|
||||
if (*_maskname)
|
||||
{
|
||||
TMask m(_maskname);
|
||||
|
||||
while (m.run() == K_ENTER);
|
||||
KEY k = m.run();
|
||||
if (k == K_QUIT) stop_run();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -81,6 +83,8 @@ void TTest_application::main_loop()
|
||||
m.run();
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -4,7 +4,7 @@ PAGE "Richiesta" -1 -1 76 12
|
||||
|
||||
STRING F_NOME 50
|
||||
BEGIN
|
||||
PROMPT 3 3 "Maschera "
|
||||
PROMPT 3 3 "Nome maschera"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
|
@ -1742,7 +1742,6 @@ class TMailer : public TSkeleton_application
|
||||
bool _start_full_screen;
|
||||
|
||||
protected:
|
||||
virtual bool task_win_iconized() const { return !_start_full_screen && xvt_win_is_taskbar_visible(); }
|
||||
virtual bool create();
|
||||
virtual void main_loop();
|
||||
};
|
||||
@ -1768,7 +1767,7 @@ void TMailer::main_loop()
|
||||
WINDOW tray = xvt_trayicon_create(TASK_WIN, 9013, appname); // CampoServer.ico
|
||||
|
||||
open_files(LF_USER, 0);
|
||||
/* if (!_start_full_screen && xvt_win_is_taskbar_visible())
|
||||
if (!_start_full_screen && xvt_win_is_taskbar_visible())
|
||||
{
|
||||
if (tray != NULL_WIN)
|
||||
{
|
||||
@ -1779,7 +1778,7 @@ void TMailer::main_loop()
|
||||
if (xvt_rect_get_width(&rct_postman) >= xvt_rect_get_width(&rct_screen) - 64)
|
||||
xvt_vobj_set_visible(TASK_WIN, FALSE);
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
TMailer_mask mm;
|
||||
|
||||
|
@ -567,13 +567,6 @@ bool TReport_mask::save_report()
|
||||
if (ok)
|
||||
_is_dirty = false;
|
||||
}
|
||||
if (is_power_station())
|
||||
{
|
||||
DIRECTORY dir;
|
||||
|
||||
xvt_fsys_get_default_dir(&dir);
|
||||
xvt_fsys_set_dir(&dir);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ BEGIN
|
||||
WARNING "Manca la descrizione"
|
||||
END
|
||||
|
||||
LIST LST_TABIVA_S1 2 28
|
||||
LIST LST_TABIVA_S1 2 20
|
||||
BEGIN
|
||||
PROMPT 2 2 "Tipo "
|
||||
FIELD S1
|
||||
@ -70,15 +70,11 @@ BEGIN
|
||||
MESSAGE CLEAR,FLD_TABIVA_R0|CLEAR,FLD_TABIVA_I0
|
||||
MESSAGE ENABLE,FLD_TABIVA_I3|ENABLE,FLD_TABIVA_I4|SHOW,CHK_TABIVA_B5
|
||||
MESSAGE ENABLE,FLD_TABIVA_S6
|
||||
ITEM "RC|Reverse Charge (vendite)"
|
||||
MESSAGE CLEAR,FLD_TABIVA_R0|CLEAR,FLD_TABIVA_I0
|
||||
MESSAGE CLEAR,FLD_TABIVA_I3|CLEAR,FLD_TABIVA_I4|HIDE,CHK_TABIVA_B5
|
||||
MESSAGE ENABLE,FLD_TABIVA_S6
|
||||
END
|
||||
END
|
||||
|
||||
STRING FLD_TABIVA_S6 4
|
||||
BEGIN
|
||||
PROMPT 44 2 "C.IVA a cui ventilare "
|
||||
PROMPT 39 2 "C.IVA a cui ventilare "
|
||||
FLAGS "U"
|
||||
FIELD S6
|
||||
COPY USE FLD_TABIVA_CODTAB
|
||||
@ -150,7 +146,7 @@ END
|
||||
|
||||
BOOLEAN CHK_TABIVA_B5
|
||||
BEGIN
|
||||
PROMPT 30 5 "Escluso dal calcolo dei bolli su fatture esenti"
|
||||
PROMPT 30 5 "Escluso dal calcolo dei bolli sufatture esenti"
|
||||
FIELD B5
|
||||
END
|
||||
|
||||
@ -192,8 +188,6 @@ BEGIN
|
||||
INPUT FLD_TABIVA_I3
|
||||
OUTPUT FLD_TABIVA_I3
|
||||
ITEM " |Nessuno"
|
||||
ITEM "14|Passaggi interni"
|
||||
ITEM "16|Cessioni beni ammortizzabili"
|
||||
ITEM "20|Operazioni non imponibili (comma 1, artt.8, 8bis e 9)"
|
||||
ITEM "21|Operazioni non imponibili a seguito di dich. d'intento"
|
||||
ITEM "22|Altre operazioni non imponibili"
|
||||
@ -207,7 +201,6 @@ BEGIN
|
||||
ITEM "36|Cessione di microprocessori"
|
||||
ITEM "37|Prestazioni comparto edile e settori connessi"
|
||||
ITEM "38|Operazioni settore energetico"
|
||||
ITEM "39|Reverse charge altri casi"
|
||||
ITEM "B1|Ammontare op. es. escluse da nr. 1 a 9 e 11 art. 10"
|
||||
ITEM "B2|Ammontare op. es. di cui al nr. 11 art. 10"
|
||||
ITEM "B3|Ammontare op. es. di cui ai nr. 1 a 9 art. 10"
|
||||
|
@ -249,7 +249,7 @@ int file4tempLow( FILE4 *file, CODE4 *c4, const int autoRemove )
|
||||
|
||||
time( &t ) ;
|
||||
t %= 10000L ;
|
||||
c4ltoa45( (long)t, fileName + 4, -4 ) ;
|
||||
c4ltoa45( t, fileName + 4, -4 ) ;
|
||||
u4nameMake( name, sizeof( name ), drive, env + strlen( drive ), fileName ) ;
|
||||
|
||||
rc = file4create( file, c4, name, 1 ) ;
|
||||
|
@ -674,7 +674,7 @@ static int i4addOneTag( INDEX4 *i4, const TAG4INFO *tagData )
|
||||
break ;
|
||||
}
|
||||
|
||||
tagFile->header.exprLen = (short) strlen( tagFile->expr->source ) + 1 ;
|
||||
tagFile->header.exprLen = strlen( tagFile->expr->source ) + 1 ;
|
||||
if ( tagData[0].filter != 0 )
|
||||
if ( *( tagData[0].filter ) != '\0' )
|
||||
{
|
||||
@ -688,7 +688,7 @@ static int i4addOneTag( INDEX4 *i4, const TAG4INFO *tagData )
|
||||
rc = error4code( c4 ) ;
|
||||
break ;
|
||||
}
|
||||
tagFile->header.filterLen = (short)strlen( tagFile->filter->source ) ;
|
||||
tagFile->header.filterLen = strlen( tagFile->filter->source ) ;
|
||||
}
|
||||
|
||||
tagFile->header.filterLen++ ; /* minimum of 1, for the '\0' */
|
||||
|
@ -230,9 +230,9 @@ bool TSelam_qmask::on_field_event(TOperable_field& o, TField_event e, long jolly
|
||||
const TRectype & ammce = cache().get(LF_AMMCE, key);
|
||||
if (!ammce.empty())
|
||||
{
|
||||
if (ammce.get_bool(AMMCE_FZPER))
|
||||
if (ammce.get_bool(AMMCE_FZPER) == TRUE)
|
||||
return error_box(TR("Sul cespite sono state forzate le Percentuali:\nprocedere dalla forzatura ammortamenti su cespite"));
|
||||
if (ammce.get_bool(AMMCE_FZQUO))
|
||||
if (ammce.get_bool(AMMCE_FZQUO) == TRUE)
|
||||
return error_box(TR("Sul cespite sono state forzate le Quote:\nprocedere dalla forzatura ammortamenti su cespite"));
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,6 @@ bool TCalcamm::calcola_ammortamenti()
|
||||
break;
|
||||
|
||||
TCespite cespite(cur.curr());
|
||||
|
||||
for (int tipo_sit = 1; tipo_sit <= 3; tipo_sit++)
|
||||
cespite.calc_amm(tipo_sit, data_limite, true);
|
||||
}
|
||||
|
@ -50,8 +50,6 @@ public:
|
||||
TString4 _causale_originale;
|
||||
TipoIVA _iva_originale;
|
||||
TString_array _iva;
|
||||
TString _idsdi;
|
||||
TDate _datasdi;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -61,7 +59,7 @@ public:
|
||||
TPrimanota_application::TPrimanota_application()
|
||||
: _rel(nullptr), _mode(0), _iva(nessuna_iva), _causale(nullptr), _giornale(nullptr),
|
||||
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY), _automatico(nullptr), _swap_mask(false), _is_set_fpcheck(false), _f1_ini(false), _f1_liq(false),
|
||||
_skip_giornale_check(false), _skip_bollato_check(false), _pro_mask(nullptr)
|
||||
_skip_giornale_check(false), _skip_bollato_check(false)
|
||||
{
|
||||
memset(_msk, 0, sizeof(_msk));
|
||||
}
|
||||
@ -441,7 +439,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
||||
}
|
||||
|
||||
const char sezione = rcaus->get_char(RCA_SEZIONE);
|
||||
TImporto zero('D', ZERO);
|
||||
const TImporto zero('D', ZERO);
|
||||
const TString80 desc(causale().desc_agg(i));
|
||||
|
||||
if (nriga == 1) m->set(F_DESCR, desc);
|
||||
@ -699,7 +697,7 @@ void TPrimanota_application::init_mask(TMask& m)
|
||||
_sal_dirty = false; // Azzero il flag di modifica del saldaconto
|
||||
fill_sheet(m); // Riempe righe contabili coi conti della causale
|
||||
m.hide(F_LINKDOC);
|
||||
has_f1_db(m);
|
||||
set_has_f1_db(&m);
|
||||
}
|
||||
|
||||
void TPrimanota_application::init_query_mode(TMask& m)
|
||||
@ -738,7 +736,7 @@ void TPrimanota_application::init_query_mode(TMask& m)
|
||||
m.set(F_CODCAUS, ini.get(MOV_CODCAUS));
|
||||
m.send_key(K_SPACE, DLG_NEWREC);
|
||||
}
|
||||
has_f1_db(m);
|
||||
set_has_f1_db(&m);
|
||||
}
|
||||
|
||||
|
||||
@ -997,19 +995,17 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
m.enable(F_BOLLACODCLI, causale().tipo_doc() == "BD");
|
||||
m.enable(F_BOLLARAGCLI, causale().tipo_doc() == "BD");
|
||||
}
|
||||
if (iva() != nessuna_iva)
|
||||
f1_init(m, m.get_date(F_DATAREG) >= get_data_start_fatt());
|
||||
}
|
||||
|
||||
void TPrimanota_application::f1_init(TMask& m, const bool fe_enabled, const bool f1_linked)
|
||||
void TPrimanota_application::f1_init_modify(TMask& m, const TRectype& mov)
|
||||
{
|
||||
const bool reverse_charge = app().causale().reverse_charge_pubb();
|
||||
const bool after_data_inizio_fe = mov.get_date(MOV_DATADOC) >= get_data_start_fatt();
|
||||
|
||||
m.field(F_IDDOCSDI).show(fe_enabled && reverse_charge);
|
||||
m.field(F_DATADOCSDI).show(fe_enabled && reverse_charge);
|
||||
m.field(F_COLFPPRO).show(fe_enabled);
|
||||
m.field(DLG_LINK).enable(fe_enabled);
|
||||
m.set(F_COLFPPRO, fe_enabled && f1_linked, 0x3);
|
||||
m.field(F_IDDOCSDI).show(after_data_inizio_fe);
|
||||
m.field(F_DATADOCSDI).show(after_data_inizio_fe);
|
||||
m.field(F_COLFPPRO).show(after_data_inizio_fe);
|
||||
m.field(DLG_LINK).enable(after_data_inizio_fe);
|
||||
m.set(F_COLFPPRO, !after_data_inizio_fe || mov.get(MOV_KEYFPPRO).empty() ? " " : "X");
|
||||
}
|
||||
|
||||
void TPrimanota_application::init_modify_mode(TMask& m)
|
||||
@ -1120,7 +1116,7 @@ void TPrimanota_application::init_modify_mode(TMask& m)
|
||||
m.enable(F_BOLLARAGCLI, causale().tipo_doc() == "BD");
|
||||
}
|
||||
if (iva() != nessuna_iva)
|
||||
f1_init(m, mov.get_date(MOV_DATADOC) >= get_data_start_fatt(), mov.get(MOV_KEYFPPRO).full());
|
||||
f1_init_modify(m, mov);
|
||||
}
|
||||
|
||||
// Controlla sulla causale se il segno del totale documento (ritsoc=false)
|
||||
@ -1492,14 +1488,18 @@ void TPrimanota_application::check_saldi()
|
||||
|
||||
void TPrimanota_application::write_fppro()
|
||||
{
|
||||
if (main_app().has_module(FPAUT) && !ini_get_bool(CONFIG_INSTALL, "Main", "SkipFPPRO"))
|
||||
#ifdef DBG
|
||||
if (!ini_get_bool(CONFIG_INSTALL, "Main", "SkipFPPRO"))
|
||||
{
|
||||
#endif
|
||||
// Controllo se la registrazione ha avuto effetto anche su FPPRO allora salvo riferimento sul mov
|
||||
if (save_fppro() > 0 && !save_dbmov())
|
||||
message_box(
|
||||
"ATTENZIONE: non e' stato possibile salvare i riferimenti del documento in ingresso per questo movimento.\n"
|
||||
"Movimento registrato senza collegamento ai documenti in ingresso.");
|
||||
#ifdef DBG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TPrimanota_application::has_tot_doc(TToken_string& fppro_keys)
|
||||
@ -1556,7 +1556,7 @@ void TPrimanota_application::set_movcoll(const long movcoll, const long numreg)
|
||||
}
|
||||
int TPrimanota_application::controlli_f1(const TMask& m)
|
||||
{
|
||||
if (iva_mask(m) && m.get(F_PROKEY).full() && has_f1_db(m) && fp_db().sq_is_connect() && check_causale(m.get(F_CODCAUS)))
|
||||
if (m.find_by_id(F_PROKEY) != nullptr && m.get(F_PROKEY).full() && has_f1_db((TMask*)&m) && fp_db().sq_is_connect() && check_causale(m.get(F_CODCAUS)))
|
||||
{
|
||||
TToken_string keys(m.get(F_PROKEY), ';');
|
||||
const TDate dataoraric = fppro_db().set_keys(keys).get_dataorarioric();
|
||||
@ -1717,19 +1717,10 @@ int TPrimanota_application::rewrite(const TMask& m)
|
||||
|
||||
if (caus.reverse_charge_pubb())
|
||||
{
|
||||
long movcoll = m.get_long(F_MOVCOLL);
|
||||
const long movcoll = m.get_long(F_MOVCOLL);
|
||||
|
||||
if (movcoll == 0L)
|
||||
find_movcoll(_rel->file().get_long(MOV_NUMREG));
|
||||
movcoll = m.get_long(F_MOVCOLL);
|
||||
if (movcoll > 0L)
|
||||
{
|
||||
TRectype & reccoll = (TRectype &) cache().get(LF_MOV, movcoll);
|
||||
|
||||
reccoll.put(MOV_IDDOCSDI, m.get(F_IDDOCSDI));
|
||||
reccoll.put(MOV_DATADOCSDI, m.get(F_DATADOCSDI));
|
||||
reccoll.rewrite();
|
||||
}
|
||||
}
|
||||
mask2rel(m);
|
||||
|
||||
@ -1797,7 +1788,7 @@ void TPrimanota_application::clean_fppro()
|
||||
|
||||
// Controlli: solo in mod modifica; che abbia fp-f1 (no F8); che non sono in salvataggio
|
||||
if (_mode != MODE_MOD
|
||||
|| !has_f1_db(msk)
|
||||
|| !has_f1_db(&msk)
|
||||
|| last_key != K_DEL && last_key != K_SAVE && last_key != K_ELIMMAS && last_key != K_QUIT && !scollega())
|
||||
return;
|
||||
|
||||
@ -1812,17 +1803,27 @@ void TPrimanota_application::clean_fppro()
|
||||
fp_db().sq_commit();
|
||||
}
|
||||
|
||||
bool TPrimanota_application::has_f1() const
|
||||
void TPrimanota_application::set_has_f1_db(TMask* m)
|
||||
{
|
||||
return has_module(F1AUT) && get_db_indirizzo().full();
|
||||
if (m->find_by_id(F_DATAREG) != nullptr && !m->get(F_DATAREG).empty())
|
||||
{
|
||||
if (TDate(m->get(F_DATAREG)) >= TDate(get_data_start_fatt()))
|
||||
_isf1 = has_module(F1AUT) && !get_db_indirizzo().empty();
|
||||
else
|
||||
_isf1 = false;
|
||||
_is_set_fpcheck = true;
|
||||
}
|
||||
else if (!_is_set_fpcheck)
|
||||
{
|
||||
_isf1 = false;
|
||||
_is_set_fpcheck = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool TPrimanota_application::has_f1_db(const TMask & m)
|
||||
bool TPrimanota_application::has_f1_db(TMask* m)
|
||||
{
|
||||
const TDate datareg = m.get_date(F_DATAREG);
|
||||
|
||||
_is_set_fpcheck = true;
|
||||
return datareg.ok() && (datareg >= get_data_start_fatt()) && has_f1();
|
||||
set_has_f1_db(m);
|
||||
return _isf1;
|
||||
}
|
||||
|
||||
bool TPrimanota_application::remove()
|
||||
@ -1891,8 +1892,6 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
_automatico->_movcoll = m.get_long(F_NUMREG);
|
||||
_automatico->_iva.destroy();
|
||||
_automatico->_totale = ZERO;
|
||||
_automatico->_idsdi = m.get(F_IDDOCSDI);
|
||||
_automatico->_datasdi = m.get(F_DATADOCSDI);
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
TToken_string row = iva.row(i);
|
||||
@ -1980,9 +1979,6 @@ void TPrimanota_application::genera_automatico(int tipo, const char* causimm)
|
||||
const TString& clnt = cache().get(LF_CLIFO, forn, CLI_CODCFASS);
|
||||
m.set(F_CODCLIFOR, clnt);
|
||||
}
|
||||
m.set(F_IDDOCSDI, _automatico->_idsdi);
|
||||
m.set(F_DATADOCSDI, _automatico->_datasdi);
|
||||
|
||||
TSheet_field & iva = m.sfield(F_SHEETIVA);
|
||||
const int items = _automatico->_iva.items();
|
||||
|
||||
@ -2676,7 +2672,7 @@ int TPrimanota_application::save_fppro()
|
||||
TMask& msk = curr_mask();
|
||||
|
||||
// Provo a vedere se hanno l'FP: se c'è l'indirizzo controllo che non sia F8 se non c'è non hanno l'FP
|
||||
if (!has_f1_db(msk))
|
||||
if (!has_f1_db(&msk))
|
||||
return pro_nofp;
|
||||
|
||||
// Anzitutto guardo la modalita' in cui sono
|
||||
@ -2741,7 +2737,7 @@ int TPrimanota_application::save_fppro()
|
||||
items = fp_db().sq_items();
|
||||
}
|
||||
|
||||
if(has_f1_db(msk) && items != 1)
|
||||
if(has_f1_db(&msk) && items != 1)
|
||||
{
|
||||
const bool forza = noyes_box("Attenzione, al movimento non e' stato abbinato nessun documento elettronico.\n"
|
||||
"Per consentire una corretta archiviazione sostitutiva si consiglia di provvedere al controllo della registrazione e di procedere\n"
|
||||
@ -2855,7 +2851,6 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action)
|
||||
|
||||
const BOOLEAN bModify = xvt_str_same(action, "Modify");
|
||||
|
||||
|
||||
TFilename intrini;
|
||||
intrini.tempdir();
|
||||
intrini.add("ActIntra.ini");
|
||||
|
@ -569,7 +569,7 @@ END
|
||||
|
||||
STRING F_PROKEY 80
|
||||
BEGIN
|
||||
PROMPT 1 26 "db key"
|
||||
PROMPT 1 19 "db key"
|
||||
HELP "Chiave database"
|
||||
FIELD KEYFPPRO
|
||||
FLAGS "H"
|
||||
|
@ -13,14 +13,12 @@ BEGIN
|
||||
PROMPT 2 1 "Contabilizzaz."
|
||||
PICTURE TOOL_EXPORT
|
||||
MODULE F1
|
||||
MESSAGE EXIT,K_ENTER
|
||||
END
|
||||
|
||||
BUTTON DLG_LINK 2 2
|
||||
BEGIN
|
||||
PROMPT 3 1 "Collega in Prima nota"
|
||||
PICTURE TOOL_LINK
|
||||
MESSAGE EXIT,K_ENTER
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 2 2
|
||||
|
@ -219,10 +219,7 @@ TSheet_field& TPrimanota_application::cgs() const
|
||||
void TPrimanota_application::set_cgs_imp(int n, const TImporto& imp)
|
||||
{
|
||||
TSheet_field& s = cgs();
|
||||
TImporto i(imp);
|
||||
|
||||
i.normalize();
|
||||
i.add_to(s.row(n), 0);
|
||||
imp.add_to(s.row(n), 0);
|
||||
s.force_update(n);
|
||||
}
|
||||
|
||||
@ -374,7 +371,7 @@ void TPrimanota_application::reset_sheet_row(TSheet_field& s, int n)
|
||||
s.destroy(n); // Remove line n
|
||||
}
|
||||
|
||||
int TPrimanota_application::set_cgs_row(int n, TImporto& importo,
|
||||
int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
|
||||
const TBill& conto, const char* desc,
|
||||
char tipo, const char* cms, const char* fas)
|
||||
{
|
||||
@ -383,8 +380,7 @@ int TPrimanota_application::set_cgs_row(int n, TImporto& importo,
|
||||
TToken_string& row = cg.row(n);
|
||||
|
||||
row.cut(0);
|
||||
importo.normalize();
|
||||
importo.add_to(row, 0);
|
||||
imp.add_to(row, 0);
|
||||
row.add(conto.string(0x3));
|
||||
row.add(""); // Codice decrizione
|
||||
row.add(desc); // Descrizione aggiuntiva
|
||||
@ -1540,7 +1536,7 @@ void TPrimanota_application::add2cg_row(TSheet_field& s, TToken_string & row, TS
|
||||
{
|
||||
const TBill conto(row, cid2index(IVA_TIPO), 0x1);
|
||||
const int pos = bill2pos(conto, cgrowtype_imponibile); // Riga in cui andra' l'imponibile
|
||||
TImporto imp = a.real2imp(d > 0 ? imp_det : imp_ind, tipod); // Imponibile
|
||||
const TImporto imp = a.real2imp(d > 0 ? imp_det : imp_ind, tipod); // Imponibile
|
||||
|
||||
if (pos >= 0) // Se il conto esisteva anche prima ...
|
||||
{
|
||||
@ -1765,7 +1761,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& s, int r, KEY k)
|
||||
real pimponibile(pag.imponibile(inv));
|
||||
|
||||
pimponibile.round(pag.round(inv));
|
||||
if ((pimposta != imposta || pimponibile != imponibile) && (!a._f1_ini && (a._pro_mask == nullptr || !a._pro_mask->da_riportare())))
|
||||
if ((pimposta != imposta || pimponibile != imponibile) && (!a._f1_ini && (a._pro_mask == nullptr || !a._pro_mask->should_bring_back())))
|
||||
a.set_scadenze(m); // Ricalcola rate
|
||||
}
|
||||
}
|
||||
@ -2846,7 +2842,7 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
|
||||
|
||||
TImporto imp = real2imp(m.get_real(F_TOTALE), cgrowtype_totale);
|
||||
|
||||
set_cgs_row(riga_totale, imp, nuovo, descr, cgrowtype_totale);
|
||||
set_cgs_row(riga_totale, imp.normalize(), nuovo, descr, cgrowtype_totale);
|
||||
}
|
||||
calcola_imp(); // Ricalcola totale IVA
|
||||
calcola_saldo(); // Ricalcola sbilanci
|
||||
@ -3022,7 +3018,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
||||
ixc->set(ic ? "X" : "");
|
||||
}
|
||||
if(m.get(F_PROKEY).empty() && app().has_module(F1AUT))
|
||||
a.fppro_mask(f, key);
|
||||
fppro_mask(f, key);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -3566,11 +3562,21 @@ HIDDEN void inventa_cambio_intra(TMask& m)
|
||||
{
|
||||
const TString& codval = m.get(F_VALUTAINTRA);
|
||||
|
||||
if (codval.full() && TCurrency::get_firm_val() != codval)
|
||||
if (codval.not_empty() && TCurrency::get_firm_val() != codval)
|
||||
{
|
||||
const TRectype & cam =cache().get("CAM", codval);
|
||||
TTable cam("CAM");
|
||||
|
||||
if (cam.full())
|
||||
cam.put("CODTAB", codval);
|
||||
const int err = cam.read(_isgteq);
|
||||
bool yes = err != NOERR;
|
||||
if (!yes)
|
||||
{
|
||||
TString16 v = cam.get("CODTAB");
|
||||
|
||||
v.cut(3).rtrim();
|
||||
yes = v != codval;
|
||||
}
|
||||
if (yes)
|
||||
m.set(F_CAMBIOINTRA, cache().get("%VAL", codval, "S4"));
|
||||
}
|
||||
}
|
||||
@ -3897,74 +3903,71 @@ bool TPrimanota_application::quadratura_handler(TMask_field& f, KEY key)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TPrimanota_application::write_righe_iva_f1(TMask& cg_msk, const TPro_msk & msk)
|
||||
void TPrimanota_application::write_righe_iva_f1(TMask& cg_msk, const shared_ptr<TPro_msk>& msk)
|
||||
{
|
||||
TSheet_field& sf = cg_msk.sfield(F_SHEETIVA);
|
||||
const TString_array& righe = msk.get_righeiva();
|
||||
const vector<TPro_msk::riga_iva_s>& righe = msk->get_righeiva();
|
||||
int i = 0;
|
||||
|
||||
FOR_EACH_ARRAY_ITEM( righe, r, obj)
|
||||
for (auto it = righe.begin(); it != righe.end(); ++it)
|
||||
{
|
||||
TToken_string & riga = STRING_TOKEN(obj);
|
||||
const real imponibile = riga.get_real(FPRI_IMPONIBILE);
|
||||
const real imposta = riga.get_real(FPRI_IMPOSTA);
|
||||
|
||||
if (imponibile != ZERO || imposta != ZERO)
|
||||
if(it->imponibile != 0 || it->imposta != 0)
|
||||
{
|
||||
TToken_string& row = sf.row(r);
|
||||
TToken_string& row = sf.row(i);
|
||||
|
||||
sf.notify(r, K_SPACE);
|
||||
sf.set_row_cell(IVA_IMPONIBILE, imponibile, r);
|
||||
sf.set_row_cell(IVA_IMPOSTA, imposta, r);
|
||||
sf.set_row_cell(IVA_PERCIVA, riga.get(FPRI_ALIQUOTA), r);
|
||||
sf.set_row_cell(IVA_NATURIVA, riga.get(FPRI_NATURA), r);
|
||||
sf.notify(r, K_ENTER);
|
||||
sf.notify(i, K_SPACE);
|
||||
row.add(it->imponibile, cid2index(IVA_IMPONIBILE));
|
||||
row.add(it->imposta, cid2index(IVA_IMPOSTA));
|
||||
row.add(it->aliquota, cid2index(IVA_PERCIVA));
|
||||
row.add(it->natura, cid2index(IVA_NATURIVA));
|
||||
sf.notify(i, K_ENTER);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool TPrimanota_application::write_scad_f1(const TMask& cg_msk, const TPro_msk & msk)
|
||||
bool TPrimanota_application::write_scad_f1(const TMask& cg_msk, const shared_ptr<TPro_msk>& msk)
|
||||
{
|
||||
TSheet_field& sf = cg_msk.sfield(FS_RATESHEET);
|
||||
const int items = sf.items();
|
||||
const TString_array & righe = msk.get_scadenze();
|
||||
const vector<TPro_msk::scadenza_s>& righe = msk->get_scadenze();
|
||||
int i = 0;
|
||||
|
||||
FOR_EACH_ARRAY_ITEM(righe, r, obj)
|
||||
for (auto it = righe.begin(); it != righe.end(); ++it, ++i)
|
||||
{
|
||||
TToken_string& row = app().pags().row(r);
|
||||
TToken_string & riga = STRING_TOKEN(obj);
|
||||
TToken_string& row = app().pags().row(i);
|
||||
|
||||
if (r >= items)
|
||||
pag_notify(sf, r, K_CTRL+K_INS);
|
||||
pag_notify(sf, r, K_SPACE);
|
||||
sf.set_row_cell(101, riga.get_date(FPSC_DATA), r);
|
||||
sf.set_row_cell(102, riga.get_real(FPSC_IMPORTO), r);
|
||||
pag_notify(sf, r, K_ENTER);
|
||||
if(i >= items)
|
||||
pag_notify(sf, i, K_CTRL+K_INS);
|
||||
pag_notify(sf, i, K_SPACE);
|
||||
row.add(it->data, cid2index(101));
|
||||
row.add(it->importo, cid2index(102));
|
||||
pag_notify(sf, i, K_ENTER);
|
||||
}
|
||||
return righe.items() > 0;
|
||||
return !righe.empty();
|
||||
}
|
||||
|
||||
void TPrimanota_application::write_clifo(TMask& cg_msk, const TPro_msk & msk)
|
||||
void TPrimanota_application::write_clifo(TMask& cg_msk, const shared_ptr<TPro_msk>& msk)
|
||||
{
|
||||
bool ok = false;
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
TToken_string keys(msk.get_fpprokeys(), ';');
|
||||
long codforn = TFppro(keys).get_codforn();
|
||||
TToken_string keys(msk->get_fpprokeys(), ';');
|
||||
TString codforn = TFppro(keys).get_codforn();
|
||||
|
||||
if (codforn == 0L)
|
||||
codforn = msk.get_codforn();
|
||||
if (codforn == 0L)
|
||||
if (codforn.empty())
|
||||
codforn = msk->get_codforn();
|
||||
if (codforn.empty())
|
||||
{
|
||||
clifo.setkey(5);
|
||||
clifo.put(CLI_TIPOCF, "F");
|
||||
clifo.put(CLI_PAIV, msk.get_piva());
|
||||
clifo.put(CLI_PAIV, msk->get_piva());
|
||||
clifo.read();
|
||||
ok = clifo.get(CLI_PAIV) == msk.get_piva();
|
||||
ok = clifo.get(CLI_PAIV) == msk->get_piva();
|
||||
if(!ok)
|
||||
{
|
||||
clifo.zero();
|
||||
clifo.setkey(5);
|
||||
clifo.put(CLI_TIPOCF, "F");
|
||||
clifo.put(CLI_PAIV, msk.get_piva());
|
||||
clifo.put(CLI_PAIV, msk->get_piva());
|
||||
clifo.put(CLI_STATOPAIV, "IT");
|
||||
clifo.read();
|
||||
}
|
||||
@ -3976,8 +3979,8 @@ void TPrimanota_application::write_clifo(TMask& cg_msk, const TPro_msk & msk)
|
||||
clifo.put(CLI_CODCF, codforn);
|
||||
clifo.read();
|
||||
}
|
||||
ok = clifo.get(CLI_PAIV) == msk.get_piva();
|
||||
if (ok && (cg_msk.get_long(F_CODCLIFOR) == 0 || cg_msk.get_long(F_CODCLIFOR) != codforn))
|
||||
ok = clifo.get(CLI_PAIV) == msk->get_piva();
|
||||
if (ok && (cg_msk.get(F_CODCLIFOR).empty() || cg_msk.get(F_CODCLIFOR) != codforn))
|
||||
{
|
||||
cg_msk.set(F_CODCLIFOR, clifo.get(CLI_CODCF));
|
||||
cg_msk.set(F_RAGSOCCF, clifo.get(CLI_RAGSOC));
|
||||
@ -3985,21 +3988,20 @@ void TPrimanota_application::write_clifo(TMask& cg_msk, const TPro_msk & msk)
|
||||
cg_msk.set(F_PIVA, clifo.get(CLI_PAIV));
|
||||
cg_msk.set(F_COFI, clifo.get(CLI_COFI));
|
||||
cg_msk.set(F_CODPAG, clifo.get(CLI_CODPAG));
|
||||
|
||||
const TRectype & tab = cache().get("%CPG", clifo.get(CLI_CODPAG));
|
||||
|
||||
TTable tab("%CPG"); tab.put("CODTAB", clifo.get(CLI_CODPAG));
|
||||
tab.read();
|
||||
cg_msk.set(F_DESPAG, tab.get("S0"));
|
||||
}
|
||||
}
|
||||
|
||||
void TPrimanota_application::set_totale(TMask& cg_msk, TPro_msk & msk)
|
||||
void TPrimanota_application::set_totale(TMask& cg_msk, const shared_ptr<TPro_msk>& msk)
|
||||
{
|
||||
real totale = msk.get_totdoc();
|
||||
real totale = msk->get_totdoc();
|
||||
|
||||
if (totale == ZERO)
|
||||
if(totale == ZERO)
|
||||
totale = app().calcola_imp();
|
||||
|
||||
const real rit = msk.get_ritenute();
|
||||
const real rit = msk->get_ritenute();
|
||||
|
||||
if (rit != ZERO)
|
||||
{
|
||||
@ -4007,83 +4009,78 @@ void TPrimanota_application::set_totale(TMask& cg_msk, TPro_msk & msk)
|
||||
cg_msk.set(F_RITFIS, rit);
|
||||
app().add_cgs_ritenute(cgrowtype_ritfis);
|
||||
}
|
||||
else
|
||||
if (msk.is_doc_split())
|
||||
totale = msk.get_tot_imp_riva();
|
||||
else if (msk->is_doc_split())
|
||||
totale = msk->get_tot_imp_riva();
|
||||
cg_msk.set(F_TOTALE, totale);
|
||||
}
|
||||
|
||||
void TPrimanota_application::riporta_dati_f1(TMask& cg_msk, TPro_msk & msk)
|
||||
void TPrimanota_application::riporta_dati_f1(TMask& cg_msk, const shared_ptr<TPro_msk>& msk)
|
||||
{
|
||||
const bool bring = msk.da_riportare();
|
||||
const bool bring = msk->should_bring_back();
|
||||
|
||||
if (bring)
|
||||
{
|
||||
TPrimanota_application & a = app();
|
||||
|
||||
if (msk.get_numdoc() != 0L && cg_msk.get(F_CODCLIFOR).empty())
|
||||
a.write_clifo(cg_msk, msk);
|
||||
a.write_righe_iva_f1(cg_msk, msk);
|
||||
a.set_totale(cg_msk, msk);
|
||||
if (msk->get_numdoc().full() && cg_msk.get(F_CODCLIFOR).empty())
|
||||
write_clifo(cg_msk, msk);
|
||||
write_righe_iva_f1(cg_msk, msk);
|
||||
set_totale(cg_msk, msk);
|
||||
cg_msk.set(FS_RECALC, ""); cg_msk.disable(FS_RDIFFER); cg_msk.disable(FS_MCOMM); cg_msk.disable(FS_NRATE);
|
||||
if (a.write_scad_f1(cg_msk, msk))
|
||||
a.set_scad_f1(cg_msk);
|
||||
if (write_scad_f1(cg_msk, msk))
|
||||
app().set_scad_f1(cg_msk);
|
||||
}
|
||||
// Li riporto anche con il collega in prima nota, e in quel caso solo se i campi non sono gia valorizzati
|
||||
if (bring || cg_msk.get(F_NUMDOCEXT) != msk.get_str_numdoc())
|
||||
if (bring || cg_msk.get(F_NUMDOC).empty())
|
||||
{
|
||||
|
||||
cg_msk.set(F_NUMDOCEXT, msk.get_str_numdoc());
|
||||
cg_msk.set(F_NUMDOC, format("%-7ld", msk.get_numdoc()));
|
||||
cg_msk.set(F_DATADOC, msk.get_datadoc());
|
||||
cg_msk.set(F_IDDOCSDI, msk.get_str_numdoc());
|
||||
cg_msk.set(F_DATADOCSDI, msk.get_datadoc());
|
||||
cg_msk.disable(F_IDDOCSDI);
|
||||
cg_msk.disable(F_DATADOCSDI);
|
||||
cg_msk.set(F_NUMDOCEXT, msk->get_numdoc());
|
||||
cg_msk.set(F_NUMDOC, msk->get_numdoc().right(7));
|
||||
}
|
||||
|
||||
if (bring || cg_msk.get(F_DATADOC).empty())
|
||||
cg_msk.set(F_DATADOC, msk->get_datadoc());
|
||||
}
|
||||
|
||||
void TPrimanota_application::insert_part_scad(TConfig& ini) // che cazzo significa la partita 73/001
|
||||
void TPrimanota_application::insert_part_scad(TConfig& ini)
|
||||
{
|
||||
TArray rif_doc;
|
||||
TString str = ini.get("NUMLINEA", "23", 0);
|
||||
vector<TToken_string> rif_doc;
|
||||
int i = 0;
|
||||
ini.set_paragraph("23");
|
||||
|
||||
// Carico nel vettore
|
||||
for (int i = 0; str.full(); str = ini.get("NUMLINEA", "23", ++i))
|
||||
while(true)
|
||||
{
|
||||
TToken_string doc("", '|');
|
||||
|
||||
TString str; str << ini.get("NUMLINEA", nullptr, i, "NULL");
|
||||
if (str != "NULL")
|
||||
{
|
||||
doc.add(str);
|
||||
doc.add(ini.get("DOCRIF", "23", i));
|
||||
doc.add(ini.get("DATADOCRIF", "23", i));
|
||||
rif_doc.add(doc);
|
||||
doc.add(ini.get("DOCRIF", nullptr, i, "NULL"));
|
||||
doc.add(ini.get("DATADOCRIF", nullptr, i, "NULL"));
|
||||
|
||||
rif_doc.insert(rif_doc.end(), doc);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// Agganciare alla partita del documento di riferimento
|
||||
if(rif_doc.items() > 0)
|
||||
if(!rif_doc.empty())
|
||||
{
|
||||
is_f1() = true;
|
||||
|
||||
TString query; query << "USE MOV\nSELECT (DATADOC==#DATADOC)";
|
||||
TISAM_recordset rec(query);
|
||||
rec.set_var("#DATADOC", TVariant(TDate(rif_doc[0].get(2))));
|
||||
TString part;
|
||||
|
||||
FOR_EACH_ARRAY_ITEM(rif_doc, r, _obj)
|
||||
do
|
||||
{
|
||||
if (part.blank())
|
||||
if (rec.get(MOV_NUMDOC).as_string() == "73/001")
|
||||
{
|
||||
rec.set_var("#DATADOC", ((TToken_string&)rif_doc[0]).get_date(2));
|
||||
|
||||
for (bool ok = rec.move_first(); ok; ok = rec.move_next())
|
||||
{
|
||||
if (rec.get_string(MOV_NUMDOC) == "73/001")
|
||||
{
|
||||
part = rec.get_string(MOV_PROTIVA);
|
||||
part = rec.get(MOV_PROTIVA).as_string();
|
||||
break;
|
||||
}
|
||||
} while (rec.move_next());
|
||||
}
|
||||
}
|
||||
|
||||
_num_doc_rif_partite = part;
|
||||
}
|
||||
}
|
||||
@ -4095,10 +4092,9 @@ bool TPrimanota_application::fppro_mask(TMask_field& f, KEY key)
|
||||
if (!app().has_module(FPAUT) || key != K_SPACE && key != K_TAB || !check_causale(cg_msk.get(F_CODCAUS)))
|
||||
return true;
|
||||
|
||||
TPro_msk * msk = app()._pro_mask;
|
||||
auto msk = std::make_shared<TPro_msk>(cg_msk);
|
||||
|
||||
if (msk == nullptr)
|
||||
app()._pro_mask = msk = new TPro_msk(cg_msk);
|
||||
app()._pro_mask = msk;
|
||||
|
||||
const TString datadoc = cg_msk.get(F_DATADOC);
|
||||
|
||||
@ -4108,13 +4104,16 @@ bool TPrimanota_application::fppro_mask(TMask_field& f, KEY key)
|
||||
msk->field(F_DATESEARCH).show();
|
||||
msk->set(F_DATESEARCH, datadoc);
|
||||
}
|
||||
if (msk->load_fppro_mask(msk.get()))
|
||||
{
|
||||
msk->run();
|
||||
// Riporto dati FPPRO su maschera Prima Nota (solo se hai F1)
|
||||
// Se non hai F1 collego senza riportarti i dati (solo le chiavi db)
|
||||
riporta_dati_f1(cg_msk, *msk);
|
||||
riporta_dati_f1(cg_msk, msk);
|
||||
cg_msk.set(F_PROKEY, msk->get_fpprokeys());
|
||||
cg_msk.set(F_COLFPPRO, cg_msk.get(F_PROKEY).full());
|
||||
is_collegato(cg_msk.field(F_COLFPPRO));
|
||||
cg_msk.set(F_ANNORIF, cg_msk.get(F_ANNOIVA));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4133,11 +4132,11 @@ bool TPrimanota_application::scollega(const bool set)
|
||||
|
||||
bool TPrimanota_application::scollega_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (app().has_module(FPAUT) && f.running_check(key))
|
||||
{
|
||||
TMask& cg_msk = f.mask();
|
||||
|
||||
if (check_causale(cg_msk.get(F_CODCAUS)) && cg_msk.get_bool(F_COLFPPRO))
|
||||
if (!app().has_module(FPAUT) || key != K_SPACE && key != K_TAB || !check_causale(cg_msk.get(F_CODCAUS)))
|
||||
return true;
|
||||
if (cg_msk.get_bool(F_COLFPPRO))
|
||||
{
|
||||
scollega(true);
|
||||
app().clean_fppro();
|
||||
@ -4151,81 +4150,103 @@ bool TPrimanota_application::scollega_handler(TMask_field& f, KEY key)
|
||||
}
|
||||
message_box("Il movimento e' stato scollegato dalla fattura elettronica\nin ingresso, precedentemente associata.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TPro_msk::load_fppro_mask(TMask & msk)
|
||||
bool TPrimanota_application::is_collegato(TMask_field& f)
|
||||
{
|
||||
TMask& cg_msk = f.mask();
|
||||
const bool has_prokey = !cg_msk.get(F_PROKEY).empty();
|
||||
|
||||
f.set(has_prokey ? "X" : " ");
|
||||
return has_prokey;
|
||||
}
|
||||
|
||||
bool TPro_msk::load_fppro_mask(TMask* msk, KEY k)
|
||||
{
|
||||
// Provo a vedere se hanno l'FP: se c'è l'indirizzo controllo che non sia F8 se non c'è non hanno l'FP
|
||||
if (k != 32)
|
||||
return false;
|
||||
if (!fp_db().sq_is_connect())
|
||||
{
|
||||
message_box("Attenzione connessione al database non riuscita.\nImpossibile collegarsi ai documenti in entrata.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const int forn = msk.get_int(F_CODCLIFORS);
|
||||
const int forn = msk->get_int(F_CODCLIFORS);
|
||||
|
||||
if (forn == 0)
|
||||
{
|
||||
msk.set(F_ENABSEARCH, "X");
|
||||
abilita_piva();
|
||||
msk->set(F_ENABSEARCH, "X");
|
||||
abilita_piva(msk);
|
||||
//message_box("Inserire prima il fornitore");
|
||||
//return false;
|
||||
}
|
||||
|
||||
const TString& codfisc = msk.get(F_COFIS);
|
||||
const TString& stato_piva = msk.get(F_STATOPAIVS);
|
||||
const TString& piva = msk.get(F_PIVAS);
|
||||
const TString& codfisc = msk->get(F_COFIS);
|
||||
const TString& stato_piva = msk->get(F_STATOPAIVS);
|
||||
const TString& piva = msk->get(F_PIVAS);
|
||||
TString query;
|
||||
TDate date;
|
||||
TString date = "";
|
||||
|
||||
if (msk.get_bool(F_ENABDATE))
|
||||
date = msk.get_date(F_DATESEARCH);
|
||||
if(!msk.get_bool(F_ENABSEARCH))
|
||||
query = query_fppro(msk.get(F_CODCLIFORS), date);
|
||||
if (msk->get_bool(F_ENABDATE))
|
||||
date = msk->get_date(F_DATESEARCH);
|
||||
if(!msk->get_bool(F_ENABSEARCH))
|
||||
query = query_fppro(msk->get(F_CODCLIFORS), date);
|
||||
else
|
||||
query = query_fppro(stato_piva, piva, date);
|
||||
fp_db().sq_set_exec(query, false);
|
||||
|
||||
TSheet_field& sf = msk.sfield(F_SHEETFPPROS);
|
||||
const bool show_all = msk.get_bool(F_SHOWALL);
|
||||
TSheet_field& sf = msk->sfield(F_SHEETFPPROS);
|
||||
|
||||
sf.reset();
|
||||
sf.hide();
|
||||
if (sf.items() > 0)
|
||||
sf.destroy();
|
||||
while (fp_db().sq_next())
|
||||
{
|
||||
const long numreg = fp_db().sq_get_long("PZ_NUMREGCONT");
|
||||
TString numreg = fp_db().sq_get("PZ_NUMREGCONT");
|
||||
const bool show_all = msk->get_bool(F_SHOWALL);
|
||||
|
||||
if (show_all || numreg == 0L)
|
||||
{
|
||||
if (numreg != "0" && !show_all)
|
||||
continue;
|
||||
|
||||
TToken_string& row = sf.row(-1);
|
||||
TToken_string keys(fp_db().sq_get("PZ_KEYPRGINVIO"), ';');
|
||||
|
||||
keys.add(fp_db().sq_get("PZ_KEYHEADERFATT")); keys.add(fp_db().sq_get("PZ_KEYBODYFATT"));
|
||||
|
||||
const int r = sf.set_row_cell(F_SELFPPROS, "");
|
||||
|
||||
sf.set_row_cell(F_TIPODOCS, fp_db().sq_get("P7_TIPODOC"), r);
|
||||
sf.set_row_cell(F_DATAORARICS, fp_db().sq_get_date("P1_DATAORARIC"), r);
|
||||
sf.set_row_cell(F_DATAS, fp_db().sq_get_date("PZ_DATA"), r);
|
||||
sf.set_row_cell(F_IMPTOTDOCS, fp_db().sq_get("PQ_IMPTOTDOC"), r);
|
||||
sf.set_row_cell(F_RITENUTE, fppro_db().set_keys(keys).get_ritenute(), r);
|
||||
sf.set_row_cell(F_NUMEROS, fp_db().sq_get("PZ_NUMERO"), r);
|
||||
sf.set_row_cell(F_RAGXML, fp_db().sq_get("P2_ANADENOMIN"), r);
|
||||
sf.set_row_cell(F_FISCIVAPAESES, fp_db().sq_get("P2_FISCIVAPAESE"), r);
|
||||
sf.set_row_cell(F_FISCIVACODS, fp_db().sq_get("P2_FISCIVACOD"), r);
|
||||
sf.set_row_cell(F_CODFISCALES, fp_db().sq_get("P2_CODFISCALE"), r);
|
||||
sf.set_row_cell(F_TIPOPROTS, fp_db().sq_get("PZ_TIPOPROT"), r);
|
||||
sf.set_row_cell(F_PROGRESSS, fp_db().sq_get("PZ_NUMPROT"), r);
|
||||
sf.set_row_cell(F_KEYFPPROS, keys, r);
|
||||
}
|
||||
row.add("", 0);
|
||||
row.add(fp_db().sq_get("P7_TIPODOC"));
|
||||
row.add(TDate(fp_db().sq_get_date("P1_DATAORARIC")));
|
||||
row.add(TDate(fp_db().sq_get_date("PZ_DATA")));
|
||||
row.add(fp_db().sq_get("PQ_IMPTOTDOC"));
|
||||
row.add(fppro_db().set_keys(keys).get_ritenute());
|
||||
row.add(fp_db().sq_get("PZ_NUMERO"));
|
||||
row.add(fp_db().sq_get("P2_ANADENOMIN"));
|
||||
row.add(fp_db().sq_get("P2_FISCIVAPAESE"));
|
||||
row.add(fp_db().sq_get("P2_FISCIVACOD"));
|
||||
row.add(fp_db().sq_get("P2_CODFISCALE"));
|
||||
row.add(fp_db().sq_get("PZ_TIPOPROT"));
|
||||
row.add(fp_db().sq_get("PZ_NUMPROT"));
|
||||
row.add(keys);
|
||||
}
|
||||
sf.force_update();
|
||||
sf.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TPro_msk::riporta(TMask_field& f)
|
||||
bool TPro_msk::fppro_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TMask& msk = f.mask();
|
||||
|
||||
const bool load = load_fppro_mask(&msk, k);
|
||||
return load;
|
||||
}
|
||||
|
||||
bool TPro_msk::riporta_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k != 32)
|
||||
return true;
|
||||
TMask& msk = f.mask();
|
||||
//if (msk.curr_page() != 3)
|
||||
//return true;
|
||||
bool ok = false;
|
||||
@ -4233,10 +4254,16 @@ bool TPro_msk::riporta(TMask_field& f)
|
||||
|
||||
FOR_EACH_SHEET_ROW(sf, nr, row)
|
||||
{
|
||||
if(row->get_bool(0))
|
||||
if(*row->get(0) == 'X')
|
||||
{
|
||||
app().pro_mask()->set_doc(sf, nr);
|
||||
_riporta = f.dlg() == DLG_OK;
|
||||
//TProtocollo protocollo(TDate(row->get(2)).year(), row->get(9), row->get(10));
|
||||
app()._pro_mask->set_doc(row->get(cid2index(F_NUMEROS)), row->get(cid2index(F_DATAS)),
|
||||
row->get(cid2index(F_IMPTOTDOCS)), row->get(cid2index(F_RITENUTE)), "", row->get(cid2index(F_KEYFPPROS)),
|
||||
msk.get(F_CODCLIFORS), row->get(cid2index(F_FISCIVACODS)));
|
||||
if (f.dlg() == DLG_OK)
|
||||
app()._pro_mask->_riporta = true;
|
||||
else
|
||||
app()._pro_mask->_riporta = false;
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
@ -4250,56 +4277,67 @@ bool TPro_msk::riporta(TMask_field& f)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TPro_msk::collega_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
return riporta_handler(f, k);
|
||||
}
|
||||
|
||||
bool TPro_msk::piva_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TMask& msk = f.mask();
|
||||
bool ok = true;
|
||||
|
||||
if(k == K_TAB && f.active() && f.focusdirty())
|
||||
{
|
||||
ok = load_fppro_mask(&msk, K_SPACE);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TPro_msk::date_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TMask& msk = f.mask();
|
||||
bool ok = true;
|
||||
|
||||
if (k == K_TAB && f.active() && f.focusdirty())
|
||||
{
|
||||
ok = load_fppro_mask(&msk, K_SPACE);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TPro_msk::fppro_selfatt() const
|
||||
{
|
||||
const TMask& mask = *this;
|
||||
TSheet_field& sf = mask.sfield(F_SHEETFPPROS);
|
||||
|
||||
sf.hide();
|
||||
FOR_EACH_SHEET_ROW(sf, nr, row)
|
||||
if (sf.get_bool_row_cell(nr, F_SELFPPROS))
|
||||
sf.set_row_cell(F_SELFPPROS, false, nr);
|
||||
{
|
||||
if (*row->get(0) == 'X')
|
||||
row->add("", 0);
|
||||
}
|
||||
sf.force_update();
|
||||
sf.show();
|
||||
}
|
||||
|
||||
bool TPro_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
TMask & m = o.mask();
|
||||
|
||||
switch (o.dlg())
|
||||
{
|
||||
case DLG_CONFIG:
|
||||
if (e == fe_button)
|
||||
load_fppro_mask(m);
|
||||
break;
|
||||
case DLG_OK:
|
||||
if (e == fe_button)
|
||||
riporta(o);
|
||||
break;
|
||||
case DLG_LINK:
|
||||
if (e == fe_button)
|
||||
riporta(o);
|
||||
break;
|
||||
case F_PIVAS:
|
||||
if (e == fe_modify)
|
||||
load_fppro_mask(m);
|
||||
break;
|
||||
case F_DATESEARCH:
|
||||
if (e == fe_modify)
|
||||
load_fppro_mask(m);
|
||||
break;
|
||||
case F_SELFPPROS:
|
||||
if (e == fe_modify)
|
||||
fppro_selfatt();
|
||||
break;
|
||||
case F_SHOWALL:
|
||||
if (e == fe_modify)
|
||||
load_fppro_mask(m);
|
||||
load_fppro_mask(this, K_SPACE);
|
||||
break;
|
||||
case F_ENABSEARCH:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
abilita_piva();
|
||||
load_fppro_mask(m);
|
||||
abilita_piva(this);
|
||||
load_fppro_mask(this);
|
||||
}
|
||||
break;
|
||||
case F_ENABDATE:
|
||||
@ -4307,7 +4345,7 @@ bool TPro_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
field(F_DATESEARCH).show(o.mask().get_bool(F_ENABDATE));
|
||||
if (!o.mask().get_bool(F_ENABDATE))
|
||||
load_fppro_mask(m);
|
||||
load_fppro_mask(this);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -4318,11 +4356,9 @@ bool TPro_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
|
||||
bool TPro_msk::is_doc_split()
|
||||
{
|
||||
FOR_EACH_ARRAY_ITEM(_righe_iva, r, obj)
|
||||
for(riga_iva_s const& riga : _righe_iva)
|
||||
{
|
||||
TToken_string & riga = STRING_TOKEN(obj);
|
||||
|
||||
if (riga.get(FPRI_ESIGIBILITA) == "S")
|
||||
if (riga.esigibilita == 'S')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -4359,71 +4395,53 @@ void TPro_msk::set_scadenze(const char* fpprokeys)
|
||||
}
|
||||
}
|
||||
|
||||
void TPro_msk::set_doc(TSheet_field & s, int nrow)
|
||||
//long numero, TDate datadoc, real totdoc, real ritenute, const char* protfppro, const char* fpprokeys, long codforn, const char* piva)
|
||||
void TPro_msk::set_doc(const char* numero, const char* datadoc, const char* totdoc, const char* ritenute, const char* protfppro, const char* fpprokeys, const char* codforn, const char* piva)
|
||||
{
|
||||
_numero = s.get_long_row_cell(nrow, F_NUMEROS);
|
||||
_str_numero = s.get_str_row_cell(nrow, F_NUMEROS);
|
||||
_datadoc = s.get_date_row_cell(nrow, F_DATAS);
|
||||
_totdoc = abs(s.get_real_row_cell(nrow, F_IMPTOTDOCS));
|
||||
_ritenute = s.get_real_row_cell(nrow, F_RITENUTE);
|
||||
_protfppro.sset("");
|
||||
|
||||
const TString & fpprokeys = s.get_str_row_cell(nrow, F_KEYFPPROS);
|
||||
|
||||
_numero = numero;
|
||||
_datadoc = datadoc;
|
||||
_totdoc = abs(totdoc);
|
||||
_ritenute = ritenute;
|
||||
_protfppro.sset(protfppro);
|
||||
_fpprokeys = fpprokeys;
|
||||
_codforn = codforn;
|
||||
_piva = piva;
|
||||
set_righeiva(fpprokeys);
|
||||
set_scadenze(fpprokeys);
|
||||
_codforn = s.get_long_row_cell(nrow, F_CODCLIFORS);
|
||||
_piva = s.get_str_row_cell(nrow, F_FISCIVACODS);
|
||||
|
||||
set_scadenze(fpprokeys);
|
||||
}
|
||||
|
||||
real TPro_msk::get_tot_imp_riva()
|
||||
{
|
||||
real tot;
|
||||
real tot = ZERO;
|
||||
|
||||
FOR_EACH_ARRAY_ITEM(_righe_iva, r, obj)
|
||||
for(riga_iva_s const& riga : _righe_iva)
|
||||
{
|
||||
TToken_string & riga = STRING_TOKEN(obj);
|
||||
|
||||
tot += riga.get_real(FPRI_IMPONIBILE);
|
||||
if (riga.imposta > ZERO)
|
||||
tot += riga.imponibile;
|
||||
}
|
||||
return tot;
|
||||
}
|
||||
|
||||
void TPro_msk::add_rigaiva(const real& imponibile, const real& imposta, const real& aliquota, const TString4& natura, char esigib)
|
||||
{
|
||||
TToken_string riga;
|
||||
|
||||
riga.add(imponibile, FPRI_IMPONIBILE);
|
||||
riga.add(imposta, FPRI_IMPOSTA);
|
||||
riga.add(aliquota, FPRI_ALIQUOTA);
|
||||
riga.add(natura, FPRI_NATURA);
|
||||
riga.add(esigib, FPRI_ESIGIBILITA);
|
||||
_righe_iva.add(riga);
|
||||
_righe_iva.insert(_righe_iva.end(), { imponibile, imposta, aliquota, natura, esigib });
|
||||
}
|
||||
|
||||
void TPro_msk::add_scad(const TDate& date, const real& importo)
|
||||
{
|
||||
TToken_string riga;
|
||||
|
||||
riga.add(date, FPSC_DATA);
|
||||
riga.add(importo, FPSC_IMPORTO);
|
||||
_scadenze.add(riga);
|
||||
_scadenze.insert(_scadenze.end(), { date, importo });
|
||||
}
|
||||
|
||||
TString& TPro_msk::query_fppro(const TString& codforn, const TDate& date)
|
||||
TString& TPro_msk::query_fppro(const TString& codforn, const TString& date)
|
||||
{
|
||||
return query_fppro(codforn, "", "", "", date, "", "", "", true, false);
|
||||
}
|
||||
|
||||
TString& TPro_msk::query_fppro(const TString& stato_piva, const TString& piva, const TDate& date)
|
||||
TString& TPro_msk::query_fppro(const TString& stato_piva, const TString& piva, const TString& date)
|
||||
{
|
||||
return query_fppro("", stato_piva, piva, "", date, "", "", "", true, true);
|
||||
}
|
||||
|
||||
TString& TPro_msk::query_fppro(const TString& codforn, const TString& stato_piva, const TString& piva, const TString& where_str, const TDate& date, const TString& keyprginvio, const TString& keyheaderfatt, const TString& keybodyfatt, bool order, bool piva_research)
|
||||
TString& TPro_msk::query_fppro(const TString& codforn, const TString& stato_piva, const TString& piva, const TString& where_str, const TString& date, const TString& keyprginvio, const TString& keyheaderfatt, const TString& keybodyfatt, bool order, bool piva_research)
|
||||
{
|
||||
TString id_fornitore;
|
||||
TString keys;
|
||||
@ -4447,15 +4465,14 @@ TString& TPro_msk::query_fppro(const TString& codforn, const TString& stato_piva
|
||||
id_fornitore << " (PZ_CLIFOR = '" << codforn << "') ";
|
||||
}
|
||||
|
||||
TString & query = query_string();
|
||||
|
||||
query << "WHERE ";
|
||||
static TString query;
|
||||
query.cut(0) << query_string() << "WHERE ";
|
||||
|
||||
if (!id_fornitore.empty())
|
||||
{
|
||||
query << id_fornitore << " ";
|
||||
if (date.ok())
|
||||
query << " AND PZ_DATA = '" << date.date2ansi() << "' ";
|
||||
if (!date.empty())
|
||||
query << " AND PZ_DATA = '" << TDate(date).date2ansi() << "' ";
|
||||
if (order)
|
||||
query << "\nORDER BY P1_DATAORARIC ASC";
|
||||
query << ";";
|
||||
@ -4467,9 +4484,9 @@ TString& TPro_msk::query_fppro(const TString& codforn, const TString& stato_piva
|
||||
query << " AND " << where_str;
|
||||
query << ";";
|
||||
}
|
||||
else if (date.ok())
|
||||
else if (!date.empty())
|
||||
{
|
||||
query << " PZ_DATA = '" << date.date2ansi() << "' ";
|
||||
query << " PZ_DATA = '" << TDate(date).date2ansi() << "' ";
|
||||
if (order)
|
||||
query << "\nORDER BY P1_DATAORARIC ASC, PZ_TIPOPROT ASC, PZ_NUMPROT ASC";
|
||||
query << ";";
|
||||
@ -4484,9 +4501,9 @@ TString& TPro_msk::query_fppro(const TString& codforn, const TString& stato_piva
|
||||
|
||||
TString& TPro_msk::query_string()
|
||||
{
|
||||
TString & query = get_tmp_string(512);
|
||||
static TString query;
|
||||
|
||||
query << "SELECT PZ_CLIFOR, PZ_DATA, CAST(P1_DATAORARIC AS DATE) AS P1_DATAORARIC, P7_TIPODOC, PQ_IMPTOTDOC, PZ_NUMERO, PZ_NUMREGCONT, PZ_TIPOPROT, " <<
|
||||
query.cut(0) << "SELECT PZ_CLIFOR, PZ_DATA, CAST(P1_DATAORARIC AS DATE) AS P1_DATAORARIC, P7_TIPODOC, PQ_IMPTOTDOC, PZ_NUMERO, PZ_NUMREGCONT, PZ_TIPOPROT, " <<
|
||||
"PZ_NUMPROT, P2_ANADENOMIN, P2_FISCIVAPAESE, P2_FISCIVACOD, P2_CODFISCALE, PZ_KEYPRGINVIO, PZ_KEYHEADERFATT, PZ_KEYBODYFATT\n" <<
|
||||
"FROM PAA0200F \nJOIN FPPRO00F\n" << " ON P2_KEYPRGINVIO = PZ_KEYPRGINVIO AND P2_KEYHEADERFATT = PZ_KEYHEADERFATT AND P2_KEYBODYFATT = PZ_KEYBODYFATT\n" <<
|
||||
"JOIN PAA0100F \nON P2_KEYPRGINVIO = P1_KEYPRGINVIO AND P2_KEYHEADERFATT = P1_KEYHEADERFATT AND P2_KEYBODYFATT = P1_KEYBODYFATT\n" <<
|
||||
@ -4495,26 +4512,36 @@ TString& TPro_msk::query_string()
|
||||
return query;
|
||||
}
|
||||
|
||||
void TPro_msk::abilita_piva()
|
||||
void TPro_msk::abilita_piva(TMask* msk)
|
||||
{
|
||||
const bool on = get_bool(F_ENABSEARCH);
|
||||
|
||||
enable(F_PIVAS, on);
|
||||
enable(F_STATOPAIVS, on);
|
||||
enable(F_COFIS, on);
|
||||
if (msk->get_bool(F_ENABSEARCH))
|
||||
{
|
||||
msk->enable(F_PIVAS);
|
||||
msk->enable(F_STATOPAIVS);
|
||||
}
|
||||
else
|
||||
{
|
||||
msk->enable(F_PIVAS, false);
|
||||
msk->enable(F_STATOPAIVS, false);
|
||||
}
|
||||
}
|
||||
|
||||
TPro_msk::TPro_msk(TMask& cg_msk) : TAutomask("cg2100t"), _riporta(false), _codforn(0L), _numero(0L)
|
||||
TPro_msk::TPro_msk(TMask& cg_msk) : TAutomask("cg2100t"), _riporta(false), _codforn("")
|
||||
{
|
||||
enable(DLG_OK, app().has_module(F1AUT));
|
||||
set(F_CODCLIFORS, cg_msk.get(F_CODCLIFOR));
|
||||
set(F_COFIS, cg_msk.get(F_COFI));
|
||||
set(F_STATOPAIVS, cg_msk.get(F_STATOPAIV));
|
||||
set(F_PIVAS, cg_msk.get(F_PIVA));
|
||||
set(F_RAGSOCS, cg_msk.get(F_RAGSOCCF));
|
||||
TMask::set_handler(DLG_CONFIG, fppro_handler);
|
||||
TMask::set_handler(DLG_OK, riporta_handler);
|
||||
if (!app().has_module(F1AUT))
|
||||
field(DLG_OK).disable();
|
||||
TMask::set_handler(DLG_LINK, collega_handler);
|
||||
TMask::set_handler(F_PIVAS, piva_handler);
|
||||
TMask::set_handler(F_DATESEARCH, date_handler);
|
||||
TMask::set(F_CODCLIFORS, cg_msk.get(F_CODCLIFOR));
|
||||
TMask::set(F_COFIS, cg_msk.get(F_COFI));
|
||||
TMask::set(F_STATOPAIVS, cg_msk.get(F_STATOPAIV));
|
||||
TMask::set(F_PIVAS, cg_msk.get(F_PIVA));
|
||||
TMask::set(F_RAGSOCS, cg_msk.get(F_RAGSOCCF));
|
||||
set(F_DATESEARCH, TDate(TODAY));
|
||||
_righe_iva.destroy();
|
||||
_scadenze.destroy();
|
||||
_righe_iva.clear();
|
||||
}
|
||||
|
||||
bool& is_f1()
|
||||
@ -4522,4 +4549,3 @@ bool& is_f1()
|
||||
static bool is_f1 = false;
|
||||
return is_f1;
|
||||
}
|
||||
|
||||
|
181
src/cg/cg2102.h
181
src/cg/cg2102.h
@ -27,78 +27,15 @@
|
||||
|
||||
#include <automask.h>
|
||||
#include "../f1/f1lib.h"
|
||||
#include <vector>
|
||||
|
||||
#define K_ELIMMAS 0 // Key per eliminazione massima
|
||||
|
||||
#define FPRI_IMPONIBILE 0
|
||||
#define FPRI_IMPOSTA 1
|
||||
#define FPRI_ALIQUOTA 2
|
||||
#define FPRI_NATURA 3
|
||||
#define FPRI_ESIGIBILITA 4
|
||||
|
||||
#define FPSC_DATA 0
|
||||
#define FPSC_IMPORTO 1
|
||||
|
||||
class TPro_msk;
|
||||
class TDati_mov_auto;
|
||||
|
||||
enum CGMaskType { _query = 0, _no_iva = 1, _iva = 2, _occas = 3};
|
||||
|
||||
class TPro_msk : public TAutomask
|
||||
{
|
||||
long _numero;
|
||||
TDate _datadoc;
|
||||
real _totdoc;
|
||||
real _ritenute;
|
||||
TProtocollo _protfppro;
|
||||
TString _fpprokeys;
|
||||
TString _piva;
|
||||
long _codforn;
|
||||
TString_array _righe_iva;
|
||||
TString_array _scadenze;
|
||||
bool _riporta;
|
||||
TString _str_numero;
|
||||
|
||||
// Non permette la selezione multipla
|
||||
void fppro_selfatt() const;
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||
public:
|
||||
bool da_riportare() const { return _riporta; }
|
||||
bool is_doc_split() ;
|
||||
|
||||
void set_righeiva(const char* fpprokeys);
|
||||
void set_scadenze(const char* fpprokeys);
|
||||
void set_doc(TSheet_field & s, int nrow);
|
||||
|
||||
const long get_numdoc() const { return _numero; }
|
||||
const TString & get_str_numdoc() const { return _str_numero; }
|
||||
const TDate & get_datadoc() const { return _datadoc; }
|
||||
const real & get_totdoc() const { return _totdoc; }
|
||||
const real & get_ritenute() const { return _ritenute; }
|
||||
const TString & get_fpprokeys() const { return _fpprokeys; }
|
||||
const long get_codforn() const { return _codforn; }
|
||||
const TString & get_piva() const { return _piva; }
|
||||
const TString_array& get_righeiva() const { return _righe_iva; }
|
||||
const TProtocollo& get_protocollo() const { return _protfppro; }
|
||||
const TString_array& get_scadenze() const { return _scadenze; }
|
||||
real get_tot_imp_riva() ;
|
||||
|
||||
void add_rigaiva(const real& imponibile, const real& imposta, const real& aliquota, const TString4& natura, char esigib);
|
||||
void add_scad(const TDate& date, const real& importo);
|
||||
|
||||
static TString& query_fppro(const TString& codforn, const TDate& date);
|
||||
static TString& query_fppro(const TString& stato_piva, const TString& piva, const TDate& date);
|
||||
static TString& query_fppro(const TString& codforn, const TString& stato_piva, const TString& piva, const TString& where_str, const TDate& date, const TString& keyprginvio, const TString& keyheaderfatt, const TString& keybodyfatt, bool order = true, bool piva_research = false);
|
||||
static TString& query_string();
|
||||
|
||||
void abilita_piva();
|
||||
|
||||
// Carica documenti FPPRO sulla maschera
|
||||
bool riporta(TMask_field& f);
|
||||
bool load_fppro_mask(TMask & msk);
|
||||
|
||||
TPro_msk(TMask& cg_msk);
|
||||
};
|
||||
|
||||
class TPrimanota_application : public TRelation_application
|
||||
{
|
||||
TMovimentoPN* _rel; // Relazione principale
|
||||
@ -153,7 +90,7 @@ class TPrimanota_application : public TRelation_application
|
||||
|
||||
TAssoc_array _colori; // Colori delle righe
|
||||
bool _isf1;
|
||||
TPro_msk * _pro_mask;
|
||||
shared_ptr<TPro_msk> _pro_mask;
|
||||
bool _is_set_fpcheck;
|
||||
int _last_date;
|
||||
bool _f1_ini;
|
||||
@ -244,19 +181,20 @@ class TPrimanota_application : public TRelation_application
|
||||
|
||||
// Gestione F1
|
||||
|
||||
void write_righe_iva_f1(TMask& cg_msk, const TPro_msk & msk);
|
||||
bool write_scad_f1(const TMask& cg_msk, const TPro_msk & msk);
|
||||
void write_clifo(TMask& cg_msk, const TPro_msk & msk);
|
||||
void set_totale(TMask& cg_msk, TPro_msk & msk);
|
||||
static void riporta_dati_f1(TMask& cg_msk, TPro_msk & msk);
|
||||
static void write_righe_iva_f1(TMask& cg_msk, const shared_ptr<TPro_msk>& msk);
|
||||
static bool write_scad_f1(const TMask& cg_msk, const shared_ptr<TPro_msk>& msk);
|
||||
static void write_clifo(TMask& cg_msk, const shared_ptr<TPro_msk>& msk);
|
||||
static void set_totale(TMask& cg_msk, const shared_ptr<TPro_msk>& msk);
|
||||
static void riporta_dati_f1(TMask& cg_msk, const shared_ptr<TPro_msk>& msk);
|
||||
void insert_part_scad(TConfig& ini);
|
||||
// Handlers per aggancio FPPRO
|
||||
// Bottone per maschera FPPRO
|
||||
static bool fppro_mask(TMask_field& f, KEY key);
|
||||
static bool scollega_handler(TMask_field& f, KEY key);
|
||||
static bool is_collegato(TMask_field& f);
|
||||
static void fppromask_set_handl(TMask* msk);
|
||||
void load_list(TMask* msk, KEY k);
|
||||
void f1_init(TMask& m, const bool fe_enabled, const bool f1_linked = false);
|
||||
static void load_list(TMask* msk, KEY k);
|
||||
static void f1_init_modify(TMask& m, const TRectype& mov);
|
||||
|
||||
void reset_sheet_row(TSheet_field& s, int n);
|
||||
int crea_somma_spese(TImporto& imp);
|
||||
@ -285,10 +223,9 @@ protected: // TApplication
|
||||
static bool scollega(bool set = false);
|
||||
// Pulisce il mov e db dai firerimenti FPPRO (in MODE_MOD per edit/delete)
|
||||
void clean_fppro();
|
||||
// Ha f1 ?
|
||||
bool has_f1() const;
|
||||
// controlla il db
|
||||
bool has_f1_db(const TMask & m);
|
||||
// setta variabili prima del controllo has_f1_db
|
||||
void set_has_f1_db(TMask* m);
|
||||
bool has_f1_db(TMask* m);
|
||||
// Controlli prima di write e rewrite
|
||||
int controlli_f1(const TMask& m);
|
||||
|
||||
@ -384,7 +321,7 @@ protected:
|
||||
real calcola_imp() const;
|
||||
|
||||
void add_cgs_tot(TMask& m);
|
||||
int set_cgs_row(int n, TImporto& importo, const TBill& conto, const char* desc, char tipo,
|
||||
int set_cgs_row(int n, const TImporto& importo, const TBill& conto, const char* desc, char tipo,
|
||||
const char* cms = nullptr, const char* fas = nullptr);
|
||||
void set_cgs_imp(int n, const TImporto& importo);
|
||||
bool add_cgs_imp(int n, const TImporto& importo);
|
||||
@ -463,18 +400,98 @@ public:
|
||||
TString_array& pag_rows() { return _pag_rows; }
|
||||
TImporto get_cgs_imp(int n) const;
|
||||
|
||||
TPro_msk * pro_mask() const { return _pro_mask; }
|
||||
|
||||
TImporto imposte_split_pay() const;
|
||||
const TString& num_doc_rif() const { return _num_doc_rif_partite; }
|
||||
|
||||
TPrimanota_application();
|
||||
virtual ~TPrimanota_application() { safe_delete(_pro_mask); }
|
||||
virtual ~TPrimanota_application() { }
|
||||
};
|
||||
|
||||
class TPro_msk : public TAutomask
|
||||
{
|
||||
public:
|
||||
struct riga_iva_s;
|
||||
struct scadenza_s;
|
||||
private:
|
||||
TString _numero;
|
||||
TDate _datadoc;
|
||||
real _totdoc;
|
||||
real _ritenute;
|
||||
TProtocollo _protfppro;
|
||||
TString _fpprokeys;
|
||||
TString _piva;
|
||||
TString _codforn;
|
||||
vector<riga_iva_s> _righe_iva;
|
||||
vector<scadenza_s> _scadenze;
|
||||
bool _riporta;
|
||||
|
||||
// Handlers per aggancio FPPRO
|
||||
// Bottone carica documenti in maschera FPPRO
|
||||
static bool fppro_handler(TMask_field& f, KEY k);
|
||||
// Bottone riporta doc FPPRO in testata Prima Nota
|
||||
static bool riporta_handler(TMask_field& f, KEY k);
|
||||
static bool collega_handler(TMask_field& f, KEY k);
|
||||
static bool piva_handler(TMask_field& f, KEY k);
|
||||
static bool date_handler(TMask_field& f, KEY k);
|
||||
// Non permette la selezione multipla
|
||||
void fppro_selfatt() const;
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||
public:
|
||||
struct riga_iva_s
|
||||
{
|
||||
real imponibile;
|
||||
real imposta;
|
||||
real aliquota;
|
||||
TString4 natura;
|
||||
char esigibilita;
|
||||
};
|
||||
struct scadenza_s
|
||||
{
|
||||
TDate data;
|
||||
real importo;
|
||||
};
|
||||
|
||||
bool should_bring_back() const { return _riporta; }
|
||||
bool is_doc_split();
|
||||
|
||||
void set_righeiva(const char* fpprokeys);
|
||||
void set_scadenze(const char* fpprokeys);
|
||||
void set_doc(const char* numero, const char* datadoc, const char* totdoc, const char* ritenute, const char* protfppro, const char* fpprokeys, const char* codforn, const char* piva);
|
||||
|
||||
TString get_numdoc() const { return _numero; }
|
||||
TDate get_datadoc() const { return _datadoc; }
|
||||
real get_totdoc() const { return _totdoc; }
|
||||
real get_ritenute() const { return _ritenute; }
|
||||
TString get_fpprokeys() const { return _fpprokeys; }
|
||||
TString get_codforn() const { return _codforn; }
|
||||
TString get_piva() const { return _piva; }
|
||||
const vector<riga_iva_s>& get_righeiva() const { return _righe_iva; }
|
||||
TProtocollo& get_protocollo() { return _protfppro; }
|
||||
vector<scadenza_s>& get_scadenze() { return _scadenze; }
|
||||
real get_tot_imp_riva();
|
||||
|
||||
|
||||
void add_rigaiva(const real& imponibile, const real& imposta, const real& aliquota, const TString4& natura, char esigib);
|
||||
void add_scad(const TDate& date, const real& importo);
|
||||
|
||||
|
||||
static TString& query_fppro(const TString& codforn, const TString& date);
|
||||
static TString& query_fppro(const TString& stato_piva, const TString& piva, const TString& date);
|
||||
static TString& query_fppro(const TString& codforn, const TString& stato_piva, const TString& piva, const TString& where_str, const TString& date, const TString& keyprginvio, const TString& keyheaderfatt, const TString& keybodyfatt, bool order = true, bool piva_research = false);
|
||||
static TString& query_string();
|
||||
|
||||
static void abilita_piva(TMask* msk);
|
||||
|
||||
// Carica documenti FPPRO sulla maschera
|
||||
static bool load_fppro_mask(TMask* msk, KEY k = 32);
|
||||
|
||||
TPro_msk() = delete;
|
||||
TPro_msk(TMask& cg_msk);
|
||||
};
|
||||
|
||||
bool& is_f1();
|
||||
|
||||
|
||||
TString& num_doc_rif();
|
||||
|
||||
#ifndef __EXTRA__
|
||||
inline TPrimanota_application& app()
|
||||
|
@ -329,7 +329,7 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
|
||||
TMask& m = f.mask();
|
||||
TPrimanota_application& a = app();
|
||||
const bool set_scad = a.is_fattura() && m.page_enabled(2); // E' attiva pagina 3
|
||||
if (key == K_ENTER && (!a._f1_ini && (a._pro_mask == nullptr || !a._pro_mask->da_riportare())))
|
||||
if (key == K_ENTER && (!a._f1_ini && (a._pro_mask == nullptr || !a._pro_mask->should_bring_back())))
|
||||
{
|
||||
if (set_scad && f.empty())
|
||||
{
|
||||
@ -356,7 +356,7 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
|
||||
}
|
||||
}
|
||||
|
||||
if (key == K_TAB && f.focusdirty() && m.insert_mode() && set_scad && (!a._f1_ini && (a._pro_mask == nullptr || !a._pro_mask->da_riportare())))
|
||||
if (key == K_TAB && f.focusdirty() && m.insert_mode() && set_scad && (!a._f1_ini && (a._pro_mask == nullptr || !a._pro_mask->should_bring_back())))
|
||||
a.set_scadenze(m);
|
||||
|
||||
return ok;
|
||||
@ -1227,7 +1227,8 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
|
||||
// Aggiornamento contopartita
|
||||
const TImporto old_importo(controsez, old_pag.get_real(PAGSCA_IMPORTO));
|
||||
TBill old_conto; old_conto.get(old_pag, true);
|
||||
TImporto new_importo(controsez, new_pag.get_real(PAGSCA_IMPORTO));
|
||||
|
||||
const TImporto new_importo(controsez, new_pag.get_real(PAGSCA_IMPORTO));
|
||||
|
||||
if (old_importo != new_importo || old_conto != new_conto)
|
||||
{
|
||||
@ -1297,7 +1298,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
|
||||
const real new_ritenute(new_pag.get(PAGSCA_RITENUTE));
|
||||
if (old_ritenute != new_ritenute)
|
||||
{
|
||||
TImporto grow_ritenute(causale().sezione_ritfis(), new_ritenute - old_ritenute);
|
||||
const TImporto grow_ritenute(causale().sezione_ritfis(), new_ritenute - old_ritenute);
|
||||
const int riga = type2pos(cgrowtype_ritfis);
|
||||
|
||||
if (riga < 0)
|
||||
@ -1318,7 +1319,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
|
||||
const real new_ritsoc(new_pag.get(PAGSCA_RITSOC));
|
||||
if (old_ritsoc != new_ritsoc)
|
||||
{
|
||||
TImporto grow_ritenute(causale().sezione_ritsoc(), new_ritsoc-old_ritsoc);
|
||||
const TImporto grow_ritenute(causale().sezione_ritsoc(), new_ritsoc-old_ritsoc);
|
||||
const int riga = type2pos(cgrowtype_ritsoc);
|
||||
|
||||
if (riga < 0)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mov.h"
|
||||
#include <map>
|
||||
#include "rmov.h"
|
||||
#include <vector>
|
||||
#include "pconti.h"
|
||||
|
||||
#define INI_ANNO "riep_anno"
|
||||
@ -22,14 +23,17 @@ class TCompetenze_mask : public TAutomask
|
||||
int s_conto;
|
||||
real importo;
|
||||
};
|
||||
|
||||
TString_array _regs;
|
||||
|
||||
std::vector<int> _regs;
|
||||
std::vector<cont_contr_t> _conts;
|
||||
|
||||
const char* get_ini(bool dataini) const;
|
||||
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||
|
||||
// Funzione becera di ordinamento del vettore _conts
|
||||
void sort_conts(bool sort_by_imp = true);
|
||||
static void swap_items(cont_contr_t* it, cont_contr_t* jt);
|
||||
static bool is_minor_of(cont_contr_t* jt, cont_contr_t* it);
|
||||
|
||||
static TString get_descr(int gruppo, int conto, int s_conto);
|
||||
void fill_contc();
|
||||
@ -46,44 +50,6 @@ const char* TCompetenze_mask::get_ini(bool dataini) const
|
||||
return ini_get_string(CONFIG_DITTA, "cg", INI_MESE, "");
|
||||
}
|
||||
|
||||
|
||||
static bool __sort_by_imp = false;
|
||||
|
||||
static int sort_sheet(TSheet_field & s, int r1, int r2)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (__sort_by_imp)
|
||||
{
|
||||
const real i1 = s.get_real_row_cell(r1, F_TOTCONTC);
|
||||
const real i2 = s.get_real_row_cell(r2, F_TOTCONTC);
|
||||
|
||||
if (i1 > i2)
|
||||
ret = 1;
|
||||
else
|
||||
if (i2 > i1)
|
||||
ret = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = s.get_int_row_cell(r1, F_GRPCONTC) - s.get_int_row_cell(r2, F_GRPCONTC);
|
||||
if (ret == 0)
|
||||
ret = s.get_int_row_cell(r1, F_NUMCONTC) - s.get_int_row_cell(r2, F_NUMCONTC);
|
||||
if (ret == 0)
|
||||
{
|
||||
const long s1 = s.get_long_row_cell(r1, F_SOTCONTC);
|
||||
const real s2 = s.get_long_row_cell(r2, F_SOTCONTC);
|
||||
|
||||
if (s1 > s2)
|
||||
ret = 1;
|
||||
else
|
||||
if (s2 > s1)
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool TCompetenze_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
@ -110,16 +76,6 @@ bool TCompetenze_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
||||
case F_ANNO:
|
||||
if (e == fe_init) set(F_ANNO, get_ini(true));
|
||||
break;
|
||||
case F_ORDIN:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
{
|
||||
TSheet_field& sf = sfield(F_CONTC);
|
||||
|
||||
__sort_by_imp = o.get_bool();
|
||||
sf.sort(sort_sheet);
|
||||
sf.force_update();
|
||||
}
|
||||
break;
|
||||
case F_MESE:
|
||||
if (e == fe_init)
|
||||
set(F_MESE, get_ini(false));
|
||||
@ -139,66 +95,100 @@ TString TCompetenze_mask::get_descr(int gruppo, int conto, int s_conto)
|
||||
return pcont.get(PCN_DESCR);
|
||||
}
|
||||
|
||||
bool TCompetenze_mask::is_minor_of(cont_contr_t* jt, cont_contr_t* it)
|
||||
{
|
||||
return jt->gruppo < it->gruppo
|
||||
|| (jt->gruppo == it->gruppo && jt->conto < it->conto)
|
||||
|| (jt->gruppo == it->gruppo && jt->conto == it->conto
|
||||
&& jt->s_conto < it->s_conto);
|
||||
}
|
||||
|
||||
void TCompetenze_mask::swap_items(cont_contr_t* it, cont_contr_t* jt)
|
||||
{
|
||||
const cont_contr_t appo = *it;
|
||||
*it = *jt;
|
||||
*jt = appo;
|
||||
}
|
||||
|
||||
void TCompetenze_mask::sort_conts(bool sort_by_imp)
|
||||
{
|
||||
// Sopra 100 rischia di essere leggermente lento?
|
||||
if (1 < _conts.size() && _conts.size() < 100)
|
||||
for (auto it = _conts.begin(); it != _conts.end(); ++it)
|
||||
for (auto jt = (it+1); jt != _conts.end(); ++jt)
|
||||
if (sort_by_imp && jt->importo > it->importo || !sort_by_imp && is_minor_of(&(*jt), &(*it)))
|
||||
swap_items(&(*it), &(*jt));
|
||||
}
|
||||
|
||||
void TCompetenze_mask::fill_contc()
|
||||
{
|
||||
TSheet_field& sf = sfield(F_CONTC);
|
||||
TAssoc_array conti;
|
||||
real tot;
|
||||
TLocalisamfile rmovs(LF_RMOV);
|
||||
|
||||
sf.hide();
|
||||
sf.reset();
|
||||
_conts.clear();
|
||||
// Per ogni registrazione
|
||||
FOR_EACH_ARRAY_ITEM(_regs, i, obj)
|
||||
for (int i = 0; i < (int)_regs.size(); ++i)
|
||||
{
|
||||
const long numreg = atol(STRING_TOKEN(obj));
|
||||
const TMovimento_contabile mov(numreg);
|
||||
const TCausale & caus = cached_causale(mov.get(MOV_CODCAUS));
|
||||
const int rows = mov.cg_rows();
|
||||
|
||||
// Per ogni riga della registrazione
|
||||
for (int r = mov.is_IVA() ? 2 : 1; r <= rows; r++)
|
||||
const int numreg = _regs[i];
|
||||
rmovs.zero();
|
||||
rmovs.put(RMV_NUMREG, numreg);
|
||||
rmovs.put(RMV_NUMRIG, 0);
|
||||
int riga = 0;
|
||||
if (rmovs.read())
|
||||
{
|
||||
const TRectype & rmov = mov.cg(r);
|
||||
const int gruppo = rmov.get_int(RMV_GRUPPO);
|
||||
const int numcontc = rmov.get_int(RMV_CONTO);
|
||||
const int s_conto = rmov.get_int(RMV_SOTTOCONTO);
|
||||
const TString& tipocc = rmov.get(RMV_TIPOC);
|
||||
const real importo = rmov.get_real(RMV_IMPORTO);
|
||||
TString key;
|
||||
|
||||
key.format("%03d|%03d|%06d", gruppo, numcontc, s_conto);
|
||||
|
||||
if (tipocc.blank()) // Solo se il tipo di conto di contr. e' un conto, cioe' vuoto
|
||||
// Per ogni riga della registrazione
|
||||
for (; rmovs.get_int(RMV_NUMREG) == numreg; rmovs.next())
|
||||
{
|
||||
// Cerco se ho già la chiave
|
||||
real * tot = (real *)conti.objptr(key);
|
||||
const int gruppo = rmovs.get_int(RMV_GRUPPOC);
|
||||
const int numcontc = rmovs.get_int(RMV_CONTOC);
|
||||
const int s_conto = rmovs.get_int(RMV_SOTTOCONTOC);
|
||||
const TString& tipocc = rmovs.get(RMV_TIPOCC);
|
||||
const real importo(rmovs.get(RMV_IMPORTO));
|
||||
|
||||
if (tot == nullptr)
|
||||
conti.add(key, tot = new real);
|
||||
*tot += importo;
|
||||
if (tipocc.blank()) // Solo se il tipo di conto di contr. e' un conto, cioe' vuoto
|
||||
{
|
||||
// Cerco se ho già la chiave
|
||||
auto it = _conts.begin();
|
||||
for (; it != _conts.end(); ++it)
|
||||
{
|
||||
if (it->gruppo == gruppo
|
||||
&& it->conto == numcontc
|
||||
&& it->s_conto == s_conto)
|
||||
break;
|
||||
}
|
||||
|
||||
if (it != _conts.end())
|
||||
it->importo += importo;
|
||||
else
|
||||
_conts.insert(_conts.end(), { gruppo, numcontc, s_conto, importo });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FOR_EACH_ASSOC_OBJECT(conti, i, k, o1)
|
||||
{
|
||||
TToken_string key = k;
|
||||
const int gruppo = key.get_int(0);
|
||||
const int conto = key.get_int(0);
|
||||
const int s_conto = key.get_long(2);
|
||||
sort_conts(get(F_ORDIN) == "X");
|
||||
|
||||
real tot; tot = 0;
|
||||
for (auto it = _conts.begin(); it != _conts.end(); ++it)
|
||||
{
|
||||
const int gruppo = it->gruppo;
|
||||
const int conto = it->conto;
|
||||
const int s_conto = it->s_conto;
|
||||
const TString& descr = get_descr(gruppo, conto, s_conto);
|
||||
const real importo = *(real *)o1;
|
||||
int r = sf.set_row_cell(F_GRPCONTC, gruppo);
|
||||
|
||||
sf.set_row_cell(F_NUMCONTC, conto, r);
|
||||
sf.set_row_cell(F_SOTCONTC, s_conto, r);
|
||||
|
||||
sf.set_row_cell(F_DESCRCON, descr, r);
|
||||
sf.set_row_cell(F_TOTCONTC, importo, r);
|
||||
tot += importo;
|
||||
TToken_string& row = sf.row(-1);
|
||||
row.add(gruppo);
|
||||
row.add(conto);
|
||||
row.add(s_conto);
|
||||
row.add(descr);
|
||||
row.add(it->importo);
|
||||
tot += it->importo;
|
||||
}
|
||||
|
||||
sf.sort(sort_sheet);
|
||||
sf.force_update();
|
||||
sf.force_update();
|
||||
sf.show();
|
||||
|
||||
set(F_TOT, tot);
|
||||
}
|
||||
@ -208,42 +198,42 @@ void TCompetenze_mask::fill()
|
||||
const int anno = get_int(F_ANNO);
|
||||
const int mese = get_int(F_MESE);
|
||||
TSheet_field& sf = sfield(F_MOVS);
|
||||
TRectype from(LF_MOV);
|
||||
TRectype to(LF_MOV);
|
||||
TDate data(1, mese, anno);
|
||||
|
||||
from.put(MOV_DATAREG, data);
|
||||
data.set_end_month();
|
||||
to.put(MOV_DATAREG, data);
|
||||
|
||||
TCursor c(new TRelation(LF_MOV), "", 2, &from, &to);
|
||||
const int items = c.items();
|
||||
TLocalisamfile movs(LF_MOV);
|
||||
|
||||
sf.hide();
|
||||
sf.reset();
|
||||
_regs.destroy();
|
||||
for (c = 0L; c.pos() < items; ++c)
|
||||
_regs.clear();
|
||||
movs.setkey(2);
|
||||
|
||||
const TDate dataini(1, mese, anno);
|
||||
TDate dataend(dataini); dataend.set_end_month();
|
||||
movs.put(MOV_DATAREG, dataini);
|
||||
if (movs.read() != NOERR)
|
||||
{
|
||||
const TRectype & mov = c.curr();
|
||||
const int month_liq = mov.get_int(MOV_MESELIQ);
|
||||
const TDate datareg(mov.get(MOV_DATAREG));
|
||||
const TDate datacomp(mov.get(MOV_DATACOMP));
|
||||
|
||||
if (month_liq != 0)
|
||||
for (; movs.next() == NOERR && movs.get_date(MOV_DATAREG) <= dataend; )
|
||||
{
|
||||
_regs.add(mov.get(MOV_NUMREG));
|
||||
const int month_liq = movs.get_int(MOV_MESELIQ);
|
||||
const TDate datareg(movs.get(MOV_DATAREG));
|
||||
const TDate datacomp(movs.get(MOV_DATACOMP));
|
||||
|
||||
int r = sf.set_row_cell(F_NUMREG, mov.get(MOV_NUMREG));
|
||||
if (month_liq != 0)
|
||||
{
|
||||
_regs.insert(_regs.end(), movs.get_int(MOV_NUMREG));
|
||||
|
||||
sf.set_row_cell(F_DATAREG, mov.get_date(MOV_DATAREG), r);
|
||||
sf.set_row_cell(F_DATADOC, mov.get_date(MOV_DATADOC), r);
|
||||
sf.set_row_cell(F_CODCAUS, mov.get(MOV_CODCAUS), r);
|
||||
sf.set_row_cell(F_MESELIQ, month_liq, r);
|
||||
sf.set_row_cell(F_NUMDOC, mov.get(MOV_NUMDOC), r);
|
||||
sf.set_row_cell(F_PROTIVA, mov.get(MOV_PROTIVA), r);
|
||||
sf.set_row_cell(F_DESCR, mov.get(MOV_DESCR), r);
|
||||
TToken_string& row = sf.row(-1);
|
||||
row.add(movs.get(MOV_NUMREG));
|
||||
row.add(datareg);
|
||||
row.add(movs.get(MOV_DATADOC));
|
||||
row.add(TCausale(movs.get(MOV_CODCAUS)).tipo_doc());
|
||||
row.add(month_liq);
|
||||
row.add(movs.get(MOV_NUMDOC));
|
||||
row.add(movs.get(MOV_PROTIVA));
|
||||
row.add(movs.get(MOV_DESCR));
|
||||
}
|
||||
}
|
||||
}
|
||||
sf.force_update();
|
||||
sf.show();
|
||||
|
||||
fill_contc();
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ END
|
||||
|
||||
NUMBER F_MESELIQ 2
|
||||
BEGIN
|
||||
PROMPT 1 5 "Mese Liq."
|
||||
PROMPT 1 5 "Causale "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
|
@ -68,8 +68,7 @@ class TListaMov_application : public TPrintapp
|
||||
int _ricser;
|
||||
bool _settata_prima_riga, _causale_gia_stampata,_mov_di_sola_iva;
|
||||
int _cur1,_cur2,_cur2b,_cur3,_cur4,_decidi,/*_tipod,*/_controllo_mov_errati;
|
||||
int _numero_riga, _alleg, _scelta_stampa, _nr, _n;
|
||||
tiporeg _tiporegistro;
|
||||
int _numero_riga, _alleg, _tiporegistro, _scelta_stampa, _nr, _n;
|
||||
int _provvis;
|
||||
liste _tipo_lista;
|
||||
word _flags;
|
||||
@ -482,11 +481,11 @@ bool TListaMov_application::filter_func_fatture (const TRelation* rel)
|
||||
|
||||
const int ann_reg = mov.get_int(MOV_ANNOIVA);
|
||||
const TString4 cod_reg = mov.get(MOV_REG);
|
||||
const tiporeg tipo_reg = cached_registro(cod_reg, ann_reg).tipo_registro();
|
||||
const int tipo_reg = tipo_registro(cod_reg, ann_reg);
|
||||
|
||||
// Considera solo iva acquisti o vendite
|
||||
if (tipo_reg != vendita && tipo_reg != acquisto)
|
||||
return false;
|
||||
if (tipo_reg != 1 && tipo_reg != 2)
|
||||
return FALSE;
|
||||
|
||||
if (app()._annoes > 0) //anno esercizio specificato nella maschera
|
||||
{
|
||||
@ -537,10 +536,8 @@ bool TListaMov_application::filter_func (const TRelation * rel)
|
||||
{
|
||||
const TString& cod_reg = mov.get(MOV_REG);
|
||||
const int ann_reg = mov.get_int(MOV_ANNOIVA);
|
||||
const tiporeg tipo_reg = cached_registro(cod_reg, ann_reg).tipo_registro();
|
||||
|
||||
// Considera solo iva acquisti o vendite
|
||||
if (tipo_reg != vendita && tipo_reg != acquisto)
|
||||
const int tipo_reg = tipo_registro(cod_reg, ann_reg);
|
||||
if (tipo_reg == 1 || tipo_reg == 2)
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -629,10 +626,9 @@ void TListaMov_application::stampa_errori_rmov()
|
||||
else set_row(_nr++, FR("@11gCodice C/F non presente in Anagrafica"));
|
||||
if (_registro.not_empty()) //se su mov e' indicato il codice registro
|
||||
{
|
||||
const TRegistro & reg = cached_registro(_registro, _ae);
|
||||
const tiporeg tipo = reg.tipo_registro();
|
||||
|
||||
if ((tipo == vendita && t != 'C') || (tipo == acquisto && t != 'F'))
|
||||
TRegistro rg (_registro, _ae);
|
||||
const int tiporeg = rg.tipo();
|
||||
if ((tiporeg == 1 && t != 'C') || (tiporeg == 2 && t != 'F'))
|
||||
set_row(_nr++, FR("@11gTipo C/F non compatibile con tipo registro"));
|
||||
}
|
||||
}
|
||||
@ -719,14 +715,14 @@ void TListaMov_application::stampa_errori_iva(int* nr, const TRigaiva& riva)
|
||||
const int tipocr = riva._tipocr;
|
||||
|
||||
if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
|
||||
if (_tiporegistro != acquisto)
|
||||
if (_tiporegistro != 2)
|
||||
set_row(++(*nr), FR("@11gCodice di indetraibilita' errato"));
|
||||
|
||||
if (_tiporegistro == vendita)
|
||||
if (_tiporegistro == 1)
|
||||
if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
|
||||
set_row(++(*nr), FR("@11gTipo costo/ricavo non valido"));
|
||||
|
||||
if (_tiporegistro == acquisto)
|
||||
if (_tiporegistro == 2)
|
||||
if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
|
||||
set_row(++(*nr), FR("@11gTipo costo/ricavo non valido"));
|
||||
}
|
||||
@ -786,11 +782,11 @@ void TListaMov_application::set_page(int file, int count)
|
||||
TString16 reg = current_cursor()->curr(LF_MOV).get(MOV_REG);
|
||||
int anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
|
||||
char prov = current_cursor()->curr(LF_MOV).get_char(MOV_PROVVIS);
|
||||
const tiporeg tipo = cached_registro(reg, anno).tipo_registro();
|
||||
TEsercizi_contabili esc;
|
||||
int tipo = tipo_registro(reg, anno);
|
||||
|
||||
TEsercizi_contabili esc;
|
||||
esc.date2esc(data); // qui verificare
|
||||
if ( (tipo == vendita) || (tipo == acquisto) )
|
||||
if ( (tipo == 1) || (tipo == 2) )
|
||||
{
|
||||
set_row (_n, FR("@103greg @3s"),FLD(LF_MOV,MOV_REG));
|
||||
set_row (_n, FR("@111gpr @5n"),FLD(LF_MOV,MOV_PROTIVA));
|
||||
@ -864,8 +860,7 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
||||
_codcf = curmov.get_long(MOV_CODCF);
|
||||
_numero = curmov.get_long(MOV_NUMREG);
|
||||
_codval = curmov.get(MOV_CODVALI);
|
||||
_tiporegistro = cached_registro(_registro, _anno).tipo_registro();
|
||||
|
||||
_tiporegistro = tipo_registro(_registro, _anno);
|
||||
|
||||
_causale_gia_stampata = FALSE;
|
||||
TEsercizi_contabili esc;
|
||||
@ -992,9 +987,11 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
||||
_descr_causale = caus.get(CAU_DESCR);
|
||||
_alleg_causale = caus.get_bool(CAU_ALLEG);
|
||||
_tipodocumento = caus.get(CAU_TIPODOC);
|
||||
_tiporegistro = cached_registro(_registro, _anno).tipo_registro();
|
||||
if ((_tiporegistro != vendita) && (_tiporegistro != acquisto))//se si tratta di un movimento di sola prima nota
|
||||
return true;
|
||||
|
||||
_tiporegistro = tipo_registro (_registro, _anno);
|
||||
|
||||
if ((_tiporegistro != 1)&&(_tiporegistro != 2))//se si tratta di un movimento di sola prima nota
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (file == LF_RMOV)
|
||||
@ -1041,10 +1038,10 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
||||
_numr = curmov.get_long(MOV_NUMREG);
|
||||
_tipo_elenco = curmov.get(MOV_TIPO);
|
||||
_codcf = curmov.get_long(MOV_CODCF);
|
||||
const tiporeg tiporeg = cached_registro(codreg, anno).tipo_registro();
|
||||
const TString8 attreg = cached_registro(codreg, anno).attivita();
|
||||
const int tiporeg = tipo_registro (codreg, anno);
|
||||
const TString8 attreg = AttivitaRegistro (codreg, anno);
|
||||
|
||||
if (tiporeg == vendita || tiporeg == acquisto)//se si tratta di un movimento iva
|
||||
if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva
|
||||
{
|
||||
_tipoatt = TipoAttivita(attreg, get_firm());
|
||||
_tipo_elenco = curmov.get(MOV_TIPO);
|
||||
@ -1873,18 +1870,18 @@ bool TListaMov_application::segnala_errori_iva()
|
||||
return true;
|
||||
}
|
||||
if (tipodet == 1 || tipodet == 3 || tipodet == 5 || tipodet == 9)
|
||||
if (_tiporegistro != acquisto)
|
||||
if (_tiporegistro != 2)
|
||||
{
|
||||
rmoviva.readat(nrec);
|
||||
return true;
|
||||
}
|
||||
if (_tiporegistro == vendita)
|
||||
if (_tiporegistro == 1)
|
||||
if (tipocr != 0 && tipocr != 1 && tipocr != 4 && tipocr != 9)
|
||||
{
|
||||
rmoviva.readat(nrec);
|
||||
return true;
|
||||
}
|
||||
if (_tiporegistro == acquisto)
|
||||
if (_tiporegistro == 2)
|
||||
if (tipocr != 0 && tipocr != 1 && tipocr != 2 && tipocr != 3 && tipocr != 5 && tipocr != 8 && tipocr != 9)
|
||||
{
|
||||
rmoviva.readat(nrec);
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "cg3.h"
|
||||
#include "cg3300.h"
|
||||
#include "cglib.h"
|
||||
|
||||
#include "cg3300a.h"
|
||||
#include "cg3300b.h"
|
||||
@ -470,19 +469,18 @@ void TStampa_allegati::ricalcola(int anno_dic)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
|
||||
const tiporeg tipo = cached_registro(reg).tipo_registro();
|
||||
|
||||
if ((tipo != acquisto) && (tipo != vendita))
|
||||
const int tiporeg = reg.get_int("I0");
|
||||
if ((tiporeg != 2) && (tiporeg != 1))
|
||||
continue;
|
||||
|
||||
if (tiporeg == vendita)
|
||||
if (tiporeg == 1)
|
||||
{
|
||||
if (cached_registro(reg).sospeso())
|
||||
continue;
|
||||
vendite = true;
|
||||
bool sosp = reg.get_bool ("B0");
|
||||
if (sosp) continue;
|
||||
vendite = TRUE;
|
||||
}
|
||||
else
|
||||
vendite = false;
|
||||
vendite = FALSE;
|
||||
|
||||
tipodoc = cau.get (CAU_TIPODOC);
|
||||
if (corrispettivo (tipodoc))
|
||||
|
@ -84,6 +84,7 @@ class TLista_fatture : public TPrintapp
|
||||
|
||||
protected:
|
||||
long select_firm_range(long from, long to);
|
||||
int tiporeg(const TString& );
|
||||
static bool mix_handler(TMask_field&, KEY);
|
||||
static bool date_handler(TMask_field&, KEY);
|
||||
static bool to_ditt_handler(TMask_field&, KEY);
|
||||
@ -116,6 +117,12 @@ public:
|
||||
|
||||
inline TLista_fatture& app() { return (TLista_fatture&) main_app(); }
|
||||
|
||||
int TLista_fatture::tiporeg(const TString& reg)
|
||||
{
|
||||
TString8 s; s.format("%4d%-3s",_date_from.year(),(const char*)reg);
|
||||
return atoi(cache().get("REG", s, "I0"));
|
||||
}
|
||||
|
||||
bool TLista_fatture::filter_func1(const TRelation *r)
|
||||
{
|
||||
TLista_fatture& a = app();
|
||||
@ -137,8 +144,8 @@ bool TLista_fatture::filter_func1(const TRelation *r)
|
||||
if (riv.get(RMI_TIPODET).blank() || percind.is_zero())
|
||||
return false;
|
||||
|
||||
const tiporeg tipo = cached_registro(rg).tipo_registro();
|
||||
if (tipo != acquisto)
|
||||
const int tiporeg = a.tiporeg(rg);
|
||||
if (tiporeg != 2)
|
||||
return false;
|
||||
}
|
||||
else // Tipo costo/ricavo
|
||||
@ -436,9 +443,8 @@ bool TLista_fatture::preprocess_page(int file, int counter)
|
||||
if (_tipo == intra)
|
||||
{
|
||||
TString4 codiva = rec.get(RMI_CODIVA);
|
||||
const tiporeg tipomov = cached_registro(mov.get(MOV_REG)).tipo_registro();
|
||||
|
||||
if (tipomov == acquisto && tipodet == 9)
|
||||
const int tipomov = tiporeg(mov.get(MOV_REG));
|
||||
if (tipomov == 2 && tipodet == 9)
|
||||
codiva = "~A19"; // Speciale per acquisti indeducibili art. 19
|
||||
const bool is_key = _intra_items.is_key(codiva); // Esiste l'elemento ?
|
||||
// Se si' allora prendi quello, altrimenti prendine uno nuovo
|
||||
@ -463,10 +469,8 @@ bool TLista_fatture::preprocess_page(int file, int counter)
|
||||
_tot_iva += iva;
|
||||
_tp_imp += imp;
|
||||
_tp_iva += iva;
|
||||
|
||||
const tiporeg tipomov = cached_registro(mov.get(MOV_REG)).tipo_registro();
|
||||
|
||||
if (_tipo == indetraibile && tipomov == acquisto && tipodet > 0)
|
||||
const int tipomov = tiporeg(mov.get(MOV_REG));
|
||||
if (_tipo == indetraibile && tipomov == 2 && tipodet > 0)
|
||||
{
|
||||
TString4 codiva = rec.get(RMI_CODIVA);
|
||||
_Iva_item * iva_row = (_Iva_item *) _indetr.objptr(codiva);
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <saldi.h>
|
||||
#include <causali.h>
|
||||
|
||||
#include "cglib.h"
|
||||
#include "cglib02.h"
|
||||
|
||||
struct therec
|
||||
{
|
||||
@ -89,7 +89,7 @@ bool CG4100_App::sort_sal()
|
||||
sal.set_anno_es(year);
|
||||
sal.clear_saldi(year);
|
||||
long numreg = 0L;
|
||||
tiposal tsal = saldo_normale;
|
||||
tiposal tsal = normale;
|
||||
char provvis;
|
||||
TDate datareg;
|
||||
|
||||
@ -127,11 +127,20 @@ bool CG4100_App::sort_sal()
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
mov.read();
|
||||
CHECK(mov.good(),"Archivi movimenti e righe inconsistenti");
|
||||
const TString& codcaus = mov.get(MOV_CODCAUS);
|
||||
|
||||
tsal = saldo_normale; // Tipo saldo normale per default
|
||||
if(codcaus.full())
|
||||
tsal = cached_causale(codcaus, year).tipo_saldo();
|
||||
// Tipo saldo normale per default
|
||||
tsal = normale;
|
||||
const TString& codcaus = mov.get(MOV_CODCAUS);
|
||||
const TRectype& causale = cache().get(LF_CAUSALI, codcaus);
|
||||
if (!causale.empty())
|
||||
{
|
||||
const char ac = causale.get_char(CAU_MOVAP);
|
||||
if (ac == 'A')
|
||||
tsal = apertura; else
|
||||
if (ac == 'C')
|
||||
tsal = chiusura;
|
||||
}
|
||||
|
||||
scaricato = mov.get_bool(MOV_SCARCON);
|
||||
provvis = mov.get_char(MOV_PROVVIS);
|
||||
datareg = mov.get_date(MOV_DATAREG);
|
||||
|
@ -208,6 +208,7 @@ bool TLiquidazione_app::user_create()
|
||||
_lam = new TTable("LAM");
|
||||
_pla = new TTable("%PLA");
|
||||
_reg = new TTable("REG");
|
||||
_iva = new TTable("%IVA");
|
||||
_del = new TTable("%DEL");
|
||||
|
||||
_mov = &_cur->file(LF_MOV);
|
||||
@ -224,6 +225,7 @@ bool TLiquidazione_app::user_create()
|
||||
_pum_r = &(_pum->curr());
|
||||
_pam_r = &(_pam->curr());
|
||||
_pom_r = &(_pom->curr());
|
||||
_iva_r = &(_iva->curr());
|
||||
_del_r = &(_del->curr());
|
||||
_lam_r = &(_lam->curr());
|
||||
_pla_r = &(_pla->curr());
|
||||
|
@ -338,6 +338,7 @@ class TLiquidazione_app : public TPrint_application
|
||||
TTable* _pla;
|
||||
TTable* _ppa;
|
||||
TTable* _reg;
|
||||
TTable* _iva;
|
||||
TTable* _del;
|
||||
|
||||
// a reference rectype per file/table
|
||||
@ -345,6 +346,7 @@ class TLiquidazione_app : public TPrint_application
|
||||
TRectype* _rmoviva_r;
|
||||
TRectype* _pcon_1_r;
|
||||
TRectype* _pcon_2_r;
|
||||
TRectype* _iva_r;
|
||||
TRectype* _pim_r;
|
||||
TRectype* _pis_r;
|
||||
TRectype* _prm_r;
|
||||
@ -620,7 +622,7 @@ public:
|
||||
bool look_pla(const char* a, bool create = false);
|
||||
bool look_ppa(int m, const char* a, int t, bool create = false);
|
||||
bool look_del(int month, int type, bool create = false);
|
||||
// bool look_iva(const char* cod);
|
||||
bool look_iva(const char* cod);
|
||||
bool look_reg(const char* reg);
|
||||
const TRectype & get_lia(long ditta = 0l, bool create = false, int anno = 0);
|
||||
const int put_lia(const TRectype & lia, bool re = true);
|
||||
|
@ -338,7 +338,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
||||
TString8 cattiv(codatt);
|
||||
cattiv << tipoatt;
|
||||
|
||||
const bool waspla = look_pla(cattiv, has_single_activity);
|
||||
const bool waspla = look_pla(cattiv); // perchè sta cosa ) , has_single_activity);
|
||||
if (!waspla)
|
||||
break; // Non calcolare attività inesistenti 29-11-2012
|
||||
|
||||
@ -1450,7 +1450,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
real nin_iva = ZERO; // imposta non incassati
|
||||
|
||||
const TString4 codiva = _rmoviva->get(RMI_CODIVA);
|
||||
const TCodiceIVA& civa = cached_codIVA(codiva);
|
||||
TCodiceIVA civa(codiva);
|
||||
|
||||
#ifdef DBG
|
||||
BREAK_DBG;
|
||||
@ -1466,16 +1466,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
continue;
|
||||
}
|
||||
|
||||
const TString4 tipoiva = civa.tipo();
|
||||
const TString4 tipoes_v = civa.IVA11_vendite();
|
||||
const TString4 tipoes_a = civa.IVA11_acquisti();
|
||||
const int tipoagr = civa.tipo_IVA_agricola(); // 2/9/2015 was S4
|
||||
const int tipoag = civa.tipo_agenzie_viaggio();
|
||||
const int tipopla = civa.tipo_plafond();
|
||||
int isrimbinfr = civa.codice_rimborso_infrannuale(); // vale per calcolo rimborso se ES o NI
|
||||
const real perciva = civa.moltiplicatore_percentuale();
|
||||
int ivarimb = !civa.escluso_dal_rimborso(); // non escluso calcolo rimb. per al. media
|
||||
const bool den_prorata = civa.tipo_IVA_agricola(); // denominatore prorata nel caso di calcolo pro rata con numeratore e denominatore
|
||||
look_iva(codiva); // da eliminare esso per evitare un problema di non lettura _iva ve eliminato
|
||||
const TString4 tipoiva = _iva->get("S1");
|
||||
const TString4 tipoes_v = _iva->get("S2");
|
||||
const TString4 tipoes_a = _iva->get("S9");
|
||||
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4
|
||||
const int tipoag = _iva->get_int("S5");
|
||||
const int tipopla = _iva->get_int("S3");
|
||||
int isrimbinfr = _iva->get_bool("B3"); // vale per calcolo rimborso se ES o NI
|
||||
const real perciva = _iva->get_real("R0") / CENTO;
|
||||
int ivarimb = !_iva->get_bool("B4"); // non escluso calcolo rimb. per al. media
|
||||
const bool den_prorata = _iva->get_bool("B7"); // denominatore prorata nel caso di calcolo pro rata con numeratore e denominatore
|
||||
|
||||
const TString4 tipocr_s = _rmoviva->get(RMI_TIPOCR);
|
||||
const int tipocr = atoi(tipocr_s);
|
||||
@ -1558,7 +1559,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
|
||||
sezfat = tipomov == vendita ? 'D' : 'A';
|
||||
|
||||
if (is_detr_diff == 1 || civa.iva_non_soggetta())
|
||||
if (is_detr_diff == 1 || civa.tipo() == "NS")
|
||||
continue;
|
||||
if (bIsMovDiff && tm == tm_fattura)
|
||||
{
|
||||
@ -2220,10 +2221,8 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
if (_pcon_1_r->get_int(PCN_INDBIL) == 4)
|
||||
if (_cur->is_first_match(-AGR_PCON2)) // Esiste il sottoconto ?
|
||||
{
|
||||
const TCodiceIVA & civa = cached_codIVA(_pcon_2_r->get(PCN_IVACOMP));
|
||||
|
||||
if (civa.ok())
|
||||
ivacomp = civa.codice(); // Ecco il codice IVA di compensazione
|
||||
if (look_iva(_pcon_2_r->get(PCN_IVACOMP)))
|
||||
ivacomp = _iva->get("CODTAB"); // Ecco il codice IVA di compensazione
|
||||
}
|
||||
look_pia(month, codatt, codiva, ivacomp, true); // Crea il record in tabella se non esiste
|
||||
real pia_imp = _pia->get_real("R0") + agr_imp; // Aggiorna...
|
||||
@ -2728,10 +2727,11 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
if (_pim->get_bool("B4"))
|
||||
{
|
||||
// ricalcola l'imposta a partire dal codice IVA
|
||||
const TCodiceIVA & civa = cached_codIVA(*_pim_codiva);
|
||||
const real old_iva = _pim->get_real("R1");
|
||||
real new_iva = _pim->get_real("R0") * civa.moltiplicatore_percentuale();
|
||||
look_iva(*_pim_codiva);
|
||||
real old_iva = _pim->get_real("R1");
|
||||
real perc = _iva->get_real("R0");
|
||||
|
||||
real new_iva = _pim->get_real("R0") * perc / CENTO;
|
||||
round_al_centesimo(new_iva);
|
||||
|
||||
if (new_iva != old_iva)
|
||||
@ -2759,9 +2759,10 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt, TAssoc_array &
|
||||
if (_pia->get_bool("B0"))
|
||||
{
|
||||
// calcola l'imposta a partire dal codice IVA di compensazione
|
||||
const TCodiceIVA & civa = cached_codIVA(*_pia_codcom);
|
||||
real iva = _pia->get_real("R0") * civa.moltiplicatore_percentuale();
|
||||
look_iva(*_pia_codcom);
|
||||
real perc = _iva->get_real("R0");
|
||||
|
||||
real iva = _pia->get_real("R0") * perc / CENTO;
|
||||
round_al_centesimo(iva);
|
||||
agr_detIA += iva;
|
||||
_pia->put("R1",iva);
|
||||
@ -2993,14 +2994,12 @@ void TLiquidazione_app::iva11_set_arr_phase_1(const TString& codatt)
|
||||
|
||||
if (is_split_payment(_mov->curr()))
|
||||
imposta = ZERO;
|
||||
|
||||
const TCodiceIVA & civa = cached_codIVA(_rmoviva->get(RMI_CODIVA));
|
||||
const TString4 codiva = civa.codice();
|
||||
const TString4 tipoiva = civa.tipo();
|
||||
const real ali = civa.percentuale();
|
||||
const TString4 tipoes_v = civa.IVA11_vendite();
|
||||
const TString4 tipoes_a = civa.IVA11_acquisti();
|
||||
const int tipoagr = civa.tipo_IVA_agricola(); // 2/9/2015 was S4
|
||||
const TString4 codiva = _iva->get("CODTAB");
|
||||
const TString4 tipoiva = _iva->get("S1");
|
||||
const real ali = _iva->get_real("R0");
|
||||
const TString4 tipoes_v = _iva->get("S2");
|
||||
const TString4 tipoes_a = _iva->get("S9");
|
||||
const int tipoagr = _iva->get_int("I4"); // 2/9/2015 was S4
|
||||
const TRectype& rcs = _cur->curr(LF_CAUSALI);
|
||||
const bool autofattura = rcs.get_bool("AUTOFATT");
|
||||
const bool valintra = rcs.get_bool("VALINTRA");
|
||||
@ -3380,17 +3379,14 @@ void TLiquidazione_app::iva11_set_arr_phase_2(const TString& codatt)
|
||||
// Must consider current activity too...
|
||||
codiva = *_pim_codiva;
|
||||
reg = *_pim_codreg;
|
||||
|
||||
const TCodiceIVA & civa = cached_codIVA(codiva);
|
||||
|
||||
look_reg(reg); // posiziona la tabella registri e quella IVA
|
||||
tiva = civa.tipo(); // tipo IVA
|
||||
tpla = civa.tipo_plafond(); // tipo gestione plafond
|
||||
tagr = civa.tipo_IVA_agricola(); // tipo gestione regime agricolo 2/9/2015 was S4
|
||||
tvia = civa.tipo_agenzie_viaggio(); // tipo gestione ag. viaggio
|
||||
v11 = civa.IVA11_vendite(); // n.ro riga vendite per mod. IVA11
|
||||
a11 = civa.IVA11_acquisti(); // n.ro riga acquisti per mod. IVA11
|
||||
aliq = civa.percentuale(); // aliquota
|
||||
look_iva(codiva); look_reg(reg); // posiziona la tabella registri e quella IVA
|
||||
tiva = _iva->get("S1"); // tipo IVA
|
||||
tpla = _iva->get("S3"); // tipo gestione plafond
|
||||
tagr = _iva->get_int("I4"); // tipo gestione regime agricolo 2/9/2015 was S4
|
||||
tvia = _iva->get("S5"); // tipo gestione ag. viaggio
|
||||
v11 = _iva->get("S2"); // n.ro riga vendite per mod. IVA11
|
||||
a11 = _iva->get("S9"); // n.ro riga acquisti per mod. IVA11
|
||||
aliq = _iva->get_real("R0"); // aliquota
|
||||
treg = (tiporeg)_reg->get_long("I0");
|
||||
const bool is_vendita = treg == vendita;
|
||||
const bool is_acquisto = treg == acquisto;
|
||||
@ -3488,7 +3484,7 @@ void TLiquidazione_app::iva11_set_arr_phase_2(const TString& codatt)
|
||||
_CorrItem& ca = (_CorrItem&) corr_ann[codiva];
|
||||
ca._totale += lor;
|
||||
if (!is_present)
|
||||
ca._aliquota = civa.percentuale(); // Se e' nuovo setta l'aliquota
|
||||
ca._aliquota = _iva->get_real("R0"); // Se e' nuovo setta l'aliquota
|
||||
}
|
||||
|
||||
tt = _pim->get("S0");
|
||||
@ -4545,10 +4541,8 @@ void TLiquidazione_app::recalc_annual(const char* att, bool & first)
|
||||
const int tipocr = atoi(*_pim_tipocr);
|
||||
codiva = *_pim_codiva;
|
||||
reg = *_pim_codreg;
|
||||
const TCodiceIVA & civa = cached_codIVA(codiva);
|
||||
|
||||
look_reg(reg);
|
||||
tiva = civa.tipo();
|
||||
look_iva(codiva); look_reg(reg);
|
||||
tiva = _iva->get("S1");
|
||||
|
||||
const TRegistro & reg = cached_registro(_reg->curr());
|
||||
const tipo_sospensione simp = reg.sospensione();
|
||||
@ -4579,7 +4573,7 @@ void TLiquidazione_app::recalc_annual(const char* att, bool & first)
|
||||
_CorrItem& ca = (_CorrItem&)corr_ann[codiva];
|
||||
ca._totale += _pim->get_real("R3");
|
||||
if (!is_key) // se non c'e' lo aggiunge
|
||||
ca._aliquota = civa.moltiplicatore_percentuale(); // Se è nuovo setta l'aliquota
|
||||
ca._aliquota = _iva->get_real("R0") / CENTO; // Se è nuovo setta l'aliquota
|
||||
}
|
||||
if (tipoatt == 1)
|
||||
volaff1 += imp_ifs;
|
||||
|
@ -554,7 +554,8 @@ bool TLiquidazione_app::look_pla(const char* a, bool create)
|
||||
(*_pla_codatt) = buf;
|
||||
|
||||
const TString16 s = _pla_r->get("CODTAB");
|
||||
bool ok = _pla->read() == NOERR;
|
||||
const int err = _pla->read();
|
||||
bool ok = err == NOERR;
|
||||
if (!ok && create)
|
||||
{
|
||||
_pla->zero();
|
||||
@ -583,7 +584,6 @@ bool TLiquidazione_app::look_reg(const char* reg)
|
||||
return rt;
|
||||
}
|
||||
|
||||
/*
|
||||
bool TLiquidazione_app::look_iva(const char* cod)
|
||||
{
|
||||
bool rt = true;
|
||||
@ -604,7 +604,6 @@ bool TLiquidazione_app::look_iva(const char* cod)
|
||||
|
||||
return rt;
|
||||
}
|
||||
*/
|
||||
|
||||
bool TLiquidazione_app::look_ppa(int month, const char* codatt, int type, bool create)
|
||||
{
|
||||
@ -983,10 +982,8 @@ real TLiquidazione_app::aliquota_agvia()
|
||||
{
|
||||
real r;
|
||||
const TString& codagv = ini_get_string(CONFIG_STUDIO, "cg", "CodAgv");
|
||||
const TCodiceIVA & civa = cached_codIVA(codagv);
|
||||
|
||||
if (civa.ok()) // Controlla se è vuoto! CM600475
|
||||
r = civa.percentuale();
|
||||
if (codagv.full() && look_iva(codagv)) // Controlla se è vuoto! CM600475
|
||||
r = _iva->get_real("R0");
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -95,13 +95,10 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
|
||||
vaf += imponibile;
|
||||
_pam->put("R1", vaf);
|
||||
_pam->rewrite();
|
||||
|
||||
// Aggiorna il totale IVA periodica CD1_1
|
||||
const TCodiceIVA & civa = cached_codIVA(ci->_codiva);
|
||||
|
||||
if (month == 13 && civa.ok())
|
||||
if (month == 13 && look_iva(ci->_codiva))
|
||||
{
|
||||
if (civa.tipo_comunicazione_attive().full()) // Solo CD1_1 ha senso coi corrispettivi...
|
||||
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi...
|
||||
{
|
||||
_pum->curr().add("R14", imponibile); // CD1_1
|
||||
_pum->rewrite();
|
||||
@ -145,11 +142,12 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
int tipocr = atoi(*_pim_tipocr);
|
||||
int mese = atoi(*_pim_mese);
|
||||
int tipodet = atoi(*_pim_tipodet);
|
||||
const TCodiceIVA & civa = cached_codIVA(*_pim_codiva);
|
||||
look_iva(*_pim_codiva);
|
||||
// base di riparto solo se non esente, non soggetto, non imponibile
|
||||
TString16 tipoiva(civa.tipo());
|
||||
TString16 tipoiva(_iva->get("S1"));
|
||||
TString16 reg = *_pim_codreg;
|
||||
|
||||
|
||||
/*
|
||||
* caso particolare SENSU Vladimiro (1995) #MI3001
|
||||
* questi vengono pero' conteggiati nel totale
|
||||
@ -163,15 +161,18 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
if (tipocr == 1 && (mese == m) &&
|
||||
att == (const char*)(*_pim_codatt))
|
||||
{
|
||||
if (civa.iva_da_ventilare())
|
||||
if (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES")
|
||||
{
|
||||
real lurd = _pim->get_real("R0");
|
||||
lurd += _pim->get_real("R1");
|
||||
real perc = civa.percentuale();
|
||||
TString other = civa.iva_a_cui_ventilare();
|
||||
|
||||
if (other.full())
|
||||
perc = cached_codIVA(other).percentuale(); // ventila a un altro codice
|
||||
real perc = _iva->get_real("R0");
|
||||
TString other = _iva->get("S6");
|
||||
if (!other.empty())
|
||||
{
|
||||
// ventila a un altro codice
|
||||
look_iva(other);
|
||||
perc = _iva->get_real("R0");
|
||||
}
|
||||
add_ventilation(perc / CENTO, lurd, *_pim_codiva, other);
|
||||
}
|
||||
}
|
||||
@ -340,11 +341,9 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
_pam->rewrite();
|
||||
|
||||
// Aggiorna il totale IVA periodica CD1_1
|
||||
const TCodiceIVA & civa = cached_codIVA(vv->_codiva);
|
||||
|
||||
if (month == 13 && civa.ok())
|
||||
if (month == 13 && look_iva(vv->_codiva))
|
||||
{
|
||||
if (civa.get("S10").full()) // Solo CD1_1 ha senso coi corrispettivi
|
||||
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi
|
||||
{
|
||||
_pum->curr().add("R14", imponibile); // CD1_1
|
||||
_pum->rewrite();
|
||||
@ -365,10 +364,9 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
// viene amorosamente messo a quanto il codice IVA prevede
|
||||
if (!was)
|
||||
{
|
||||
const TCodiceIVA & civa = cached_codIVA((vv->_codiva));
|
||||
|
||||
look_iva(vv->_codiva);
|
||||
_pim->put("I1", (long)vendita);
|
||||
if (!civa.escluso_dal_rimborso())
|
||||
if (!_iva->get_bool("B4"))
|
||||
_pim->put("B3", "X");
|
||||
}
|
||||
_pim->rewrite();
|
||||
@ -535,8 +533,8 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
if (!_pim->get_bool("B3")) continue;
|
||||
|
||||
// Se il tipo di codice e' NS non va considerato nella sommatoria del tot. acquisti
|
||||
const TCodiceIVA & civa = cached_codIVA(codiva);
|
||||
const bool non_sogg = civa.iva_non_soggetta();
|
||||
look_iva(codiva);
|
||||
const bool non_sogg = _iva->get("S1") == "NS";
|
||||
|
||||
if (!is_mens) // Trimestrali
|
||||
{
|
||||
@ -567,7 +565,7 @@ _DescrItem* TLiquidazione_app::recalc_rimborso(int month, const char* codatts,
|
||||
ca._totale += _pim->get_real("R3");
|
||||
if (!is_key) // se non c'e' lo aggiunge
|
||||
{
|
||||
ca._aliquota = civa.moltiplicatore_percentuale(); // Se e' nuovo setta l'aliquota
|
||||
ca._aliquota = _iva->get_real("R0")/CENTO; // Se e' nuovo setta l'aliquota
|
||||
corr_ann.add(codiva,ca);
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
|
||||
continue;
|
||||
|
||||
look_reg(*_pim_codreg);
|
||||
const TCodiceIVA & civa = cached_codIVA(*_pim_codiva);
|
||||
look_iva(*_pim_codiva);
|
||||
|
||||
int tipocr = atoi(*_pim_tipocr);
|
||||
int tipodet = atoi(*_pim_tipodet);
|
||||
@ -295,7 +295,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt)
|
||||
real imponibile = _pim->get_real("R0");
|
||||
real imposta = _pim->get_real("R1");
|
||||
tiporeg tipomov = (tiporeg)_reg->get_long("I0");
|
||||
TString4 tipoiva = civa.tipo();
|
||||
TString4 tipoiva = _iva->get("S1");
|
||||
|
||||
if (_year != *_pim_anno || (month == 13 && mese < 13))
|
||||
continue;
|
||||
@ -564,19 +564,28 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
continue;
|
||||
|
||||
TString4 codiva = codtab.mid(16,4); codiva.trim();
|
||||
const TCodiceIVA & civa = cached_codIVA(codiva);
|
||||
|
||||
if (!civa.ok())
|
||||
if (!look_iva(codiva))
|
||||
continue;
|
||||
|
||||
tiporeg tipomov = (tiporeg)_reg->get_int("I0");
|
||||
bool corrisp = _reg->get_bool("B0");
|
||||
const TString4 tipoiva = civa.tipo();
|
||||
const TString4 tipoiva = _iva->get("S1");
|
||||
const TString4 other = tab->get("S4");
|
||||
TToken_string s1(tab->get("S1"), '!'); // Imponibile/iva fatture in ritardo
|
||||
real rit_imp(s1.get(0));
|
||||
real rit_iva(s1.get(1));
|
||||
|
||||
/* Perchè _pim invece di tab ? 17-10-2012
|
||||
diffimp = _pim->get_real("R26");
|
||||
diffiva = _pim->get_real("R27");
|
||||
diffincimp = _pim->get_real("R28");
|
||||
diffinciva = _pim->get_real("R29");
|
||||
|
||||
diffimp_acq = _pim->get_real("R30");
|
||||
diffiva_acq = _pim->get_real("R31");
|
||||
diffincimp_acq = _pim->get_real("R32");
|
||||
diffinciva_acq = _pim->get_real("R33"); */
|
||||
|
||||
diffimp = tab->get_real("R26");
|
||||
diffiva = tab->get_real("R27");
|
||||
diffincimp = tab->get_real("R28");
|
||||
@ -594,10 +603,10 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
issosp |= (sosp_imp != nessuna_sospensione); // Setta il flag di presenza registri in sospensione (qualsiasi tipo: sospensione_normale, vol_affari, liquidazione)
|
||||
// ACHTUNG! Corrispettivi da ventileer possono ventilare ad un altro codiva; in tal caso si scrive quello
|
||||
if (corrisp && other.full())
|
||||
{
|
||||
look_iva(other);
|
||||
codiva = other;
|
||||
|
||||
const TCodiceIVA & civa1 = cached_codIVA(codiva); // codice IVA aggiornato per eventuale ventilazione
|
||||
|
||||
}
|
||||
// se e' corrispettivo da ventilare non scrivo un cannolo ripieno visto che e' stato ventilato
|
||||
if (tipomov == vendita && tipoiva == "VE" && !describe_pis)
|
||||
continue;
|
||||
@ -704,7 +713,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
|
||||
ca._totale_vf += tab->get_real(tipoiva == "VE" ? "R2" : "R3");
|
||||
if (!is_key) // se non c'e' lo aggiunge
|
||||
{
|
||||
ca._aliquota = civa.moltiplicatore_percentuale(); // Se e' nuovo setta l'aliquota
|
||||
ca._aliquota = _iva->get_real("R0")/CENTO; // Se e' nuovo setta l'aliquota
|
||||
corr_ann.add(codiva,ca);
|
||||
}
|
||||
// vedi corrispettivi veri e falsi
|
||||
@ -1795,9 +1804,8 @@ void TLiquidazione_app::set_pim(_DescrItem& d)
|
||||
rw++;
|
||||
else
|
||||
{
|
||||
const TCodiceIVA & civa = cached_codIVA(d._s1);
|
||||
|
||||
d._s2 = civa.get("S0");
|
||||
look_iva(d._s1);
|
||||
d._s2 = _iva->get("S0");
|
||||
if (d._s2.len() > 19) d._s2.cut(19);
|
||||
}
|
||||
|
||||
@ -2926,9 +2934,8 @@ void TLiquidazione_app::set_ventila(_DescrItem& d)
|
||||
for(i = 0; i < d._arr.items(); i++)
|
||||
{
|
||||
_vDesc& vd = (_vDesc&)d._arr[i];
|
||||
const TCodiceIVA & civa = cached_codIVA(vd._codiva);
|
||||
|
||||
s0 = civa.descrizione(); s0.cut(23);
|
||||
look_iva(vd._codiva);
|
||||
s0 = _iva->get("S0"); s0.cut(23);
|
||||
|
||||
set_row(row+i,"@8g%5s@17g%-23s@41g%r@68g%r@89g%r",
|
||||
(const char*)vd._codiva,
|
||||
@ -3058,15 +3065,13 @@ void TLiquidazione_app::set_regagr(_DescrItem& d)
|
||||
_DescrItem& di = (_DescrItem&) agr_array[i];
|
||||
if (di._flags != PROGAGR)
|
||||
continue;
|
||||
|
||||
const TCodiceIVA & civa = cached_codIVA(di._s0);
|
||||
|
||||
des = civa.descrizione(); des.cut(25);
|
||||
al = civa.percentuale();
|
||||
look_iva(di._s0);
|
||||
des = _iva->get("S0"); des.cut(25);
|
||||
al = _iva->get_real("R0");
|
||||
set_row(r,"%4s %-25s@48g%s %%", (const char*) di._s0, (const char*) des, al.string("#@,@@"));
|
||||
set_row(r,"@56g%r@75g%4s",&di._r0, (const char*)di._s1);
|
||||
const TCodiceIVA & civa1 = cached_codIVA(di._s1);
|
||||
al = civa1.percentuale();
|
||||
look_iva(di._s1);
|
||||
al = _iva->get_real("R0");
|
||||
set_row(r++,"@92g%s %%@100g%r", al.string("#@,@@"), &di._r1);
|
||||
t1 += di._r0;
|
||||
t2 += di._r1;
|
||||
|
@ -160,16 +160,6 @@ void TQuadro_VE_recordset::load()
|
||||
add_value(STRING_TOKEN(imposta.objptr(aliquota)), iva);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int tipocr = atoi(codtab.mid(15, 1)); // tipo costo_ricavo
|
||||
|
||||
if (tipocr == 4)
|
||||
{
|
||||
if (int_tipo_iva11_ven == acq_ind_pass_int || int_tipo_iva11_ven == cess_amm)
|
||||
add_value("VE40.1", imp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case acq_simp:
|
||||
break;
|
||||
@ -195,12 +185,12 @@ void TQuadro_VE_recordset::load()
|
||||
break;
|
||||
case acq_ind_pass_int: // passaggi interni
|
||||
if (vendite)
|
||||
add_value("VE40.1", imp);
|
||||
add_value("VE40.1", iva);
|
||||
break;
|
||||
case acq_ind_art_19: // indetr. art. 19
|
||||
break;
|
||||
case cess_amm: // cessioni amministrative
|
||||
add_value("VE40.1", imp);
|
||||
add_value("VE40.1", iva);
|
||||
break;
|
||||
case vend_rimborso: // vendite valide per rimborso
|
||||
break;
|
||||
@ -261,28 +251,24 @@ void TQuadro_VE_recordset::load()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
TISAM_recordset & exp = get_recordset(REP_PAART17);
|
||||
|
||||
for (exp.move_first(); !exp.eof(); exp.move_next())
|
||||
{
|
||||
TString8 cod(exp.get(FIELD_NAME(LF_RMOVIVA, RMI_CODIVA)).as_string());
|
||||
const TCodiceIVA & codiva = cached_codIVA(cod);
|
||||
const TString & aliquota = codiva.aliquota();
|
||||
const TRectype & mov = cache().get(LF_MOV, exp.get(FIELD_NAME(LF_RMOVIVA, RMI_NUMREG)).as_int());
|
||||
TString8 cod(exp.get(FIELD_NAME(LF_RMOVIVA, RMI_CODIVA)).as_string());
|
||||
const TCodiceIVA & codiva = cached_codIVA(cod);
|
||||
const TString & aliquota = codiva.aliquota();
|
||||
|
||||
if (aliquota.full())
|
||||
{
|
||||
const real imp = exp.get(FIELD_NAME(LF_RMOVIVA, RMI_IMPONIBILE)).as_real();
|
||||
real iva = exp.get(FIELD_NAME(LF_RMOVIVA, RMI_IMPOSTA)).as_real();
|
||||
if (aliquota.full())
|
||||
{
|
||||
const real imp = exp.get(FIELD_NAME(LF_RMOVIVA, RMI_IMPONIBILE)).as_real();
|
||||
|
||||
if (codiva.is_agricola())
|
||||
sub_value(STRING_TOKEN(imponibile_agricolo.objptr(aliquota)), imp);
|
||||
else
|
||||
sub_value(STRING_TOKEN(imponibile.objptr(aliquota)), imp);
|
||||
}
|
||||
if (codiva.is_agricola())
|
||||
sub_value(STRING_TOKEN(imponibile_agricolo.objptr(aliquota)), imp);
|
||||
else
|
||||
sub_value(STRING_TOKEN(imponibile.objptr(aliquota)), imp);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
TISAM_recordset & reg = get_recordset(REP_REGOLARIZ);
|
||||
|
||||
@ -319,7 +305,6 @@ void TQuadro_VE_recordset::load()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
query = "USE LIM\n FROM CODTAB==";
|
||||
query << year() << "13\nTO CODTAB==" << year() << "13";
|
||||
|
||||
|
@ -286,9 +286,9 @@ void TQuadro_VF_recordset::load()
|
||||
}
|
||||
if (non_soggetto)
|
||||
{
|
||||
if (int_tipo_iva11_acq == 15)
|
||||
if (tipo_iva11_acq == "15A" || int_tipo_iva11_acq == 15)
|
||||
{
|
||||
if (tipo_iva11_acq == "15B")
|
||||
if (tipo_iva11_acq == "15A")
|
||||
add_value("VF17.2", imp);
|
||||
add_value("VF17.1", imp);
|
||||
}
|
||||
|
2069
src/cg/modf24/cg5500.cpp
Executable file
2069
src/cg/modf24/cg5500.cpp
Executable file
File diff suppressed because it is too large
Load Diff
129
src/cg/modf24/cg5500.h
Executable file
129
src/cg/modf24/cg5500.h
Executable file
@ -0,0 +1,129 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <msksheet.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
// IVA a debito da riportare al mese successivo
|
||||
|
||||
class TSheet_field;
|
||||
class TViswin;
|
||||
|
||||
class Visliq_app : public TSkeleton_application
|
||||
{
|
||||
TString _freqviva;
|
||||
int _year;
|
||||
long _firm;
|
||||
|
||||
TRelation* _nditte;
|
||||
TLocalisamfile * _f24;
|
||||
TArray_sheet* _ditte;
|
||||
TString_array _nomiditte;
|
||||
|
||||
TTable* _lim;
|
||||
TTable* _lam;
|
||||
TTable* _lia;
|
||||
TTable* _del;
|
||||
|
||||
TRectype* _lim_r;
|
||||
TRectype* _lam_r;
|
||||
TRectype* _del_r;
|
||||
TRecfield* _del_ditta;
|
||||
TRecfield* _del_anno;
|
||||
TRecfield* _del_mese;
|
||||
TRecfield* _del_tipo;
|
||||
TRecfield* _lim_anno;
|
||||
TRecfield* _lim_mese;
|
||||
TRecfield* _lam_anno;
|
||||
TRecfield* _lam_mese;
|
||||
bool _has_f24;
|
||||
|
||||
|
||||
TSheet_field* _vers_sheet, *_liq_sheet;
|
||||
TArray _vers_rows, _liq_rows;
|
||||
TMask* _mask;
|
||||
bool _from_one;
|
||||
bool _is_annual;
|
||||
bool _sh_dirty, _sv_dirty;
|
||||
|
||||
const char* itoname(int m);
|
||||
|
||||
bool is_trim(int x);
|
||||
bool is_month_ok(int x, int month = -1);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
// handlers
|
||||
static bool set_ditta(TMask_field&, KEY);
|
||||
static bool set_ragsoc(TMask_field&, KEY);
|
||||
static bool sel_mese_sh1 (TMask_field&, KEY);
|
||||
static bool sel_mese_sh2 (TMask_field&, KEY);
|
||||
static bool ch_year_handler(TMask_field& f, KEY key);
|
||||
|
||||
static const char* link_handler(TMask&, int, const char*, bool doubleclick);
|
||||
|
||||
static bool sheet_action(TSheet_field& s, int r, KEY k);
|
||||
static bool vers_action(TSheet_field& s, int r, KEY k);
|
||||
|
||||
public:
|
||||
virtual bool firm_change_enabled() const { return FALSE; }
|
||||
|
||||
static Visliq_app& app() { return (Visliq_app&)main_app(); }
|
||||
TArray_sheet* get_ditte_sheet() { return _ditte; }
|
||||
|
||||
void build_ditte_sheet();
|
||||
void build_nomiditte();
|
||||
|
||||
bool look_lia(long ditta = 0l, int year = 0);
|
||||
bool look_lim(int m);
|
||||
bool look_del(int month, int type, bool create = false);
|
||||
bool look_f24(int month, int type, bool create = false);
|
||||
int look_ver(int month, int type, bool create = false);
|
||||
|
||||
|
||||
void read_general(TMask& m);
|
||||
void write_general(TMask& m);
|
||||
void write_liq();
|
||||
void write_del();
|
||||
|
||||
void set_freqviva();
|
||||
void set_freqviva(const char* f) { _freqviva = f; }
|
||||
void set_mask_freq(TMask&);
|
||||
void set_year(const char* y) { _year = atoi(y); }
|
||||
void set_year(int y) { _year = y; }
|
||||
void reset_fields();
|
||||
|
||||
void set_liq_rows (TSheet_field& s) { _liq_rows = s.rows_array(); }
|
||||
void set_vers_rows(TSheet_field& s) { _vers_rows = s.rows_array(); }
|
||||
|
||||
// 2 palle
|
||||
TMask* get_main_mask() { return _mask; }
|
||||
bool select_butt(TMask& m);
|
||||
TTable* del() { return _del; }
|
||||
|
||||
real Visliq_app::min_vers(int anno, int month);
|
||||
// riaggiusta la liquidazione del mese dato
|
||||
void recalc_liq_data(TViswin* v, real& rimb, real& rett, real& vers, real& acc,
|
||||
real& varimp, real& impnonver, real& credspec,
|
||||
TString& d1, TString& d2, TString& d3, TDate& date,
|
||||
TString& abi, TString& cab, TString& con);
|
||||
|
||||
// Calcolo del credito utilizzato IVA ed F24
|
||||
real credito_utilizzato(int year, int month) const;
|
||||
|
||||
// riaggiusta le liquidazioni successive se serve
|
||||
void recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field* sv);
|
||||
|
||||
// workhorses
|
||||
void vis_liq();
|
||||
bool vis_all();
|
||||
bool vis_one(int);
|
||||
|
||||
Visliq_app() : _vers_sheet(NULL), _liq_sheet(NULL) {}
|
||||
virtual ~Visliq_app() {}
|
||||
};
|
||||
|
||||
inline Visliq_app& app() { return (Visliq_app&) main_app(); }
|
137
src/cg/modf24/cg5501.cpp
Executable file
137
src/cg/modf24/cg5501.cpp
Executable file
@ -0,0 +1,137 @@
|
||||
#include "cg5500.h"
|
||||
#include <utility.h>
|
||||
#include <righef24.h>
|
||||
|
||||
bool Visliq_app::look_lim(int m)
|
||||
{
|
||||
bool ok = FALSE;
|
||||
|
||||
_lim_r->zero();
|
||||
_lam_r->zero();
|
||||
(*_lim_anno) = _year;
|
||||
(*_lim_mese) = format("%02d",m);
|
||||
|
||||
if (_lim->read() == NOERR)
|
||||
{
|
||||
(*_lam_anno) = _year;
|
||||
(*_lam_mese) = format("%02d",m);
|
||||
_lam->read();
|
||||
}
|
||||
else
|
||||
{
|
||||
_lim_r->zero();
|
||||
(*_lim_anno) = _year;
|
||||
(*_lim_mese) = format("%02d",m);
|
||||
}
|
||||
|
||||
return _lim->good() && _lam->good();
|
||||
}
|
||||
|
||||
bool Visliq_app::look_del(int month, int type, bool create)
|
||||
{
|
||||
_del->zero();
|
||||
(*_del_ditta) = format("%05ld", get_firm());
|
||||
(*_del_anno) = _year;
|
||||
(*_del_mese) = format("%02d", month);
|
||||
(*_del_tipo) = format("%1d", type);
|
||||
|
||||
TString16 ctab = _del->get("CODTAB");
|
||||
_del->read();
|
||||
|
||||
bool ok = _del->good();
|
||||
|
||||
if (!ok && create)
|
||||
{
|
||||
_del->zero();
|
||||
_del->put("CODTAB",ctab);
|
||||
_del->write();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool Visliq_app::look_f24(int month, int type, bool create)
|
||||
{
|
||||
TLocalisamfile & f24 = *_f24;
|
||||
const bool mensile = _freqviva == "M";
|
||||
|
||||
int codtrib = mensile ? 6000 + month : 6031 + (month / 3);
|
||||
|
||||
if (type == 7)
|
||||
codtrib = mensile ? 6013 : 6035;
|
||||
|
||||
f24.setkey(4);
|
||||
f24.put(F24_TIPOINTEST, "D");
|
||||
f24.put(F24_INTEST, get_firm());
|
||||
f24.put(F24_DATASCAD, _year);
|
||||
f24.put(F24_TRIBUTO, codtrib);
|
||||
const bool found = f24.read(_isgteq) == NOERR && codtrib == f24.get_int(F24_TRIBUTO);
|
||||
if (create && !found)
|
||||
{
|
||||
long progr = 0L;
|
||||
TDate scad( type == 7 ? 27 : 16, (mensile || type == 7) ? month : ((month + 2) / 3) * 3), _year);
|
||||
|
||||
while (scad.wday() > 5)
|
||||
++scad;
|
||||
if (month < 13 && type != 7)
|
||||
scad.addmonth(mensile ? 1 : 2);
|
||||
if (f24.last() == NOERR)
|
||||
progr = f24.get_long(F24_PROGR);
|
||||
progr++;
|
||||
f24.zero();
|
||||
f24.put(F24_PROGR, progr);
|
||||
|
||||
f24.put(F24_TRIBUTO, codtrib);
|
||||
f24.put(F24_TIPOINTEST, "D");
|
||||
f24.put(F24_INTEST, get_firm());
|
||||
if (month >= 13)
|
||||
{
|
||||
if (type == 7)
|
||||
f24.put(F24_DESCR, "Acconto IVA");
|
||||
else
|
||||
f24.put(F24_DESCR,"IVA annuale");
|
||||
}
|
||||
else
|
||||
f24.put(F24_DESCR, format("IVA mese di %s %s", itom(month), (const char *)_year));
|
||||
f24.put(F24_DATASCAD, scad);
|
||||
f24.put(F24_ANNO, _year);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
int Visliq_app::look_ver(int month, int type, bool create)
|
||||
{
|
||||
if (look_del(month, type, create))
|
||||
return 1;
|
||||
else
|
||||
if (app()._has_f24 && look_f24(month, type, create))
|
||||
return 2;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool Visliq_app::look_lia(long ditta, int year)
|
||||
{
|
||||
if (year == 0) year = _year;
|
||||
if (ditta == 0l) ditta = get_firm();
|
||||
TString16 y; y << format("%05ld", ditta); y << year;
|
||||
|
||||
_lia->zero();
|
||||
_lia->put("CODTAB", y);
|
||||
_lia->read();
|
||||
|
||||
return _lia->good();
|
||||
}
|
||||
|
||||
|
||||
bool Visliq_app::is_trim(int x)
|
||||
// TRUE se il mese passato e' un trimestre
|
||||
{ return x == 3 || x == 6 || x == 9 || x == 12; }
|
||||
|
||||
bool Visliq_app::is_month_ok(int x, int month)
|
||||
// TRUE se il mese passato e' compatibile con il regime
|
||||
// di liquidazione e (opz) non e' maggiore di quello scelto
|
||||
{
|
||||
if (month == -1) month = x;
|
||||
return _freqviva == "M" ?
|
||||
( x > 0 && x <= month) :
|
||||
( x <= month && is_trim(x));
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
#include <rmoviva.h>
|
||||
|
||||
#include "..\cg\cgsaldac.h"
|
||||
#include "..\cg\cglib.h"
|
||||
#include "..\cg\cg2103.h"
|
||||
#include "..\ve\velib.h"
|
||||
|
||||
#include "cm1100a.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "../ce/collces.h"
|
||||
#include "../ve/velib.h"
|
||||
#include "../cg/cglib.h"
|
||||
#include "../cg/cg2103.h"
|
||||
|
||||
#include "../ca/movana.h"
|
||||
#include "../ca/rmovana.h"
|
||||
|
@ -972,7 +972,7 @@ private:
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
bool test_row(int nrow);
|
||||
bool test_row(const TToken_string& row);
|
||||
void load_um();
|
||||
|
||||
static void sheetrighe_get(TSheet_field &fld_righe, int item);
|
||||
@ -1071,13 +1071,12 @@ void TDistinta_mask::load_um()
|
||||
}
|
||||
|
||||
|
||||
bool TDistinta_mask::test_row(int nrow)
|
||||
bool TDistinta_mask::test_row(const TToken_string& row)
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
const TCodice_articolo father = get(F_CODICE);
|
||||
TCodice_articolo code = sheet.get_str_row_cell(nrow, F_CODART);
|
||||
bool ok = code != father;
|
||||
|
||||
TCodice_articolo code; row.get(1, code);
|
||||
bool ok = code != father;
|
||||
if (ok && _tree.find_node(father) > 0)
|
||||
{
|
||||
TToken_string path; _tree.curr_id(path);
|
||||
@ -1089,9 +1088,12 @@ bool TDistinta_mask::test_row(int nrow)
|
||||
"in quanto la distinta risulterebbe ciclica."), (const char*)code);
|
||||
|
||||
// Se e' una lavorazione
|
||||
if ((get(F_TIPO) == "L") &&
|
||||
!(sheet.get_str_row_cell(nrow, F_TIPOCOMP) == "L" && _tree.is_lav(code)))
|
||||
return error_box(FR("Il codice '%s' non e' una lavorazione"), (const char*)code);
|
||||
if (get(F_TIPO)[0] == 'L')
|
||||
{
|
||||
ok = row[0] == 'L' && _tree.is_lav(code);
|
||||
if (!ok)
|
||||
error_box(FR("Il codice '%s' non e' una lavorazione"), (const char*)code);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -1168,47 +1170,41 @@ bool TDistinta_mask::on_unitsheet_event(TOperable_field& o, TField_event e, long
|
||||
bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const short id = o.dlg();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case F_SHEET:
|
||||
if (e == se_notify_add || e == se_notify_modify || e == fe_close)
|
||||
if (e == se_notify_add || e == se_notify_modify || e == fe_close)
|
||||
{
|
||||
|
||||
|
||||
TSheet_field& sheet = (TSheet_field&)o;
|
||||
const int nrig = int(jolly);
|
||||
TToken_string& row = sheet.row(nrig);
|
||||
switch(e)
|
||||
{
|
||||
case se_notify_add:
|
||||
{
|
||||
TSheet_field& sheet = (TSheet_field&)o;
|
||||
const int nrig = int(jolly);
|
||||
|
||||
sheet.set_row_cell(F_TIPOCOMP, "A", nrig); // Forza il listbox ad articolo
|
||||
sheet.set_row_cell(F_EXPR, 1, nrig); // Forza la quantita' ad 1
|
||||
sheet.set_row_cell(F_SORT0, nrig + 1, nrig); // Inizializza numero riga
|
||||
sheet.select(nrig);
|
||||
sheet.force_update(nrig);
|
||||
}
|
||||
row.add("A", F_TIPOCOMP-FIRST_FIELD); // Forza il listbox ad articolo
|
||||
row.add("", F_EXPR-FIRST_FIELD); // Forza la quantita' ad 1
|
||||
row.add(nrig+1, F_SORT0-FIRST_FIELD); // Inizializza numero riga
|
||||
sheet.select(nrig);
|
||||
break;
|
||||
case se_notify_modify:
|
||||
return test_row(int(jolly));
|
||||
break;
|
||||
return test_row(row);
|
||||
case fe_close:
|
||||
{
|
||||
TSheet_field& sheet = (TSheet_field&)o;
|
||||
const int nrig = int(jolly);
|
||||
TString80 code;
|
||||
|
||||
TString80 code1;
|
||||
for (int n = sheet.items()-1; n >= 0; n--)
|
||||
{
|
||||
code = sheet.get_str_row_cell(n, F_CODART);
|
||||
if (code.full())
|
||||
const TToken_string& row = sheet.row(n);
|
||||
row.get(F_CODART-FIRST_FIELD, code);
|
||||
if (!code.blank())
|
||||
{
|
||||
if (!test_row(nrig))
|
||||
if (!test_row(row))
|
||||
return false;
|
||||
for (int m = n - 1; m >= 0; m--)
|
||||
{
|
||||
if (code == sheet.get_str_row_cell(m, F_CODART))
|
||||
const TToken_string& row = sheet.row(m);
|
||||
row.get(F_CODART-FIRST_FIELD, code1);
|
||||
if (code == code1)
|
||||
{
|
||||
int k = noyesall_box("Il codice %s e' ripetuto alla riga %d,\ncontinuare ugualmente ?", (const char *) code, n + 1);
|
||||
if (k == K_NO)
|
||||
@ -1223,7 +1219,7 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
|
||||
sheet.destroy(n);
|
||||
}
|
||||
}
|
||||
if (((TSheet_field&)o).items() == 0)
|
||||
if (sheet.items() == 0)
|
||||
message_box(TR("E' necessario inserire almeno una riga nella distinta"));
|
||||
break;
|
||||
default:
|
||||
|
@ -246,13 +246,13 @@ LIST F_TIPOCOMP 1 12
|
||||
BEGIN
|
||||
PROMPT 2 1 "Tipo "
|
||||
ITEM "A|Articolo"
|
||||
MESSAGE SHOW,11@|HIDE,12@|HIDE,13@|HIDE,14@|ENABLE,F_UMEXPR|ENABLE,11@|CLEAR,12@|CLEAR,13@|CLEAR,14@
|
||||
MESSAGE SHOW,11@|HIDE,12@|HIDE,13@|HIDE,14@|ENABLE,F_UMEXPR|ENABLE,11@|DISABLE,12@|DISABLE,13@|DISABLE,14@
|
||||
ITEM "L|Lavorazione"
|
||||
MESSAGE HIDE,11@|SHOW,12@|HIDE,13@|HIDE,14@|CLEAR,F_UMEXPR|CLEAR,11@|ENABLE,12@|CLEAR,13@|CLEAR,14@
|
||||
MESSAGE HIDE,11@|SHOW,12@|HIDE,13@|HIDE,14@|DISABLE,F_UMEXPR|DISABLE,11@|ENABLE,12@|DISABLE,13@|DISABLE,14@
|
||||
ITEM "D|Distinta"
|
||||
MESSAGE HIDE,11@|HIDE,12@|SHOW,13@|HIDE,14@|ENABLE,F_UMEXPR|CLEAR,11@|CLEAR,12@|ENABLE,13@|CLEAR,14@
|
||||
MESSAGE HIDE,11@|HIDE,12@|SHOW,13@|HIDE,14@|ENABLE,F_UMEXPR|DISABLE,11@|DISABLE,12@|ENABLE,13@|DISABLE,14@
|
||||
ITEM "V|Variabile"
|
||||
MESSAGE HIDE,11@|HIDE,12@|HIDE,13@|SHOW,14@|CLEAR,F_UMEXPR|CLEAR,11@|CLEAR,12@|CLEAR,13@|ENABLE,14@
|
||||
MESSAGE HIDE,11@|HIDE,12@|HIDE,13@|SHOW,14@|CLEAR,F_UMEXPR|DISABLE,11@|DISABLE,12@|DISABLE,13@|ENABLE,14@
|
||||
FIELD TIPO
|
||||
END
|
||||
|
||||
@ -282,8 +282,8 @@ BEGIN
|
||||
OUTPUT F_CODLAV CODTAB
|
||||
OUTPUT F_DESLAV S0
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD CODCOMP
|
||||
FLAGS "UHD"
|
||||
FIELD CODCOMP
|
||||
FLAGS "UHD"
|
||||
GROUP 12
|
||||
END
|
||||
|
||||
@ -297,7 +297,7 @@ BEGIN
|
||||
OUTPUT F_CODDIS CODDIST
|
||||
OUTPUT F_DESDIS DESCR
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD CODCOMP
|
||||
FIELD CODCOMP
|
||||
FLAGS "UHD"
|
||||
GROUP 13
|
||||
END
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <printer.h>
|
||||
#include <progind.h>
|
||||
|
||||
#include "../cg/cglib.h"
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../mg/mglib.h"
|
||||
#include "../ve/velib.h"
|
||||
#include "dblib.h"
|
||||
|
@ -454,7 +454,7 @@ int TImplosion_mask::find_roots(const char* articolo, TAssoc_array& roots) const
|
||||
|
||||
TAssoc_array ass[2];
|
||||
int c = 0; // Array dei children = 0; fathers = 1
|
||||
ass[c].add(articolo);
|
||||
ass[c].add(articolo, NULL);
|
||||
|
||||
const char* cap = FR("Livello %d - Articoli %ld");
|
||||
TString caption; caption.format(cap, 0, 0L);
|
||||
@ -478,7 +478,7 @@ int TImplosion_mask::find_roots(const char* articolo, TAssoc_array& roots) const
|
||||
for (cur = 0L; cur.pos() < cur.items(); ++cur)
|
||||
{
|
||||
const TString& father = cur.curr().get("CODDIST");
|
||||
ass[!c].add(father);
|
||||
ass[!c].add(father, NULL);
|
||||
}
|
||||
cur.freeze(FALSE);
|
||||
}
|
||||
@ -559,7 +559,7 @@ void TImplosion_mask::implode_slow()
|
||||
key << row->get();
|
||||
key.rtrim();
|
||||
}
|
||||
_xmas.add(key);
|
||||
_xmas.add(key, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ void TImplosion_mask::implode_medium()
|
||||
key = articolo;
|
||||
if (livello.not_empty())
|
||||
key << '|' << livello;
|
||||
_xmas.add(key);
|
||||
_xmas.add(key, NULL);
|
||||
|
||||
TAssoc_array roots;
|
||||
const long items = find_roots(articolo, roots);
|
||||
|
@ -1,25 +1,25 @@
|
||||
#define F_CODICE 201
|
||||
#define F_DESCR 202
|
||||
#define F_COSUNIT 203
|
||||
#define F_UNMIS 204
|
||||
#define F_STAMPA 205
|
||||
#define F_UMDESC 206
|
||||
#define F_CODICEART 207
|
||||
#define F_SEARCHART 208
|
||||
#define F_SHEET 209
|
||||
#define F_NUMPERS 210
|
||||
#define F_PRODUTTIV 211
|
||||
#define F_UNTEMPO 212
|
||||
#define F_DESUNTEMPO 213
|
||||
#define F_UNMIS2 214
|
||||
#define F_LINEESTD 215
|
||||
#define F_PERCMIN 216
|
||||
#define F_PRODNRIL 217
|
||||
#define F_CODICE 101
|
||||
#define F_DESCR 102
|
||||
#define F_COSUNIT 103
|
||||
#define F_UNMIS 104
|
||||
#define F_STAMPA 105
|
||||
#define F_UMDESC 106
|
||||
#define F_CODICEART 107
|
||||
#define F_SEARCHART 108
|
||||
#define F_SHEET 109
|
||||
#define F_NUMPERS 110
|
||||
#define F_PRODUTTIV 111
|
||||
#define F_UNTEMPO 112
|
||||
#define F_DESUNTEMPO 113
|
||||
#define F_UNMIS2 114
|
||||
#define F_LINEESTD 115
|
||||
#define F_PERCMIN 116
|
||||
#define F_PRODNRIL 117
|
||||
|
||||
|
||||
#define F_CODLIN 101
|
||||
#define F_DESCRLIN 102
|
||||
#define F_CODIMP 103
|
||||
#define F_LNUMPERS 104
|
||||
#define F_LPRODUTTIV 105
|
||||
#define F_CODLIN 101
|
||||
#define F_DESCRLIN 102
|
||||
#define F_CODIMP 103
|
||||
#define F_LNUMPERS 104
|
||||
#define F_LPRODUTTIV 105
|
||||
#define F_DESCRIMP 120
|
||||
|
@ -524,23 +524,6 @@ bool TEffetti_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
if (e == fe_modify)
|
||||
sfield(F_SHEET_RIGHE).set_focusdirty();
|
||||
break;
|
||||
case F_IBAN_STATO:
|
||||
if (mode() == MODE_MOD && e == fe_init)
|
||||
{
|
||||
TRelation * rel = app().get_relation();
|
||||
|
||||
if (rel != nullptr)
|
||||
{
|
||||
TRectype & rec = rel->lfile().curr();
|
||||
|
||||
if (rec.get(EFF_IBAN).empty())
|
||||
{
|
||||
set(F_CODABI, rec.get(EFF_CODABI));
|
||||
set(F_CODCAB, rec.get(EFF_CODCAB));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
case F_SHEET_RIGHE:
|
||||
return on_sheet_event(o, e, jolly);
|
||||
default:
|
||||
|
333
src/f1/f1lib.cpp
333
src/f1/f1lib.cpp
@ -20,14 +20,20 @@ TFppro& fppro_db()
|
||||
return *fppro;
|
||||
}
|
||||
|
||||
bool TFppro::sql_inj(TToken_string& keys)
|
||||
bool TFppro::sql_inj(const TString& str)
|
||||
{
|
||||
TString appo; appo << str;
|
||||
appo.upper();
|
||||
return appo.contains("--") || appo.contains("SELECT") || appo.contains("DELETE") || appo.contains("DROP");
|
||||
}
|
||||
|
||||
bool TFppro::sql_inj(const keys_s& keys)
|
||||
{
|
||||
TToken_string str("", ';');
|
||||
|
||||
str.add(keys.get(0));
|
||||
str.add(keys.get(1));
|
||||
str.add(keys.get(2));
|
||||
return str.contains("--") || str.contains("SELECT") || str.contains("DELETE") || str.contains("DROP");
|
||||
str.add(keys.prginvio);
|
||||
str.add(keys.headerfatt);
|
||||
str.add(keys.bodyfatt);
|
||||
return sql_inj(str);
|
||||
}
|
||||
|
||||
bool TFppro::check_reg(TToken_string& keys, int numreg)
|
||||
@ -38,74 +44,68 @@ bool TFppro::check_reg(TToken_string& keys, int numreg)
|
||||
bool TFppro::guess_the_doc(const TLocalisamfile& mov)
|
||||
{
|
||||
// Prendo il fornitore del mov per controllare la p.iva
|
||||
TCli_for forn = cached_clifor('F', mov.get_long(MOV_CODCF));
|
||||
|
||||
const TString4 statopiva(forn.get(CLI_STATOPAIV));
|
||||
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
clifo.put(CLI_TIPOCF, "F");
|
||||
const TString& codforn = mov.get(MOV_CODCF);
|
||||
clifo.put(CLI_CODCF, codforn);
|
||||
clifo.read();
|
||||
TString cli_statopiva, cli_piva;
|
||||
cli_statopiva << clifo.get(CLI_STATOPAIV);
|
||||
cli_piva << clifo.get(CLI_PAIV);
|
||||
const real tot = mov.get_real(MOV_TOTDOC) + mov.get_real(MOV_RITFIS) + mov.get_real(MOV_RITSOC);
|
||||
TString numdoc = mov.get(MOV_NUMDOCEXT);
|
||||
|
||||
if (numdoc.empty())
|
||||
numdoc = mov.get(MOV_NUMDOC);
|
||||
// Controllo datadoc - numdoc - totdoc - p.iva
|
||||
|
||||
TString query;
|
||||
|
||||
query << "SELECT PQ_KEYPRGINVIO AS KEYPRGINVIO, PQ_KEYHEADERFATT AS KEYHEADERFATT, PQ_KEYBODYFATT AS KEYBODYFATT, P7_DATA AS DATA,\n" <<
|
||||
"\tP7_NUMERO AS NUMDOC, PQ_IMPTOTDOC AS IMPTOTDOC, P2_FISCIVAPAESE AS STATOPIVA, P2_FISCIVACOD AS PIVA FROM PAA2700F\n" <<
|
||||
"JOIN PAA0700F ON PQ_KEYPRGINVIO = P7_KEYPRGINVIO AND PQ_KEYHEADERFATT = P7_KEYHEADERFATT AND PQ_KEYBODYFATT = P7_KEYBODYFATT\n" <<
|
||||
"JOIN PAA0200F ON PQ_KEYPRGINVIO = P2_KEYPRGINVIO AND PQ_KEYHEADERFATT = P2_KEYHEADERFATT AND PQ_KEYBODYFATT = P2_KEYBODYFATT\n" <<
|
||||
"WHERE P7_DATA = '" << mov.get_date(MOV_DATADOC).date2ansi() << "' AND \n" <<
|
||||
"(P7_NUMERO = '" << numdoc << "' OR P7_NUMERO LIKE '%" << numdoc << "%') \n";
|
||||
if (statopiva.full())
|
||||
query << "' AND \n" << "P2_FISCIVAPAESE = '" << statopiva;
|
||||
query << "' AND \n" << "P2_FISCIVACOD = '" << forn.get(CLI_PAIV);
|
||||
if (forn.gruppo_IVA())
|
||||
query << "' AND \n" "P2_COCAZZO = '" << forn.get(CLI_COFI); // cazzo;
|
||||
query << "PQ_IMPTOTDOC = " << tot;
|
||||
query << "SELECT PQ_KEYPRGINVIO AS KEYPRGINVIO, PQ_KEYHEADERFATT AS KEYHEADERFATT, PQ_KEYBODYFATT AS KEYBODYFATT, P7_DATA AS DATA,\n" <<
|
||||
"\tP7_NUMERO AS NUMDOC, PQ_IMPTOTDOC AS IMPTOTDOC, P2_FISCIVAPAESE AS STATOPIVA, P2_FISCIVACOD AS PIVA FROM PAA2700F\n" <<
|
||||
"JOIN PAA0700F ON PQ_KEYPRGINVIO = P7_KEYPRGINVIO AND PQ_KEYHEADERFATT = P7_KEYHEADERFATT AND PQ_KEYBODYFATT = P7_KEYBODYFATT\n" <<
|
||||
"JOIN PAA0200F ON PQ_KEYPRGINVIO = P2_KEYPRGINVIO AND PQ_KEYHEADERFATT = P2_KEYHEADERFATT AND PQ_KEYBODYFATT = P2_KEYBODYFATT\n" <<
|
||||
"WHERE P7_DATA = '" << mov.get_date(MOV_DATADOC).date2ansi() << "' AND \n" <<
|
||||
"(P7_NUMERO = '" << numdoc << "' OR P7_NUMERO LIKE '%" << numdoc << "%') AND \n" <<
|
||||
(cli_statopiva.full() ? TString("P2_FISCIVAPAESE = '") << cli_statopiva << "' AND " : "") <<
|
||||
"P2_FISCIVACOD = '" << cli_piva << "' AND \n" << "PQ_IMPTOTDOC = " << tot;
|
||||
|
||||
if (_db->sq_set_exec(query) && _db->sq_items() == 1)
|
||||
{
|
||||
_keys = _db->sq_get("KEYPRGINVIO");
|
||||
_keys.add(_db->sq_get("KEYHEADERFATT"));
|
||||
_keys.add(_db->sq_get("KEYBODYFATT"));
|
||||
_keys = { _db->sq_get("KEYPRGINVIO"), _db->sq_get("KEYHEADERFATT"), _db->sq_get("KEYBODYFATT") };
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* TFppro::get_keys_fppro()
|
||||
const char* TFppro::get_keys_fppro() const
|
||||
{
|
||||
TString& keys = get_tmp_string(64);
|
||||
|
||||
keys.cut(0) << _keys.get(0) << ";" << _keys.get(1) << ";" << _keys.get(2);
|
||||
return keys;
|
||||
static TString keys;
|
||||
keys.cut(0) << _keys.prginvio << ";" << _keys.headerfatt << ";" << _keys.bodyfatt;
|
||||
return (const char*)keys;
|
||||
}
|
||||
|
||||
long TFppro::get_numreg()
|
||||
int TFppro::get_numreg()
|
||||
{
|
||||
if (!_is_set)
|
||||
{
|
||||
if (set_query())
|
||||
return _db->sq_get_long("PZ_NUMREGCONT");
|
||||
return _db->sq_get_int("PZ_NUMREGCONT");
|
||||
return -1;
|
||||
}
|
||||
return _db->sq_get_long("PZ_NUMREGCONT");
|
||||
return _db->sq_get_int("PZ_NUMREGCONT");
|
||||
}
|
||||
|
||||
long TFppro::get_numreg(TToken_string& keys)
|
||||
int TFppro::get_numreg(TToken_string& keys)
|
||||
{
|
||||
set_keys(keys);
|
||||
return get_numreg();
|
||||
}
|
||||
|
||||
long TFppro::get_codforn()
|
||||
TString TFppro::get_codforn() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
query << "SELECT PZ_CLIFOR FROM FPPRO00F\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get_long("PZ_CLIFOR");
|
||||
return _db->sq_get("PZ_CLIFOR");
|
||||
}
|
||||
|
||||
TDate TFppro::get_datareg()
|
||||
@ -127,13 +127,12 @@ TDate TFppro::get_datareg(TToken_string& keys)
|
||||
return TDate();
|
||||
}
|
||||
|
||||
real TFppro::get_ritenute()
|
||||
real TFppro::get_ritenute() const
|
||||
{
|
||||
real imp;
|
||||
real imp = ZERO;
|
||||
TString query;
|
||||
|
||||
query << "SELECT P7_IMPORTORIT AS IMPORTO FROM PAA0700F\n" <<
|
||||
"WHERE P7_KEYPRGINVIO = '" << _keys.get(0) << "' AND P7_KEYHEADERFATT = '" << _keys.get(1) << "' AND P7_KEYBODYFATT = '" << _keys.get(2) << "'";
|
||||
"WHERE P7_KEYPRGINVIO = '" << _keys.prginvio << "' AND P7_KEYHEADERFATT = '" << _keys.headerfatt << "' AND P7_KEYBODYFATT = '" << _keys.bodyfatt << "'";
|
||||
_db->sq_set_exec(query, false);
|
||||
for(bool ok = _db->sq_next(); ok; ok = _db->sq_next())
|
||||
imp += _db->sq_get_real("IMPORTO");
|
||||
@ -141,69 +140,66 @@ real TFppro::get_ritenute()
|
||||
}
|
||||
|
||||
TFppro& TFppro::set_keys(TToken_string& keys)
|
||||
{
|
||||
if (keys.items() == 3)
|
||||
{
|
||||
const keys_s k = { keys.get(0), keys.get(1), keys.get(2) };
|
||||
return set_keys(k);
|
||||
}
|
||||
_is_set = false;
|
||||
_keys_setted = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TFppro& TFppro::set_keys(const keys_s& keys)
|
||||
{
|
||||
if (sql_inj(keys))
|
||||
{
|
||||
TString msg; msg << "Database error: Possibile SQL INJECTION:\n" << keys;
|
||||
;
|
||||
//throw std::exception(msg);
|
||||
error_box(msg);
|
||||
_last_error.cut(0) << msg;
|
||||
}
|
||||
else if (!keys.prginvio.empty() && !keys.headerfatt.empty() && !keys.bodyfatt.empty())
|
||||
{
|
||||
_keys = keys;
|
||||
_keys_setted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TString prginvio = keys.get(0);
|
||||
TString headerfatt = keys.get(1);
|
||||
TString bodyfatt = keys.get(2);
|
||||
|
||||
if (prginvio.full() && headerfatt.full() && bodyfatt.full())
|
||||
{
|
||||
_keys = keys;
|
||||
_keys_setted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_last_error = "Chiavi settate non valide:\n";
|
||||
_last_error << keys;
|
||||
_keys_setted = false;
|
||||
}
|
||||
_last_error.cut(0) << "Chiavi settate non valide:\n" << keys;
|
||||
_keys_setted = false;
|
||||
}
|
||||
_is_set = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool TFppro::associa_mov(const long numreg)
|
||||
bool TFppro::associa_mov(const int numreg) const
|
||||
{
|
||||
TRectype & mov = (TRectype &) cache().get(LF_MOV, numreg);
|
||||
bool ok = mov.full();
|
||||
|
||||
if (ok)
|
||||
bool ok;
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
if ((ok = mov.read() == NOERR))
|
||||
{
|
||||
TString query;
|
||||
query << "UPDATE FPPRO00F \nSET " <<
|
||||
"PZ_TIPOCF = 'F', PZ_CLIFOR = '" << mov.get(MOV_CODCF) << "', PZ_NUMREGCONT = '" <<
|
||||
mov.get(MOV_NUMREG) << "', PZ_DATAREGCONT = '" << mov.get_date(MOV_DATAREG).date2ansi() << "'\n" <<
|
||||
fppro_db().where_str() << ";";
|
||||
ok = _db->sq_set_exec(query) && _db->sq_commit();
|
||||
|
||||
if (ok) // Scrivo sul movimento il riferimento al fppro
|
||||
mov.put(MOV_KEYFPPRO, get_keys_fppro());
|
||||
if ((ok = mov.rewrite() == NOERR)) // Scrivo sul movimento il riferimento al fppro
|
||||
{
|
||||
mov.put(MOV_IDDOCSDI, fppro_db().get_numdoc());
|
||||
mov.put(MOV_DATADOCSDI, fppro_db().get_numdoc());
|
||||
mov.put(MOV_KEYFPPRO, get_keys_fppro());
|
||||
ok = mov.rewrite() == NOERR;
|
||||
}
|
||||
else // Se la scrittura sul db fallisce levo sul movimento il riferimento all'fppro
|
||||
{
|
||||
mov.zero(MOV_IDDOCSDI);
|
||||
mov.zero(MOV_DATADOCSDI);
|
||||
mov.zero(MOV_KEYFPPRO);
|
||||
mov.rewrite();
|
||||
TString query;
|
||||
query << "UPDATE FPPRO00F \nSET " <<
|
||||
"PZ_TIPOCF = 'F', PZ_CLIFOR = '" << mov.get(MOV_CODCF) << "', PZ_NUMREGCONT = '" <<
|
||||
mov.get(MOV_NUMREG) << "', PZ_DATAREGCONT = '" << mov.get_date(MOV_DATAREG).date2ansi() << "'\n" <<
|
||||
fppro_db().where_str() << ";";
|
||||
if (!((ok = _db->sq_set_exec(query) && _db->sq_commit()))) // Se la scrittura sul db fallisce levo sul movimento il riferimento all'fppro
|
||||
{
|
||||
mov.put(MOV_KEYFPPRO, "");
|
||||
mov.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
const TString & TFppro::get_tipoprot()
|
||||
const char* TFppro::get_tipoprot() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
@ -212,98 +208,80 @@ const TString & TFppro::get_tipoprot()
|
||||
return _db->sq_get("TIPOPROT");
|
||||
}
|
||||
|
||||
const TString & TFppro::get_numprot()
|
||||
const char* TFppro::get_numprot() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
static TString num;
|
||||
query << "SELECT PZ_NUMPROT AS NUMPROT FROM FPPRO00F\r\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
|
||||
return _db->sq_get("NUMPROT");
|
||||
return num.cut(0) = _db->sq_get("NUMPROT");
|
||||
}
|
||||
|
||||
const TString & TFppro::get_annoprot()
|
||||
const char* TFppro::get_annoprot() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
static TString anno;
|
||||
query << "SELECT PZ_ANNOPROT AS ANNOPROT FROM FPPRO00F\r\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get("ANNOPROT");
|
||||
return anno.cut(0) = _db->sq_get("ANNOPROT");
|
||||
}
|
||||
|
||||
const TString & TFppro::get_dataoraric()
|
||||
const char* TFppro::get_dataoraric() const
|
||||
{
|
||||
TString query;
|
||||
TString & data = get_tmp_string(16);
|
||||
|
||||
query << "SELECT PZ_DATAORARIC AS DATAORARIC FROM FPPRO00F\r\n" << where_str();
|
||||
static TString data;
|
||||
query << "SELECT PZ_DATAORARIC AS DATAORARIC FROM FPPRO00F\r\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
data << _db->sq_get_date("DATAORARIC").date2ansi();
|
||||
return data;
|
||||
return data.cut(0) << _db->sq_get_date("DATAORARIC").date2ansi();
|
||||
}
|
||||
|
||||
const TString & TFppro::get_tipodoc()
|
||||
const char* TFppro::get_tipodoc() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
static TString tipodoc;
|
||||
query << "SELECT PZ_TIPODOC AS TIPODOC FROM FPPRO00F\r\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get("TIPODOC");
|
||||
return tipodoc.cut(0) << _db->sq_get("TIPODOC");
|
||||
}
|
||||
|
||||
const TString & TFppro::get_numdoc()
|
||||
const char* TFppro::get_numdoc() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
static TString numdoc;
|
||||
query << "SELECT PZ_NUMERO AS NUMDOC FROM FPPRO00F\r\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get("NUMDOC");
|
||||
return numdoc.cut(0) << _db->sq_get("NUMDOC");
|
||||
}
|
||||
|
||||
TDate TFppro::get_data_first_doc() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
query << "SELECT min(a.DATA) AS DATA \nFROM( \n\tSELECT P7_DATA as DATA \n" <<
|
||||
"\tFROM PAA0700F \n\tUNION \n\tSELECT P7_DATA as DATA \n\tFROM PAF0700F \n) a";
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get_date("DATA");
|
||||
}
|
||||
|
||||
TDate TFppro::get_data_doc()
|
||||
TDate TFppro::get_dataorarioric() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
query << "SELECT PZ_DATA FROM FPPRO00F\r\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get_date("PZ_DATA");
|
||||
}
|
||||
|
||||
|
||||
TDate TFppro::get_dataorarioric()
|
||||
{
|
||||
TString query;
|
||||
|
||||
query << "SELECT P1_DATAORARIC \nFROM PAA0100F \n" <<
|
||||
"WHERE P1_KEYPRGINVIO = '" << _keys.get(0) << "' AND P1_KEYHEADERFATT = '" << _keys.get(1) << "' AND P1_KEYBODYFATT = '" << _keys.get(2) << "'";
|
||||
"WHERE P1_KEYPRGINVIO = '" << _keys.prginvio << "' AND P1_KEYHEADERFATT = '" << _keys.headerfatt << "' AND P1_KEYBODYFATT = '" << _keys.bodyfatt << "'";
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get_date("P1_DATAORARIC");
|
||||
}
|
||||
|
||||
long TFppro::get_numregcont()
|
||||
int TFppro::get_numregcont() const
|
||||
{
|
||||
TString query;
|
||||
|
||||
query << "SELECT PZ_NUMREGCONT FROM FPPRO00F\n" << where_str();
|
||||
_db->sq_set_exec(query);
|
||||
return _db->sq_get_long("PZ_NUMREGCONT");
|
||||
return _db->sq_get_int("PZ_NUMREGCONT");
|
||||
}
|
||||
|
||||
TString TFppro::get_last_error(bool clear)
|
||||
{
|
||||
TString & l = get_tmp_string(128);
|
||||
|
||||
l = _last_error;
|
||||
TString l(_last_error);
|
||||
if(clear)
|
||||
_last_error.cut(0);
|
||||
return l;
|
||||
@ -319,14 +297,14 @@ bool TFppro::set_query()
|
||||
return _is_set = false;
|
||||
}
|
||||
|
||||
const char* TFppro::where_str()
|
||||
const char* TFppro::where_str() const
|
||||
{
|
||||
static TString str;
|
||||
str.cut(0) << " WHERE PZ_KEYPRGINVIO = '" << _keys.get(0) << "' AND PZ_KEYHEADERFATT = '" << _keys.get(1) << "' AND PZ_KEYBODYFATT = '" << _keys.get(2) << "'";
|
||||
str.cut(0) << " WHERE PZ_KEYPRGINVIO = '" << _keys.prginvio << "' AND PZ_KEYHEADERFATT = '" << _keys.headerfatt << "' AND PZ_KEYBODYFATT = '" << _keys.bodyfatt << "'";
|
||||
return str;
|
||||
}
|
||||
|
||||
TFppro::TFppro() : _keys("", ';'), _keys_setted(false), _is_set(false)
|
||||
TFppro::TFppro() : _keys({ "\0", "\0", "\0" }), _keys_setted(false), _is_set(false)
|
||||
{
|
||||
_db = new SSimple_query();
|
||||
const bool ok = set_connection(*_db);
|
||||
@ -344,14 +322,13 @@ prot_s TProtocollo::get_prot()
|
||||
return prot;
|
||||
}
|
||||
|
||||
const TString& TProtocollo::prot_in(const int year, const char* tipoprot, const char* progres) const
|
||||
TString& TProtocollo::prot_in(const int year, const char* tipoprot, const char* progres)
|
||||
{
|
||||
TString & protocollo = get_tmp_string(128);
|
||||
static TString protocollo;
|
||||
TString tipo(tipoprot);
|
||||
|
||||
if (tipo.empty())
|
||||
tipo << "no_prot";
|
||||
protocollo << year << "-" << tipo << "/" << progres;
|
||||
protocollo.cut(0) << year << "-" << tipo << "/" << progres;
|
||||
return protocollo;
|
||||
}
|
||||
|
||||
@ -371,7 +348,7 @@ void TProtocollo::sset(const char* prot)
|
||||
_progres = p.get();
|
||||
}
|
||||
|
||||
const TString& TProtocollo::get_prot() const
|
||||
TString& TProtocollo::get_prot() const
|
||||
{
|
||||
return prot_in(_year, _tipoprot, _progres);
|
||||
}
|
||||
@ -386,21 +363,29 @@ const char* get_ini_codcaus()
|
||||
return ini_get_string(FILE_CONFIG, FILE_SECTION, F1_CAUS);
|
||||
}
|
||||
|
||||
const char* get_codcaus(const char * tipodoc, long codcf)
|
||||
const char* get_codcaus(const char * tipodoc, const long codcf)
|
||||
{
|
||||
TCli_for f = cached_clifor('F', codcf);
|
||||
TLocalisamfile cfven(LF_CFVEN);
|
||||
cfven.put(CFV_TIPOCF, "F");
|
||||
cfven.put(CFV_CODCF, codcf);
|
||||
const char* codcaus = "";
|
||||
const char* codcausnc = "";
|
||||
const bool nc = TString(tipodoc) == "TD04";
|
||||
|
||||
if (cfven.read() == NOERR)
|
||||
{
|
||||
codcaus = cfven.get(CFV_CODCAUS);
|
||||
codcausnc = cfven.get(CFV_CODCAUSNC);
|
||||
}
|
||||
|
||||
if (nc)
|
||||
{
|
||||
const TString & codcaus = f.vendite().get(CFV_CODCAUSNC);
|
||||
if (codcaus.full())
|
||||
return codcaus;
|
||||
if (!TString(codcausnc).empty())
|
||||
return codcausnc;
|
||||
}
|
||||
else
|
||||
{
|
||||
const TString & codcaus = f.vendite().get(CFV_CODCAUS);
|
||||
if (codcaus.full())
|
||||
if (!TString(codcaus).empty())
|
||||
return codcaus;
|
||||
}
|
||||
return get_ini_codcaus();
|
||||
@ -411,12 +396,12 @@ bool get_endatareg()
|
||||
return ini_get_bool(FILE_CONFIG, FILE_SECTION, "endatareg");
|
||||
}
|
||||
|
||||
const TString & get_datainireg()
|
||||
TString get_datainireg()
|
||||
{
|
||||
return ini_get_string(FILE_CONFIG, FILE_SECTION, "datainireg");
|
||||
}
|
||||
|
||||
const TString & get_dataendreg()
|
||||
TString get_dataendreg()
|
||||
{
|
||||
return ini_get_string(FILE_CONFIG, FILE_SECTION, "dataendreg");
|
||||
}
|
||||
@ -459,42 +444,74 @@ bool check_causale(const TString& cod_caus, bool acq)
|
||||
|
||||
bool check_causale(const TString& cod_caus, const TString& tipo_doc, bool acq)
|
||||
{
|
||||
const TCausale& c = cached_causale(cod_caus);
|
||||
const TCausale& caus = cached_causale(cod_caus);
|
||||
|
||||
if(tipo_doc == "FA" || tipo_doc == "BD" || tipo_doc == "AF" || tipo_doc == "FF")
|
||||
return c.tipo_doc() == tipo_doc;
|
||||
return caus.tipo_doc() == tipo_doc;
|
||||
|
||||
if (tipo_doc == "NC" || tipo_doc == "ND")
|
||||
{
|
||||
bool nota;
|
||||
bool nota_iva = false;
|
||||
|
||||
if ((nota = c.tipo_doc() == tipo_doc))
|
||||
if ((nota = caus.tipo_doc() == tipo_doc))
|
||||
{
|
||||
if (acq)
|
||||
nota_iva = c.reg().tipo() == iva_acquisti;
|
||||
nota_iva = caus.reg().tipo() == iva_acquisti;
|
||||
else
|
||||
nota_iva = c.reg().tipo() == iva_vendite;
|
||||
nota_iva = caus.reg().tipo() == iva_vendite;
|
||||
}
|
||||
return nota && nota_iva;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool check_caus_has_rit(const TString& cod_caus, int year)
|
||||
bool check_caus_has_rit(const TString& cod_caus, bool rit)
|
||||
{
|
||||
const TCausale & c = cached_causale(cod_caus, year);
|
||||
|
||||
return c.causale_770().full();
|
||||
TLocalisamfile causali(LF_CAUSALI);
|
||||
causali.put(CAU_CODCAUS, cod_caus);
|
||||
causali.read();
|
||||
return *causali.get(CAU_M770) != '\0';
|
||||
}
|
||||
|
||||
void run_cont_ini(bool liq)
|
||||
{
|
||||
TString cmd;
|
||||
|
||||
cmd.cut(0) << "cg2 -0 -i" << TFilename().temp("cg2CONTAB", "ini") << " -f1" << (liq ? " -liq" : " ") << " /u" << user();
|
||||
|
||||
TExternal_app app(cmd);
|
||||
|
||||
app.run();
|
||||
static TString run_string;
|
||||
#ifdef DBG
|
||||
run_string.cut(0) << "cg2 -0 -i" << F1_INIREGCONT << "*" << ".ini" << " -f1" << (liq? " -liq" : " ") << " /u" << user();
|
||||
#else
|
||||
run_string.cut(0) << "cg2 -0 -i" << TFilename().tempdir() << "\\" << F1_INIREGCONT << "*" << ".ini" << " -f1" << (liq ? " -liq" : " ") << " /u" << user();
|
||||
#endif
|
||||
TExternal_app(run_string).run();
|
||||
}
|
||||
|
||||
void TF1_log::log(int severity, const char* msg)
|
||||
{
|
||||
if (_log == nullptr)
|
||||
{
|
||||
_log = new TLog_report("Stato contabilizzazione:");
|
||||
// Tento l'eliminazione del file
|
||||
std::remove("f1_cg.log");
|
||||
}
|
||||
|
||||
static TString txt;
|
||||
txt.cut(0) << msg;
|
||||
_log->log(severity, txt);
|
||||
// Scrivo anche su file
|
||||
std::filebuf fb;
|
||||
fb.open("f1_cg.log", std::ios::out | std::ios::app);
|
||||
std::ostream os(&fb);
|
||||
os << txt << std::endl;
|
||||
fb.close();
|
||||
}
|
||||
|
||||
bool TF1_log::show_log()
|
||||
{
|
||||
if (_log)
|
||||
{
|
||||
_log->preview();
|
||||
delete _log;
|
||||
_log = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
@ -7,8 +7,8 @@
|
||||
|
||||
#define FILE_CONFIG CONFIG_DITTA
|
||||
#define FILE_SECTION "f1"
|
||||
#define F1_INIREGCONT "cgreg"
|
||||
#define F1_CAUS "caus"
|
||||
#define F1_INIREGCONT "cg2CONTAB"
|
||||
#define LOG_MSG 0
|
||||
#define LOG_WARN 1
|
||||
#define LOG_ERR 2
|
||||
@ -39,48 +39,63 @@ typedef struct _prot_s
|
||||
*/
|
||||
class TFppro : public TObject
|
||||
{
|
||||
TToken_string _keys;
|
||||
struct keys_s
|
||||
{
|
||||
TString prginvio;
|
||||
TString headerfatt;
|
||||
TString bodyfatt;
|
||||
|
||||
operator const char*() const
|
||||
{
|
||||
static TToken_string a("", ';');
|
||||
a.add(prginvio);
|
||||
a.add(headerfatt);
|
||||
a.add(bodyfatt);
|
||||
return a;
|
||||
}
|
||||
} _keys;
|
||||
|
||||
SSimple_query* _db;
|
||||
bool _keys_setted;
|
||||
bool _is_set; // Query is setted
|
||||
TString _fppro_query;
|
||||
TString _last_error;
|
||||
|
||||
bool sql_inj(TToken_string& keys);
|
||||
static bool sql_inj(const TString& str);
|
||||
static bool sql_inj(const keys_s& keys);
|
||||
public:
|
||||
const char* where_str();
|
||||
const char* where_str() const;
|
||||
|
||||
bool check_reg(TToken_string& keys, int numreg);
|
||||
// Se un mov. registrato non e' collegato all'FPPRO cerco di capire qual'e`
|
||||
bool guess_the_doc(const TLocalisamfile& mov);
|
||||
// Getters
|
||||
const char* get_keys_fppro();
|
||||
long get_numreg();
|
||||
long get_numreg(TToken_string& keys);
|
||||
long get_codforn();
|
||||
const char* get_keys_fppro() const;
|
||||
int get_numreg();
|
||||
int get_numreg(TToken_string& keys);
|
||||
TString get_codforn() const;
|
||||
TDate get_datareg();
|
||||
TDate get_datareg(TToken_string& keys);
|
||||
real get_ritenute();
|
||||
real get_ritenute() const;
|
||||
TDate get_data_first_doc() const;
|
||||
TDate get_dataorarioric();
|
||||
long get_numregcont();
|
||||
|
||||
TDate get_dataorarioric() const;
|
||||
int get_numregcont() const;
|
||||
|
||||
TString get_last_error(bool clear = true);
|
||||
// Setters
|
||||
bool set_query();
|
||||
TFppro& set_keys(TToken_string& keys);
|
||||
TFppro& set_keys(const keys_s& keys);
|
||||
|
||||
bool associa_mov(long numreg);
|
||||
const TString & get_tipoprot();
|
||||
const TString & get_numprot();
|
||||
const TString & get_annoprot();
|
||||
const TString & get_dataoraric();
|
||||
const TString & get_tipodoc();
|
||||
const TString & get_numdoc();
|
||||
TDate get_data_doc();
|
||||
bool associa_mov(int numreg) const;
|
||||
const char* get_tipoprot() const;
|
||||
const char* get_numprot() const;
|
||||
const char* get_annoprot() const;
|
||||
const char* get_dataoraric() const;
|
||||
const char* get_tipodoc() const;
|
||||
const char* get_numdoc() const;
|
||||
|
||||
TFppro();
|
||||
TFppro();
|
||||
TFppro(TToken_string& keys) : TFppro() { set_keys(keys); }
|
||||
};
|
||||
|
||||
@ -96,29 +111,36 @@ public:
|
||||
|
||||
void set(const TProtocollo& prot);
|
||||
void sset(const char* prot);
|
||||
const TString& get_prot() const;
|
||||
TString& get_prot() const;
|
||||
prot_s get_prot();
|
||||
|
||||
int get_year() const { return _year; }
|
||||
const TString& get_tipoprot() const { return _tipoprot; }
|
||||
const TString& get_progres() const { return _progres; }
|
||||
const TString& prot_in(int year, const char* tipoprot, const char* progres) const;
|
||||
TString& get_tipoprot() { return _tipoprot; }
|
||||
TString& get_progres() { return _progres; }
|
||||
|
||||
|
||||
static TString& prot_in(int year, const char* tipoprot, const char* progres);
|
||||
|
||||
operator const char*() const { return static_cast<const char*>(get_prot()); }
|
||||
|
||||
};
|
||||
|
||||
class TF1_log : public TLog_report
|
||||
class TF1_log : TObject
|
||||
{
|
||||
TLog_report* _log;
|
||||
public:
|
||||
TF1_log() : TLog_report("Stato contabilizzazione:") {}
|
||||
bool show_log() { export_text("f1_cg.log", 0, false); return preview(); }
|
||||
TF1_log() : _log(nullptr){}
|
||||
void log(int severity, const char* msg);
|
||||
bool show_log();
|
||||
};
|
||||
|
||||
TFppro& fppro_db();
|
||||
|
||||
const char* get_ini_codcaus();
|
||||
const char* get_codcaus(const char * tipodoc, long codcf);
|
||||
const char* get_codcaus(const char * tipodoc, const long codcf);
|
||||
bool get_endatareg();
|
||||
const TString & get_datainireg();
|
||||
const TString & get_dataendreg();
|
||||
TString get_datainireg();
|
||||
TString get_dataendreg();
|
||||
bool get_periodprec();
|
||||
|
||||
void set_ini_codcaus(const TString& codcaus);
|
||||
@ -131,7 +153,7 @@ void set_periodprec(bool flag);
|
||||
bool check_causale(const TString& cod_caus, bool acq = true);
|
||||
// Controlla se il "cod_caus" ha come "tipo_doc" FA o NC (di acquisto)
|
||||
bool check_causale(const TString& cod_caus, const TString& tipo_doc, bool acq = true);
|
||||
bool check_caus_has_rit(const TString& cod_caus, int year = 0);
|
||||
bool check_caus_has_rit(const TString& cod_caus, bool rit);
|
||||
void run_cont_ini(bool liq);
|
||||
|
||||
#endif // _F1LIB_H_
|
||||
|
@ -593,9 +593,7 @@ bool TF9Prospetto_integr::operator()(const char* numreg_acq, const char* numreg_
|
||||
_items = _prosp_rs->items();
|
||||
if (_items == 0)
|
||||
{
|
||||
FILE* log;
|
||||
|
||||
fopen_s(&log, "TF9Prospetto_integr_error.txt", "a");
|
||||
FILE* log = fopen("TF9Prospetto_integr_error.txt", "a");
|
||||
if (!_prosp_rs->last_exec())
|
||||
{
|
||||
if (log != nullptr)
|
||||
|
@ -73,7 +73,7 @@ int n;
|
||||
tmpa[i] = pSrc[i];
|
||||
|
||||
/* sort pointers */
|
||||
qsort((void *)tmpa,n,sizeof(DEC *), (int (__cdecl *)(void)) _SortInc);
|
||||
qsort((void *)tmpa,n,sizeof(DEC *), _SortInc);
|
||||
|
||||
if (n%2)
|
||||
_MacDCopy(pDst, tmpa[(n-1)/2]);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "../cg/cglib.h"
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRigheF24_set
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <utility.h>
|
||||
|
||||
#include "../cg/cg2101.h"
|
||||
#include "../cg/cglib.h"
|
||||
#include "../cg/cg2103.h"
|
||||
#include "../cg/cgsaldac.h"
|
||||
#include "../mg/movmag.h"
|
||||
#include "../mg/rmovmag.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <utility.h>
|
||||
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../cg/cglib.h"
|
||||
#include "../cg/cg2103.h"
|
||||
#include "../cg/cgsaldac.h"
|
||||
#include "../cg/cgpagame.h"
|
||||
|
||||
|
@ -395,9 +395,7 @@ THEN
|
||||
#F1.203 +!</postscript>
|
||||
</field>
|
||||
</section>
|
||||
<sql>USE IVADIFF KEY 4 SELECT (BETWEEN(DATAREGP;#DAL;#AL))(TIPOIVA==#TIPOIVA)(TIPODIFF==#TIPODIFF)((CHIUSA=#CHIUSA)||(#CHIUSA="T"))
|
||||
FROM DATAREG=#DAL
|
||||
TO DATAREG=#AL
|
||||
<sql>USE IVADIFF SELECT (BETWEEN(DATAREG,#DAL,#AL))(TIPOIVA==#TIPOIVA)(TIPODIFF==#TIPODIFF)((CHIUSA=#CHIUSA)||(#CHIUSA="T"))
|
||||
JOIN MOV INTO NUMREG==NUMREG
|
||||
JOIN CLIFO TO MOV INTO TIPOCF==TIPO CODCF==CODCF</sql>
|
||||
</report>
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
void TICpag_print::main_loop()
|
||||
{
|
||||
TMask m("ic0200a");
|
||||
TMask m("ic0100a");
|
||||
while (m.run() == K_ENTER)
|
||||
{
|
||||
TICpag_report r("ic0200p");
|
||||
|
@ -1,71 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<report libraries="" page_merge="" save_printer="" name="ic0200p" use_printer_font="" orientation="" page_split="" lpi="6" command="" class="">
|
||||
<report name="IC0200P" lpi="6">
|
||||
<font face="Arial" size="10" />
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Head" level="" hidden="" page_break="" can_break="" pattern="1" />
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Head" level="1" hidden="" page_break="" can_break="" pattern="1">
|
||||
<section type="Head" pattern="1" />
|
||||
<section type="Head" level="1" pattern="1">
|
||||
<prescript description="H1 PRESCRIPT">MESSAGE RESET,F1</prescript>
|
||||
<field deactivated="" type="Stringa" hidden="" align="center" link="" dynamic_height="" shade_offset="" width="90" codval="" height="2" id="" pattern="1" hide_zero="" text="">
|
||||
<field type="Stringa" align="center" width="90" height="2" pattern="1">
|
||||
<font face="Arial" bold="1" size="20" />
|
||||
<source>IF(#TIPOIVA==1,"INCASSI", "PAGAMENTI") + " CON IVA " + IF(#TIPODIFF==1,"DIFFERITA", "PER CASSA")</source>
|
||||
</field>
|
||||
<field y="2" deactivated="" type="Stringa" hidden="" align="center" link="" dynamic_height="" shade_offset="" width="90" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field y="2" type="Stringa" align="center" width="90" pattern="1">
|
||||
<font face="Arial" bold="1" size="10" />
|
||||
<source>IF(#DAL="",""," DAL "+#DAL) + IF(#AL="","", " AL "+#AL)</source>
|
||||
</field>
|
||||
</section>
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Head" level="2" hidden="" page_break="" can_break="" pattern="1">
|
||||
<section type="Head" level="2" pattern="1">
|
||||
<groupby>NUMREG</groupby>
|
||||
<font face="Arial" bold="1" size="10" />
|
||||
<prescript description="H2 PRESCRIPT">MESSAGE RESET,F2</prescript>
|
||||
<field border="3" y="0.5" deactivated="" type="Linea" hidden="" link="" dynamic_height="" shade_offset="" width="90" codval="" height="0" id="" pattern="1" hide_zero="" text="" />
|
||||
<field y="1" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="8" codval="" id="" pattern="1" hide_zero="" text="Fattura" />
|
||||
<field x="8" y="1" deactivated="" type="Stringa" hidden="" link="" dynamic_height="" shade_offset="" width="10" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field border="3" y="0.5" type="Linea" width="90" height="0" pattern="1" />
|
||||
<field y="1" type="Testo" width="8" pattern="1" text="Fattura" />
|
||||
<field x="8" y="1" type="Stringa" width="10" pattern="1">
|
||||
<source>MOV.NUMDOC</source>
|
||||
</field>
|
||||
<field x="19" y="1" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="3" codval="" id="" pattern="1" hide_zero="" text="del" />
|
||||
<field x="22" y="1" deactivated="" type="Data" hidden="" link="" dynamic_height="" shade_offset="" width="10" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="19" y="1" type="Testo" width="3" pattern="1" text="del" />
|
||||
<field x="22" y="1" type="Data" width="10" pattern="1">
|
||||
<source>MOV.DATADOC</source>
|
||||
</field>
|
||||
<field x="40" y="1" deactivated="" type="Stringa" hidden="" link="" dynamic_height="" shade_offset="" width="50" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="40" y="1" type="Stringa" width="50" pattern="1">
|
||||
<source>CLIFO.RAGSOC</source>
|
||||
</field>
|
||||
<field x="19" y="2" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="7" codval="" id="" pattern="1" hide_zero="" text="Sezione" />
|
||||
<field x="25" y="2" deactivated="" type="Testo" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="" pattern="1" hide_zero="" text="Importo" />
|
||||
<field x="40" y="2" deactivated="" type="Testo" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="" pattern="1" hide_zero="" text="Imponibile" />
|
||||
<field x="56" y="2" deactivated="" type="Testo" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="4" codval="" id="" pattern="1" hide_zero="" text="IVA" />
|
||||
<field x="61" y="2" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="3" codval="" id="" pattern="1" hide_zero="" text="Ind." />
|
||||
<field x="63" y="2" deactivated="" type="Testo" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="" pattern="1" hide_zero="" text="Imposta" />
|
||||
<field x="80" y="2" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="6" codval="" id="" pattern="1" hide_zero="" text="Chiusa" />
|
||||
<field y="3" deactivated="" type="Numero" hidden="" align="right" link="MOV.NUMREG" dynamic_height="" shade_offset="" width="7" codval="" id="" pattern="1" hide_zero="1" text="">
|
||||
<field x="19" y="2" type="Testo" width="7" pattern="1" text="Sezione" />
|
||||
<field x="25" y="2" type="Testo" align="right" width="15" pattern="1" text="Importo" />
|
||||
<field x="40" y="2" type="Testo" align="right" width="15" pattern="1" text="Imponibile" />
|
||||
<field x="56" y="2" type="Testo" align="right" width="4" pattern="1" text="IVA" />
|
||||
<field x="61" y="2" type="Testo" width="3" pattern="1" text="Ind." />
|
||||
<field x="63" y="2" type="Testo" align="right" width="15" pattern="1" text="Imposta" />
|
||||
<field x="80" y="2" type="Testo" width="6" pattern="1" text="Chiusa" />
|
||||
<field y="3" type="Numero" align="right" link="MOV.NUMREG" width="7" pattern="1" hide_zero="1">
|
||||
<source>NUMREG</source>
|
||||
</field>
|
||||
<field x="8" y="3" deactivated="" type="Data" hidden="" link="" dynamic_height="" shade_offset="" width="10" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="8" y="3" type="Data" width="10" pattern="1">
|
||||
<source>DATAREG</source>
|
||||
</field>
|
||||
<field x="19" y="3" deactivated="" type="Array" hidden="" link="" dynamic_height="" shade_offset="" width="5" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="19" y="3" type="Array" width="5" pattern="1">
|
||||
<source>IF(#TIPOIVA==1,"D","A")</source>
|
||||
<list>
|
||||
<li Value="Dare" Code="D" />
|
||||
<li Value="Avere" Code="A" />
|
||||
</list>
|
||||
</field>
|
||||
<field x="25" y="3" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="25" y="3" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@">
|
||||
<source>MOV.TOTDOC</source>
|
||||
</field>
|
||||
<field x="83" y="3" deactivated="" type="Booleano" valign="center" hidden="" link="" dynamic_height="" shade_offset="" width="1" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="83" y="3" type="Booleano" valign="center" width="1" pattern="1">
|
||||
<source>CHIUSA</source>
|
||||
</field>
|
||||
<field border="1" y="4.5" deactivated="" type="Linea" hidden="" link="" dynamic_height="" shade_offset="" width="90" codval="" height="0" id="" pattern="1" hide_zero="" text="" />
|
||||
<field border="1" y="4.5" type="Linea" width="90" height="0" pattern="1" />
|
||||
</section>
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Body" level="" hidden="" page_break="" can_break="" pattern="1" />
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Body" level="1" hidden="" page_break="" can_break="" pattern="1">
|
||||
<field deactivated="" type="Stringa" hidden="" align="right" link="MOV.NUMREG" dynamic_height="" shade_offset="" width="7" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<section type="Body" pattern="1" />
|
||||
<section type="Body" level="1" pattern="1">
|
||||
<field type="Stringa" align="right" link="MOV.NUMREG" width="7" pattern="1">
|
||||
<source>IF(NUMREGP==NUMREG,"",NUMREGP)</source>
|
||||
</field>
|
||||
<field x="8" deactivated="" type="Data" hidden="" link="" dynamic_height="" shade_offset="" width="10" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="8" type="Data" width="10" pattern="1">
|
||||
<source>DATAREGP</source>
|
||||
</field>
|
||||
<field x="25" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="25" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@">
|
||||
<source>IMPORTO</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">#100 @
|
||||
"A"
|
||||
@ -86,7 +86,7 @@ ELSE
|
||||
#F2.101 +!
|
||||
THEN</postscript>
|
||||
</field>
|
||||
<field x="40" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="40" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@">
|
||||
<source>IMPONIBILE</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">#100 @
|
||||
"A"
|
||||
@ -107,10 +107,10 @@ ELSE
|
||||
#F2.102 +!
|
||||
THEN</postscript>
|
||||
</field>
|
||||
<field x="56" deactivated="" type="Stringa" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="4" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="56" type="Stringa" align="right" width="4" pattern="1">
|
||||
<source>CODIVA</source>
|
||||
</field>
|
||||
<field x="63" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="63" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@">
|
||||
<source>IMPOSTA</source>
|
||||
<postscript description="B1.0 POSTSCRIPT">#100 @
|
||||
"A"
|
||||
@ -131,33 +131,33 @@ ELSE
|
||||
#F2.103 +!
|
||||
THEN</postscript>
|
||||
</field>
|
||||
<field x="83" deactivated="" type="Booleano" valign="center" hidden="" link="" dynamic_height="" shade_offset="" width="1" codval="" id="" pattern="1" hide_zero="" text="">
|
||||
<field x="83" type="Booleano" valign="center" width="1" pattern="1">
|
||||
<source>CHIUSA</source>
|
||||
</field>
|
||||
<field x="19" deactivated="" type="Array" hidden="" link="" dynamic_height="" shade_offset="" width="5" codval="" id="100" pattern="1" hide_zero="" text="">
|
||||
<field x="19" type="Array" width="5" id="100" pattern="1">
|
||||
<source>SEZIONE</source>
|
||||
<list>
|
||||
<li Value="Dare" Code="D" />
|
||||
<li Value="Avere" Code="A" />
|
||||
</list>
|
||||
</field>
|
||||
<field x="61" deactivated="" type="Stringa" hidden="" link="" dynamic_height="" shade_offset="" width="1" codval="" id="101" pattern="1" hide_zero="" text="">
|
||||
<field x="61" type="Stringa" width="1" id="101" pattern="1">
|
||||
<source>IVADIFF.INDETR</source>
|
||||
</field>
|
||||
</section>
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Foot" level="" hidden="" page_break="" can_break="" pattern="1" />
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Foot" level="1" hidden="" height="3" page_break="" can_break="" pattern="1">
|
||||
<field border="1" y="0.25" deactivated="" type="Linea" hidden="" link="" dynamic_height="" shade_offset="" width="90" codval="" height="0" id="" pattern="1" hide_zero="" text="" />
|
||||
<field x="4" y="0.5" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="14" codval="" id="" pattern="1" hide_zero="" text="Totale Generale" />
|
||||
<field x="4" y="2" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="20" codval="" id="" pattern="1" hide_zero="" text="Totale Indetraibile" />
|
||||
<field x="19" y="0.5" deactivated="" type="Array" hidden="" link="" dynamic_height="" shade_offset="" width="5" codval="" id="100" pattern="1" hide_zero="" text="">
|
||||
<section type="Foot" pattern="1" />
|
||||
<section type="Foot" level="1" height="3" pattern="1">
|
||||
<field border="1" y="0.25" type="Linea" width="90" height="0" pattern="1" />
|
||||
<field x="4" y="0.5" type="Testo" width="14" pattern="1" text="Totale Generale" />
|
||||
<field x="4" y="2" type="Testo" width="20" pattern="1" text="Totale Indetraibile" />
|
||||
<field x="19" y="0.5" type="Array" width="5" id="100" pattern="1">
|
||||
<source>SEZIONE</source>
|
||||
<list>
|
||||
<li Value="Dare" Code="D" />
|
||||
<li Value="Avere" Code="A" />
|
||||
</list>
|
||||
</field>
|
||||
<field x="25" y="0.5" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="101" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="25" y="0.5" type="Valuta" align="right" width="15" id="101" pattern="1" text="###.###.###,@@">
|
||||
<prescript description="F1.101 PRESCRIPT">#THIS @
|
||||
0
|
||||
C;
|
||||
@ -172,7 +172,7 @@ ELSE
|
||||
THEN
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="40" y="0.5" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="102" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="40" y="0.5" type="Valuta" align="right" width="15" id="102" pattern="1" text="###.###.###,@@">
|
||||
<prescript description="F1.102 PRESCRIPT">#THIS @
|
||||
0
|
||||
C;
|
||||
@ -183,7 +183,7 @@ IF
|
||||
#THIS !
|
||||
THEN</prescript>
|
||||
</field>
|
||||
<field x="63" y="0.5" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="103" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="63" y="0.5" type="Valuta" align="right" width="15" id="103" pattern="1" text="###.###.###,@@">
|
||||
<prescript description="F1.103 PRESCRIPT">#THIS @
|
||||
0
|
||||
C;
|
||||
@ -194,8 +194,8 @@ IF
|
||||
#THIS !
|
||||
THEN</prescript>
|
||||
</field>
|
||||
<field x="25" y="2" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="201" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<prescript description="">#THIS @
|
||||
<field x="25" y="2" type="Valuta" align="right" width="15" id="201" pattern="1" text="###.###.###,@@">
|
||||
<prescript>#THIS @
|
||||
0
|
||||
C;
|
||||
IF
|
||||
@ -209,8 +209,8 @@ ELSE
|
||||
THEN
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="40" y="2" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="202" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<prescript description="">#THIS @
|
||||
<field x="40" y="2" type="Valuta" align="right" width="15" id="202" pattern="1" text="###.###.###,@@">
|
||||
<prescript>#THIS @
|
||||
0
|
||||
C;
|
||||
IF
|
||||
@ -221,8 +221,8 @@ IF
|
||||
THEN
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="63" y="2" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="203" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<prescript description="">#THIS @
|
||||
<field x="63" y="2" type="Valuta" align="right" width="15" id="203" pattern="1" text="###.###.###,@@">
|
||||
<prescript>#THIS @
|
||||
0
|
||||
C;
|
||||
IF
|
||||
@ -233,18 +233,18 @@ IF
|
||||
THEN</prescript>
|
||||
</field>
|
||||
</section>
|
||||
<section repeat="" keep_with_next="" deactivated="" hidden_if_needed="" type="Foot" level="2" hidden="" height="3" page_break="" can_break="" pattern="1">
|
||||
<field border="1" y="0.25" deactivated="" type="Linea" hidden="" link="" dynamic_height="" shade_offset="" width="90" codval="" height="0" id="" pattern="1" hide_zero="" text="" />
|
||||
<field x="5" y="0.5" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="10" codval="" id="" pattern="1" hide_zero="" text="Totale" />
|
||||
<field x="4" y="2" deactivated="" type="Testo" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="14" codval="" id="" pattern="1" hide_zero="" text="Indetraibile" />
|
||||
<field x="19" y="0.5" deactivated="" type="Array" hidden="" link="" dynamic_height="" shade_offset="" width="5" codval="" id="100" pattern="1" hide_zero="" text="">
|
||||
<section type="Foot" level="2" height="3" pattern="1">
|
||||
<field border="1" y="0.25" type="Linea" width="90" height="0" pattern="1" />
|
||||
<field x="5" y="0.5" type="Testo" width="10" pattern="1" text="Totale" />
|
||||
<field x="4" y="2" type="Testo" align="right" width="14" pattern="1" text="Indetraibile" />
|
||||
<field x="19" y="0.5" type="Array" width="5" id="100" pattern="1">
|
||||
<source>SEZIONE</source>
|
||||
<list>
|
||||
<li Value="Dare" Code="D" />
|
||||
<li Value="Avere" Code="A" />
|
||||
</list>
|
||||
</field>
|
||||
<field x="25" y="0.5" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="101" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="25" y="0.5" type="Valuta" align="right" width="15" id="101" pattern="1" text="###.###.###,@@">
|
||||
<prescript description="F2.101 PRESCRIPT">#THIS @
|
||||
0
|
||||
C;
|
||||
@ -270,7 +270,7 @@ THEN
|
||||
*
|
||||
#F1.101 +!</postscript>
|
||||
</field>
|
||||
<field x="40" y="0.5" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="102" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="40" y="0.5" type="Valuta" align="right" width="15" id="102" pattern="1" text="###.###.###,@@">
|
||||
<prescript description="F2.102 PRESCRIPT">#THIS @
|
||||
0
|
||||
C;
|
||||
@ -292,7 +292,7 @@ THEN
|
||||
*
|
||||
#F1.102 +!</postscript>
|
||||
</field>
|
||||
<field x="63" y="0.5" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="103" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<field x="63" y="0.5" type="Valuta" align="right" width="15" id="103" pattern="1" text="###.###.###,@@">
|
||||
<prescript description="F2.103 PRESCRIPT">#THIS @
|
||||
0
|
||||
C;
|
||||
@ -314,8 +314,8 @@ THEN
|
||||
*
|
||||
#F1.103 +!</postscript>
|
||||
</field>
|
||||
<field x="25" y="2" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="201" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<prescript description="">#THIS @
|
||||
<field x="25" y="2" type="Valuta" align="right" width="15" id="201" pattern="1" text="###.###.###,@@">
|
||||
<prescript>#THIS @
|
||||
0
|
||||
C;
|
||||
IF
|
||||
@ -328,7 +328,7 @@ ELSE
|
||||
"D" #100 !
|
||||
THEN
|
||||
</prescript>
|
||||
<postscript description="">#100 @
|
||||
<postscript>#100 @
|
||||
"A"
|
||||
=
|
||||
IF
|
||||
@ -340,8 +340,8 @@ THEN
|
||||
*
|
||||
#F1.201 +!</postscript>
|
||||
</field>
|
||||
<field x="40" y="2" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="202" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<prescript description="">#THIS @
|
||||
<field x="40" y="2" type="Valuta" align="right" width="15" id="202" pattern="1" text="###.###.###,@@">
|
||||
<prescript>#THIS @
|
||||
0
|
||||
C;
|
||||
IF
|
||||
@ -350,7 +350,7 @@ IF
|
||||
*
|
||||
#THIS !
|
||||
THEN</prescript>
|
||||
<postscript description="">#100 @
|
||||
<postscript>#100 @
|
||||
"A"
|
||||
=
|
||||
IF
|
||||
@ -362,8 +362,8 @@ THEN
|
||||
*
|
||||
#F1.202 +!</postscript>
|
||||
</field>
|
||||
<field x="63" y="2" deactivated="" type="Valuta" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="15" codval="" id="203" pattern="1" hide_zero="" text="###.###.###,@@">
|
||||
<prescript description="">#THIS @
|
||||
<field x="63" y="2" type="Valuta" align="right" width="15" id="203" pattern="1" text="###.###.###,@@">
|
||||
<prescript>#THIS @
|
||||
0
|
||||
C;
|
||||
IF
|
||||
@ -372,7 +372,7 @@ IF
|
||||
*
|
||||
#THIS !
|
||||
THEN</prescript>
|
||||
<postscript description="">#100 @
|
||||
<postscript>#100 @
|
||||
"A"
|
||||
=
|
||||
IF
|
||||
@ -385,9 +385,8 @@ THEN
|
||||
#F1.203 +!</postscript>
|
||||
</field>
|
||||
</section>
|
||||
<sql>USE IVADIFF KEY 4 SELECT (BETWEEN(DATAREGP,#DAL,#AL))(TIPOIVA==#TIPOIVA)(TIPODIFF==#TIPODIFF)(NUMPROE;0)((CHIUSA=#CHIUSA)||(#CHIUSA="T"))((CODIVA=#CODIVA)||(#CODIVA=""))
|
||||
JOIN MOV INTO NUMREG==NUMREG
|
||||
JOIN CLIFO TO MOV INTO TIPOCF==TIPO CODCF==CODCF
|
||||
FROM DATAREG=#FDAL
|
||||
TO DATAREG=#FAL</sql>
|
||||
<sql>USE IVADIFF SELECT (BETWEEN(DATAREGP,#DAL,#AL))(TIPOIVA==#TIPOIVA)(TIPODIFF==#TIPODIFF)(NUMPROE;0)((CHIUSA=#CHIUSA)||(#CHIUSA="T"))
|
||||
BY NUMREG DATAREGP NUMREGP
|
||||
JOIN MOV INTO NUMREG==NUMREG
|
||||
JOIN CLIFO TO MOV INTO TIPOCF==TIPO CODCF==CODCF</sql>
|
||||
</report>
|
@ -330,69 +330,8 @@ TApplication::~TApplication()
|
||||
SAFE_DELETE(_god_vars);
|
||||
}
|
||||
|
||||
const TString & logdir()
|
||||
{
|
||||
TString & name = get_tmp_string(1024);
|
||||
|
||||
name << firm2dir(prefix().get_codditta()) << "/log";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
const TString & logname()
|
||||
{
|
||||
TString & name = (TString &) logdir();
|
||||
|
||||
name << "/dblog.xml";
|
||||
return name;
|
||||
}
|
||||
const TString & rollname(const TDate & day)
|
||||
{
|
||||
TString & name = (TString &)logdir();
|
||||
|
||||
name << "/dblog" << day.date2ansi() << ".txt";
|
||||
return name;
|
||||
}
|
||||
|
||||
bool TApplication::create()
|
||||
{
|
||||
if (use_files())
|
||||
{
|
||||
TConfig c(CONFIG_STUDIO, "Main");
|
||||
|
||||
db_log(c.get("DBLog", "Main", -1, "off") == "on");
|
||||
|
||||
if (db_log())
|
||||
{
|
||||
TFilename logd = logdir();
|
||||
int roll_days = c.get_int("RollingDays", "Main", -1, 10);
|
||||
TDate oggi(TODAY);
|
||||
TDate lastroll(c.get("LastDate", "Main", -1, oggi.stringa()));
|
||||
TDate limit(lastroll);
|
||||
|
||||
if (!logd.exist())
|
||||
make_dir(logd);
|
||||
limit += roll_days;
|
||||
if (!lastroll.ok() || (limit <= oggi))
|
||||
{
|
||||
TSystemisamfile dblog(LF_DBLOG);
|
||||
TFilename roll = rollname(lastroll);
|
||||
TFilename logn = logname();
|
||||
|
||||
dblog.dump(roll);
|
||||
dblog.zap();
|
||||
if (logn.exist())
|
||||
{
|
||||
roll.ext("xml");
|
||||
rename(logn, roll);
|
||||
}
|
||||
c.set("LastDate", oggi.date2ansi());
|
||||
}
|
||||
}
|
||||
}
|
||||
TRACE("Create");
|
||||
return true;
|
||||
}
|
||||
{ return true; }
|
||||
|
||||
|
||||
bool TApplication::destroy()
|
||||
|
@ -107,8 +107,6 @@ protected:
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Visualizza il log
|
||||
virtual void show_log() {}
|
||||
// @cmember Fa partire l'applicazione
|
||||
void run(int argc, char* argv[], const char* name);
|
||||
|
||||
@ -206,10 +204,6 @@ public:
|
||||
virtual ~TApplication();
|
||||
};
|
||||
|
||||
const TString & logdir();
|
||||
const TString & logname();
|
||||
const TString & rollname(const TDate & day);
|
||||
|
||||
class TSkeleton_application : public TApplication
|
||||
{
|
||||
protected:
|
||||
|
@ -448,363 +448,7 @@ TAssoc_array & TAssoc_array::copy(const TAssoc_array & a) // @parm Array associa
|
||||
add(obj->key(), obj->obj(), TRUE);
|
||||
return * this;
|
||||
}
|
||||
////
|
||||
///
|
||||
///0
|
||||
|
||||
TArray& TIndexed_array::bucket(int index)
|
||||
{
|
||||
TArray* arr = (TArray*)_bucket.objptr(index);
|
||||
|
||||
if (arr == nullptr)
|
||||
{
|
||||
arr = new TArray;
|
||||
_bucket.add(arr, index);
|
||||
}
|
||||
return *arr;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Cerca l'oggetto con chiave <p k>
|
||||
//
|
||||
// @rdesc Ritorna l'oggetto corrispondente alla chiave passate come parametro.
|
||||
// <nl>Il parametro <p isnew> assume il valore TRUE se si tratta di un
|
||||
// nuovo oggetto.
|
||||
THash_key* TIndexed_array::_lookup(
|
||||
const char* k, // @parm Chiave da cercare
|
||||
bool& isnew, // @parm Viene assegnato TRUE se si tratta di una nuova chiave
|
||||
bool insert) // @parm Permette di inserire la chiave
|
||||
|
||||
// @comm Ricerca all'interno della tabella hash l'oggetto con la chiave <p k>,
|
||||
// nel caso non venga trovato <p isnew> ritorna TRUE (si tratta di un
|
||||
// oggetto nuovo) e viene inserito nella tabella se il parametro <p insert>
|
||||
// e' settato a TRUE.
|
||||
{
|
||||
const TFixed_string key(k);
|
||||
const word hv = key.hash() % HASH_SIZE;
|
||||
TArray& arr = bucket(hv);
|
||||
THash_key* o = nullptr;
|
||||
isnew = false;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < arr.items(); i++)
|
||||
{
|
||||
THash_key* ob = (THash_key*)arr.objptr(i);
|
||||
if (ob->_key == key)
|
||||
{
|
||||
o = ob; break;
|
||||
}
|
||||
if (ob->_key > key)
|
||||
break;
|
||||
}
|
||||
|
||||
if (o == nullptr)
|
||||
{
|
||||
if (insert)
|
||||
{
|
||||
o = new THash_key(key);
|
||||
arr.insert(o, i);
|
||||
}
|
||||
isnew = true;
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
bool TIndexed_array::add2index(const char* key, int index, bool force)
|
||||
{
|
||||
bool isnew = false;
|
||||
THash_key * key_object = _lookup(key, isnew, true);
|
||||
|
||||
isnew &= key_object != nullptr;
|
||||
if (isnew)
|
||||
key_object->_index = index;
|
||||
return key != nullptr && isnew;
|
||||
}
|
||||
|
||||
// @mfunc Copia tutto l'array e ne duplica gli elementi
|
||||
//
|
||||
TIndexed_array & TIndexed_array::copy(const TIndexed_array & a) // @parm Array associativo sorgente
|
||||
{
|
||||
TIndexed_array& from = (TIndexed_array&)a;
|
||||
|
||||
TArray::destroy();
|
||||
TArray::copy(from);
|
||||
FOR_EACH_ARRAY_ITEM(from, r, o)
|
||||
{
|
||||
THash_object & obj = *((THash_object *)o);
|
||||
|
||||
add2index(obj.key(), r, true);
|
||||
}
|
||||
restart();
|
||||
return *this;
|
||||
}
|
||||
|
||||
const char* TIndexed_array::class_name() const
|
||||
{
|
||||
return "Indexed array";
|
||||
}
|
||||
|
||||
|
||||
word TIndexed_array::class_id() const
|
||||
{
|
||||
return CLASS_INDEXED_ARRAY;
|
||||
}
|
||||
|
||||
bool TIndexed_array::is_kind_of(word id) const
|
||||
{
|
||||
return class_id() == CLASS_INDEXED_ARRAY || TArray::is_kind_of(id);
|
||||
}
|
||||
|
||||
#ifdef DBG
|
||||
TObject& TIndexed_array::operator[] (int index) const
|
||||
{
|
||||
THash_object * o = (THash_object *)TArray::objptr(index);
|
||||
|
||||
if (o == nullptr)
|
||||
fatal_box("Can't access NULL array item %d of %d", index, size());
|
||||
return o->obj();
|
||||
}
|
||||
#endif
|
||||
|
||||
void TIndexed_array::destroy()
|
||||
{
|
||||
TArray::destroy();
|
||||
_bucket.destroy();
|
||||
_row = _col = 0;
|
||||
_rowitem = _colitem = 0;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Aggiunge un oggetto all'array.
|
||||
// @rdesc Ritorna TRUE se esisteva gia' un elemento con la stessa chiave
|
||||
bool TIndexed_array::add(
|
||||
const char* key, // @parm Chiave d'ordinamento
|
||||
TObject* obj, // @parm Oggetto da inserire (default=nullptr)
|
||||
bool force) // @parm Permette di forzare l'inserimento se esiste gia'
|
||||
// un oggetto con la stessa chiave
|
||||
|
||||
// @parm const TObject | &obj | Indirizzo dell'oggetto da aggiungere
|
||||
//
|
||||
// @syntax add(const char* key, TObject* obj, bool force)
|
||||
// @syntax add(const char* key, const TObject& obj, bool force)
|
||||
//
|
||||
// @comm Se l'oggetto da aggiungere esite gia' la chiave guarda il parametro <p force>:
|
||||
// <nl>se <p force> = TRUE lo sostituisce e ritorna TRUE,
|
||||
// <nl>se <p force> = FALSE non sostituisce e ritorna TRUE,
|
||||
// <nl>altrimenti ritorna FALSE.
|
||||
// <nl><nl>Nel caso l'oggetto da aggiungere venga passato per indirizzo
|
||||
// la funzione aggiunge una copia dell'oggetto e quindi deve essere
|
||||
// definita <mf TObject::dup>
|
||||
{
|
||||
bool isnew = false;
|
||||
THash_key* o = _lookup(key, isnew, true);
|
||||
|
||||
isnew |= force;
|
||||
if (isnew)
|
||||
{
|
||||
const int index = TArray::add(o); // ??
|
||||
|
||||
o->_index = index;
|
||||
}
|
||||
return isnew;
|
||||
}
|
||||
|
||||
bool TIndexed_array::add(const char* key, const TObject& obj, bool force)
|
||||
{
|
||||
bool isnew = false;
|
||||
THash_key * o = _lookup(key, isnew, true);
|
||||
|
||||
isnew |= force;
|
||||
if (isnew)
|
||||
{
|
||||
const int index = TArray::add(obj.dup());
|
||||
|
||||
o->_index = index;
|
||||
}
|
||||
return isnew;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Elimina un oggetto.
|
||||
// @rdesc Ritorna il risultato dell'operazione
|
||||
//
|
||||
// @flag TRUE | Eliminazione avvenuta
|
||||
// @flag FALSE | L'oggetto non e' stato trovato
|
||||
bool TIndexed_array::remove(
|
||||
const char* k) // @parm Chiave dell'oggetto da eliminare
|
||||
|
||||
// @comm Cerca nella tabella hash l'oggetto con chiave <p k> e lo elimina.
|
||||
|
||||
{
|
||||
const TFixed_string key(k);
|
||||
const word hv = key.hash() % HASH_SIZE;
|
||||
TArray& arr = bucket(hv);
|
||||
THash_object* o = nullptr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < arr.items(); i++)
|
||||
{
|
||||
THash_object* ob = (THash_object*)&arr[i];
|
||||
if (ob->key() == key)
|
||||
{
|
||||
o = ob; break;
|
||||
}
|
||||
if (ob->key() > key)
|
||||
break;
|
||||
}
|
||||
if (o != nullptr)
|
||||
{
|
||||
arr.destroy(i, true);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Trova l'oggetto indicizzato
|
||||
//
|
||||
// @rdesc Ritorna l'oggetto cercato. Se l'oggetto non viene trovato
|
||||
// ritorna un errore
|
||||
TObject& TIndexed_array::find(
|
||||
const char* key) const // @parm Chiave dell'oggetto da trovare
|
||||
|
||||
|
||||
// @comm Cerca l'oggetto indicizzato con chiave <p key>. Viene controllato se
|
||||
// non c'e' (normalmente si usa operator[key])
|
||||
{
|
||||
TObject* o = objptr(key);
|
||||
|
||||
CHECKS(o, "Can't find hash object with key ", key);
|
||||
return *o;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Ritorna l'oggetto con chiave <p key>
|
||||
// @rdesc Se l'oggetto esiste ne ritorna il puntatore, altrimenti ritorna nullptr
|
||||
TObject* TIndexed_array::objptr(
|
||||
const char* key) const // @parm Chiave dell'oggetto da ritornare
|
||||
{
|
||||
bool isnew = false;
|
||||
THash_key * k = ((TIndexed_array*)this)->_lookup(key, isnew);
|
||||
|
||||
if (k != nullptr)
|
||||
{
|
||||
THash_object * o = (THash_object *)TArray::objptr(k->index());
|
||||
|
||||
return o ? o->_obj : nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Controlla l'esistenza di una chiave
|
||||
//
|
||||
// @rdesc Ritorna il risultato della ricerca
|
||||
//
|
||||
// @flag TRUE | Se la chiave esiste
|
||||
// @flag FALSE | Se la chiave non esiste
|
||||
bool TIndexed_array::is_key(
|
||||
const char* key) const // @parm Chiave di cui cercare l'esistenza
|
||||
{
|
||||
bool isnew = false;
|
||||
THash_key* o = ((TIndexed_array *)this)->_lookup(key, isnew);
|
||||
|
||||
return o != nullptr;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Ritorna solo l'oggetto
|
||||
//
|
||||
// @rdesc Ritorna il puntatore all'oggetto (se diverso da nullptr), altrimenti
|
||||
// ritorna error object
|
||||
TObject* TIndexed_array::get()
|
||||
// @xref <mf TAssoc_array::get_hashobj>
|
||||
{
|
||||
const TArray* arr = (const TArray*)_bucket.objptr(_row);
|
||||
while (_row < HASH_SIZE)
|
||||
{
|
||||
if (arr && (int)_col < arr->items())
|
||||
break;
|
||||
_row = _bucket.succ(_row);
|
||||
arr = (const TArray*)_bucket.objptr(_row);
|
||||
_col = 0;
|
||||
}
|
||||
if (_row >= HASH_SIZE)
|
||||
{
|
||||
_row = 0;
|
||||
return nullptr;
|
||||
}
|
||||
THash_object* o = (THash_object*)arr->objptr(_col++);
|
||||
return (o == nullptr || o->_obj == nullptr) ? &error_object : o->_obj;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Ritorna l'oggetto e la relativa chiave
|
||||
//
|
||||
// @rdesc Se l'oggetto esiste ne ritorna il puntatore, altrimenti ritorna nullptr
|
||||
THash_key* TIndexed_array::get_hashkey()
|
||||
|
||||
// @comm Se l'oggetto viene trovato viene richiamata la funzione
|
||||
// <mf TAssoc_array::objptr>
|
||||
//
|
||||
// @xref <mf TAssoc_array::get>
|
||||
{
|
||||
const TArray* arr = (const TArray*)_bucket.objptr(_row);
|
||||
|
||||
while (_row < HASH_SIZE)
|
||||
{
|
||||
if (arr && (int)_col < arr->items())
|
||||
break;
|
||||
_row = _bucket.succ(_row);
|
||||
arr = (const TArray*)_bucket.objptr(_row);
|
||||
_col = 0;
|
||||
}
|
||||
if (_row >= HASH_SIZE)
|
||||
{
|
||||
_row = 0;
|
||||
return nullptr;
|
||||
}
|
||||
return (THash_key*)arr->objptr(_col++);
|
||||
}
|
||||
|
||||
const TString& TIndexed_array::get_str(const char* key) const
|
||||
{
|
||||
bool isnew = false;
|
||||
THash_key* k = ((TIndexed_array *)this)->_lookup(key, isnew);
|
||||
|
||||
if (k != nullptr)
|
||||
{
|
||||
THash_object * o = (THash_object *) TArray::objptr(k->index());
|
||||
|
||||
if (o != nullptr && o->obj().is_kind_of(CLASS_STRING))
|
||||
return (const TString&)o->obj();
|
||||
}
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
bool TIndexed_array::get_bool(const char* key) const
|
||||
{
|
||||
const TString& str = get_str(key);
|
||||
return str.full() && strchr("1XY", str[0]) != nullptr;
|
||||
}
|
||||
|
||||
int TIndexed_array::get_int(const char* key) const
|
||||
{
|
||||
const TString& str = get_str(key);
|
||||
return str.full() ? atoi(str) : 0;
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCache
|
||||
|
@ -20,8 +20,6 @@ class THash_object : public TObject
|
||||
{
|
||||
// @cfriend TAssoc_array
|
||||
friend class TAssoc_array;
|
||||
// @cfriend TIndexed_array
|
||||
friend class TIndexed_array;
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
|
||||
@ -167,162 +165,6 @@ public:
|
||||
{ destroy(); }
|
||||
};
|
||||
|
||||
class THash_key : public TObject
|
||||
// @author:(INTERNAL) Villa
|
||||
{
|
||||
// @cfriend TAssoc_array
|
||||
friend class TIndexed_array;
|
||||
|
||||
// @access:(INTERNAL) Private Member
|
||||
|
||||
// @cmember:(INTERNAL) Chiave d'ordinamento
|
||||
TString _key;
|
||||
// @cmember:(INTERNAL) indice
|
||||
int _index;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Ritorna la chiave di ordinamento
|
||||
const TString& key() const { return _key; }
|
||||
// @cmember Ritorna l'oggetto
|
||||
int index() const { return _index; }
|
||||
|
||||
// @cmember Costruttore (inizializza la chiave ed opzionalmente l'oggetto)
|
||||
THash_key(const char* k, int index = -1) : _key(k), _index(index) {}
|
||||
// @cmember Distruttore
|
||||
virtual ~THash_key() {}
|
||||
};
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TIndexed_array | Array con indice hash
|
||||
//
|
||||
// @base public |TObject
|
||||
|
||||
class TIndexed_array : public TArray
|
||||
|
||||
// @author:(INTERNAL) Villa
|
||||
|
||||
//@access:(INTERNAL) Private Member
|
||||
{
|
||||
// @cmember:(INTERNAL) Numero di righe della tabella hash
|
||||
word _row;
|
||||
// @cmember:(INTERNAL) Numero di colonne della tabella hash
|
||||
word _col;
|
||||
// @cmember:(INTERNAL) Numero di righe della tabella hash per i metodi _item
|
||||
int _rowitem;
|
||||
// @cmember:(INTERNAL) Numero di colonne della tabella hash per i metodi _item
|
||||
int _colitem;
|
||||
// @cmember:(INTERNAL) Array contenente i dati veri e propri
|
||||
TArray _bucket;
|
||||
|
||||
// @access Protected member
|
||||
protected:
|
||||
TArray& bucket(int index); // ok
|
||||
// @cmember Azzera il numero di riga e colonna corrente della tabella hash
|
||||
void restart() { _row = 0; _col = 0; } //ok
|
||||
|
||||
// @cmember Cerca l'oggetto con chiave k
|
||||
THash_key * _lookup(const char* k, bool& isnew, bool insert = false); //ok
|
||||
// @cmember aggiunge la chiave all'indice
|
||||
bool add2index(const char* key, int index = -1, bool force = false); //ok
|
||||
// @cmember Copia tutto l'array associativo e ne duplica gli elementi
|
||||
TIndexed_array & copy(const TIndexed_array & a); //ok
|
||||
|
||||
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Duplica l'array associativo copiandone gli elementi.
|
||||
virtual TObject* dup() const { return new TIndexed_array(*this); } // ok
|
||||
|
||||
// @cmember Ritorna il nome della classe
|
||||
virtual const char* class_name() const; // ok
|
||||
// @cmember Ritorna l'id della class
|
||||
virtual word class_id() const; // ok
|
||||
// @cmember Controlla se si tratta di un oggetto derivato da TArray
|
||||
virtual bool is_kind_of(word cid) const; //ok
|
||||
|
||||
// @cmember Ritorna l'oggetto nella posizione index
|
||||
TObject& operator[] (int index) const; // ok
|
||||
// @cmember Ritorna l'oggetto nella posizione index
|
||||
virtual TObject* objptr(int index) const; // ok
|
||||
|
||||
//qui
|
||||
// @cmember Rimuove uno o tutti (default) gli elementi
|
||||
virtual bool destroy(int index = -1, bool pack = false);
|
||||
// @cmember Aggiunge un oggetto ad un array.
|
||||
virtual int add(TObject* obj, int index = -1) { CHECK(false, "Must specifiy a key"); }
|
||||
// @cmember Inserisce un elemento dell'array nella posizione index
|
||||
virtual int insert(TObject* obj, int index = 0, bool force = false) { CHECK(false, "Must specifiy a key"); }
|
||||
|
||||
// @cmember Aggiunge un oggetto all'array. L'oggetto viene duplicato
|
||||
virtual int add(const TObject& object, int index = -1) { CHECK(false, "Must specifiy a key"); }
|
||||
// @cmember Inserisce un oggetto alla posizione index
|
||||
virtual int insert(const TObject& object, int index = 0, bool force = false) { CHECK(false, "Must specifiy a key"); }
|
||||
// @cmember Elimina l'elemento nella posizione index dell'array
|
||||
TObject* remove(int index, bool pack = false);
|
||||
// @cmember Elimina l'elemento nella posizione index dell'array
|
||||
TObject* remove_item(bool pack = false);
|
||||
// @cmember Scambia di posto due elementi dell'array
|
||||
void swap(int i1, int i2);
|
||||
// @cmember Rende contigui tutti gli elementi non nulli
|
||||
virtual void pack();
|
||||
// @cmember Cancella tutti gli elementi
|
||||
virtual void destroy();
|
||||
|
||||
// @cmember Aggiunge un oggetto. Se era gia' presente guarda il parametro force
|
||||
bool add(const char* key, TObject* obj = nullptr, bool force = false); //ok
|
||||
|
||||
// @cmember Aggiunge una copia dell'oggetto
|
||||
bool add(const char* key, const TObject& obj, bool force = false); //ok
|
||||
|
||||
// @cmember Elimina un oggetto
|
||||
bool remove(const char* key);
|
||||
|
||||
// @cmember Controlla l'esistenza di una chiave
|
||||
bool is_key(const char* key) const;
|
||||
|
||||
// @cmember Ritorna l'oggetto con chiave key
|
||||
TObject* objptr(const char* key) const;
|
||||
|
||||
// @cmember Trova l'oggetto indicizzato
|
||||
TObject& find(const char* key) const;
|
||||
|
||||
// @cmember Ritorna l'indice del oggetto con chiave key (piu' intuitivo di <mf TAssoc_array::find>)
|
||||
TObject& operator[] (const char* key) const { return find(key); }
|
||||
|
||||
// @cmember Ritorna solo l'oggetto
|
||||
TObject* get();
|
||||
// @cmember Ritorna l'oggetto e la relativa chiave
|
||||
THash_key* get_hashkey(); // ok
|
||||
|
||||
bool get_bool(const char* key) const;
|
||||
int get_int(const char* key) const;
|
||||
const TString& get_str(const char* key) const;
|
||||
|
||||
// @cmember Operatore di assegnamento tra array indicizzati
|
||||
TIndexed_array& operator= (const TIndexed_array & a) { return copy(a); }
|
||||
|
||||
// @cmember Costruttori
|
||||
TIndexed_array(int arraysize) : TArray(arraysize), _row(0), _col(0) {}
|
||||
TIndexed_array() : _row(0), _col(0) {}
|
||||
// @cmember Costruttore. Copia tutto l'array indicizzato e ne duplica gli elementi
|
||||
TIndexed_array(const TIndexed_array& a) : _row(0), _col(0) { copy(a);}
|
||||
// @cmember Distruttore
|
||||
virtual ~TIndexed_array() {}
|
||||
};
|
||||
|
||||
inline TObject* TIndexed_array::objptr(int index) const
|
||||
{
|
||||
THash_object * o = (THash_object *) TArray::objptr(index);
|
||||
|
||||
return (o) ? &(o->obj()) : nullptr;
|
||||
}
|
||||
|
||||
#ifndef DBG
|
||||
inline TObject& TArray::operator[] (int index) const { return ((THash_obj*)objptr(index))->obj();}
|
||||
#endif
|
||||
class TCache : public TObject
|
||||
{
|
||||
TArray _data;
|
||||
|
@ -19,7 +19,6 @@ BEGIN
|
||||
PICTURE TOOL_DELREC
|
||||
END
|
||||
|
||||
|
||||
BUTTON DLG_NULL 2 2
|
||||
BEGIN
|
||||
PROMPT -1 1 ""
|
||||
@ -27,10 +26,3 @@ BEGIN
|
||||
END
|
||||
|
||||
#include <navbar.h>
|
||||
|
||||
BUTTON DLG_LOG 2 2
|
||||
BEGIN
|
||||
PROMPT 3 1 "~Log"
|
||||
|
||||
PICTURE TOOL_PREVIEW
|
||||
END
|
@ -1,7 +1,6 @@
|
||||
#define __ISAM_CPP
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
|
||||
#include <applicat.h>
|
||||
#include <config.h>
|
||||
#include <dblog.h>
|
||||
#include <execp.h>
|
||||
@ -19,7 +18,6 @@
|
||||
#include <utility.h>
|
||||
#include <tabutil.h>
|
||||
#include <varrec.h>
|
||||
#include <xml.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
@ -444,7 +442,7 @@ HIDDEN void browse_null(char *start, int nc)
|
||||
|
||||
// Traduce l'espressione chiave di CodeBase
|
||||
|
||||
HIDDEN int __build_key(const RecDes& recd, int numkey, const RecType recin, char *key, bool build_x_cb, bool token = false)
|
||||
HIDDEN int __build_key(const RecDes& recd, int numkey, const RecType recin, char *key, bool build_x_cb)
|
||||
/* *recd; descrittore record */
|
||||
/* numkey; numero chiave */
|
||||
/* recin; buffer contenente il record */
|
||||
@ -511,8 +509,6 @@ HIDDEN int __build_key(const RecDes& recd, int numkey, const RecType recin, cha
|
||||
key[i] = toupper(key[i]);
|
||||
|
||||
l += len;
|
||||
if (!build_x_cb && token && i < recd.Ky[numkey].NkFields - 1)
|
||||
key[l++] = '|';
|
||||
}
|
||||
|
||||
// rtrim
|
||||
@ -887,7 +883,6 @@ int TBaseisamfile::_read(TRectype& rec, word op, word lockop)
|
||||
prefix().lock_record(_isam_handle, _recno); else
|
||||
if (lockop == _unlock)
|
||||
prefix().unlock_record(_isam_handle, _recno);
|
||||
_current->clear_modified_fields();
|
||||
}
|
||||
|
||||
return _lasterr;
|
||||
@ -922,221 +917,19 @@ int TBaseisamfile::_readat(TRectype& rec, TRecnotype nrec, word lockop)
|
||||
if (_lasterr != NOERR)
|
||||
_lasterr = get_error(_lasterr);
|
||||
else
|
||||
{
|
||||
rec = (const char*)DB_getrecord(fhnd);
|
||||
_current->clear_modified_fields();
|
||||
}
|
||||
_recno = DB_recno(fhnd);
|
||||
if (rec.has_memo())
|
||||
rec.init_memo(_recno, _isam_handle);
|
||||
return _lasterr;
|
||||
}
|
||||
|
||||
bool __db_log = false;
|
||||
|
||||
void db_log(const bool on)
|
||||
{
|
||||
__db_log = on;
|
||||
}
|
||||
|
||||
bool db_log() { return is_debug_station() && __db_log; }
|
||||
bool to_db_log(int logic) { return db_log() && logic != LF_DBLOG && logic != LF_USER; }
|
||||
void db_log_on() { db_log(true); }
|
||||
void db_log_off() { db_log(false); }
|
||||
|
||||
TLocalisamfile * __dblog = NULL;
|
||||
TXmlItem * __root = NULL;
|
||||
|
||||
bool TBaseisamfile::writelog(const db_op op, TRectype & rec, TRectype * act_rec, int fhnd)
|
||||
{
|
||||
bool changed = false;
|
||||
const struct tm * timeloc = xvt_time_now();
|
||||
time_t timestamp = time(NULL);
|
||||
TString trans("DBtrans");
|
||||
TString80 user = ::user();
|
||||
int year;
|
||||
int release;
|
||||
int tag;
|
||||
int patch;
|
||||
TDate date(timeloc->tm_mday, timeloc->tm_mon + 1, timeloc->tm_year + 1900);
|
||||
TString time;
|
||||
TFilename cmdline(main_app().argv(0));
|
||||
TString80 s;
|
||||
|
||||
if (__dblog == NULL)
|
||||
__dblog = new TLocalisamfile(LF_DBLOG);
|
||||
|
||||
const int len = __dblog->curr().length(DBL_USER);
|
||||
|
||||
xvt_sys_get_user_name(s.get_buffer(), s.size());
|
||||
|
||||
const int at = s.find('@');
|
||||
|
||||
if (at > 0)
|
||||
s.cut(at); // Windows 8.1 / 10.0 user profile
|
||||
if (user.len() + s.len() + 1 <= len)
|
||||
user << ':' << s;
|
||||
xvt_sys_get_host_name(s.get_buffer(), s.size());
|
||||
if (user.len() + s.len() + 1 <= len)
|
||||
user << '@' << s;
|
||||
|
||||
TApplication::get_version_info(year, release, tag, patch);
|
||||
|
||||
__dblog->zero();
|
||||
if (__root == NULL)
|
||||
__root = new TXmlItem;
|
||||
__root->Destroy();
|
||||
|
||||
cmdline = cmdline.name_only();
|
||||
for (int i = 1; i < main_app().argc(); i++)
|
||||
cmdline << ' ' << main_app().argv(i);
|
||||
time.format("%02d:%02d:%02d", timeloc->tm_hour, timeloc->tm_min, timeloc->tm_sec);
|
||||
|
||||
__root->SetTag(trans);
|
||||
|
||||
__dblog->put(DBL_CMDLINE, cmdline);
|
||||
__dblog->put(DBL_ANNO, year);
|
||||
__dblog->put(DBL_RELEASE, release);
|
||||
__dblog->put(DBL_TAG, tag);
|
||||
__dblog->put(DBL_PATCH, patch);
|
||||
__root->SetAttr("cmdline", cmdline);
|
||||
__root->SetAttr("year", year);
|
||||
__root->SetAttr("release", release);
|
||||
__root->SetAttr("tag", tag);
|
||||
__root->SetAttr("patch", patch);
|
||||
|
||||
TXmlItem & head = __root->AddChild("Head");
|
||||
|
||||
__dblog->put(DBL_CMD, op);
|
||||
__dblog->put(DBL_FILE, _logicnum);
|
||||
__dblog->put(DBL_RECNO, _recno);
|
||||
__dblog->put(DBL_USER, user);
|
||||
__dblog->put(DBL_SESSION, xvt_sys_get_session_id());
|
||||
__dblog->put(DBL_DATA, date);
|
||||
__dblog->put(DBL_ORA, time);
|
||||
__dblog->put(DBL_TIMESTAMP, (long)timestamp);
|
||||
head.SetAttr("cmd", op);
|
||||
head.SetAttr("file", _logicnum);
|
||||
head.SetAttr("recno", _recno);
|
||||
head.SetAttr("user", user);
|
||||
head.SetAttr("session", xvt_sys_get_session_id());
|
||||
head.SetAttr("data", date.date2ansi());
|
||||
head.SetAttr("ora", time);
|
||||
head.SetAttr("timestamp", (long) timestamp);
|
||||
|
||||
TXmlItem & key = __root->AddChild("key");
|
||||
|
||||
for (byte i = 0; i < rec.rec_des().Ky[0].NkFields; i++)
|
||||
{
|
||||
const char * keyfieldname = rec.rec_des().Fd[rec.rec_des().Ky[0].FieldSeq[i]].Name;
|
||||
const TString & value = rec.get(keyfieldname);
|
||||
TXmlItem & field = key.AddChild("field");
|
||||
|
||||
field.SetAttr(keyfieldname, value);
|
||||
}
|
||||
__dblog->put(DBL_KEY, rec.key_token());
|
||||
|
||||
TXmlItem & data = __root->AddChild("data");
|
||||
|
||||
if (op != db_remove)
|
||||
{
|
||||
for (byte i = 0; i < rec.rec_des().NFields; i++)
|
||||
{
|
||||
const TString16 fieldname(rec.rec_des().Fd[i].Name);
|
||||
TString value = rec.get_modified_field(i);
|
||||
|
||||
if (op == db_add)
|
||||
{
|
||||
TXmlItem & field = data.AddChild("field");
|
||||
|
||||
field.SetAttr(fieldname, value);
|
||||
changed = true;
|
||||
}
|
||||
else
|
||||
if (rec.field_modified(i))
|
||||
{
|
||||
bool fchanged = false;
|
||||
|
||||
switch (TFieldtypes(rec.rec_des().Fd[i].TypeF))
|
||||
{
|
||||
case _nullfld: // @emem Campo non definito
|
||||
break;
|
||||
case _alfafld: // @emem Campo di tipo alfanumerico
|
||||
fchanged = act_rec->get(fieldname) != value.trim();
|
||||
break;
|
||||
case _intfld: // @emem Campo di tipo intero
|
||||
fchanged = act_rec->get_int(fieldname) != atoi(value);
|
||||
break;
|
||||
case _longfld: // @emem Campo di tipo intero lungo
|
||||
fchanged = act_rec->get_long(fieldname) != atol(value);
|
||||
break;
|
||||
case _realfld: // @emem Campo di tipo reale (vedi <c real>)
|
||||
fchanged = act_rec->get_real(fieldname) != real(value);
|
||||
break;
|
||||
case _datefld: // @emem Campo di tipo data (vedi <c TDate>)
|
||||
fchanged = act_rec->get_date(fieldname) != TDate(value);
|
||||
break;
|
||||
case _wordfld: // @emem Campo di tipo intero senza segno
|
||||
fchanged = act_rec->get_long(fieldname) != atol(value);
|
||||
break;
|
||||
case _charfld: // @emem Campo di tipo carattere
|
||||
fchanged = act_rec->get_char(fieldname) != value[0];
|
||||
break;
|
||||
case _boolfld: // @emem Campo di tipo booleano
|
||||
{
|
||||
const bool b = (value.full() && strchr("1STXY", toupper(value[0])) != NULL) ? true : false;
|
||||
const bool b1 = act_rec->get_bool(fieldname);
|
||||
|
||||
fchanged = b ^ b1;
|
||||
}
|
||||
break;
|
||||
case _intzerofld: // @emem Campo ditipo intero zero filled
|
||||
fchanged = act_rec->get_int(fieldname) != atoi(value);
|
||||
break;
|
||||
case _longzerofld: // @emem Campo di tipo intero lungo zero filled
|
||||
fchanged = act_rec->get_long(fieldname) != atol(value);
|
||||
break;
|
||||
case _memofld:
|
||||
fchanged = true;
|
||||
default:
|
||||
break;
|
||||
}; // @emem Campo di tipo memo
|
||||
if (fchanged)
|
||||
{
|
||||
TXmlItem & field = data.AddChild("field");
|
||||
|
||||
changed = true;
|
||||
field.SetAttr(fieldname, value);
|
||||
if (rec.preserve_values() && act_rec != NULL)
|
||||
act_rec->put(fieldname, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
changed = true;
|
||||
if (changed)
|
||||
{
|
||||
TString trans;
|
||||
|
||||
__root->AsString(trans);
|
||||
__dblog->put(DBL_TRANS, trans);
|
||||
// __dblog->write();
|
||||
// __root->Append(logname);
|
||||
if (rec.preserve_values() &&(op == db_update) && (act_rec != NULL))
|
||||
rec.TRectype::operator =(*act_rec);
|
||||
}
|
||||
rec.clear_modified_fields();
|
||||
return changed;
|
||||
}
|
||||
|
||||
int TBaseisamfile::_write(const TRectype& rec)
|
||||
{
|
||||
CHECK(!rec.empty(), "Can't write an empty record");
|
||||
|
||||
// Controlla che la chiave sia piena
|
||||
TString & key = get_tmp_string(384);
|
||||
TString256 key;
|
||||
|
||||
__build_key(rec.rec_des(), 1, rec.string(), key.get_buffer(), true);
|
||||
if (key.blank())
|
||||
@ -1155,23 +948,13 @@ int TBaseisamfile::_write(const TRectype& rec)
|
||||
|
||||
browse_null(rec.string(), dst_len);
|
||||
memcpy(DB_getrecord(fhnd), rec.string(), dst_len);
|
||||
bool changed = false;
|
||||
|
||||
if (to_db_log(_logicnum))
|
||||
changed = writelog(db_add, (TRectype&)rec, NULL, fhnd);
|
||||
_lasterr = DB_add(fhnd);
|
||||
_recno = DB_recno(fhnd);
|
||||
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
if (changed && to_db_log(_logicnum))
|
||||
{
|
||||
__dblog->write();
|
||||
__root->Append(logname());
|
||||
}
|
||||
if (rec.has_memo())
|
||||
((TRectype&)rec).write_memo(_isam_handle, _recno );
|
||||
if (_logicnum < 1000)
|
||||
rec_cache(_logicnum).notify_change();
|
||||
|
||||
}
|
||||
@ -1214,40 +997,27 @@ int TBaseisamfile::rewrite_write()
|
||||
int TBaseisamfile::_rewrite(const TRectype& rec)
|
||||
{
|
||||
CHECK(!rec.empty(), "Can't write an empty record");
|
||||
TAuto_variable_rectype act_rec(rec);
|
||||
bool changed = false;
|
||||
|
||||
// Forza l'uso della chiave principale (per chiavi duplicate?)
|
||||
TRectype save_rec(rec);
|
||||
|
||||
const int fhnd = handle(1);
|
||||
while ((_lasterr = cisread(fhnd, 1, act_rec, _isequal + _testandlock, _recno)) == _islocked) ;// Si Posiziona e locca per sicurezza...
|
||||
_lasterr = cisread(fhnd, 1, save_rec, _isequal + _nolock, _recno); // Si Posiziona per sicurezza...
|
||||
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
const int len = DB_reclen(fhnd);
|
||||
if (len != act_rec.len())
|
||||
if (len != save_rec.len())
|
||||
NFCHECK("Record size mismatch on file %d: RecDes=%d, DB_reclen=%d",
|
||||
_logicnum, act_rec.len(), len);
|
||||
_logicnum, save_rec.len(), len);
|
||||
|
||||
browse_null(rec.string(), len);
|
||||
|
||||
|
||||
if (to_db_log(_logicnum))
|
||||
changed = writelog(db_update, (TRectype &)rec, &act_rec, fhnd);
|
||||
else
|
||||
changed = memcmp(rec.string(), act_rec.string(), len) != 0;
|
||||
if (changed)
|
||||
if (memcmp(rec.string(), save_rec.string(), len) != 0)
|
||||
{
|
||||
memcpy(DB_getrecord(fhnd), rec.string(), len);
|
||||
_lasterr = DB_rewrite(fhnd);
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
if (to_db_log(_logicnum))
|
||||
{
|
||||
__dblog->write();
|
||||
__root->Append(logname());
|
||||
}
|
||||
}
|
||||
rec_cache(_logicnum).notify_change();
|
||||
else
|
||||
_lasterr = get_error(_lasterr);
|
||||
}
|
||||
@ -1264,7 +1034,7 @@ int TBaseisamfile::_rewrite(const TRectype& rec)
|
||||
if (changed)
|
||||
((TRectype&)rec).write_memo(_isam_handle, _recno);
|
||||
}
|
||||
if (changed && _logicnum < 1000)
|
||||
if (changed)
|
||||
rec_cache(_logicnum).notify_change();
|
||||
}
|
||||
}
|
||||
@ -1288,30 +1058,10 @@ int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec)
|
||||
|
||||
if ((_lasterr=DB_go(fhnd,nrec))== NOERR)
|
||||
{
|
||||
TRectype save_rec(rec);
|
||||
const int len = DB_reclen(fhnd);
|
||||
|
||||
memcpy(DB_getrecord(fhnd), save_rec.string(), len);
|
||||
browse_null(rec.string(),DB_reclen(fhnd));
|
||||
if (to_db_log(_logicnum))
|
||||
changed = writelog(db_update, (TRectype &)rec, &save_rec, fhnd);
|
||||
else
|
||||
changed = memcmp(rec.string(), save_rec.string(), len) != 0 ;
|
||||
if (changed)
|
||||
{
|
||||
memcpy(DB_getrecord(fhnd), rec.string(), DB_reclen(fhnd));
|
||||
_lasterr = DB_rewrite(fhnd);
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
if (to_db_log(_logicnum))
|
||||
{
|
||||
__dblog->write();
|
||||
__root->Append(logname());
|
||||
}
|
||||
}
|
||||
else
|
||||
_lasterr = get_error(_lasterr);
|
||||
}
|
||||
memcpy(DB_getrecord(fhnd),rec.string(),DB_reclen(fhnd));
|
||||
_lasterr=DB_rewrite(fhnd);
|
||||
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
|
||||
}
|
||||
else
|
||||
_lasterr = get_error(_lasterr);
|
||||
@ -1326,7 +1076,7 @@ int TBaseisamfile::rewriteat(const TRectype& rec, TRecnotype nrec)
|
||||
if (changed)
|
||||
((TRectype&)rec).write_memo(_isam_handle, _recno);
|
||||
}
|
||||
if (changed && _logicnum < 1000)
|
||||
if (changed)
|
||||
rec_cache(_logicnum).notify_change();
|
||||
}
|
||||
return _lasterr;
|
||||
@ -1348,21 +1098,11 @@ int TBaseisamfile::_remove(const TRectype& rec)
|
||||
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
if (to_db_log(_logicnum))
|
||||
writelog(db_remove, (TRectype &) rec, NULL, fhnd);
|
||||
_lasterr = DB_delete(fhnd); // Put only deletion flag on record, must remove keys too!
|
||||
if (_lasterr == NOERR)
|
||||
{
|
||||
if (changed && to_db_log(_logicnum))
|
||||
{
|
||||
__dblog->write();
|
||||
__root->Append(logname());
|
||||
}
|
||||
if (curr().has_memo( ))
|
||||
curr().init_memo();
|
||||
if (_logicnum < 1000)
|
||||
rec_cache(_logicnum).notify_change();
|
||||
DB_flush(fhnd);
|
||||
}
|
||||
@ -2758,15 +2498,6 @@ int TSystemisamfile::load(
|
||||
const int l = fldlen.get_int(j);
|
||||
s1 = s.mid(pos, l);
|
||||
s1.rtrim();
|
||||
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
|
||||
if (t == _alfafld || t == _memofld)
|
||||
{
|
||||
TString s2 = s1;
|
||||
|
||||
s1 = esc(s2);
|
||||
}
|
||||
put(fld.row(j), s1);
|
||||
pos += l;
|
||||
}
|
||||
@ -2779,6 +2510,7 @@ int TSystemisamfile::load(
|
||||
s1 = s.get();
|
||||
if (fd)
|
||||
{
|
||||
s1.rtrim(1);
|
||||
s1.ltrim(1);
|
||||
}
|
||||
const TFieldtypes t = curr().type((const TString&)fld[j]);
|
||||
@ -3549,8 +3281,6 @@ void TRectype::init(int logicnum)
|
||||
|
||||
if (_length > 0 && lf_has_memo(logicnum))
|
||||
init_memo(RECORD_NON_FISICO);
|
||||
clear_modified_fields();
|
||||
set_preserve_values();
|
||||
}
|
||||
|
||||
bool TRectype::changed(const char* fieldname, const char* val, const char* compare_to)
|
||||
@ -3591,7 +3321,6 @@ TRectype::TRectype(const TRectype& r)
|
||||
init_memo(r._memo_data->recno(), r._memo_data->file());
|
||||
*_memo_data = *r._memo_data;
|
||||
}
|
||||
_modified_fields = r._modified_fields;
|
||||
memcpy(_rec, r._rec, _length);
|
||||
memcpy(_tab, r._tab, sizeof(_tab));
|
||||
setempty(r.empty());
|
||||
@ -4055,7 +3784,6 @@ void TRectype::put_str(const char* fieldname, const char* val)
|
||||
if (ft == _boolfld)
|
||||
val = (*val && strchr("1STXY", toupper(*val)) != NULL) ? "T" : "F";
|
||||
|
||||
set_modified_field(nf, val);
|
||||
if (*val == '\0')
|
||||
{
|
||||
TRecfield f(*this, fieldname);
|
||||
@ -4102,7 +3830,6 @@ void TRectype::zero(const char* fieldname)
|
||||
const byte dec = recd.Fd[nf].Dec;
|
||||
const TFieldtypes type = (TFieldtypes) recd.Fd[nf].TypeF;
|
||||
|
||||
set_modified_field(nf, "");
|
||||
switch (type)
|
||||
{
|
||||
case _datefld:
|
||||
@ -4134,24 +3861,6 @@ void TRectype::zero(const char* fieldname)
|
||||
}
|
||||
}
|
||||
|
||||
void TRectype::set_modified_field(int i, const char *val)
|
||||
{
|
||||
const RecFieldDes& fd = rec_des().Fd[i];
|
||||
|
||||
TString * v = (TString *)_modified_fields.objptr(i);
|
||||
|
||||
if (v == NULL)
|
||||
{
|
||||
TString old_val = get(fd.Name);
|
||||
|
||||
if (old_val != val)
|
||||
_modified_fields.add(val, i);
|
||||
}
|
||||
else
|
||||
*v = val;
|
||||
}
|
||||
|
||||
|
||||
void TRectype::zero(char c)
|
||||
{
|
||||
memset(_rec, c, len());
|
||||
@ -4163,7 +3872,6 @@ void TRectype::zero(char c)
|
||||
if(has_memo())
|
||||
init_memo( RECORD_NON_FISICO );
|
||||
setempty(true);
|
||||
clear_modified_fields();
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
@ -4179,7 +3887,6 @@ TRectype& TRectype::operator =(const TRectype& rec)
|
||||
}
|
||||
memcpy(_tab, rec._tab, sizeof(_tab));
|
||||
setempty(rec.empty()); // Copy emptiness status
|
||||
_modified_fields = rec._modified_fields;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -4369,19 +4076,10 @@ TRectype& TRectype::operator =(const char* rec)
|
||||
const char* TRectype::key(int numkey) const
|
||||
{
|
||||
TString& tmp = get_tmp_string(256);
|
||||
|
||||
__build_key(rec_des(), numkey, _rec, tmp.get_buffer(), false);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const char* TRectype::key_token(int numkey) const
|
||||
{
|
||||
TString& tmp = get_tmp_string(256);
|
||||
|
||||
__build_key(rec_des(), numkey, _rec, tmp.get_buffer(), false, true);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void TRectype::fill_transaction(TConfig& cfg, int row) const
|
||||
{
|
||||
TString16 p; p << num();
|
||||
@ -4665,24 +4363,13 @@ void TRecfield::put_subfield(const char* s)
|
||||
_rec->put(_name, out);
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((p < 0) && (s && *s))
|
||||
{
|
||||
TString out = str;
|
||||
|
||||
out << '\n' << _sub_field << s;
|
||||
_rec->put(_name, out);
|
||||
}
|
||||
}
|
||||
|
||||
int TRecfield::operator =(int i)
|
||||
{
|
||||
TString16 buff; buff << i;
|
||||
if (_sub_field.empty())
|
||||
{
|
||||
_rec->set_modified_field(_nf, buff);
|
||||
__putfieldbuff(_len, _dec, _type, buff, _p);
|
||||
}
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
else
|
||||
put_subfield(buff);
|
||||
_rec->setempty(FALSE);
|
||||
@ -4694,10 +4381,7 @@ long TRecfield::operator =(long l)
|
||||
{
|
||||
TString16 buff; buff << l;
|
||||
if (_sub_field.empty())
|
||||
{
|
||||
_rec->set_modified_field(_nf, buff);
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
}
|
||||
else
|
||||
put_subfield(buff);
|
||||
_rec->setempty(false);
|
||||
@ -4706,13 +4390,9 @@ long TRecfield::operator =(long l)
|
||||
|
||||
const real& TRecfield::operator =(const real& r)
|
||||
{
|
||||
const char * buff = r.string();
|
||||
|
||||
const char* buff = r.string();
|
||||
if (_sub_field.empty())
|
||||
{
|
||||
_rec->set_modified_field(_nf, buff);
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
}
|
||||
else
|
||||
put_subfield(buff);
|
||||
_rec->setempty(FALSE);
|
||||
@ -4723,10 +4403,7 @@ const TDate& TRecfield::operator =(const TDate& d)
|
||||
{
|
||||
const TString16 buff = d.stringa();
|
||||
if (_sub_field.empty())
|
||||
{
|
||||
_rec->set_modified_field(_nf, buff);
|
||||
__putfieldbuff( _len, _dec, _type, buff, _p);
|
||||
}
|
||||
else
|
||||
put_subfield(buff);
|
||||
_rec->setempty(FALSE);
|
||||
@ -4740,11 +4417,8 @@ const char* TRecfield::operator =(const char* s)
|
||||
if (_type == _memofld)
|
||||
_rec->put(_name, s);
|
||||
else
|
||||
{
|
||||
_rec->set_modified_field(_nf, s);
|
||||
__putfieldbuff(_len, _dec, _type, s, _p);
|
||||
__putfieldbuff( _len, _dec, _type, s, _p);
|
||||
}
|
||||
}
|
||||
else
|
||||
put_subfield(s);
|
||||
_rec->setempty(FALSE);
|
||||
|
@ -31,15 +31,6 @@
|
||||
|
||||
const int MAX_KEYS = 8;
|
||||
|
||||
enum db_op {db_add = 1, db_remove, db_update};
|
||||
|
||||
extern void db_log(bool on);
|
||||
extern bool db_log();
|
||||
extern bool to_db_log(int logic);
|
||||
extern void db_log_on();
|
||||
extern void db_log_off();
|
||||
|
||||
|
||||
class TBaseisamfile;
|
||||
class TLocalisamfile;
|
||||
class TRecfield;
|
||||
@ -95,9 +86,6 @@ protected:
|
||||
// @cmember:(INTERNAL) Campo "COD" della tabella
|
||||
TMemo_data* _memo_data;
|
||||
|
||||
TString_array _modified_fields;
|
||||
bool _preserve_values;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Segnalazione di un campo inesistente
|
||||
@ -116,7 +104,6 @@ protected:
|
||||
virtual void put_str(const char* fieldname, const char* val);
|
||||
|
||||
bool set_edit_info(const char* ut, const char* dt, const char* or);
|
||||
void set_modified_field(int i, const char * val);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
@ -293,19 +280,12 @@ public:
|
||||
{return _rec[0] == ' ';}
|
||||
// @cmember Ritorna il valore della chiave numero <p numkey>
|
||||
const char* key(int numkey = 1) const;
|
||||
// @cmember Ritorna il valore della chiave numero <p numkey> come token string per le cache
|
||||
const char* key_token(int numkey = 1) const; // @cmember Ritorna se si tratta di un record valido
|
||||
// @cmember Ritorna se si tratta di un record valido
|
||||
virtual bool ok() const
|
||||
{ return _rec != NULL; }
|
||||
// @cmember Ritorna true se sono uguali
|
||||
bool is_equal(const TRectype& r) const;
|
||||
|
||||
bool field_modified(int i) const { return _modified_fields.objptr(i) != NULL; }
|
||||
const TString & get_modified_field(int i) const { return field_modified(i) ? _modified_fields.row(i) : EMPTY_STRING; }
|
||||
void clear_modified_fields(int i = -1) { _modified_fields.destroy(i); }
|
||||
bool preserve_values() { return _preserve_values; }
|
||||
void set_preserve_values(bool on = true) { _preserve_values = on; }
|
||||
|
||||
virtual void init_memo(const TRecnotype recno = RECORD_NON_FISICO, TIsam_handle file = 0);
|
||||
virtual void reset_memo() { _memo_data->init(RECORD_NON_FISICO, 0); }
|
||||
virtual void update_memo() {}
|
||||
@ -430,7 +410,6 @@ protected:
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember:(INTERNAL) IO su file:
|
||||
virtual bool writelog(const db_op op, TRectype & rec, TRectype * new_rec, int fhnd);
|
||||
virtual int _read(TRectype& rec, word op = _isequal, word lockop = _nolock);
|
||||
virtual int _readat(TRectype& rec, TRecnotype nrec, word lockop = _nolock);
|
||||
virtual int _write(const TRectype& rec);
|
||||
|
@ -1194,7 +1194,6 @@ int TMask::win2page(WINDOW w) const
|
||||
TMask_field* TMask::parse_field(TScanner& scanner)
|
||||
{
|
||||
const TString& k = scanner.key();
|
||||
|
||||
if (k == "BO") return new TBoolean_field(this);
|
||||
if (k == "BR") return new TBrowsefile_field(this);
|
||||
if (k == "BU") return new TButton_field(this);
|
||||
|
@ -61,6 +61,7 @@
|
||||
#define MOV_KEYFPPRO "KEYFPPRO"
|
||||
#define MOV_MOVCOLL "MOVCOLL"
|
||||
#define MOV_ELABF9 "ELABF9"
|
||||
|
||||
#define MOV_IDDOCSDI "IDDOCSDI"
|
||||
#define MOV_DATADOCSDI "DATADOCSDI"
|
||||
|
||||
|
@ -3882,7 +3882,7 @@ void TSheet_field::save_columns_order()
|
||||
s.save_columns_order();
|
||||
}
|
||||
|
||||
void TSheet_field::check_row(int n, int mode, bool final)
|
||||
void TSheet_field::check_row(int n, int mode)
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
const int current = s->_cur_rec;
|
||||
@ -3903,9 +3903,7 @@ void TSheet_field::check_row(int n, int mode, bool final)
|
||||
if (f.has_check())
|
||||
f.set_dirty();
|
||||
}
|
||||
row2mask(n, r, mode);
|
||||
if (final)
|
||||
m.check_fields();
|
||||
row2mask(n, r, mode);
|
||||
mask2row(n, r);
|
||||
m.set_mode(mask_mode);
|
||||
s->_cur_rec = current;
|
||||
|
@ -171,8 +171,6 @@ public:
|
||||
virtual void set_row_cell(TToken_string & row, short id, const bool value) { row.add(value ? "X" : "", cid2index(id)); }
|
||||
virtual int set_row_cell_currency(TToken_string& row, short id, const real& n);
|
||||
|
||||
virtual void clear_row_cell(TToken_string & row, short id) { set_row_cell(row, id, ""); }
|
||||
|
||||
virtual int set_row_cell(short id, const char * value, int nrow = -1);
|
||||
virtual int set_row_cell(short id, char value, int nrow = -1);
|
||||
virtual int set_row_cell(short id, long value, int nrow = -1);
|
||||
@ -182,8 +180,6 @@ public:
|
||||
virtual int set_row_cell(short id, const bool value, int nrow = -1);
|
||||
virtual int set_row_cell_currency(short id, const real& n, int nrow = -1);
|
||||
|
||||
virtual int clear_row_cell(short id, int nrow = -1) { return set_row_cell(id, "", nrow); }
|
||||
|
||||
virtual const char * get_str_row_cell(TToken_string & row, short id) { return row.get(cid2index(id)); }
|
||||
virtual char get_char_row_cell(TToken_string & row, short id) { return row.get_char(cid2index(id)); }
|
||||
virtual long get_long_row_cell(TToken_string & row, short id) { return row.get_long(cid2index(id)); }
|
||||
@ -332,7 +328,7 @@ public:
|
||||
virtual void post_insert(int) { }
|
||||
|
||||
// @cmember Esegue tutti i check iniziali sulla riga <p n>
|
||||
void check_row(int n, int mode = 0x3, bool final = false);
|
||||
void check_row(int n, int mode = 0x3);
|
||||
|
||||
// @cmember Trasferisce i valori dalla maschera alla riga <p n>
|
||||
void update_row(int n) { mask2row(n, row(n)); }
|
||||
@ -382,11 +378,11 @@ public:
|
||||
TString_array& sheetof##__riga = (__sheet).rows_array(); \
|
||||
FOR_EACH_ARRAY_ROW_BACK(sheetof##__riga, __r, __riga)
|
||||
|
||||
#define FOR_EACH_SHEET_ROW_LOOP(__sheet, __r) \
|
||||
int sheetit##__r = __sheet.items(); \
|
||||
for (int __r = 0; r < sheetit##__r; r++)
|
||||
#define FOR_EACH_SHEET_ROW_LOOP(__sheet, __r) \
|
||||
int it##__r = __sheet.items(); \
|
||||
for( int __r = 0; r < it##__r; __r++)
|
||||
|
||||
#define FOR_EACH_SHEET_ROW_BACK_LOOP(__sheet, __r, __riga) \
|
||||
int sheetit##__r = __sheet.items(); \
|
||||
for (int __r = sheetit##__r - 1; r >= 0; r--)
|
||||
#define FOR_EACH_SHEET_ROW_BACK_LOOP(__sheet, __r) \
|
||||
int it##__r = __sheet.items(); \
|
||||
for( int __r = it##__r - 1; r >= 0 ; __r--)
|
||||
#endif
|
||||
|
@ -7,14 +7,10 @@
|
||||
#include <sheet.h>
|
||||
#include <recarray.h>
|
||||
#include <relapp.h>
|
||||
#include <reputils.h>
|
||||
#include <statbar.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <dblog.h>
|
||||
#include <bagn010.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRelation_application
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -572,15 +568,10 @@ bool TRelation_application::modify_mode()
|
||||
{
|
||||
if (err == _islocked)
|
||||
{
|
||||
if (db_log())
|
||||
_locked = !yesno_box(TR("I dati sono già usati da un altro programma, vuoi modificare ugualmente"));
|
||||
else
|
||||
{
|
||||
_locked = true;
|
||||
message_box(TR("I dati sono già usati da un altro programma, scrittura disabilitata"));
|
||||
}
|
||||
}
|
||||
else
|
||||
_locked = true;
|
||||
message_box(TR("I dati sono già usati da un altro programma, scrittura disabilitata"));
|
||||
}
|
||||
else
|
||||
{
|
||||
error_box(FR("Impossibile leggere i dati: errore %d"), err);
|
||||
if (!is_transaction())
|
||||
@ -1303,378 +1294,6 @@ int TRelation_application::rewrite(const TMask& m)
|
||||
const char* TRelation_application::record_description(const TRelation& r) const
|
||||
{ return r.file().description(); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TLogtrans_report
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TLogtrans_report : public TReport
|
||||
{
|
||||
TAssoc_array _vars;
|
||||
|
||||
protected:
|
||||
virtual bool use_mask() { return false; }
|
||||
virtual bool set_usr_val(const TString& name, const TVariant& var);
|
||||
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
||||
|
||||
public:
|
||||
TLogtrans_report(TRecordset* rs);
|
||||
};
|
||||
|
||||
bool TLogtrans_report::set_usr_val(const TString& name, const TVariant& var)
|
||||
{
|
||||
if (!TReport::set_usr_val(name, var))
|
||||
_vars.add(name, new TVariant(var));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TLogtrans_report::get_usr_val(const TString& name, TVariant& var) const
|
||||
{
|
||||
if (name[0] == '#')
|
||||
{
|
||||
TVariant* v = (TVariant*)_vars.objptr(name);
|
||||
|
||||
if (v != nullptr)
|
||||
{
|
||||
var = *v;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (name == "TRANSACTION")
|
||||
{
|
||||
const int fieldlen = ((TLogtrans_report *)this)->field("B1.114")->get_rect().width() / 100;
|
||||
const TString &data = ((TISAM_recordset *)recordset())->cursor()->curr().get(DBL_TRANS);
|
||||
TString outstring;
|
||||
int pos = data.find("<data>");
|
||||
int rowlen = 0;
|
||||
|
||||
while ((pos = data.find("<field", pos)) >= 0)
|
||||
{
|
||||
pos += 6;
|
||||
int end = data.find(" />", pos);
|
||||
TString field = data.mid(pos, end - pos);
|
||||
|
||||
field.trim();
|
||||
if ((rowlen + 3 + field.len() >= fieldlen) && outstring.full())
|
||||
{
|
||||
outstring << '\n';
|
||||
rowlen = 0;
|
||||
}
|
||||
if (rowlen > 0)
|
||||
{
|
||||
outstring << "/";
|
||||
rowlen += 1;
|
||||
}
|
||||
outstring << field;
|
||||
rowlen += field.len();
|
||||
pos += 3;
|
||||
}
|
||||
var = outstring;
|
||||
return true;
|
||||
}
|
||||
return TReport::get_usr_val(name, var);
|
||||
}
|
||||
|
||||
TLogtrans_report::TLogtrans_report(TRecordset* rs)
|
||||
{
|
||||
load("bagn010b");
|
||||
|
||||
set_recordset(rs);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TLog_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
static COLOR __row_colors[16] = { COLOR_WHITE, blend_colors(COLOR_WHITE, COLOR_RED),
|
||||
blend_colors(COLOR_WHITE, COLOR_GREEN), blend_colors(COLOR_WHITE, COLOR_BLUE),
|
||||
blend_colors(COLOR_WHITE, COLOR_CYAN), blend_colors(COLOR_WHITE, COLOR_MAGENTA),
|
||||
blend_colors(COLOR_WHITE, COLOR_YELLOW), blend_colors(COLOR_WHITE, COLOR_DKGRAY),
|
||||
blend_colors(COLOR_WHITE, COLOR_GRAY), blend_colors(COLOR_WHITE, COLOR_LTGRAY),
|
||||
blend_colors(COLOR_WHITE, COLOR_DKCYAN), blend_colors(COLOR_WHITE, COLOR_LTYELLOW),
|
||||
blend_colors(COLOR_WHITE, COLOR_DKGREEN), blend_colors(COLOR_WHITE, COLOR_DKBLUE),
|
||||
blend_colors(COLOR_WHITE, COLOR_DKRED), blend_colors(COLOR_WHITE, COLOR_DKMAGENTA) };
|
||||
|
||||
COLOR TLog_mask::row_color(bool change)
|
||||
{
|
||||
return __row_colors[_curr_color = (_curr_color + (change ? 1 : 0) % 16)];
|
||||
}
|
||||
|
||||
HIDDEN const TString & reformat_ora(const TString & ora)
|
||||
{
|
||||
bool duepunti = ora.find(":") >= 0;
|
||||
bool meno = ora.find("-") >= 0;
|
||||
TToken_string tmp(ora, duepunti ? ':' : meno ? '-' : '|');
|
||||
long long_ora = tmp.get_int();
|
||||
int minuto = tmp.get_int();
|
||||
int secondo = tmp.get_int();
|
||||
TString & formatted_ora = get_tmp_string(16);
|
||||
|
||||
if (long_ora <= 0)
|
||||
formatted_ora = "24:00:00";
|
||||
else
|
||||
{
|
||||
if (long_ora > 24L)
|
||||
{
|
||||
if (long_ora > 2400L)
|
||||
{
|
||||
secondo = long_ora % 100L;
|
||||
long_ora /= 100L;
|
||||
}
|
||||
else
|
||||
secondo = 0;
|
||||
minuto = long_ora % 100L;
|
||||
long_ora /= 100L;
|
||||
}
|
||||
formatted_ora << format("%02d", long_ora) << ':' << format("%02d", minuto) << ':' << format("%02d", secondo);
|
||||
}
|
||||
return formatted_ora;
|
||||
}
|
||||
|
||||
void TLog_mask::set_limit(bool on)
|
||||
{
|
||||
TString filter;
|
||||
|
||||
if (on)
|
||||
{
|
||||
TDate datalim = get_date(F_DATALIM);
|
||||
TString oralim = get(F_ORALIM);
|
||||
|
||||
if (datalim.ok())
|
||||
{
|
||||
oralim = reformat_ora(oralim);
|
||||
filter << "(STR(" << DBL_DATA << "<" << datalim.date2ansi() << "))||(STR(" << DBL_DATA << "==" << datalim.date2ansi() << ")&&(" << DBL_ORA << "<=\"" << oralim << "\"))";
|
||||
}
|
||||
}
|
||||
_log.setfilter(filter);
|
||||
}
|
||||
|
||||
void TLog_mask::print_log()
|
||||
{
|
||||
set_limit();
|
||||
|
||||
;
|
||||
TISAM_recordset * recset = new TISAM_recordset(_log);
|
||||
const int items = _log.items();
|
||||
TString line;
|
||||
TString oralim = get(F_ORALIM);
|
||||
TLogtrans_report transactions(recset);
|
||||
|
||||
transactions.set_var("#DATALIM", get_date(F_DATALIM));
|
||||
transactions.set_var("#ORALIM", oralim = "24:00:00" ? "" : oralim);
|
||||
transactions.set_recordset(recset);
|
||||
transactions.print_or_preview();
|
||||
set_limit(false);
|
||||
}
|
||||
|
||||
void TLog_mask::replay_log()
|
||||
{
|
||||
set_limit();
|
||||
const int items = _log.items();
|
||||
TLog_report logrep;
|
||||
|
||||
for (_log = 0L; _log.pos() < items; ++_log)
|
||||
{
|
||||
TXmlItem trans; trans << _log.curr().get(DBL_TRANS);
|
||||
TToken_string key;
|
||||
TXmlItem * keytag = trans.FindFirst("Key");
|
||||
int n = keytag->GetChildren();
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
TXmlItem * item = keytag->GetChild(i);
|
||||
|
||||
if (item->GetTag() == "field")
|
||||
{
|
||||
TToken_string fieldval(item->GetText(), '=');
|
||||
|
||||
key.add(fieldval.get(1));
|
||||
}
|
||||
}
|
||||
|
||||
const int file = _log.curr().get_int(DBL_FILE);
|
||||
TRectype& rec = (TRectype &) cache().get(file, key);
|
||||
TXmlItem * valuetag = trans.FindFirst("Key");
|
||||
|
||||
n = valuetag->GetChildren();
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
TXmlItem * item = valuetag->GetChild(i);
|
||||
|
||||
if (item->GetTag() == "data")
|
||||
{
|
||||
TToken_string fieldval(item->GetText(), '=');
|
||||
const TString fieldname(fieldval.get());
|
||||
|
||||
rec.put(fieldname, fieldval.get(1));
|
||||
}
|
||||
}
|
||||
|
||||
TLocalisamfile f(file);
|
||||
|
||||
const int err = rec.write_rewrite(f);
|
||||
|
||||
if (err != NOERR)
|
||||
{
|
||||
logrep.log(2, format("errore = %d", err));
|
||||
}
|
||||
}
|
||||
set_limit(false);
|
||||
}
|
||||
|
||||
bool TLog_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_ORALIM:
|
||||
if (e == fe_modify)
|
||||
o.set(reformat_ora(o.get()));
|
||||
|
||||
case F_DATALIM:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
set_limit();
|
||||
load_sheet();
|
||||
}
|
||||
break;
|
||||
case F_PRINT:
|
||||
if (e == fe_button)
|
||||
print_log();
|
||||
break;
|
||||
case F_REPLAY:
|
||||
if (e == fe_button)
|
||||
replay_log();
|
||||
break;
|
||||
case F_SHEET:
|
||||
if (e == se_enter)
|
||||
set_key_values(curr_page(), ((TSheet_field &)o).selected());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TLog_mask::set_key_values(int page, long pos)
|
||||
{
|
||||
_log = pos;
|
||||
const int file = _log.curr().get_int(DBL_FILE);
|
||||
const TRectype & rec = cache().get(file, _log.curr().get(DBL_KEY));
|
||||
|
||||
if (multi_file())
|
||||
set_mask(page);
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
TMask_field & f = field(F_KEYFIELD1 + i);
|
||||
const TString & prompt(f.prompt());
|
||||
|
||||
if (prompt.full())
|
||||
f.set(rec.get(prompt));
|
||||
}
|
||||
}
|
||||
|
||||
void TLog_mask::set_mask(int page)
|
||||
{
|
||||
const TRectype & rec = _datarel->lfile().curr();
|
||||
TTrec trec(rec.num());
|
||||
TToken_string key(trec.keydef());
|
||||
TToken_string fields(key.get(0), '+');
|
||||
TSheet_field & sh = sfield(F_SHEET);
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
TString prompt(fields.get(i));
|
||||
TMask_field & f = field(F_KEYFIELD1 + i);
|
||||
|
||||
if (prompt.starts_with("UPPER"))
|
||||
prompt = prompt.ltrim(6);
|
||||
|
||||
const int pos = prompt.find('[');
|
||||
|
||||
if (pos > 0)
|
||||
prompt = prompt.left(pos);
|
||||
f.show(prompt.full());
|
||||
f.set_prompt(prompt);
|
||||
}
|
||||
|
||||
if (_select)
|
||||
{
|
||||
RCT rect;
|
||||
int deltay = 9 - (fields.items() - 1) / 2;
|
||||
|
||||
sh.get_rect(rect);
|
||||
rect.top -= deltay;
|
||||
sh.set_rect(rect);
|
||||
sh.force_update();
|
||||
}
|
||||
}
|
||||
|
||||
void TLog_mask::load_sheet(int page)
|
||||
{
|
||||
TSheet_field & sh = sfield(F_SHEET);
|
||||
const int items = _log.items();
|
||||
const TRectype & rec = _log.curr();
|
||||
TString curr_key = rec.get(DBL_KEY);
|
||||
|
||||
_curr_color = 0;
|
||||
sh.reset_sheet();
|
||||
for (_log = 0L; _log.pos() < items; ++_log)
|
||||
{
|
||||
const int r = sh.set_row_cell(F_DATA, _log.curr().get_date(DBL_DATA));
|
||||
|
||||
sh.set_row_cell(F_ORA, rec.get(DBL_ORA), r);
|
||||
sh.set_row_cell(F_USER, rec.get(DBL_USER), r);
|
||||
sh.set_row_cell(F_SESSION, rec.get_int(DBL_SESSION), r);
|
||||
sh.set_row_cell(F_CONTENT, rec.get(DBL_TRANS), r);
|
||||
|
||||
const TString & key = rec.get(DBL_KEY);
|
||||
|
||||
sh.set_back_and_fore_color(row_color(!select() && key != curr_key), COLOR_BLACK, r);
|
||||
curr_key = key;
|
||||
}
|
||||
sh.force_update();
|
||||
}
|
||||
|
||||
TLog_mask::TLog_mask(TRelation * rel, bool select) : TAutomask("bagn010"),
|
||||
_select(select), _datarel(rel),
|
||||
_log(new TRelation(LF_DBLOG), "", rel == nullptr ? 1 : 2),
|
||||
_curr_color(-1)
|
||||
{
|
||||
TRectype from(_log.curr());
|
||||
|
||||
if (_datarel != nullptr)
|
||||
{
|
||||
const int file = rel->lfile().num();
|
||||
|
||||
from.put(DBL_FILE, file);
|
||||
}
|
||||
set_mask();
|
||||
if (_select)
|
||||
{
|
||||
const TRectype & rec = rel->lfile().curr();
|
||||
const TString & key = rec.key_token();
|
||||
|
||||
from.put(DBL_KEY, key);
|
||||
}
|
||||
if (from.full())
|
||||
_log.setregion(from, from);
|
||||
load_sheet();
|
||||
|
||||
}
|
||||
|
||||
void TRelation_application::show_log()
|
||||
{
|
||||
TLog_mask m(get_relation(), check_edit_mode());
|
||||
|
||||
m.run();
|
||||
}
|
||||
|
||||
static bool show_log_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE)
|
||||
main_app().show_log();
|
||||
return true;
|
||||
}
|
||||
// @doc INTERNAL
|
||||
|
||||
// @mfunc Cancella il record corrente
|
||||
@ -1763,11 +1382,6 @@ void TRelation_application::main_loop()
|
||||
|
||||
// imposta la maschera in query mode
|
||||
query_mode();
|
||||
if (_mask && _mask->find_by_id(DLG_LOG))
|
||||
{
|
||||
_mask->show(DLG_LOG, db_log() && admin());
|
||||
_mask->set_handler(DLG_LOG, show_log_handler);
|
||||
}
|
||||
_mask->open_modal();
|
||||
|
||||
// Provoca l'autopremimento per il messaggio di LINK
|
||||
|
@ -21,33 +21,6 @@
|
||||
#include <transaction.h>
|
||||
#endif
|
||||
|
||||
// @doc EXTERNAL
|
||||
// @class TLog_mask | Classe la visualizzazione e il replay del log delle transazioni
|
||||
//
|
||||
// @base public | TAutomask
|
||||
class TLog_mask : public TAutomask
|
||||
{
|
||||
TRelation * _datarel;
|
||||
TCursor _log;
|
||||
bool _select;
|
||||
int _curr_color;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
void set_key_values(int page, long pos);
|
||||
void set_mask(int page = 1);
|
||||
void load_sheet(int page = 1);
|
||||
bool select() const { return _select || curr_page() > 1; }
|
||||
bool multi_file() const { return _datarel == nullptr; }
|
||||
COLOR row_color(bool change);
|
||||
void set_limit(bool on = true);
|
||||
void print_log();
|
||||
void replay_log();
|
||||
|
||||
public:
|
||||
TLog_mask(TRelation * rel = nullptr, bool one_rec = false);
|
||||
};
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @class TRelation_application | Classe per la gestione di una applicazione di manutenzione di uno
|
||||
@ -276,9 +249,6 @@ protected:
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Visualizza il log
|
||||
virtual void show_log();
|
||||
|
||||
virtual void mask2ini(const TMask& m, TConfig& ini);
|
||||
// @cmember Ritorna la relazione da modificare
|
||||
virtual TRelation* get_relation() const pure;
|
||||
|
@ -108,8 +108,6 @@ bool TTable_application::user_create()
|
||||
return false;
|
||||
|
||||
_tabname = argv(2);
|
||||
if (_tabname == "ĘU")
|
||||
_tabname = "%CAU";
|
||||
_tabname.upper();
|
||||
_rel = new TRelation(_tabname);
|
||||
|
||||
|
@ -26,35 +26,28 @@ const real SSimple_query::sq_get_real(const char * field)
|
||||
return app;
|
||||
}
|
||||
|
||||
const TString & SSimple_query::sq_get(const char* field, const bool rtrim)
|
||||
TString SSimple_query::sq_get(const char* field, bool rtrim)
|
||||
{
|
||||
TString & fld = get_tmp_string(1024);
|
||||
|
||||
fld = _rec.get(field);
|
||||
TString fld = _rec.get(field);
|
||||
if (rtrim)
|
||||
fld.rtrim();
|
||||
|
||||
return fld;
|
||||
}
|
||||
|
||||
const TString & SSimple_query::sq_get(const string& field, const bool rtrim)
|
||||
TString SSimple_query::sq_get(const string& field, const bool rtrim)
|
||||
{
|
||||
return sq_get(field.c_str(), rtrim);
|
||||
}
|
||||
|
||||
const TString & SSimple_query::sq_get(TString& field, const bool rtrim)
|
||||
TString SSimple_query::sq_get(TString& field, bool rtrim)
|
||||
{
|
||||
return sq_get((const char *)field, rtrim);
|
||||
return sq_get(static_cast<const char*>(field), rtrim);
|
||||
}
|
||||
|
||||
const TString & SSimple_query::sq_get(unsigned int column, const bool rtrim)
|
||||
TString SSimple_query::sq_get(unsigned int column, bool rtrim)
|
||||
{
|
||||
TString & val = get_tmp_string(1024);
|
||||
|
||||
val << _rec.get(column);
|
||||
if (rtrim)
|
||||
val.rtrim();
|
||||
return val;
|
||||
return _rec.get(column);
|
||||
}
|
||||
|
||||
unsigned SSimple_query::sq_get_num_fields() const
|
||||
@ -62,12 +55,9 @@ unsigned SSimple_query::sq_get_num_fields() const
|
||||
return _rec.get_num_fields();
|
||||
}
|
||||
|
||||
const TString & SSimple_query::sq_get_name_field(const unsigned column) const
|
||||
TString SSimple_query::sq_get_name_field(const unsigned column) const
|
||||
{
|
||||
TString & name = get_tmp_string();
|
||||
|
||||
name = _rec.get_name_field(column);
|
||||
return name;
|
||||
return _rec.get_name_field(column);
|
||||
}
|
||||
|
||||
int SSimple_query::sq_get_width_field(const unsigned column) const
|
||||
@ -85,8 +75,6 @@ TFieldtypes SSimple_query::sq_get_type_field(const unsigned column) const
|
||||
return _boolfld;
|
||||
if (type == "dtShort")
|
||||
return _intfld;
|
||||
if (type == "dtLong")
|
||||
return _longfld;
|
||||
if (type == "dtULong")
|
||||
return _longfld;
|
||||
if (type == "dtDouble")
|
||||
|
@ -40,22 +40,29 @@
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif //
|
||||
#endif // !__STRINGS_H
|
||||
|
||||
#ifndef __DATE_H
|
||||
#include <date.h>
|
||||
#endif //
|
||||
#endif // !__DATE_H
|
||||
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif //
|
||||
#endif // !__REAL_H
|
||||
|
||||
#define CHIAVE_ID_ "_ID_"
|
||||
#include "recset.h"
|
||||
|
||||
/********************************************************************************
|
||||
* SSimpleQuery (Sirio Simple Query) *
|
||||
* SSimpleQuery (Sirio Simple Query) *
|
||||
* "Wrapper" di TXvt_recordset, implementa OGNI funzione in modo tale da *
|
||||
* poterlo sostituire brutalmente in qualsiasi momento così da non aver *
|
||||
* problemi come durante il passaggio da ISAM a SQL (spero). che cazzata da riscrivere *
|
||||
* problemi come durante il passaggio da ISAM a SQL (spero). *
|
||||
* Se ti stai domandando perchè non è stata usata l'ereditarietà (magari con *
|
||||
* un bel ": private TXvt_recordset" così da bloccare il tutto) è per bloccare *
|
||||
* qualsiasi riferimento a questa classe in eventuali reimplementazioni future. *
|
||||
* Preferisco scrivere un po' di codice ridondante adesso che andare a fare *
|
||||
* salti mortali dopo *
|
||||
********************************************************************************/
|
||||
class SSimple_query
|
||||
{
|
||||
@ -153,19 +160,19 @@ public:
|
||||
/**< Ritorna il valore nel campo (field) in formato (SADateTime), Campo non gestisce le ore */
|
||||
//SADateTime sqGetDateTime(const char* field) { get_short(field); }
|
||||
/**< Ritorna il valore nel campo (field) passato come (const char *) in formato (const char *) */
|
||||
const TString & sq_get(const char* field, bool rtrim = true);
|
||||
TString sq_get(const char* field, bool rtrim = true);
|
||||
/**< Ritorna il valore nel campo (field) passato come (string) in formato (const char *) */
|
||||
const TString & sq_get(const string& field, bool rtrim = true);
|
||||
TString sq_get(const string& field, bool rtrim = true);
|
||||
/**< Ritorna il valore nel campo (field) passato come (TString) in formato (const char *) */
|
||||
const TString & sq_get(TString& field, bool rtrim = true);
|
||||
TString sq_get(TString& field, bool rtrim = true);
|
||||
/**< Ritorna il valore della colonna numero (column) passato come (unsigned int) */
|
||||
const TString & sq_get(unsigned int column, bool rtrim = true);
|
||||
TString sq_get(unsigned int column, bool rtrim = true);
|
||||
/**< Ritorna il valore nel campo (field) in formato (char) */
|
||||
const char sq_get_char(const char* field) { return _rec.get_char(field); }
|
||||
/**< Ritorna il numero di campi dopo l'ultimo comando di esecuzione effettuato; se il risultato esiste */
|
||||
unsigned int sq_get_num_fields() const;
|
||||
/**< Ritorna il nome del campo numero (column) in formato (TString) = */
|
||||
const TString & sq_get_name_field(unsigned column) const;
|
||||
/**< Ritorna il nome del campo numero (column) in formato (TString= */
|
||||
TString sq_get_name_field(unsigned column) const;
|
||||
/**< Ritorna la grandezza del campo numero (column) */
|
||||
int sq_get_width_field(unsigned column) const;
|
||||
/**< Ritorna il tipo del campo numero (column) in formato (TFieldtypes) */
|
||||
@ -191,12 +198,12 @@ public:
|
||||
void defrost() { _rec.defrost(); }
|
||||
|
||||
/**< Costruttore, non inizializza nulla, da caricare successivamente */
|
||||
SSimple_query() {};
|
||||
SSimple_query() = default;
|
||||
/**< Costruttore, Accetta in ingresso dei parametri per la connessione, volendo è anche possibile impostare una query ed eseguirla. Attenzione! Non risponde se la query ha avuto un esito positivo o negativo! */
|
||||
SSimple_query(const char* db, const char* user, const char* pass, const TT_driver tipo_db, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipo_db, query, ex, freezed) {}
|
||||
//SSimpleQuery(const TString& db, const TString& user, const TString& pass, TT_driver tipoDb, const char * query = "", const bool ex = false, const bool freezed = false) : _rec(db, user, pass, tipoDb, query, ex, freezed) {}
|
||||
/**< Distruttore */
|
||||
virtual ~SSimple_query() {};
|
||||
virtual ~SSimple_query() = default;
|
||||
};
|
||||
|
||||
#endif
|
@ -490,7 +490,6 @@ struct linger {
|
||||
/*
|
||||
* Windows Sockets definitions of regular Microsoft C error constants
|
||||
*/
|
||||
#ifndef WSAEINTR
|
||||
#define WSAEINTR (WSABASEERR+4)
|
||||
#define WSAEBADF (WSABASEERR+9)
|
||||
#define WSAEACCES (WSABASEERR+13)
|
||||
@ -498,7 +497,6 @@ struct linger {
|
||||
#define WSAEINVAL (WSABASEERR+22)
|
||||
#define WSAEMFILE (WSABASEERR+24)
|
||||
|
||||
|
||||
/*
|
||||
* Windows Sockets definitions of regular Berkeley error constants
|
||||
*/
|
||||
@ -583,7 +581,6 @@ struct linger {
|
||||
/*
|
||||
* Windows Sockets errors redefined as regular Berkeley error constants
|
||||
*/
|
||||
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#define EALREADY WSAEALREADY
|
||||
@ -621,7 +618,6 @@ struct linger {
|
||||
#define EDQUOT WSAEDQUOT
|
||||
#define ESTALE WSAESTALE
|
||||
#define EREMOTE WSAEREMOTE
|
||||
#endif
|
||||
|
||||
/* Socket function prototypes */
|
||||
|
||||
|
@ -2285,21 +2285,20 @@ void TFatturazione_lav_app::main_loop()
|
||||
for (bool ok = recset.move_first(); ok && pi->add_status(); ok = recset.move_next())
|
||||
{
|
||||
TDocumento & doc =(TDocumento &) recset.cursor()->curr();
|
||||
const TCli_for &cli = doc.clifor();
|
||||
const long codcli = cli.codice();
|
||||
const TCli_for &cli = cached_clifor('C', doc.get_long(DOC_CODCF));
|
||||
//preparo la chiave e recupero da CFVEN i dati di quel cliente
|
||||
|
||||
if (codcli != last_clifo)
|
||||
if (cli.codice() != last_clifo)
|
||||
{
|
||||
key.format("C|%ld", cli.codice());
|
||||
key.format("C|%ld", cli.codice());
|
||||
TString str;
|
||||
str << TR("Cliente") << ' ' << cli.codice() << ' ' << cache().get(LF_CLIFO, key, CLI_RAGSOC);
|
||||
pi->set_text(str);
|
||||
last_clifo = codcli;
|
||||
last_clifo = cli.codice();
|
||||
}
|
||||
|
||||
//se non è l'ultimo cliente, allora:
|
||||
if (codcli != lastcli)
|
||||
if (cli.codice() != lastcli)
|
||||
{
|
||||
//se effettivamente devo elaborare delle bolle per questo cliente, allora:
|
||||
if (docsin.items() > 0)
|
||||
@ -2345,7 +2344,7 @@ void TFatturazione_lav_app::main_loop()
|
||||
docsin.rewrite();
|
||||
docsin.destroy(-1);
|
||||
}
|
||||
lastcli = codcli;
|
||||
lastcli = cli.codice();
|
||||
}
|
||||
|
||||
//se il documento che sto analizzando è corretto, allora:
|
||||
@ -2464,10 +2463,10 @@ void TFatturazione_lav_app::main_loop()
|
||||
doc.update(DOC_CODCABP, cab);
|
||||
doc.update(DOC_PROGBNP, progbnp);
|
||||
}
|
||||
doc_updated |= doc.update(DOC_CODPAG, cli.get(CLI_CODPAG)); // was update_if_full
|
||||
doc_updated |= doc.update(DOC_PERCSPINC, cli.vendite().get(CFV_PERCSPINC)); // was update_if_full
|
||||
doc_updated |= doc.update(DOC_ADDBOLLI, cli.vendite().get_bool(CFV_ADDBOLLI)); // was update_if_full
|
||||
doc_updated |= doc.update(DOC_CODAGVIS, cli.vendite().get(CFV_CODAG1)); // was update_if_full
|
||||
doc_updated |= doc.update_if_full(DOC_CODPAG, cli.get(CLI_CODPAG));
|
||||
doc_updated |= doc.update_if_full(DOC_PERCSPINC, cli.vendite().get(CFV_PERCSPINC));
|
||||
doc_updated |= doc.update_if_full(DOC_ADDBOLLI, cli.vendite().get_bool(CFV_ADDBOLLI));
|
||||
doc_updated |= doc.update_if_full(DOC_CODAGVIS, cli.vendite().get(CFV_CODAG1));
|
||||
if (doc_updated)
|
||||
{
|
||||
TString msg(" Cli.");
|
||||
|
@ -594,7 +594,7 @@ bool TGestione_bolle_msk::lv_bolla_handler(TMask_field& f, KEY k)
|
||||
if (dmsk._stcodcf == codcf && dmsk._stcodcont == codcont && nrighe > 0)
|
||||
return true;
|
||||
|
||||
doc.cli2doc();
|
||||
doc.clifor().cli2doc(doc);
|
||||
dmsk.mask2doc();
|
||||
|
||||
dmsk._stcodcf = codcf;
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include <sheet.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "../cg/cglib.h"
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../cg/cg2103.h"
|
||||
#include "../cg/cgsaldac.h"
|
||||
|
||||
#include "lv4.h"
|
||||
@ -64,7 +65,7 @@ const TCausale& TCausali_cache::causale(const char tipocf, tipo_movimento tm)
|
||||
{
|
||||
// Metodo bastardo per evitare TToken_string temporanee "a randa"
|
||||
// creo chiave a lunghezza fissa TIPOCF+TIPOMOV+ANNO = C12010
|
||||
const char key[4] = { tipocf, '0'+(char) tm, '\0' };
|
||||
const char key[4] = { tipocf, '0'+tm, '\0' };
|
||||
return *(const TCausale*)objptr(key);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include "../ce/cespi.h"
|
||||
#include "../ce/salce.h"
|
||||
|
||||
#include "../cg/cglib.h"
|
||||
#include "../cg/cg2103.h"
|
||||
#include "../cg/cglib01.h"
|
||||
|
||||
#include "lv4.h"
|
||||
#include "lv4100.h"
|
||||
|
@ -426,7 +426,6 @@ TMask * Tab_app_mag::set_mask(TMask * _m)
|
||||
{
|
||||
const TString& tabname = get_tabname();
|
||||
TString maskname; get_mask_name(maskname);
|
||||
|
||||
return Tab_application::set_mask(new TMask_tabmag(maskname, tabname));
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,8 @@
|
||||
|
||||
#include "np0.h"
|
||||
#include "np0200.h"
|
||||
#include "..\cg\cglib.h"
|
||||
#include "..\cg\cg2101.h"
|
||||
#include "..\cg\cglib02.h"
|
||||
|
||||
#include <pconti.h>
|
||||
#include <mov.h>
|
||||
@ -563,7 +564,7 @@ bool TApertura_chiusura::set()
|
||||
(*_cur) = 0L;
|
||||
_sld->set_anno_es(_annoesch);
|
||||
_sld->set_movprovv(FALSE);
|
||||
_sld->set_tipo_saldo(saldo_chiusura);
|
||||
_sld->set_tipo_saldo(chiusura);
|
||||
_sld->set_movimentato(TRUE);
|
||||
|
||||
costi();
|
||||
@ -581,7 +582,7 @@ bool TApertura_chiusura::set()
|
||||
_totale_saldo = ZERO;
|
||||
|
||||
_sld->set_anno_es(_annoesap);
|
||||
_sld->set_tipo_saldo(saldo_apertura);
|
||||
_sld->set_tipo_saldo(apertura);
|
||||
_sld->set_movimentato(TRUE);
|
||||
|
||||
*_cur = 0l;
|
||||
@ -596,7 +597,7 @@ bool TApertura_chiusura::set()
|
||||
(*_cur) = 0L;
|
||||
_sld->set_anno_es(_annoesch);
|
||||
_sld->set_movprovv(FALSE);
|
||||
_sld->set_tipo_saldo(saldo_chiusura);
|
||||
_sld->set_tipo_saldo(chiusura);
|
||||
_sld->set_movimentato(TRUE);
|
||||
|
||||
costi();
|
||||
@ -614,7 +615,7 @@ bool TApertura_chiusura::set()
|
||||
_totale_saldo = ZERO;
|
||||
|
||||
_sld->set_anno_es(_annoesap);
|
||||
_sld->set_tipo_saldo(saldo_apertura);
|
||||
_sld->set_tipo_saldo(apertura);
|
||||
_sld->set_movimentato(TRUE);
|
||||
|
||||
*_cur = 0l;
|
||||
@ -768,7 +769,7 @@ void TApertura_chiusura::costi()
|
||||
}
|
||||
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo.is_zero())
|
||||
@ -914,7 +915,7 @@ void TApertura_chiusura::ricavi()
|
||||
|
||||
//numrig++;
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo.is_zero()) continue;
|
||||
@ -1153,7 +1154,7 @@ void TApertura_chiusura::chiudi_attivita()
|
||||
}
|
||||
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
const int dbkey = saldi.getkey();
|
||||
saldi.setkey(1);
|
||||
@ -1303,7 +1304,7 @@ void TApertura_chiusura::chiudi_passivita()
|
||||
//numrig++;
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
//sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo.is_zero()) continue;
|
||||
@ -1448,7 +1449,7 @@ void TApertura_chiusura::chiudi_conti_ordine()
|
||||
}
|
||||
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
const int dbkey = saldi.getkey();
|
||||
saldi.setkey(1);
|
||||
@ -1645,7 +1646,7 @@ void TApertura_chiusura::apri_attivita()
|
||||
|
||||
//numrig++;
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo == ZERO) continue;
|
||||
@ -1791,7 +1792,7 @@ void TApertura_chiusura::apri_passivita()
|
||||
|
||||
//numrig++;
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo.is_zero()) continue;
|
||||
@ -1937,7 +1938,7 @@ void TApertura_chiusura::apri_conti_ordine()
|
||||
//numrig++;
|
||||
s = saldi.get_long(SLD_SOTTOCONTO);
|
||||
|
||||
sale.saldo_cont_sep(Registrazione, g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
sale.saldo_cont_sep(g, c, s, _annoesch, botime, indbil, _cod_cont_sep, 0, _cod_cont_sep.blank());
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo == ZERO) continue;
|
||||
|
@ -380,7 +380,7 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
||||
TDocumento& documento = (TDocumento&)cf.form().cursor()->curr(LF_DOC);
|
||||
TCli_for& cli_for = documento.clifor();
|
||||
TOccasionale& cli_occ = documento.occas();
|
||||
const bool occasionale = cli_for.is_occasionale();
|
||||
const bool occasionale = cli_for.occasionale();
|
||||
if (print_cod)
|
||||
ws << cli_for.get("CODCF") << " ";
|
||||
if (occasionale)
|
||||
|
@ -512,20 +512,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -496,20 +496,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -499,20 +499,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -511,20 +511,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -512,20 +512,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -496,20 +496,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -499,20 +499,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -511,20 +511,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -512,20 +512,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -496,20 +496,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -499,20 +499,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -511,20 +511,6 @@ HE "Inserisci il codice del tipo di pagamento"
|
||||
WA "Codice tipo pagamento non trovato"
|
||||
ADD RU ba3 -6
|
||||
EN
|
||||
ST 226 6
|
||||
BE
|
||||
PR 2 19 "Contabilità separata "
|
||||
FL "U"
|
||||
CH NORMAL
|
||||
FI CONTSEP
|
||||
US &NPENT
|
||||
IN CODTAB 226
|
||||
DI "Codice@6" CODTAB
|
||||
DI "Descrizione@50" S0
|
||||
OU 226 CODTAB
|
||||
ADD RUN np0 -0 &ENT
|
||||
MO NP
|
||||
EN
|
||||
EN
|
||||
PA "Pagamenti" 11 60 14
|
||||
GR -1 78 6
|
||||
|
@ -123,24 +123,6 @@ DI "Codice@20" CODTAB
|
||||
OU 124 CODTAB
|
||||
OU 252 S0
|
||||
EN
|
||||
BO 187
|
||||
BE
|
||||
PR 2 14 "Rev.charge "
|
||||
FI REVCHARGE
|
||||
EN
|
||||
ST 154 1
|
||||
BE
|
||||
PR 30 14 "Indetraib. "
|
||||
US %DET
|
||||
IN CODTAB 154
|
||||
DI "Codice" CODTAB
|
||||
DI "Tipo" I0
|
||||
DI "Descrizione@50" S0
|
||||
OU 154 CODTAB
|
||||
CH NORMAL
|
||||
FI TIPODET
|
||||
FL "U"
|
||||
EN
|
||||
NU 133 3
|
||||
BE
|
||||
PR 2 15 "Gruppo "
|
||||
|
@ -277,24 +277,6 @@ DI "Codice@20" CODTAB
|
||||
OU 124 CODTAB
|
||||
OU 252 S0
|
||||
EN
|
||||
BO 187
|
||||
BE
|
||||
PR 2 14 "Rev.charge "
|
||||
FI REVCHARGE
|
||||
EN
|
||||
ST 154 1
|
||||
BE
|
||||
PR 30 14 "Indetraib. "
|
||||
US %DET
|
||||
IN CODTAB 154
|
||||
DI "Codice" CODTAB
|
||||
DI "Tipo" I0
|
||||
DI "Descrizione@50" S0
|
||||
OU 154 CODTAB
|
||||
CH NORMAL
|
||||
FI TIPODET
|
||||
FL "U"
|
||||
EN
|
||||
ST 127 5
|
||||
BE
|
||||
PR 2 18 "Caus.mag. "
|
||||
|
@ -277,24 +277,6 @@ DI "Codice@20" CODTAB
|
||||
OU 124 CODTAB
|
||||
OU 252 S0
|
||||
EN
|
||||
BO 187
|
||||
BE
|
||||
PR 2 14 "Rev.charge "
|
||||
FI REVCHARGE
|
||||
EN
|
||||
ST 154 1
|
||||
BE
|
||||
PR 30 14 "Indetraib. "
|
||||
US %DET
|
||||
IN CODTAB 154
|
||||
DI "Codice" CODTAB
|
||||
DI "Tipo" I0
|
||||
DI "Descrizione@50" S0
|
||||
OU 154 CODTAB
|
||||
CH NORMAL
|
||||
FI TIPODET
|
||||
FL "U"
|
||||
EN
|
||||
ST 127 5
|
||||
BE
|
||||
PR 2 18 "Caus.mag. "
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user