Patch level : xx.282

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Riportata la versione 01.05 patch 282


git-svn-id: svn://10.65.10.50/trunk@8058 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1999-04-16 12:02:04 +00:00
parent 6184af824d
commit 649a9819c8
69 changed files with 2519 additions and 1715 deletions

View File

@ -449,9 +449,10 @@ class TMenuitem : public TObject
TString _caption, _action;
char _type;
COLOR _color;
int _exist : 2;
bool _firm : 2;
bool _password : 2;
int _exist : 2;
bool _enabled : 2;
bool _firm : 2;
bool _password : 2;
bool _reloadmenu : 2;
protected:
@ -599,7 +600,10 @@ void TMenuitem::create(const char* t)
{
if (_action.find('.') < 0)
_action << ".men";
menu().read(_action, _action);
if (fexist(_action))
menu().read(_action, _action);
else
_action.cut(0);
_type = '[';
}

View File

@ -24,8 +24,8 @@ int main(int argc,char** argv)
ba1700(argc,argv); break;
case 7:
ba1800(argc,argv); break;
case 8:
ba1900(argc,argv); break;
// case 8:
// ba1900(argc,argv); break; quest cosa e'
default:
ba1100(argc,argv); break; // Manutenzione
}

View File

@ -591,124 +591,123 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga)
switch (tasto)
{
case K_F4:
if (logicnum > 1)
{
const TFilename filename(_mask->get(FLD_NOME));
const TString tabella(_mask->get(F_TAB));
TEdit_file ef;
ef.browse(logicnum, filename, tabella);
}
break;
case K_F5:
case K_F6:
case K_F8:
if (!superprassi)
{
error_box("Funzione non ammessa per l'utente %s", (const char*)user());
break;
}
case K_F7:
case K_ENTER:
{
strcpy (dep.SysName,_mask->get (FLD_NOME));
dep.EOD = atol(_mask->get (FLD_EOD));
dep.Flags = atol(_mask->get (FLD_FLAG));
strcpy (dep.Des,_mask->get (FLD_DESC));
strcpy (dep.FCalc,_mask->get (FLD_FORMULA));
const TRecnotype eox = _mask->get_bool(FLD_EXTEND) ? _mask->get_long(FLD_EOX) : oldeox;
case K_F4:
if (logicnum > 1)
{
const TFilename filename(_mask->get(FLD_NOME));
const TString tabella(_mask->get(F_TAB));
TEdit_file ef;
ef.browse(logicnum, filename, tabella);
}
break;
case K_F5:
case K_F6:
case K_F8:
if (!superprassi)
{
error_box("Funzione non ammessa per l'utente %s", (const char*)user());
break;
}
case K_F7:
case K_ENTER:
{
strcpy (dep.SysName,_mask->get (FLD_NOME));
dep.EOD = atol(_mask->get (FLD_EOD));
dep.Flags = atol(_mask->get (FLD_FLAG));
strcpy (dep.Des,_mask->get (FLD_DESC));
strcpy (dep.FCalc,_mask->get (FLD_FORMULA));
const TRecnotype eox = _mask->get_bool(FLD_EXTEND) ? _mask->get_long(FLD_EOX) : oldeox;
_browse->dir()->get(logicnum, _lock, _nordir, _sysdirop);
_browse->dir()->set(dep.SysName, dep.EOD, dep.Flags,
dep.Des, dep.FCalc);
_browse->dir()->put(logicnum, _nordir, _sysdirop);
_browse->dir()->get(logicnum, _lock, _nordir, _sysdirop);
_browse->dir()->set(dep.SysName, dep.EOD, dep.Flags,
dep.Des, dep.FCalc);
_browse->dir()->put(logicnum, _nordir, _sysdirop);
if (eox != oldeox)
{
TSystemisamfile f(logicnum);
d.get(logicnum);
TFilename f_name(d.name());
f_name.ext("dbf");
if (f_name.exist())
f.extend(eox);
else
f.build(eox);
_browse->dir()->get(logicnum, _nolock, _nordir, _sysdirop);
}
if (tasto == K_F5 && logicnum > 1)
{
TSystemisamfile f(logicnum);
f.pack();
//Pack supplementare tramite FOXPRO (da togliere con CodeBase 6)
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (logicnum > 2 && logicnum < 6 && f.status() == NOERR)
if (fexist("packaga.exe"))
{
d.get(logicnum);
TFilename f_name(d.name());
f_name.ext("dbf");
f_name.replace('/','\\'); // A volte rimangono delle slash
TString cmd("packaga -t");
cmd << " " << f_name;
TExternal_app packapp(cmd);
packapp.run(FALSE,FALSE);
}
if (eox != oldeox)
{
TSystemisamfile f(logicnum);
d.get(logicnum);
TFilename f_name(d.name());
f_name.ext("dbf");
if (f_name.exist())
f.extend(eox);
else
f.build(eox);
_browse->dir()->get(logicnum, _nolock, _nordir, _sysdirop);
}
if (tasto == K_F5 && logicnum > 1)
{
TSystemisamfile f(logicnum);
f.pack();
//Pack supplementare tramite FOXPRO (da togliere con CodeBase 6)
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#if !defined(CB6)
if (logicnum > 2 && logicnum < 6 && f.status() == NOERR)
if (fexist("packaga.exe"))
{
d.get(logicnum);
TFilename f_name(d.name());
f_name.ext("dbf");
f_name.replace('/','\\'); // A volte rimangono delle slash
TString cmd("packaga -t");
cmd << " " << f_name;
TExternal_app packapp(cmd);
packapp.run(FALSE,FALSE);
}
#endif
}
break;
case K_F6:
{
_rec = new TRec_sheet(logicnum, _mask->get(F_TAB));
_rec->edit();
delete _rec;
_rec = NULL;
}
break;
case K_F7:
{
TMask m("ba1100b");
TFilename nout(dumpfilename(dep));
m.set(FLD_OUTFILE, nout);
if (m.run() == K_ENTER)
{
nout = m.get(FLD_OUTFILE);
if (nout.not_empty())
{
TSystemisamfile f(logicnum);
const char fs = *esc(m.get(FLD_FS));
const char fd = *esc(m.get(FLD_FD));
const char rs = *esc(m.get(FLD_RS));
const bool withdel = m.get_bool(FLD_WITHDEL);
const int keyno = m.get_int(FLD_KEYNO);
f.dump(nout, keyno, fs, fd, rs, withdel);
}
}
}
break;
case K_F8:
{
TMask m("ba1100c");
TFilename ninp(dumpfilename(dep));
m.set(FLD_INFILE, ninp);
if (m.run() == K_ENTER)
{
TSystemisamfile f(logicnum);
char fs = *esc(m.get(FLD_FS));
char fd = *esc(m.get(FLD_FD));
char rs = *esc(m.get(FLD_RS));
ninp = m.get(FLD_INFILE);
f.load(ninp, fs, fd, rs);
}
}
break;
default:
break;
}
}
default:
break;
#endif
}
else
if (tasto == K_F6)
{
_rec = new TRec_sheet(logicnum, _mask->get(F_TAB));
_rec->edit();
delete _rec;
_rec = NULL;
}
else
if(tasto == K_F7)
{
TMask m("ba1100b");
TFilename nout(dumpfilename(dep));
m.set(FLD_OUTFILE, nout);
if (m.run() == K_ENTER)
{
nout = m.get(FLD_OUTFILE);
if (nout.not_empty())
{
TSystemisamfile f(logicnum);
const char fs = *esc(m.get(FLD_FS));
const char fd = *esc(m.get(FLD_FD));
const char rs = *esc(m.get(FLD_RS));
const bool withdel = m.get_bool(FLD_WITHDEL);
const int keyno = m.get_int(FLD_KEYNO);
f.dump(nout, keyno, fs, fd, rs, withdel);
}
}
}
else
if (tasto == K_F8)
{
TMask m("ba1100c");
TFilename ninp(dumpfilename(dep));
m.set(FLD_INFILE, ninp);
if (m.run() == K_ENTER)
{
TSystemisamfile f(logicnum);
char fs = *esc(m.get(FLD_FS));
char fd = *esc(m.get(FLD_FD));
char rs = *esc(m.get(FLD_RS));
ninp = m.get(FLD_INFILE);
f.load(ninp, fs, fd, rs);
}
}
}
break;
default:
break;
}
}

View File

@ -305,51 +305,56 @@ TSubmenu& TMenu::get_submenu(const char* name)
void TMenu::import(const char* filename, TString& first)
{
TSubmenu* sub;
TScanner scan(filename);
first.cut(0);
while (scan.good())
{
TString& line = scan.line();
if (line[0] == '[')
{
if (first.empty())
first = line;
sub = &get_submenu(line);
} else
if (line.compare("Caption", 7, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Caption");
line.ltrim(equal+1);
line.strip("\"");
*sub = line;
} else
if (line.compare("Module", 6, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Module");
sub->set_module(atoi(line.mid(equal+1)));
} else
if (line.compare("Item", 4, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Item");
line.ltrim(equal+1);
line.trim();
TMenu_item& child = sub->add_child(line);
const int bracket = line.rfind('<');
if (bracket > 0)
{
TString16 name = line.mid(bracket+1);
name.strip("< >");
import(name, name);
child.cmd() = name;
}
}
}
TScanner scan(filename);
first.cut(0);
while (scan.good())
{
TString& line = scan.line();
if (line[0] == '[')
{
if (first.empty())
first = line;
sub = &get_submenu(line);
} else
if (line.compare("Caption", 7, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Caption");
line.ltrim(equal+1);
line.strip("\"");
*sub = line;
} else
if (line.compare("Module", 6, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Module");
sub->set_module(atoi(line.mid(equal+1)));
} else
if (line.compare("Item", 4, TRUE) == 0)
{
CHECK(sub, "Invalid menu file");
const int equal = line.find('=');
CHECK(equal > 0, "Invalid menu Item");
line.ltrim(equal+1);
line.trim();
const int bracket = line.rfind('<');
if (bracket > 0)
{
TString16 name = line.mid(bracket+1);
name.strip("< >");
if (fexist(name))
{
import(name, name);
TMenu_item& child = sub->add_child(line);
child.cmd() = name;
}
}
else
sub->add_child(line);
}
}
}
TSubmenu& TMenu::add_submenu(const char* para, int parent_module)

View File

@ -9,6 +9,7 @@
#include <prefix.h>
#include <progind.h>
#include <text.h>
#include <sheet.h>
#include <utility.h>
#include "ba1.h"
@ -34,7 +35,7 @@ public:
class TFascicolator : public TCreazione_dischi
{
protected:
virtual bool use_files() const { return TRUE; }
// virtual bool use_files() const { return TRUE; }
virtual void main_loop();
public:
virtual bool modify_mode() { return TRUE;}
@ -421,6 +422,7 @@ void TFconv_ini::export_module(const char* module, const char* summary)
// TAuto_token_string
///////////////////////////////////////////////////////////
/*
TAuto_token_string& TAuto_token_string::create(const char* ts)
{
// Copia la stringa
@ -438,7 +440,7 @@ TAuto_token_string& TAuto_token_string::create(const char* ts)
return *this;
}
*/
///////////////////////////////////////////////////////////
// Maschera composizione del modulo
///////////////////////////////////////////////////////////
@ -915,7 +917,6 @@ protected:
static bool creazip_handler(TMask_field& f, KEY k);
static bool modules_notify(TSheet_field& f, int row, KEY k);
static bool import_export_handler(TMask_field& f, KEY k);
<<<<<<< ba1600.cpp
static bool patchl_handler(TMask_field& f, KEY k);

View File

@ -245,21 +245,6 @@ void TInstaller_mask::update_version()
force_update();
}
bool is_internet_path(const TString& addr)
{
if (addr.compare("www.", 4, TRUE) == 0)
return TRUE;
if (addr.compare("http:", 5, TRUE) == 0)
return TRUE;
int a1, a2, a3, a4;
if (sscanf(addr, "%d.%d.%d.%d", &a1, &a2, &a3, &a4) == 4)
return TRUE;
return FALSE;
}
// Cerca nel percorso specificato sulla maschera tutti i possibili files .ini
// utilizzabili per un'installazione e li inserisce nello spreadsheet
bool TInstaller_mask::autoload()

View File

@ -18,7 +18,7 @@ protected:
virtual bool create();
virtual void main_loop();
static bool test_firm(TMask_field& f, KEY k);
KEY query(long& firm, char& floppy, TString& desc, bool& tmp) const;
KEY query(long& firm, char& floppy, TString& desc, bool& temp, bool& zip) const;
public:
void stop_job();

View File

@ -7,7 +7,8 @@ int main(int argc, char** argv)
switch (r)
{
default:
case 0:
default:
ba7100(argc, argv) ; break;
}

View File

@ -11,7 +11,7 @@
#include <extcdecl.h>
#if XVT_OS == XVT_OS_WIN
#if (XVT_OS == XVT_OS_WIN) || (XVT_OS == XVT_OS_WIN32)
#include <direct.h>
#define RMDIR _rmdir
#else
@ -1573,7 +1573,7 @@ void TConversione_archivi::convert_cap() const
file = new TTable(cod);
dir.get(file->num(), _nolock, _nordir, _sysdirop);
const bool good_file = dir.is_com() ^ _codditta != 0;
const bool good_file = dir.is_com() ^ (_codditta != 0);
if (!good_file)
{
delete file;

View File

@ -420,7 +420,7 @@ void TFax_mask::set_field(const char* field, const char* value)
const TString& TFax_mask::get_field(const char* field)
{
TMask_field* f = lookup(field);
return f ? f->get() : "";
return f ? f->get() : EMPTY_STRING;
}
bool TFax_mask::code_handler(TMask_field& f, KEY k)

View File

@ -2,6 +2,7 @@
#include <isam.h>
#include <progind.h>
#include <prefix.h>
#include <utility.h>
// prototipi
#include "bainsta.h"
#include "bainst.h"
@ -38,6 +39,8 @@ int TSystemtempfile::load(
if (fl == NULL)
{
error_box("Non riesco ad aprire il file %s",from);
clearerr(fl);
setstatus(2);
return 2;
}
TRecnotype r = 0, e = 0, nitems = 0, nread = 0;
@ -55,24 +58,10 @@ int TSystemtempfile::load(
if (ditte.read() == NOERR)
attprev = ditte.get("CODATTPREV");
}
if (fl == NULL)
{
clearerr(fl);
setstatus(err);
return err;
}
char w[80];
while ((fgets(w, 80, fl) != NULL))
{
if (strncmp(w, "[Data]", 6) == 0)
{
nitems = ftell(fl);
break;
}
}
fseek(fl, 0L, SEEK_END);
nitems = ftell(fl) - nitems;
nitems = ftell(fl);
fclose(fl);
TScanner f(from);
//open();
@ -80,7 +69,7 @@ int TSystemtempfile::load(
TToken_string s(1024, fs);
bool fixedlen = (fs == '\0');
int nflds = curr().items();
TArray fld(nflds);
TString_array fld(nflds);
int len[MaxFields];
TString sfd(3);
TString s1(64);
@ -88,49 +77,54 @@ int TSystemtempfile::load(
if (f.paragraph("Header"))
{
f.equal();
const long level = atol(f.line());
if (level > get_std_level())
error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.",
from, level/100, level%100, get_std_level()/100, get_std_level()%100);
//lcf = getlcf(level);
int equal;
TString key;
nflds = 0;
TToken_string s2(f.line());
int p = s2.find('=');
if (p > 0)
while ((equal = f.line().find('=')) > 0)
{
s1 = s2.left(p);
s2.ltrim(p+1);
}
else s1.cut(0);
while (s1 == "Fields")
{
for (const char * fd = s2.get(); fd != NULL; fd = s2.get())
key = f.token().left(equal);
key.trim();
if (key == "Version")
{
TToken_string wfd(fd, ',');
fld.add(new TString(wfd.get()));
len[nflds] = wfd.get_int();
nflds++;
}
s2 = f.line();
p = s2.find('=');
if (p > 0)
const long level = atol(f.token().mid(equal+1));
if (level > prefix().filelevel())
error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.",
from, level/100, level%100, get_std_level()/100, get_std_level()%100);
// lcf = getlcf(level);
} else
if (key == "File")
{
s1 = s2.left(p);
s2.ltrim(p+1);
}
else s1.cut(0);
const int logic = atoi(f.token().mid(equal+1));
if (logic != num())
error_box("L'archivio %s e' stato generato dal file %d",
from, logic);
} else
if (key == "Fields")
{
TToken_string riga = f.token().mid(equal+1);
TToken_string wfd(32, ',');
FOR_EACH_TOKEN(riga, fd)
{
wfd = fd; wfd.strip_spaces();
fld.add(wfd.get(0));
len[nflds] = wfd.get_int();
nflds++;
}
}
}
}
else
{
if (nflds == 0 || fld.items() == 0)
{
nflds = curr().items();
for (int j = 0; j < nflds; j++)
{
fld.add(TString(curr().fieldname(j)), j);
fld.add(curr().fieldname(j), j);
const TString & wfld = (const TString & ) fld[j];
len[j] = (curr().type(wfld) == _datefld) ? 10 : curr().length(wfld);
}
}
if (!f.paragraph("Data"))
{
error_box("Formato dei dati non valido");
@ -161,7 +155,7 @@ int TSystemtempfile::load(
}
if ((r + e) % 50 == 0)
{
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
s1.format("Imp. archivio %d\n%6ld records %6ld errori - %3d", _logicnum, r, e, last);
p.set_text(s1);
}
p.setstatus(nread + 1);
@ -189,21 +183,29 @@ int TSystemtempfile::load(
s2++;
s2[strlen(s2) - 1] = '\0';
}
if (curr().type((const TString&) fld[j]) == _memofld)
s1 = esc(s2);
else
s1 = s2;
put((const TString&) fld[j], s2);
}
}
if (write() == NOERR) r++;
int err = write();
if (err == _isreinsert)
err = rewrite();
if (err == NOERR)
r++;
else
{
#ifdef DBG
yesnofatal_box("Numero linea relativa all'errore: %ld",r+e+1);
#endif
error_box("Errore di scrittura alla riga %ld", r+e+1);
e++;
last = status();
break;
}
s = f.line();
}
s1.format("Imp. archivio %s\n%6ld records %6ld errori - %3d", filename(), r, e, last);
s1.format("Imp. archivio %d\n%6ld records %6ld errori - %3d", _logicnum, r, e, last);
p.set_text(s1);
//close();
setstatus(err);
@ -257,12 +259,15 @@ int TSystemtempfile::dump(
len[j] = (t == _datefld) ? 10 : curr().length(wfld);
}
TRecnotype i = 0;
const TRecnotype nitems = nkey ? items() : filehnd()->d->EOD;
s.format("Esportazione archivio %s", filename());
TProgind p(nitems, s, TRUE, TRUE, 70);
TString s1;
fprintf(f, "[Header]\nVersion=%ld", prefix().filelevel());
const TRecnotype nitems = items();
s.format("Esportazione archivio %s", filename());
TProgind p(nitems, s, TRUE, TRUE, 70);
TString s1,sfld;
fprintf(f, "[Header]\nVersion=%ld\nFile=%d",
prefix().filelevel(), num());
for (int k = 0; k < nflds; k++)
{
if ((k % 10) == 0) fprintf(f, "\nFields=");
@ -290,7 +295,17 @@ int TSystemtempfile::dump(
s1 = "";
if (j && fs) s1 << fs;
if (fd) s1 << fd;
s1 << get((const TString&)fld[j]);
sfld = get((const TString&)fld[j]);
if (curr().type((const TString&) fld[j]) == _memofld)
{
int p = 0;
while ((p = sfld.find('\n', 0)) >= 0)
{
sfld.overwrite("\\", p);
sfld.insert("n", p+1);
}
}
s1 << sfld;
if (fd) s1 << fd;
}
s << s1;
@ -321,8 +336,18 @@ int TSystemtempfile::dump(
s1 = "";
if (j && fs) s1 << fs;
if (fd) s1 << fd;
s1 << get((const TString&)fld[j]);
if (fd) s1 << fd;
s1 = get((const TString&)fld[j]);
if (curr().type((const TString&) fld[j]) == _memofld)
{
int p = 0;
while ((p = sfld.find('\n', 0)) >= 0)
{
sfld.overwrite("\\", p);
sfld.insert("n", p+1);
}
}
s1 << sfld;
if (fd) s1 << fd;
}
s << s1;
}

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <mask.h>
#include <isam.h>
#define G_PREINST 1
int bainst00(int argc, char** argv);

View File

@ -6,3 +6,4 @@
#define FLD_TABCAM_R10 106
#define FLD_TABCAM_D0 107
#define FLD_TABCAM_I2 108
#define FLD_DATACAM_COPY 109

View File

@ -29,7 +29,7 @@ BEGIN
OUTPUT FLD_TABCAM_I2 I2
OUTPUT FLD_TABCAM_B1 B1
CHECKTYPE FORCED
MESSAGE COPY,FLD_CODVAL_COPY
// MESSAGE COPY,FLD_CODVAL_COPY
WARNING "Valuta assente"
END

View File

@ -473,7 +473,7 @@ bool TStampa_IVdirettiva::data_bil_raff (TMask_field& f, KEY key)
a()._anno_esercizio_raf = anno;
}
else
anno == 1;
anno = 1;
/****
if (dataraf == botime)
{

View File

@ -534,6 +534,7 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
{
TImporto cassa(impsal); cassa.swap_section();
TImporto residuo(imptot); residuo -= cassa; residuo.normalize(imptot.sezione());
bool ok = TRUE;
if (!residuo.is_zero())
{

View File

@ -1655,7 +1655,7 @@ bool TStampa_giornale::data_a_hndl (TMask_field& f, KEY k)
{
if (dtda.not_empty())
{
if (data_da.year() != data_a.year());
if (data_da.year() != data_a.year())
return f.warning_box("Le date specificate non appartengono allo stesso anno");
if (data_da > data_a)
return f.warning_box("La data di partenza non puo' essere maggiore della data finale");

View File

@ -45,20 +45,6 @@ void _Iva11Array::zero(const char* fld_name)
}
// Methods of _ProrataItem
void _ProrataItem::set(const int a, const real& c, const real& p, const bool fl)
{
_current_perc = c;
_previous_ok = a < 1998 ? TRUE : fl;
if (a > 1997) // Se siamo prima del 1997 la percentuale prec vale 0
{
if (!_previous_ok) // Se non ha trovato la percentuale anno precedente
_previous_perc = c; // usa quella attuale ricordandosi la segnalazione
else
_previous_perc = p;
}
}
// Calcola prorata con percentuale identificata dall'anno passato
// se la % prorata relativa all'anno indicato non esiste, ritorna 0

View File

@ -17,6 +17,7 @@
#include <mov.h>
#include <rmoviva.h>
#include <pconti.h>
#include <utility.h>
// -------------------- QUI comincia l'avventura --------------------------
// Datemi un punto di appoggio ******************
@ -245,7 +246,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
for (int i = atoi(_year); i>=anno; i--)
{
_year = format("%d", i);
_year = format("%d", i);
if (look_pla(cattiv, FALSE)) // Reperisce percentuale prorata anno indicato (se esiste la tabella)
pa.add(_year, _pla->get_real("R8"));
}

View File

@ -538,7 +538,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool
real rit_iva(s1.get(1));
const bool is_rit= tipodet != 0 && month == 13 && rit_imp != 0.0; //Se fattura in ritardo con tipo detr. != 0 e si sta calcolando l'annuale
const tipo_sospensione sosp_imp = _reg->get_bool("B1") ? (tipo_sospensione) _reg->get_int("I9") : nessuna;
issosp |= sosp_imp != nessuna; // Setta il flag di presenza registri in sospensione (qualsiasi tipo: normale, vol_affari, liquidazione)
issosp |= (sosp_imp != nessuna); // Setta il flag di presenza registri in sospensione (qualsiasi tipo: normale, vol_affari, liquidazione)
// ACHTUNG! Corrispettivi da ventileer possono ventilare
// ad un altro codiva; in tal caso si scrive quello

View File

@ -7,6 +7,25 @@
#include "cg4400a.h"
#include "cg4400b.h"
#include "cglib01.h"
#include <mask.h>
#include <sheet.h>
#include <progind.h>
#include <mailbox.h>
#include <execp.h>
#include <utility.h>
#include <defmask.h>
#include <prefix.h>
#include <mov.h>
#include <clifo.h>
#include <nditte.h>
#include <anagr.h>
#include <occas.h>
#include <comuni.h>
#include <unloc.h>
#include <causali.h>
#include <rmoviva.h>
static enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione };
@ -241,7 +260,7 @@ void TStampa_registri_app::get_dati_ditta()
unloc.read();
if (unloc.read() == NOERR)
{
TRectype dep = look_comuni (unloc.get(ULC_COMULC));
TRectype & dep =look_comuni (unloc.get(ULC_COMULC));
_comunefis = dep.get(COM_DENCOM);
_provfis = dep.get(COM_PROVCOM);
_cap = dep.get(COM_CAPCOM);

View File

@ -47,7 +47,7 @@ void Visliq_app::set_freqviva()
_freqviva = _lia->get("S7");
else
{
TLocalisamfile ditte(LF_NDITTE,TRUE);
TLocalisamfile ditte(LF_NDITTE);
ditte.zero();
ditte.put("CODDITTA", get_firm());
ditte.read();
@ -647,8 +647,7 @@ bool Visliq_app::vis_one(int m)
end_wait();
TProgind* pp = new TProgind(10l,"Estrazione liquidazione: prego attendere",
FALSE,FALSE);
liq.run();
if (liq.error())
if (liq.run() != 0)
{
beep();
return FALSE;
@ -659,7 +658,7 @@ bool Visliq_app::vis_one(int m)
brw.goto_pos(brw.lines()-16l, 9);
delete pp;
TViswin* vsw = brw.vis_win();
TViswin & vsw = brw.vis_win();
bool is_delega = FALSE;
real vers; TDate date; TString abi(5), cab(5), con(3);
@ -822,7 +821,7 @@ bool Visliq_app::vis_one(int m)
}
void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& vers,
void Visliq_app::recalc_liq_data(TViswin & vsw, real& rimb, real& rett, real& vers,
real& acc, TString& d1, TString& d2, TDate& date, TString&
abi, TString& cab, TString& con)
{
@ -908,47 +907,47 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver
// una sburlata di search ......
int x = 0;
long lvers = -1l;
long line = vsw->search("CALCOLO LIQUIDAZIONE D'IMPOSTA", x);
long line = vsw.search("CALCOLO LIQUIDAZIONE D'IMPOSTA", x);
int wasdebt = ris.sign();
long lrisd = vsw->search("RISULTATO", x, line, TRUE); // RISULTATO a debito
long lrisc = vsw->search("RISULTATO", x, lrisd+1l, TRUE); // credito
long lrettc = vsw->search("Rettifiche IVA a credito",x,line,TRUE);
long lrettd = vsw->search("Rettifiche IVA a debito", x,line,TRUE);
long lacct = vsw->search("Versamento acconto dicembre",x,line,TRUE);
long lrimb = vsw->search("Iva chiesta a rimborso",x,line,TRUE);
long lintr = vsw->search("Interesse",x,line,TRUE);
long livdv = vsw->search("IVA DOVUTA",x,line,TRUE);
long lrivr = vsw->search("Versamenti effettuati",x,line,TRUE);
long lrisd = vsw.search("RISULTATO", x, line, TRUE); // RISULTATO a debito
long lrisc = vsw.search("RISULTATO", x, lrisd+1l, TRUE); // credito
long lrettc = vsw.search("Rettifiche IVA a credito",x,line,TRUE);
long lrettd = vsw.search("Rettifiche IVA a debito", x,line,TRUE);
long lacct = vsw.search("Versamento acconto dicembre",x,line,TRUE);
long lrimb = vsw.search("Iva chiesta a rimborso",x,line,TRUE);
long lintr = vsw.search("Interesse",x,line,TRUE);
long livdv = vsw.search("IVA DOVUTA",x,line,TRUE);
long lrivr = vsw.search("Versamenti effettuati",x,line,TRUE);
if (wasdebt != 0)
lvers = vsw->search(wasdebt < 0 ? "CREDITO ATTUALE" : "IVA DA VERSARE",
lvers = vsw.search(wasdebt < 0 ? "CREDITO ATTUALE" : "IVA DA VERSARE",
x, line, TRUE);
if (lvers == -1l)
lvers = vsw->search("IVA A DEBITO DA NON VERSARE", x, line, TRUE);
lvers = vsw.search("IVA A DEBITO DA NON VERSARE", x, line, TRUE);
if (lvers == -1l)
lvers = lrisc+1l;
// ... seguita da una sburlata di replace
vsw->replace(lrimb, rimb.string("###.###.###.###"), 75);
vsw->replace(lrisd, risdb.string("###.###.###.###"), 75);
vsw->replace(lrisc, riscr.string("###.###.###.###"), 58);
vsw->replace(lacct, acc.string("###.###.###.###"), 58);
vsw.replace(lrimb, rimb.string("###.###.###.###"), 75);
vsw.replace(lrisd, risdb.string("###.###.###.###"), 75);
vsw.replace(lrisc, riscr.string("###.###.###.###"), 58);
vsw.replace(lacct, acc.string("###.###.###.###"), 58);
if (rett.sign() > 0)
{
vsw->replace(lrettd, rett.string("###.###.###.###"), 75);
vsw->replace(lrettc, " ", 58);
vsw.replace(lrettd, rett.string("###.###.###.###"), 75);
vsw.replace(lrettc, " ", 58);
}
else if (rett.sign() < 0)
{
real rabs = abs(rett);
vsw->replace(lrettc, rabs.string("###.###.###.###"), 58);
vsw->replace(lrettd, " ", 75);
vsw.replace(lrettc, rabs.string("###.###.###.###"), 58);
vsw.replace(lrettd, " ", 75);
}
else
{
vsw->replace(lrettc, " ", 58);
vsw->replace(lrettd, " ", 75);
vsw.replace(lrettc, " ", 58);
vsw.replace(lrettd, " ", 75);
}
if (risul.sign() < 0) // Significa che in questo momento il risultato e' a credito
@ -958,15 +957,15 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver
ln.overwrite(rabs.string("###.###.###.###"), 58);
if (lintr > 0) // Quindi niente riga "Interessi " ...
{
vsw->replace(lintr," ",23);
vsw->replace(lintr," ",33);
vsw->replace(lintr," ",41);
vsw->replace(lintr," ",75);
vsw.replace(lintr," ",23);
vsw.replace(lintr," ",33);
vsw.replace(lintr," ",41);
vsw.replace(lintr," ",75);
}
if (livdv > 0) // ...ed "IVA DOVUTA"
{
vsw->replace(livdv," ",23);
vsw->replace(livdv," ",75);
vsw.replace(livdv," ",23);
vsw.replace(livdv," ",75);
}
}
else if (risul.sign() > 0) // ... altrimenti siamo a debito, in tal caso si hanno gli interessi (solo trimestrali of course)
@ -977,30 +976,30 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver
if (lintr == -1)
{
lintr = lrisc + 2;
vsw->replace(lintr, "Interesse", 23);
vsw->replace(lintr, itt.stringa(6,2), 33);
vsw->replace(lintr, "%", 43);
vsw.replace(lintr, "Interesse", 23);
vsw.replace(lintr, itt.stringa(6,2), 33);
vsw.replace(lintr, "%", 43);
}
if (livdv == -1)
{
livdv = lrisc + 1;
vsw->replace(livdv, "IVA DOVUTA", 23);
vsw.replace(livdv, "IVA DOVUTA", 23);
}
if (lintr > 0)
vsw->replace(lintr, intr.string("###.###.###.###"), 75);
vsw.replace(lintr, intr.string("###.###.###.###"), 75);
if (livdv > 0)
{
vsw->replace(livdv, risul.string("###.###.###.###"), 75);
vsw.replace(livdv, risul.string("###.###.###.###"), 75);
risul += intr;
}
}
ln.overwrite("IVA DA VERSARE", 23);
ln.overwrite(risul.string("###.###.###.###"), 75);
}
vsw->replace(lvers, ln, 0);
vsw->replace(lrivr, vers.string("###.###.###.###"), 58);
vsw.replace(lvers, ln, 0);
vsw.replace(lrivr, vers.string("###.###.###.###"), 58);
vsw->refresh();
vsw.refresh();
}
void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field* sv)

View File

@ -99,7 +99,7 @@ public:
TTable* del() { return _del; }
// riaggiusta la liquidazione del mese dato
void recalc_liq_data(TViswin* v, real& rimb, real& rett, real& vers,
void recalc_liq_data(TViswin & v, real& rimb, real& rett, real& vers,
real& acc, TString& d1, TString& d2, TDate& date, TString&
abi, TString& cab, TString& con);

View File

@ -57,7 +57,7 @@ public:
virtual bool create();
virtual bool destroy();
virtual bool menu(MENU_TAG m);
virtual void main_loop();
virtual bool check_autorization() const
{return FALSE;}
virtual void on_config_change();

View File

@ -1179,7 +1179,7 @@ bool TVar_sc::codval_handler(TMask_field& f, KEY k)
TConfig conf (CONFIG_DITTA);
TString valuta = conf.get("GesVal");
if (codval.not_empty && valuta.empty())
if (codval.not_empty() && valuta.empty())
return f.warning_box("Non e' possibile indicare il codice valuta se non indicata la gestione valuta sui parametri ditta");
if (codval.empty() && valuta.not_empty())
return f.warning_box("Il codice valuta deve essere indicato in quanto indicata la gestione in valuta sui parametri ditta");

View File

@ -22,7 +22,8 @@ class TProgind;
#include <occas.h>
#include <partite.h>
#include <scadenze.h>
#include <pagsca.h>
#include <pagsca.h>
#include <varrec.h>
#define TEMP_CAUS "tcaus"
#define TEMP_RCAUS "trcaus"

View File

@ -1247,7 +1247,7 @@ bool TPartita::esistono_abbuoni_diffcam(long nreg) const
const TString& TPartita::codice_valuta() const
{
const int ultima = last();
return ultima > 0 ? riga(ultima).codice_valuta() : EMPTY_STRING;
return ultima > 0 ? riga(ultima).codice_valuta() : (const TString &) EMPTY_STRING;
}
bool TPartita::in_valuta() const

View File

@ -4,9 +4,10 @@
int main(int argc, char** argv)
{
int n = argc > 1 ? atoi(argv[1]+1) : 0;
int n = argc > 1 ? (argv[1][1] - '0') : 0;
switch(n)
{
case 4: db0500(argc, argv); break;
default: db0100(argc, argv); break;
}
exit(0);

View File

@ -2,5 +2,6 @@
#define __DB0_H
int db0100(int argc, char* argv[]);
int db0500(int argc, char* argv[]);
#endif

View File

@ -1,2 +1,11 @@
#define APPNAME EURO_DB
#define QAPPNAME "EURO_DB"
#define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url>
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"

View File

@ -1,733 +1,189 @@
#include "db0.h"
#include <msksheet.h>
#include <tabapp.h>
#include <modaut.h>
#include "dblib.h"
#include <automask.h>
#include <relapp.h>
#include <sheet.h>
#include <tabutil.h>
#include "dbtblav.h"
#include "../mg/mglib.h"
#include "../mg/anamag.h"
#include "db0100a.h"
///////////////////////////////////////////////////////////
// Funzione di richiesta stringa che andra' in libreria
///////////////////////////////////////////////////////////
#include <defmask.h>
bool query_string(const char* prompt, TString& str, int width = 50, const char* flags= "")
class TLavorazione_tab : public TLavorazione
{
int maskwidth = width+2;
if (maskwidth < 26)
maskwidth = 26;
if (maskwidth > 78)
maskwidth = 78;
TMask m(prompt, 1, maskwidth, 5);
m.add_string(DLG_USER, 0, "", 1, 1, width, flags, width > 76 ? 76 : width);
m.add_button(DLG_CANCEL, 0, "", -12, -1, 10, 2);
m.add_button(DLG_OK, 0, "", -22, -1, 10, 2);
m.set(DLG_USER, str);
bool ok = m.run() == K_ENTER;
if (ok)
str = m.get(DLG_USER);
return ok;
}
///////////////////////////////////////////////////////////
// TDistinta_sheet
///////////////////////////////////////////////////////////
class TDistinta_sheet : public TSheet
{
TArray _data;
protected:
virtual void get_row(long n, TToken_string& row);
virtual long get_items() const { return _data.items(); }
public:
TArray& rows_array() { return _data; }
TDistinta_sheet();
virtual ~TDistinta_sheet() { }
void put_sheet(TSheet_field & s);
void fill_sheet(TSheet_field & s);
TLavorazione_tab (const TRectype r) : TLavorazione(r) {}
TLavorazione_tab (const char* cod) : TLavorazione(cod) {}
virtual ~TLavorazione_tab (){}
};
void TDistinta_sheet::get_row(long n, TToken_string& row)
void TLavorazione_tab::fill_sheet(TSheet_field & sheet)
{
const TRiga_esplosione& re = (const TRiga_esplosione&)_data[int(n)];
row.cut(0);
row.add(re.tipo());
row.add(re.articolo());
row.add(re.giacenza());
row.add(re.um());
row.add(re.val().string(0, 5));
row.add(re.livello());
row.add(re.ordinamento());
}
TDistinta_sheet::TDistinta_sheet()
: TSheet(-1, -1, 0, 20, "Esplosione", "Tipo|Codice@20|Giacenza@15|UM|Quantita'@18R|Liv.@R|Sort@8R")
{
}
///////////////////////////////////////////////////////////
// TQuery_mask
///////////////////////////////////////////////////////////
class TQuery_mask : public TAutomask
{
TDistinta_tree& _tree;
TToken_string _curr;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
const TToken_string& curr() const { return _curr; }
void restart_tree();
TQuery_mask(TDistinta_tree& tree);
virtual ~TQuery_mask() { }
};
void TQuery_mask::restart_tree()
{
_tree.restart();
while (!_tree.is_leaf())
sheet.destroy();
int righe = 0;
const int maxlinee = linee();
for (int j = 0; j < maxlinee ; j++)
{
_tree.expand();
_tree.goto_firstson();
if (_tree.has_rbrother())
break;
TToken_string& row = sheet.row(righe);
row=cod_linea(j);
if (!row.blank())
{
row.add(raw_numpers_linea(j) ,F_LNUMPERS-101);
row.add(raw_produttiv_linea(j).string() ,F_LPRODUTTIV-101);
sheet.check_row(righe);
righe++;
}
}
TTree_field& tf = tfield(F_TREE);
tf.win().update_thumb(0, 0);
tf.win().force_update();
}
bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
void TLavorazione_tab::put_sheet(TSheet_field& sheet)
{
switch (o.dlg())
int righe = sheet.items();
bool ok=TRUE;
int l=0;
reset_linee();
for (int i = 0; i < righe ; i++)
{
case F_CODICE:
if (e == fe_modify)
TToken_string & row=sheet.row(i);
TString16 linea =row.get(F_CODLIN-101);
if (!linea.blank())
{
TTree_field& tf = tfield(F_TREE);
const TCodice_articolo val = o.get();
if (val.not_empty() && _tree.has_root())
ok=FALSE;
// aggiunge il codice linea
linea.trim();
if (set_cod_linea(l,linea))
{
long pos = _tree.find_node(val);
if (pos <= 0)
{
if (_tree.set_root(val))
pos = 1;
}
if (pos > 0)
{
tf.select_current();
do { _tree.expand(); } while (_tree.goto_father());
pos = _tree.find_node(val, SCAN_PRE_ORDER | SCAN_IGNORING_UNEXPANDED);
TField_window& win = tf.win();
const TPoint& range = win.range();
if (pos > range.y)
win.set_scroll_max(win.columns(), pos+win.rows());
win.update_thumb(-1, pos-1);
win.force_update();
tf.set_focus();
}
}
else
{
_tree.set_root(val);
}
tf.win().force_update();
}
case F_SORT:
if (e == fe_init || e == fe_modify)
{
int sk = atoi(o.get());
_tree.set_sort_key(sk);
if (e == fe_modify)
restart_tree();
}
break;
case F_TREE:
if (e == fe_modify)
{
_tree.curr_id(_curr);
TCodice_articolo code; _tree.curr_code(code);
set(F_CODICE, code);
}
break;
case DLG_SELECT:
if (e == fe_button)
{
const TString& str = get(F_CODICE);
if (str.not_empty())
set(F_CODICEQ, str);
else
return FALSE;
}
break;
case F_COPY:
if (e == fe_button)
{
const TString oldcode = get(F_CODICE);
TLocalisamfile dist(LF_DIST);
dist.put("CODDIST", oldcode);
if (dist.read() == NOERR)
{
TString newcode;
if (query_string("Nuovo codice", newcode, 20, "U"))
// aggiunge il numero persone
linea=row.get(F_LNUMPERS-101);
linea.rtrim();
if (set_numpers_linea(l,atoi(linea)))
{
if (newcode.not_empty() && newcode != oldcode)
{
dist.put("CODDIST", newcode);
const int err = dist.write();
if (err == NOERR)
{
TRecord_array rdist(LF_RDIST, "NRIG");
rdist.renum_key("CODDIST", oldcode);
if (rdist.read(rdist.key()) == NOERR)
{
rdist.renum_key("CODDIST", newcode);
rdist.write();
}
}
else
{
if (err == _isreinsert)
error_box("La distinta '%s' e' gia' stata inserita", (const char*)newcode);
else
error_box("Errore %d durante la registrazione della distinta '%s'", err, (const char*)newcode);
}
}
// aggiunge il fattore di produttività
linea=row.get(F_LPRODUTTIV-101);
linea.cut(5);
linea.rtrim();
if (!set_produttiv_linea(l,real(linea)))
break;
ok=TRUE;
}
else break;
}
else
error_box("Il codice '%s' non corrisponde ad una distinta valida", (const char*)oldcode);
else break;
l++;
}
break;
case F_EXPLODE:
if (e == fe_button)
{
TCodice_articolo art = get(F_CODICE);
if (art.not_empty())
{
_tree.set_root(art);
restart_tree();
}
if (_tree.goto_root())
{
_tree.curr_code(art);
TString80 caption;
caption << "Esplosione " << art;
TMask m("db0100c");
m.set_caption(caption);
m.set(F_SORT, get(F_SORT));
m.set(F_ARTICOLI, "X");
m.set(F_LAVORAZIONI, "X");
m.set(F_VIRTUALI, "X");
if (m.run() == K_ENTER)
{
TDistinta_sheet a;
a.set_caption(caption);
int sk = m.get_int(F_SORT);
int md = m.get_int(F_MAXDEPTH);
int gr = m.get_int(F_GROUPMODE);
bool mb = m.get_bool(F_MATBASE);
bool lq = m.get_bool(F_LASTQTA);
TString16 fi;
if (m.get_bool(F_ARTICOLI)) fi << 'A';
if (m.get_bool(F_LAVORAZIONI)) fi << 'L';
if (m.get_bool(F_VIRTUALI)) fi << 'V';
if (fi.len() == 3) fi.cut(0);
_tree.explode(a.rows_array(), mb, gr, md, fi, sk, lq);
a.run();
}
}
}
break;
default:
break;
}
return TRUE;
}
TQuery_mask::TQuery_mask(TDistinta_tree& dt)
: TAutomask("db0100a"), _tree(dt)
{
TTree_field& tree = tfield(F_TREE);
tree.set_tree(&_tree);
}
///////////////////////////////////////////////////////////
// TDistinta_mask
///////////////////////////////////////////////////////////
class TDistinta_mask : public TAutomask
{
TDistinta_tree& _tree;
TRecord_cache _ord;
bool on_distsheet_event(TOperable_field& o, TField_event e, long jolly);
bool on_parmsheet_event(TOperable_field& o, TField_event e, long jolly);
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
bool test_row(const TToken_string& row);
public:
TDistinta_mask(TDistinta_tree& dt);
virtual ~TDistinta_mask() { }
};
bool TDistinta_mask::test_row(const TToken_string& row)
{
const TCodice_articolo father = get(F_CODICE);
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);
path.add(code);
ok = !_tree.is_cyclic(path);
}
if (!ok)
error_box("Il codice '%s' non puo' essere utilizzato\n"
"in quanto la distinta risulterebbe ciclica.", (const char*)code);
// Se e' una lavorazione
if (get(F_TIPO)[0] == 'L')
{
ok = row[0] == 'L' && _tree.is_lav(code);
if (!ok)
error_box("Il codice '%s' non e' una lavorazione", (const char*)code);
set_cod_linea(l,"");
message_box("Impossibile memorizzare piu' di %d righe",l);
}
return ok;
}
bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long jolly)
class TDistinta_tables : public TTable_application
{
const short id = o.dlg();
switch (id)
{
case F_SHEET:
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:
row.add("A", F_TIPOCOMP-FIRST_FIELD); // Forza il listbox ad articolo
row.add("1", F_EXPR-FIRST_FIELD);
break;
case se_notify_modify:
return test_row(row);
case fe_close:
{
TString80 code;
for (int n = sheet.items()-1; n >= 0; n--)
{
const TToken_string& row = sheet.row(n);
row.get(F_CODART-FIRST_FIELD, code);
if (!code.blank())
{
if (!test_row(row))
return FALSE;
}
else
sheet.destroy(n);
}
}
if (sheet.items() == 0)
error_box("E' necessario inserire almeno una riga nella distinta");
break;
default:
break;
}
}
break;
case F_CODART:
case F_CODLAV:
case F_CODDIS:
if (e == fe_modify || e == fe_init)
{
TMask& m = o.mask();
const TEdit_field& ef = (const TEdit_field&)o;
const TRectype& rec = ef.browse()->cursor()->curr();
switch(rec.num())
{
case LF_ANAMAG:
m.set(F_DESCOMP, rec.get(ANAMAG_DESCR));
m.enable(F_UMEXPR);
if (m.get(F_UMEXPR).empty())
{
const TCodice_articolo art = o.get();
const TQuantita qta(art);
m.set(F_UMEXPR, qta.um());
}
break;
case LF_DIST :
m.set(F_DESCOMP, rec.get("DESCR"));
m.set(F_UMEXPR, rec.get("UM"));
m.disable(F_UMEXPR);
break;
default :
m.set(F_DESCOMP, rec.get("S0"));
m.set(F_UMEXPR, rec.get("S6"));
m.disable(F_UMEXPR);
break;
}
}
break;
case F_EXPR:
if (e == fe_modify)
{
const TString& str = o.get();
if (str.not_empty())
{
TDistinta_expr expr;
if (expr.set(str))
{
if (expr.numvar() > 0)
{
TDecoder var("VAR");
for (int v = expr.numvar()-1; v >= 0; v--)
{
const char* name = expr.varname(v);
if (var.decode(name).empty())
return error_box("La variabile %s non e' definita in tabella", name);
}
}
else
o.set(expr.as_string());
}
else
return error_box("Errore di sintassi: %s", expr.last_token());
}
else
return error_box("L'espressione deve essere specificata");
}
break;
case F_SORT1:
case F_SORT2:
case F_SORT3:
case F_SORT4:
case F_SORT5:
if (e == fe_modify && o.empty())
{
TString16 key; key << (o.dlg() - F_SORT1 + 1);
bool completo = _ord.get(key).get_bool("B0");
if (completo)
return error_box("Il criterio di ordinamento %s deve essere specificato",
(const char*)key);
}
break;
default:
break;
}
return TRUE;
}
bool TDistinta_mask::on_parmsheet_event(TOperable_field& o, TField_event e, long jolly)
{
const short id = o.dlg();
switch (id)
{
case F_PARAM:
if (e == fe_modify || e == fe_close)
{
const TString& str = o.get();
if (!isalpha(str[0]) && str[0] != '_')
return error_box("Il nome del parametro deve iniziare con un carattere alfabetico o con _");
for (const char* s = str; *s; s++)
{
if (!isalnum(*s) && *s != '_')
return error_box("Il nome del parametro puo' contenere solo caratteri alfanumerici o _");
}
}
break;
default:
break;
}
return TRUE;
}
static _sort_key = 0;
static int compare_sheet_rows(const TObject** o1, const TObject** o2)
{
TToken_string* s1 = (TToken_string*)*o1;
TToken_string* s2 = (TToken_string*)*o2;
const int key_pos = F_SORT1 - FIRST_FIELD + _sort_key - 1;
long k1 = s1->get_long(key_pos);
long k2 = s2->get_long(key_pos);
if (k1 == 0) k1 = 100000000L;
if (k2 == 0) k2 = 100000000L;
return k1 == k2 ? 0 : (k1 > k2 ? +1 : -1);
}
bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
const short id = o.dlg();
switch (id)
{
case F_CODICE:
if (e == fe_init)
{
bool virtuale = TRUE;
const TString& code = o.get();
const char type = _tree.get_type(code);
switch(type)
{
case 'A':
{
set(F_TIPO, "A", TRUE);
TDecoder mag(LF_ANAMAG, ANAMAG_DESCR);
set(F_DESCR, mag.decode(code));
const TQuantita qta(code);
set(F_UM, qta.um());
}
break;
case 'L':
{
set(F_TIPO, "L", TRUE);
TTable lav("LAV");
lav.put("CODTAB", code);
if (lav.read() == NOERR)
{
set(F_DESCR, lav.get("S0"));
set(F_UM, lav.get("S6"));
set(F_PREZZO, lav.get("R0"));
}
}
break;
default:
set(F_TIPO, "V", TRUE);
break;
}
}
break;
case F_SORT:
if (e == fe_modify)
{
TSheet_field& sf = sfield(F_SHEET);
_sort_key = atoi(o.get());
if (_sort_key > 0)
{
TString_array& a = sf.rows_array();
a.TArray::sort(compare_sheet_rows);
}
else
{
TRelation rel(LF_DIST);
sf.autoload(rel);
}
sf.force_update();
}
break;
case F_SHEET:
return on_distsheet_event(o, e, jolly);
default:
if (id >= 101 && id < 500) // E' in uno sheet?
{
switch (jolly)
{
case 1 : return on_distsheet_event(o, e, jolly);
case 2 : return on_parmsheet_event(o, e, jolly);
default: break;
}
}
break;
}
return TRUE;
}
TDistinta_mask::TDistinta_mask(TDistinta_tree& dt)
: TAutomask("db0100b"), _tree(dt), _ord("ORD")
{
TSheet_field& sf = sfield(F_SHEET);
TMask& sm = sf.sheet_mask();
TString16 key;
int i;
for (i = 4; i >= 0; i--)
{
key.format("%d", i+1);
const bool kill = _ord.get(key).empty();
if (kill)
{
const short id = F_SORT1+i;
sm.hide(id);
sf.delete_column(id);
}
}
TCodgiac_livelli cgl;
for (i = 4; i > 0; i--)
{
const short id = F_LIV1+i;
const bool kill = !cgl.enabled(i);
if (kill)
{
sm.hide(id);
sf.delete_column(id);
}
else
{
const TString & header = cgl.name(i);
const int len = header.len() + 1;
const int f_len = cgl.code_length(i);
sf.set_column_header(id, header);
sf.set_column_width(id, (len > f_len ? len : f_len) * 8);
}
}
}
///////////////////////////////////////////////////////////
// TDistinta_app
///////////////////////////////////////////////////////////
class TDistinta_app : public TRelation_application
{
TDistinta_tree _tree;
TRelation* _therel;
TQuery_mask* _querymask;
TDistinta_mask* _themask;
int _mode;
void parms2rel(const TMask& m);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual TRelation* get_relation() const { return _therel; }
virtual bool changing_mask(int mode);
virtual TMask* get_mask(int mode);
virtual int read(TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
virtual bool user_create();
virtual TString& get_mask_name(TString& name) const;
virtual TMask * set_mask(TMask * _m);
public:
void rows2rel(const TMask& m);
};
bool TDistinta_app::user_create()
{
_therel = new TRelation(LF_DIST);
_querymask = new TQuery_mask(_tree);
_themask = new TDistinta_mask(_tree);
return TRUE;
}
bool TDistinta_app::user_destroy()
bool TDistinta_tables::user_create()
{
delete _themask;
delete _querymask;
delete _therel;
return TRUE;
}
bool TDistinta_app::changing_mask(int mode)
{
bool was_query = _mode == MODE_QUERY || _mode == MODE_QUERYINS;
bool is_query = mode == MODE_QUERY || mode == MODE_QUERYINS;
return was_query != is_query;
}
TMask* TDistinta_app::get_mask(int mode)
{
const bool is_query = mode == MODE_QUERY || mode == MODE_QUERYINS;
_mode = mode;
return is_query ? (TMask*)_querymask : (TMask*)_themask;
}
int TDistinta_app::read(TMask& m)
{
const int err = TRelation_application::read(m);
if (err == NOERR)
bool err = TTable_application::user_create();
if (get_tabname() == "LAV")
{
TSheet_field& sheet = m.sfield(F_SHEET);
FOR_EACH_SHEET_ROW(sheet, nrig, row)
sheet.check_row(nrig);
TToken_string memo(1024, '\n');
memo = _therel->curr().get("PARAMETRI");
const int righe = memo.items();
TSheet_field& params = m.sfield(F_PARAMS);
params.destroy();
for (int i = 0; i < righe; i++)
{
TToken_string& row = params.row(i);
memo.get(i, row);
int equal = row.find('=');
if (equal > 0)
row[equal] = '|';
}
TLavorazione_tab *lav= new TLavorazione_tab("");
get_relation()->lfile().set_curr(lav);
}
return err;
}
void TDistinta_app::parms2rel(const TMask& m)
TMask * TDistinta_tables::set_mask(TMask* _m)
{
TToken_string memo(1024, '\n');
TSheet_field& parms = m.sfield(F_PARAMS);
TString var;
FOR_EACH_SHEET_ROW(parms, r, row)
TMask* mask = TTable_application::set_mask(_m);
if (get_tabname() == "LAV")
{
var = row->get(0);
if (!var.blank())
TSheet_field& sheet = mask->sfield(F_SHEET);
if (!has_module(MRAUT))
mask->disable_page(1);
}
return mask;
}
TString& TDistinta_tables::get_mask_name(TString& name) const
{
name = get_tabname();
name.insert("dbtb", 0);
return name;
}
int TDistinta_tables::read(TMask& m)
{
int err = TTable_application::read(m);
if (err == NOERR)
{
if (get_tabname() == "LAV")
{
memo.add(var);
memo << '=';
memo << row->get();
TSheet_field& sheet = m.sfield(F_SHEET);
if (sheet.shown())
{
TLavorazione_tab &lav=(TLavorazione_tab &)get_relation()->curr();
lav.fill_sheet(sheet);
sheet.force_update();
}
}
}
_therel->curr().put("PARAMETRI", memo);
// Azzera albero per rispecchiare eventuali modifiche
_querymask->restart_tree();
return err;
}
int TDistinta_app::write(const TMask& m)
void TDistinta_tables::rows2rel(const TMask& m)
{
parms2rel(m);
return TRelation_application::write(m);
if (get_tabname() == "LAV")
{
TSheet_field& sheet = m.sfield(F_SHEET);
TLavorazione_tab &lav=(TLavorazione_tab &)get_relation()->curr();
lav.put_sheet(sheet);
}
}
int TDistinta_app::rewrite(const TMask& m)
int TDistinta_tables::write(const TMask& m)
{
parms2rel(m);
return TRelation_application::rewrite(m);
rows2rel(m);
int err = TTable_application::write(m);
return err;
}
int TDistinta_tables::rewrite(const TMask& m)
{
rows2rel(m);
int err = TTable_application::rewrite(m);
return err;
}
///////////////////////////////////////////////////////////
// db0100 gestione distinte
// Main program
///////////////////////////////////////////////////////////
int db0100(int argc, char* argv[])
{
TDistinta_app a;
a.run(argc, argv, "Distinta base");
if (argc > 2)
{
TString name;
name << "Tabella " << argv[2];
TDistinta_tables dt;
dt.run(argc, argv, name);
}
return 0;
}

View File

@ -36,10 +36,48 @@ bool query_string(const char* prompt, TString& str, int width = 50, const char*
return ok;
}
///////////////////////////////////////////////////////////
// TDistinta_app
///////////////////////////////////////////////////////////
class TQuery_mask;
class TDistinta_mask;
class TDistinta_app : public TRelation_application
{
TDistinta_tree _tree;
TRelation* _therel;
TQuery_mask* _querymask;
TDistinta_mask* _themask;
int _mode;
void parms2rel(const TMask& m);
protected:
virtual void init_insert_mode(TMask &);
virtual bool user_create();
virtual bool user_destroy();
virtual TRelation* get_relation() const { return _therel; }
virtual bool changing_mask(int mode);
virtual TMask* get_mask(int mode);
virtual void init_query_mode(TMask& m);
virtual int read(TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
virtual bool remove();
public:
TRelation & relation() {return *_therel;}
};
TDistinta_app& app()
{ return (TDistinta_app&)main_app();}
///////////////////////////////////////////////////////////
// TDistinta_sheet
///////////////////////////////////////////////////////////
class TDistinta_sheet : public TSheet
{
TArray _data;
@ -194,9 +232,11 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
if (newcode.not_empty() && newcode != oldcode)
{
dist.put("CODDIST", newcode);
TString environment=dist.get("PARAMETRI");
const int err = dist.write();
if (err == NOERR)
{
{
// copia le righe di distinta
TRecord_array rdist(LF_RDIST, "NRIG");
rdist.renum_key("CODDIST", oldcode);
if (rdist.read(rdist.key()) == NOERR)
@ -204,6 +244,27 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
rdist.renum_key("CODDIST", newcode);
rdist.write();
}
// copia le righe delle UM
TRecord_array um(LF_UMART, "NRIGA");
um.renum_key("CODART", newcode);
int err=um.read(um.key()) ;
if (um.rows() == 0)
err = _iskeynotfound;
switch (err)
{
case _isemptyfile:
case _iskeynotfound:
um.renum_key("CODART", oldcode);
if (um.read(um.key()) == NOERR )
{
um.renum_key("CODART", newcode);
um.write();
}
break;
case NOERR:
dist.put("UM", um.row(1).get("UM"));
break;
}
}
else
{
@ -246,23 +307,38 @@ bool TQuery_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
a.set_caption(caption);
int sk = m.get_int(F_SORT);
int md = m.get_int(F_MAXDEPTH);
int gr = m.get_int(F_GROUPMODE);
TExplosion_grouping gr = TExplosion_grouping(m.get_int(F_GROUPMODE));
bool mb = m.get_bool(F_MATBASE);
bool lq = m.get_bool(F_LASTQTA);
bool iv = m.get_bool(F_IGNOREVIRT);
TString16 fi;
if (m.get_bool(F_ARTICOLI)) fi << 'A';
if (m.get_bool(F_LAVORAZIONI)) fi << 'L';
if (m.get_bool(F_VIRTUALI)) fi << 'V';
if (fi.len() == 3) fi.cut(0);
if (m.get_bool(F_GHOST)) fi << 'G';
_tree.explode(a.rows_array(), mb, gr, md, fi, sk, lq, iv);
_tree.explode(a.rows_array(), mb, gr, md, fi, sk);
a.run();
}
}
}
break;
case F_VAR_IMPIANTO:
if (e == fe_modify || e == fe_init)
{
_tree.set_global("_IMPIANTO",o.get());
if (_tree.goto_root())
restart_tree();
}
break;
case F_HIDE_GHOST:
if (e == fe_modify)
{
const char ig=*o.get();
_tree.set_ignore_ghost(ig > ' ');
if (_tree.goto_root())
restart_tree();
}
break;
default:
break;
}
@ -284,20 +360,65 @@ class TDistinta_mask : public TAutomask
{
TDistinta_tree& _tree;
TRecord_cache _ord;
void set_um_rif(int row);
bool on_distsheet_event(TOperable_field& o, TField_event e, long jolly);
bool on_unitsheet_event(TOperable_field& o, TField_event e, long jolly);
bool on_parmsheet_event(TOperable_field& o, TField_event e, long jolly);
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
bool test_row(const TToken_string& row);
void load_um();
public:
TDistinta_mask(TDistinta_tree& dt);
virtual ~TDistinta_mask() { }
};
void TDistinta_mask::load_um()
{
// *****************************
// LETTURA SHEET UNITA' DI MISURA
char tree_type=_tree.get_type(get(F_CODICE));
TSheet_field &units= (TSheet_field &)field(F_UNITA); // prende lo sheet delle unità di misura
if (tree_type=='L')
{
units.destroy();
}
else
{
app().relation().lfile().put("CODDIST",get(F_CODICE));
units.record()->read(*units.putkey(app().relation()));
units.autoload(app().relation());
}
units.disable_cell(0, units.cid2index(FU_FC));
const bool virtuale=tree_type!='A' && tree_type !='L';
units.enable_column(units.cid2index(FU_UM),virtuale);
units.enable_column(units.cid2index(FU_DESC),virtuale);
units.enable_column(units.cid2index(FU_FC),virtuale);
units.enable_column(units.cid2index(FU_PREZZO),virtuale);
if (units.items()==0)
units.row(0) << get(F_UM) << "|1"; // aggiunge una riga allo sheet
if (units.items()==1)
{
set(F_UM,units.cell(0,units.cid2index(FU_UM)));
set(F_UMART1ST,get(F_UM));
}
TString16 um;
FOR_EACH_SHEET_ROW_BACK(units, u, urow)
{
urow->get(units.cid2index(FU_UM), um);
if (!um.blank() && um == get(F_UM))
{
set_um_rif(u);
break;
}
}
}
bool TDistinta_mask::test_row(const TToken_string& row)
{
const TCodice_articolo father = get(F_CODICE);
@ -325,6 +446,90 @@ bool TDistinta_mask::test_row(const TToken_string& row)
return ok;
}
// Forza la riga row ad essere quella dell'unita' di distinta
void TDistinta_mask::set_um_rif(int row)
{
TSheet_field& sht = sfield(F_UNITA);
const int chk = sht.cid2index(FU_RIF);
const int fc = sht.cid2index(FU_FC);
const int cod = sht.cid2index(FU_UM);
TToken_string& first = sht.row(row);
first.add("X", chk);
set(F_UM, first.get(cod), TRUE);
set(F_FCUMART, first.get(fc), TRUE);
sht.force_update(row);
}
bool TDistinta_mask::on_unitsheet_event(TOperable_field& o, TField_event e, long jolly)
{
static bool was_checked = FALSE;
TSheet_field& sht = (TSheet_field&)o;
const int chk = sht.cid2index(FU_RIF);
const int cod = sht.cid2index(FU_UM);
switch(e)
{
case se_query_modify:
sht.sheet_mask().enable(DLG_DELREC, jolly > 0L);
was_checked = *sht.cell(int(jolly), chk) > ' ';
break;
case se_query_del:
return get_bool(F_VIRTUALE) && jolly > 0L; // Impedisce di cancellare l'unita' di misura base
case se_notify_del:
if (was_checked)
set_um_rif(0);
break;
case se_notify_modify:
{
const bool is_checked = *sht.cell(int(jolly), chk) > ' ';
if (is_checked != was_checked)
{
if (was_checked)
set_um_rif(0);
else
{
FOR_EACH_SHEET_ROW(sht, r, row)
{
if (r == jolly)
set_um_rif(r);
else
{
if (*row->get(chk) > ' ')
{
row->add(" ", chk);
sht.force_update(r);
}
}
}
}
was_checked = is_checked;
}
if (jolly == 0L)
set(F_UMART1ST,sht.cell(0,sht.cid2index(FU_UM)));
}
break;
case se_query_add:
if (!get_bool(F_VIRTUALE))
return FALSE;
break;
case se_notify_add:
if (jolly == 0L)
{
const int fc = sht.cid2index(FU_FC);
sht.disable_cell(0, fc);
sht.row(0).add("1", fc);
}
break;
case fe_close:
if (sht.items() == 0 || *sht.cell(0,0)<=' ')
return sht.error_box("E' necessario specificare l'unita' di misura principale");
break;
default: break;
}
return TRUE;
}
bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long jolly)
{
const short id = o.dlg();
@ -340,8 +545,9 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
{
case se_notify_add:
row.add("A", F_TIPOCOMP-FIRST_FIELD); // Forza il listbox ad articolo
row.add("1", F_EXPR-FIRST_FIELD); // Forza la quantita' ad 1
row.add("", F_EXPR-FIRST_FIELD); // Forza la quantita' ad 1
row.add(nrig+1, F_SORT0-FIRST_FIELD); // Inizializza numero riga
sheet.set_focus_cell(nrig,F_TIPOCOMP-FIRST_FIELD);
break;
case se_notify_modify:
return test_row(row);
@ -387,14 +593,15 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
const TCodice_articolo art = o.get();
if (art.not_empty() && _tree.is_mag(art))
{
const TQuantita qta(art);
TCodice_um um = "$$"; // Unita' distinta
TQuantita qta(art, um, ZERO);
m.set(F_UMEXPR, qta.um());
}
}
break;
case LF_DIST :
m.set(F_DESCOMP, rec.get("DESCR"));
m.set(F_UMEXPR, rec.get("UM"));
//m.set(F_UMEXPR, rec.get("UM"));
break;
default :
m.set(F_DESCOMP, rec.get("S0"));
@ -441,7 +648,7 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
if ((fe_modify || fe_close) && o.empty())
{
TString16 key; key << (o.dlg() - F_SORT1 + 1);
bool completo = _ord.get(key).get_bool("B0");
bool completo = cache().get("ORD", key).get_bool("B0");
if (completo)
{
TAutomask& m = (TAutomask&)o.mask();
@ -462,7 +669,7 @@ bool TDistinta_mask::on_parmsheet_event(TOperable_field& o, TField_event e, long
const short id = o.dlg();
switch (id)
{
case F_PARAM:
case FV_PARAM:
if (e == fe_modify || e == fe_close)
{
const TString& str = o.get();
@ -517,12 +724,8 @@ bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jol
{
set(F_TIPO, "A", TRUE);
TArticolo mag (code);
TArticolo mag (code);
set(F_DESCR, mag.get(ANAMAG_DESCR));
const TQuantita qta(code);
set(F_UM, qta.um());
set(F_PREZZO, mag.get(ANAMAG_COSTSTD));
set(F_PESO, mag.get(ANAMAG_PESO));
set(F_UMP, mag.get(ANAMAG_UMP));
@ -545,6 +748,7 @@ bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jol
set(F_TIPO, "V", TRUE);
break;
}
load_um();
}
}
break;
@ -567,6 +771,8 @@ bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jol
sf.force_update();
}
break;
case F_UNITA:
return on_unitsheet_event(o, e, jolly);
case F_SHEET:
return on_distsheet_event(o, e, jolly);
default:
@ -585,16 +791,17 @@ bool TDistinta_mask::on_field_event(TOperable_field& o, TField_event e, long jol
}
TDistinta_mask::TDistinta_mask(TDistinta_tree& dt)
: TAutomask("db0500b"), _tree(dt), _ord("ORD")
: TAutomask("db0500b"), _tree(dt)
{
TSheet_field& sf = sfield(F_SHEET);
sf.set_append(FALSE);
TMask& sm = sf.sheet_mask();
TString16 key;
int i;
for (i = 4; i >= 0; i--)
{
key.format("%d", i+1);
const bool kill = _ord.get(key).empty();
const bool kill = cache().get("ORD",key).empty();
if (kill)
{
const short id = F_SORT1+i;
@ -608,59 +815,72 @@ TDistinta_mask::TDistinta_mask(TDistinta_tree& dt)
{
const short id = F_LIV1+i-1;
cgl.set_sheetcolumn(sf,id,i);
/* const bool kill = !cgl.enabled(i);
if (kill)
{
sm.hide(id);
sf.delete_column(id);
}
else
{
const TString & header = cgl.name(i);
const int len = header.len() + 1;
const int f_len = cgl.code_length(i);
sf.set_column_header(id, header);
sf.set_column_width(id, (len > f_len ? len : f_len) * 8);
}*/
}
TSheet_field& su = sfield(F_UNITA);
su.set_lines_record(*(new TRecord_array(LF_UMART, "NRIGA")));
_ord.test_file_changes();
cache().test_file_changes(LF_TAB);
}
///////////////////////////////////////////////////////////
// TDistinta_app
///////////////////////////////////////////////////////////
class TDistinta_app : public TRelation_application
{
TDistinta_tree _tree;
TRelation* _therel;
TQuery_mask* _querymask;
TDistinta_mask* _themask;
int _mode;
void parms2rel(const TMask& m);
protected:
virtual bool user_create();
virtual bool user_destroy();
virtual TRelation* get_relation() const { return _therel; }
virtual bool changing_mask(int mode);
virtual TMask* get_mask(int mode);
virtual void init_query_mode(TMask& m);
virtual int read(TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
public:
};
bool TDistinta_app::user_create()
{
_therel = new TRelation(LF_DIST);
_querymask = new TQuery_mask(_tree);
_themask = new TDistinta_mask(_tree);
/*
if (noyes_box("Rinumero le righe delle distinte?"))
if (noyes_box("Sicuro?"))
if (noyes_box("Sicuro sicuro?"))
if (noyes_box("Sicuro sicuro sicuro?"))
{
int err;
TString cod="";int nrig;
TLocalisamfile rdist(LF_RDIST);
err = rdist.read(_isfirst);
while (err == NOERR)
{
if (cod != rdist.get("CODDIST"))
{
cod = rdist.get("CODDIST");
nrig=1;
}
rdist.put("SORT1",nrig);
rdist.rewrite();
rdist.put("NRIG",rdist.get_int("NRIG")+1);
err = rdist.read(_isgteq);
nrig++;
}
}
if (noyes_box("Rinumero le unita' di misura articoli?"))
if (noyes_box("Sicuro?"))
if (noyes_box("Sicuro sicuro?"))
if (noyes_box("Sicuro sicuro sicuro?"))
{
int err;
TString cod="";int nrig;
TLocalisamfile umart(LF_UMART);
err = umart.read(_isfirst);
while (err == NOERR)
{
if (cod != umart.get("CODART"))
{
cod = umart.get("CODART");
nrig=1;
}
umart.put("PREZZO",nrig);
umart.rewrite();
umart.put("NRIGA",umart.get_int("NRIGA")+1);
err = umart.read(_isgteq);
nrig++;
}
}
*/
return TRUE;
}
@ -672,6 +892,14 @@ bool TDistinta_app::user_destroy()
return TRUE;
}
void TDistinta_app::init_insert_mode(TMask &m)
{
TSheet_field &f= (TSheet_field &)m.field(F_UNITA);
if (f.items() == 0)
f.row(0) = " |1"; // aggiunge una riga allo sheet
}
bool TDistinta_app::changing_mask(int mode)
{
bool was_query = _mode == MODE_QUERY || _mode == MODE_QUERYINS;
@ -701,7 +929,7 @@ int TDistinta_app::read(TMask& m)
FOR_EACH_SHEET_ROW(sheet, nrig, row)
{
sheet.check_row(nrig);
sheet.row(nrig).add(nrig+1, F_SORT0 - FIRST_FIELD);
sheet.row(nrig).add(nrig+1, sheet.cid2index(F_SORT0));
}
TToken_string memo(1024, '\n');
@ -746,15 +974,52 @@ void TDistinta_app::parms2rel(const TMask& m)
int TDistinta_app::write(const TMask& m)
{
parms2rel(m);
return TRelation_application::write(m);
int err = TRelation_application::write(m);
if (err == NOERR)
{
TSheet_field& f = m.sfield(F_UNITA); // prende lo sheet delle unità di misura
err = f.record()->write(FALSE);
}
return err;
}
int TDistinta_app::rewrite(const TMask& m)
{
parms2rel(m);
return TRelation_application::rewrite(m);
int err = TRelation_application::rewrite(m);
if (err == NOERR)
{
TSheet_field& f= m.sfield(F_UNITA); // prende lo sheet delle unità di misura
err = f.record()->write(TRUE);
}
return err;
}
bool TDistinta_app::remove()
{
bool ok = TRelation_application::remove();
if (ok)
{
TMask &m=curr_mask();
TSheet_field &f= (TSheet_field &)m.field(F_UNITA); // prende lo sheet delle unità di misura
TLocalisamfile anamag(LF_ANAMAG);
anamag.put("CODART",m.get(F_CODICE));
int err=anamag.read();// esiste l'articolo
switch(err)
{
case _iskeynotfound :
case _isemptyfile :
case _iseof:
ok = f.record()->remove()==NOERR;
break;
default:
break;
}
}
return ok;
}
///////////////////////////////////////////////////////////
// db0500 gestione distinte
///////////////////////////////////////////////////////////

View File

@ -10,16 +10,34 @@
#define F_VIRTUALE 506
#define F_COPY 507
#define F_EXPLODE 508
#define F_HIDE_GHOST 509
#define F_DESCR 510
#define F_ARTPROD 511
#define F_PREZZO 512
#define F_UM 513
#define F_PESO 514
#define F_UMP 515
#define F_ARTACQ 512
#define F_PREZZO 513
#define F_UM 514
#define F_PESO 515
#define F_UMP 516
#define F_UMART1ST 517
#define F_FCUMART 518
#define F_MASTER 519
#define F_SHEET 520
#define F_PARAMS 521
#define F_UNITA 521
#define F_PARAMS 522
#define F_VAR_IMPIANTO 550
#define F_VAR_LINEA 551
#define F_VAR_MAG 552
#define F_VAR_DEP 553
#define F_VAR_LIV1 554
#define F_VAR_LIV2 555
#define F_VAR_LIV3 556
#define F_VAR_LIV4 557
#define F_VAR_DATA 558
#define F_TIPOCOMP 101
#define F_CODART 102
@ -40,16 +58,21 @@
#define F_SORT5 114
#define F_SORT0 115
#define F_PARAM 101
#define F_VALUE 102
#define FU_UM 101
#define FU_FC 102
#define FU_PREZZO 103
#define FU_RIF 104
#define FU_DESC 105
#define FV_PARAM 101
#define FV_VALUE 102
#define F_MATBASE 101
#define F_MAXDEPTH 102
#define F_ARTICOLI 103
#define F_LAVORAZIONI 104
#define F_VIRTUALI 105
#define F_GROUPMODE 106
#define F_LASTQTA 107
#define F_IGNOREVIRT 108
#define F_GHOST 106
#define F_GROUPMODE 107
#endif

View File

@ -47,14 +47,16 @@ ENDPAGE
PAGE "Distinta base" -1 -1 80 20
GROUPBOX DLG_NULL 78 4
STRING DLG_PROFILE 30
BEGIN
PROMPT 1 1 "Distinta"
FLAGS "H"
PROMPT 1 1 ""
PSELECT
END
STRING F_CODICE 20
BEGIN
PROMPT 2 2 "Cerca "
PROMPT 2 1 "Cerca "
FLAGS "GU"
USE LF_DIST
JOIN LF_ANAMAG INTO CODART==CODDIST
@ -64,14 +66,15 @@ BEGIN
OUTPUT F_CODICE CODDIST
CHECKTYPE REQUIRED
FIELD CODDIST
DEFAULT NONE
END
STRING F_CODICEQ 20
BEGIN
PROMPT 47 2 "Codice "
PROMPT 2 2 "Articolo "
FIELD CODDIST
KEY 1
USE LF_ANAMAG
USE LF_ANAMAG
JOIN LF_UMART INTO CODART=CODART NRIGA=1
INPUT CODART F_CODICEQ
DISPLAY "Codice@20" CODART
@ -81,28 +84,80 @@ BEGIN
ADD RUN ve2 -3
MESSAGE COPY,F_CODICE
FLAGS "U"
DEFAULT NONE
END
STRING F_DESCR 50 40
BEGIN
KEY 2
PROMPT 34 2 ""
USE LF_ANAMAG KEY 2
JOIN LF_UMART INTO CODART=CODART NRIGA=1
INPUT DESCR F_DESCR
DISPLAY "Descrizione@50" DESCR
DISPLAY "Codice@20" CODART
OUTPUT F_CODICEQ CODART
OUTPUT F_CODICE CODART
CHECKTYPE NORMAL
ADD RUN ve2 -3
FLAGS "U"
DEFAULT NONE
END
STRING F_VAR_IMPIANTO 5
BEGIN
FLAGS "UF"
PROMPT 2 3 "Impianto "
USE IMP
INPUT CODTAB F_VAR_IMPIANTO
DISPLAY "Codice " CODTAB
DISPLAY "Descrizione@50" S0
OUPUT F_VAR_IMPIANTO CODTAB
MESSAGE CHECK, F_VAR_LINEA
CHECKTYPE FORCED
END
STRING F_VAR_LINEA 5
BEGIN
FLAGS "UF"
PROMPT 20 3 "Linea "
USE LNP
INPUT CODTAB F_VAR_LINEA
DISPLAY "Codice " CODTAB
DISPLAY "Descrizione@50" S0
DISPLAY "Impianto" S6
OUPUT F_VAR_LINEA CODTAB
OUPUT F_VAR_IMPIANTO S6
CHECKTYPE FORCED
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 3 "Ordinamento "
PROMPT 2 4 "Ordinamento "
USE ORD
INPUT CODTAB F_SORT
DISPLAY "Codice ordinamento" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_SORT CODTAB
OUTPUT F_SORTDESC S0
CHECKTYPE NORMAL
CHECKTYPE FORCED
FLAGS "U"
MESSAGE EMPTY "Immissione",F_SORTDESC
NUM_EXPR #F_SORT<=5
WARNING "L'ordinamento deve essere compreso tra 0 e 5"
DEFAULT NONE
END
STRING F_SORTDESC 50
BEGIN
PROMPT 24 3 ""
PROMPT 24 4 ""
FLAGS "D"
DEFAULT NONE
END
BOOL F_HIDE_GHOST
BEGIN
FLAGS "Fh"
PROMPT 2 5 "Nascondi le distinte virtuali non di produzione"
DEFAULT NONE
END
TREE F_TREE -3 -1

View File

@ -65,6 +65,7 @@ BEGIN
FIELD CODDIST
END
LIST F_TIPO 1 12
BEGIN
PROMPT 54 2 "Tipo "
@ -80,8 +81,8 @@ END
BOOLEAN F_VIRTUALE
BEGIN
PROMPT 50 50 "Virtuale"
MESSAGE FALSE DISABLE,1@
MESSAGE TRUE ENABLE,1@
MESSAGE FALSE DISABLE,1@|ENABLE,F_ARTACQ
MESSAGE TRUE ENABLE,1@|CLEAR,F_ARTACQ
FLAGS "DG"
FIELD VIRTUALE
END
@ -103,46 +104,72 @@ BOOLEAN F_ARTPROD
BEGIN
PROMPT 2 5 "Articolo di produzione"
FIELD ARTPROD
GROUP 1
FLAGS "D"
END
NUMBER F_PREZZO 15
BOOLEAN F_ARTACQ
BEGIN
PROMPT 2 6 "Costo "
PICTURE "."
PROMPT 32 5 "Articolo di acquisto"
FIELD ARTACQ
END
BOOLEAN F_MASTER
BEGIN
PROMPT 60 5 "Articolo Master"
FIELD MASTER
END
CURRENCY F_PREZZO 15
BEGIN
PROMPT 2 6 "Costo "
FIELD PREZZO
GROUP 1
FLAGS "D"
FLAGS "DU"
END
STRING F_UM 3
STRING F_UM 2
BEGIN
PROMPT 42 6 "Unita' di misura "
USE %UMS
INPUT CODTAB F_UM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@60" S0
OUTPUT F_UM CODTAB
PROMPT 26 6 "Unita' di misura "
FLAGS "DG"
USE LF_UMART KEY 2
JOIN LF_UMART ALIAS 200 INTO CODART==CODART
INPUT CODART F_CODICE SELECT
INPUT UM F_UM
OUTPUT F_UM UM
OUTPUT F_FCUMART FC
OUTPUT F_UMART1ST 200@->UM
CHECKTYPE NORMAL
FIELD UM
GROUP 1
FLAGS "D"
END
NUMBER F_FCUMART 18 5
BEGIN
PROMPT 50 6 "= "
PICTURE "###.###.###,@@@@@"
FLAG "D"
CHECKTYPE REQUIRED
END
STRING F_UMART1ST 2
BEGIN
PROMPT 74 6 ""
FLAG "D"
END
NUMBER F_PESO 15 5
BEGIN
PROMPT 2 7 "Peso "
PROMPT 2 7 "Peso "
FIELD PESO
GROUP 1
FLAGS "D"
END
STRING F_UMP 3
STRING F_UMP 2
BEGIN
PROMPT 42 7 "Unita' di misura del peso "
COPY USE F_UM
PROMPT 26 7 "Unita' di misura del peso "
USE %UMS
INPUT CODTAB F_UMP
COPY DISPLAY F_UM
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_UMP CODTAB
FIELD UMP
GROUP 1
@ -196,21 +223,39 @@ ENDPAGE
PAGE "Parametri" -1 -1 80 20
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 1 1 "Distinta"
END
STRING F_CODICEQ 20
BEGIN
PROMPT 2 2 "Codice "
PROMPT 1 1 "Distinta "
FLAGS "D"
FIELD CODDIST
END
TEXT DLG_NULL
BEGIN
PROMPT 1 2 "@bUnita' di misura"
END
SPREADSHEET F_UNITA 0 5
BEGIN
PROMPT 0 3 ""
ITEM "Codice"
ITEM "Fatt. Convers.@18"
ITEM "Prezzo Netto@18"
ITEM "Unita' di riferimento"
ITEM "Descrizione@50"
USE LF_UMART KEY NRIGA
INPUT CODART F_CODICE
FLAGS "A"
END
TEXT DLG_NULL
BEGIN
PROMPT 1 9 "@bElenco Variabili"
END
SPREADSHEET F_PARAMS
BEGIN
PROMPT 0 4 ""
PROMPT 0 10 ""
ITEM "Variabile@20"
ITEM "Valore@70"
END
@ -219,7 +264,7 @@ ENDPAGE
ENDMASK
PAGE "Distinta" -1 -1 68 14
PAGE "Distinta" -1 -1 68 15
GROUPBOX DLG_NULL 66 6
BEGIN
@ -234,7 +279,7 @@ BEGIN
ITEM "L|Lavorazione"
MESSAGE HIDE,F_CODART|SHOW,F_CODLAV|HIDE,F_CODDIS|HIDE,F_CODVAR|DISABLE,F_UMEXPR
ITEM "D|Distinta"
MESSAGE HIDE,F_CODART|HIDE,F_CODLAV|SHOW,F_CODDIS|HIDE,F_CODVAR|DISABLE,F_UMEXPR
MESSAGE HIDE,F_CODART|HIDE,F_CODLAV|SHOW,F_CODDIS|HIDE,F_CODVAR|ENABLE,F_UMEXPR
ITEM "V|Variabile"
MESSAGE HIDE,F_CODART|HIDE,F_CODLAV|HIDE,F_CODDIS|SHOW,F_CODVAR|CLEAR,F_UMEXPR
FIELD TIPO
@ -362,7 +407,7 @@ END
STRING F_UMEXPR 2
BEGIN
PROMPT 2 7 "Unita' di misura "
USE LF_UMART KEY 2
USE LF_UMART KEY 2 SELECT CODART==#F_CODART
JOIN LF_ANAMAG INTO CODART==CODART
INPUT CODART F_CODART SELECT
INPUT UM F_UMEXPR
@ -381,6 +426,8 @@ BEGIN
PROMPT 2 8 ""
FIELD EXPR
FLAGS "U"
CHECKTYPE REQUIRED
WARNING "Necessario la quantita'"
END
GROUPBOX DLG_NULL 66 3
@ -448,22 +495,88 @@ ENDPAGE
ENDMASK
PAGE "Unita'" -1 -1 66 7
STRING FU_UM 2
BEGIN
PROMPT 1 1 "Unita' "
FLAGS "U"
USE %UMS
INPUT CODTAB FU_UM
DISPLAY "Unita'" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT FU_UM CODTAB
OUTPUT FU_DESC S0
CHECKTYPE REQUIRED
FILED UM
END
STRING FU_DESC 50
BEGIN
PROMPT 13 1 ""
USE %UMS KEY 2
INPUT S0 FU_DESC
DISPLAY "Descrizione@50" S0
DISPLAY "Unita'@20" CODTAB
COPY OUTPUT FU_UM
CHECKTYPE REQUIRED
END
NUMBER FU_FC 18 5
BEGIN
PROMPT 1 2 "Fattore di conversione "
PICTURE ".5"
FIELD FC
CHECKTYPE REQUIRED
END
CURRENCY FU_PREZZO 18
BEGIN
PROMPT 1 3 "Prezzo Netto "
FLAGS "U"
FIELD PREZZO
END
BOOLEAN FU_RIF
BEGIN
PROMPT 1 4 "Unita' di riferimento per distinta"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK
PAGE "Variabili" -1 -1 64 5
STRING F_PARAM 20
STRING FV_PARAM 20
BEGIN
PROMPT 1 1 "Variabile "
USE VAR
INPUT CODTAB F_PARAM
INPUT CODTAB FV_PARAM
DISPLAY "Codice@20" CODTAB
DISPLAY "Numerico@B" B0
DISPLAY "Descrizione@50" S0
OUTPUT F_PARAM CODTAB
OUTPUT FV_PARAM CODTAB
CHECKTYPE REQUIRED
FLAGS "U"
END
STRING F_VALUE 70 50
STRING FV_VALUE 70 50
BEGIN
PROMPT 1 2 "Valore "
END

View File

@ -6,12 +6,10 @@ RADIOBUTTON F_MATBASE 1 31
BEGIN
PROMPT 1 1 "Tipo"
ITEM " |Scalare"
MESSAGE ENABLE,F_LASTQTA
ITEM "X|Materiali di base"
MESSAGE CLEAR,F_LASTQTA
END
GROUPBOX DLG_NULL 32 5
GROUPBOX DLG_NULL 32 6
BEGIN
PROMPT 33 1 "Visualizza"
END
@ -29,6 +27,13 @@ END
BOOLEAN F_VIRTUALI
BEGIN
PROMPT 34 4 "Distinte virtuali"
MESSAGE TRUE ENABLE,F_GHOST
MESSAGE FALSE CLEAR,F_GHOST
END
BOOLEAN F_GHOST
BEGIN
PROMPT 34 5 "Distinte non di produzione"
END
NUMBER F_MAXDEPTH 3
@ -37,16 +42,6 @@ BEGIN
FLAGS "U"
END
BOOLEAN F_LASTQTA
BEGIN
PROMPT 2 6 "Disabilita ricalcolo quantita'"
END
BOOLEAN F_IGNOREVIRT
BEGIN
PROMPT 2 7 "Escludi distinte virtuali che non sono prodotti"
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 8 "Ordina "
@ -71,9 +66,11 @@ LIST F_GROUPMODE 1 48
BEGIN
PROMPT 2 9 "Raggruppa "
ITEM "0|Nessun raggruppamento"
ITEM "1|Alla prima unita' di misura"
ITEM "2|All'unita' di misura di riferimento"
ITEM "3|Per unita' di misura"
ITEM "1|Raggruppa per unita' di misura"
ITEM "2|Converti nell'unita' principale"
ITEM "3|Raggruppa all'unita' di misura principale"
ITEM "4|Converti nell'unita' di misura di distinta"
ITEM "5|Raggruppa all'unita' di misura di distinta"
END
BUTTON DLG_OK 10 2

View File

@ -10,7 +10,6 @@ int main(int argc, char** argv)
case 1:
db1200(argc, argv);
break;
case 0:
default:
db1100(argc, argv);
break;

View File

@ -1,10 +1,9 @@
#define APPNAME campo
#define QAPPNAME "campo"
#define APPNAME EURO_DB
#define QAPPNAME "EURO_DB"
#define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url>
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"

View File

@ -35,20 +35,20 @@
enum seltype { by_num, by_date };
enum expltype { mat_base, scalare};
enum valtype { no_val, last_cost, average_cost, pond_cost, last2cost, std_cost, LIFO_annuale, LIFO_storico, FIFO_annuale, FIFO_storico };
enum grptype { no_grp, first_um, ref_um, normal_um };
struct _ParmStruct
{
seltype _selections;
expltype _explosion;
valtype _valorization;
grptype _group_by;
TExplosion_grouping _group_by;
TString16 _anno_es, _from_num, _to_num, _sl_mag, _mb_mag; // Ma perche'...
TDate _from_date, _to_date, _obs_date;
long _from_doc, _to_doc;
int _year, _periods, _det_lev, _ordering;
bool _last_qta, _vis_art, _vis_lav, _vis_vir, _fabbisogno,
_val_magmb, _val_depmb, _cfr_scmin, _separate_dists;
bool _vis_art, _vis_lav, _vis_vir, _vis_gho,
_fabbisogno, _val_magmb, _val_depmb,
_cfr_scmin, _separate_dists;
};
struct _CallBackStruct
@ -166,14 +166,13 @@ public:
void set_value(const real& r) { _value = r; }
void set_residuo(const real& r) { _residuo = r; }
TRiga_esplosione2print() {};
TRiga_esplosione2print(const TDistinta_tree& tree,
const TExplosion_params& ep);
TRiga_esplosione2print(const TDistinta_tree& tree);
TRiga_esplosione2print(const TRiga_esplosione& re);
~TRiga_esplosione2print() {};
};
TRiga_esplosione2print::TRiga_esplosione2print(const TDistinta_tree& tree, const TExplosion_params& ep)
: TRiga_esplosione(tree, ep)
TRiga_esplosione2print::TRiga_esplosione2print(const TDistinta_tree& tree)
: TRiga_esplosione(tree)
{
}
@ -345,7 +344,7 @@ static bool valorizza_nodo(TTree& node, void* jolly, word when)
dist_node.curr_id(__path);
if (dist_node.goto_firstson())
{
dist_node.explode(exploded, TRUE, 2);
dist_node.explode(exploded, TRUE, RAGGR_EXP_BASE);
dist_node.goto_node(__path);
const int items = exploded.items(); // Se 0 siamo su di una foglia...
@ -640,9 +639,10 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
if (disp < zero_ref)
{
r = zero_ref - disp;
r2p->set_qta2order(aaa.convert_to_um(r, re.um())); // In UM locale...
const real cv = aaa.convert_to_um(r, re.um()); // In UM locale...
r2p->set_qta2order(cv);
if (!re.mat_base())
_residui.add(re.path(), r);
_residui.add(re.path(), cv);
}
if (disp > zero_ref)
@ -670,8 +670,14 @@ void TExplode_distinta_form::set_explosion_rows(TArray& exp_array)
// Se l'utente non vuole la valorizzazione sul calcolo
// disponibilita', stampa quella sul fabbisogno richiesto
const real& qta = !(tipo == 'A' && _p->_fabbisogno) ? re.val() * _d->qta() : r2p->qta2order();
#ifdef DBG
CHECK(_valori.objptr(k),"Perke' mi ritrovo senza un elemento nella cache dei valori?!?!?");
r = *(real*)_valori.objptr(k);
#else
if (_valori.objptr(k) == NULL)
r = ZERO;
else
#endif
r = *(real*)_valori.objptr(k);
r *= qta;
r2p->set_value(r);
@ -684,7 +690,7 @@ void TExplode_distinta_form::print()
{
// Explode & deflagrate...
if (!_distinta.set_root(_d->cod()))
if (!_distinta.set_root(_d->cod(), _d->um()))
return;
// Inizializza lo sfondo delle pagine normali se no col piffero che stampa la fincatura...
@ -703,12 +709,12 @@ void TExplode_distinta_form::print()
if (_p->_vis_art) fi << 'A';
if (_p->_vis_lav) fi << 'L';
if (_p->_vis_vir) fi << 'V';
if (fi.len() == 3) fi.cut(0);
if (_p->_vis_vir) fi << 'V';
if (_p->_vis_gho) fi << 'G';
_distinta.curr_code((TCodice_articolo& )_d->cod());
_distinta.explode(explosion_array, _p->_explosion == mat_base, _p->_group_by,
_p->_det_lev, fi, _p->_ordering, _p->_last_qta);
_p->_det_lev, fi, _p->_ordering);
// Dopo l'esplosione mette in testa all'array la riga di definizione della Distinta stessa:
// codice + UM + Fabbisogno (sostanzialmente si tratta di un TRiga_esplosione)
explosion_array.insert(_d->head_obj(), 0);
@ -721,7 +727,7 @@ void TExplode_distinta_form::print()
// I know this is kinda dog-programming
setter._p = _p; // but it seems quite reasonable setting a couple
setter._a = &_valori; // of pointers and passing'em in a struct
_distinta.set_root(_d->cod());
_distinta.set_root(_d->cod(), _d->um());
_distinta.scan_depth_first(valorizza_nodo, &setter);
}
@ -823,11 +829,12 @@ inline TEsplosione_distinta_app& app() { return (TEsplosione_distinta_app&) mai
TRiga_esplosione * _Dist2Explode::head_obj()
{
TRiga_esplosione * re = new TRiga_esplosione;
TQuantita qta(_cod, _um, 1.00);
re->set(_cod, _um, real(1.00));
re->set_tipo('A'); // La testata e' cmq un articolo... disse Zorba Il Greco a Sinuhe L'Egiziano
re->set_path(_cod);
TDistinta_tree tree;
tree.set_root(qta);
TRiga_esplosione * re = new TRiga_esplosione(tree);
return re;
}
@ -853,6 +860,7 @@ void _Dist2Explode::set(TToken_string& t)
_livgiac.trim();
_mag.format("%3s", (const char*)t.get(5));
_mag << t.get(6);
_mag.trim();
_um = t.get(7);
_qta = t.get(8);
_datacons = t.get(10);
@ -969,7 +977,7 @@ bool TEsplosione_distinta_app::check_articoli(TMask_field& f, KEY k)
bool TEsplosione_distinta_app::create()
{
open_files(LF_UMART, LF_OCCAS, LF_CLIFO, LF_DOC, LF_RIGHEDOC, LF_INDSP, LF_CFVEN, LF_TABCOM, LF_MAG, LF_DIST, 0);
open_files(LF_UMART, LF_OCCAS, LF_CLIFO, LF_DOC, LF_RIGHEDOC, LF_INDSP, LF_CFVEN, LF_TABCOM, LF_MAG, LF_DIST, LF_STOMAG, 0);
_mask = new TMask("db1100a");
TSheet_field& sa = (TSheet_field&) _mask->field(F_SHEETART);
sa.sheet_mask().set_handler(F_QTA, check_articoli);
@ -1173,7 +1181,7 @@ void TEsplosione_distinta_app::main_loop()
_parameters._selections = (seltype) _mask->get_int(F_TIPOSEL);
_parameters._explosion = (expltype) _mask->get_int(F_STAMPA);
_parameters._valorization = (valtype) _mask->get_int(F_VALORIZZAZIONE);
_parameters._group_by = (grptype) _mask->get_int(F_GROUPMODE);
_parameters._group_by = (TExplosion_grouping) _mask->get_int(F_GROUPMODE);
_parameters._year = _mask->get_int(F_ANNO);
_parameters._from_num = _mask->get(F_NUMFROM);
_parameters._to_num = _mask->get(F_NUMTO);
@ -1199,10 +1207,10 @@ void TEsplosione_distinta_app::main_loop()
_parameters._vis_art = _mask->get_bool(F_ARTICOLI);
_parameters._vis_vir = _mask->get_bool(F_VIRTUALI);
_parameters._vis_lav = _mask->get_bool(F_LAVORAZIONI);
_parameters._vis_gho = _mask->get_bool(F_GHOST);
_parameters._fabbisogno= _mask->get_bool(F_FABBISOGNO);
_parameters._last_qta = _mask->get_bool(F_LASTQTA);
_parameters._sl_mag = _mask->get(F_SLMAG); _parameters._sl_mag << _mask->get(F_SLDEP);
_parameters._mb_mag = _mask->get(F_MBMAG); _parameters._mb_mag << _mask->get(F_MBDEP);
_parameters._sl_mag = _mask->get(F_SLMAG); _parameters._sl_mag << _mask->get(F_SLDEP);
_parameters._mb_mag = _mask->get(F_MBMAG); _parameters._mb_mag << _mask->get(F_MBDEP);
_parameters._val_magmb = _mask->get_bool(F_VALMAGMB);
_parameters._val_depmb = _mask->get_bool(F_VALDEPMB);
_parameters._cfr_scmin = _mask->get_bool(F_SCMIN);

View File

@ -13,8 +13,6 @@ END
GENERAL
BEGIN
OFFSET 0 0
FONT "Courier New"
SIZE 10
END

View File

@ -14,7 +14,7 @@
#define F_STAMPA 112
#define F_DETTAGLIO 113
#define F_VALORIZZAZIONE 114
#define F_LASTQTA 115
#define F_GHOST 115
#define F_ARTICOLI 116
#define F_LAVORAZIONI 117
#define F_VIRTUALI 118

View File

@ -139,9 +139,9 @@ LISTBOX F_STAMPA 18
BEGIN
PROMPT 2 9 "Esplosione "
ITEM "0|Materiali di base"
MESSAGE ENABLE,F_LASTQTA|ENABLE,F_GROUPMODE
MESSAGE ENABLE,F_GROUPMODE
ITEM "1|Scalare"
MESSAGE CLEAR,F_LASTQTA|CLEAR,F_GROUPMODE
MESSAGE CLEAR,F_GROUPMODE
END
NUMBER F_DETTAGLIO 3
@ -150,21 +150,16 @@ BEGIN
FLAGS "U"
END
BOOLEAN F_LASTQTA
BEGIN
PROMPT 2 10 "Disabilita ricalcolo quantita'"
END
BOOLEAN F_FABBISOGNO
BEGIN
PROMPT 2 11 "Calcola disponibilita'"
PROMPT 2 10 "Calcola disponibilita'"
MESSAGE TRUE ENABLE,4@
MESSAGE FALSE CLEAR,4@|CLEAR,6@
END
BOOLEAN F_SEPARATE
BEGIN
PROMPT 2 12 "Separa distinte"
PROMPT 2 11 "Separa distinte"
END
BOOLEAN F_SCMIN
@ -269,26 +264,32 @@ BEGIN
GROUP 6
END
GROUPBOX DLG_NULL 30 5
GROUPBOX DLG_NULL 30 6
BEGIN
PROMPT 1 13 "Visualizza"
PROMPT 1 12 "Visualizza"
END
BOOLEAN F_ARTICOLI
BEGIN
PROMPT 2 14 "Articoli"
PROMPT 2 13 "Articoli"
END
BOOLEAN F_LAVORAZIONI
BEGIN
PROMPT 2 15 "Lavorazioni"
PROMPT 2 14 "Lavorazioni"
END
BOOLEAN F_VIRTUALI
BEGIN
PROMPT 2 16 "Distinte virtuali"
PROMPT 2 15 "Distinte virtuali"
END
BOOLEAN F_GHOST
BEGIN
PROMPT 2 16 "Distinte non di produzione"
END
NUMBER F_SORT 1
BEGIN
PROMPT 2 18 "Ordina "
@ -313,9 +314,11 @@ LIST F_GROUPMODE 1 53
BEGIN
PROMPT 2 19 "Raggruppa "
ITEM "0|Nessun raggruppamento"
ITEM "1|Alla prima unita' di misura"
ITEM "2|All'unita' di misura di riferimento"
ITEM "3|Per unita' di misura"
ITEM "1|Raggruppa per unita' di misura"
ITEM "2|Converti nell'unita' principale"
ITEM "3|Raggruppa all'unita' di misura principale"
ITEM "4|Converti nell'unita' di misura di distinta"
ITEM "5|Raggruppa all'unita' di misura di distinta"
END
ENDPAGE
@ -450,7 +453,7 @@ END
STRING F_UMEXPR 2
BEGIN
PROMPT 2 7 "Unita' di misura "
USE LF_UMART KEY 2
USE LF_UMART KEY 2 SELECT CODART==#F_CODDIS
JOIN LF_ANAMAG INTO CODART==CODART
INPUT CODART F_CODDIS SELECT
INPUT UM F_UMEXPR

View File

@ -1,5 +1,5 @@
#define APPNAME campo
#define QAPPNAME "campo"
#define APPNAME EURO_DB
#define QAPPNAME "EURO_DB"
#define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url>

View File

@ -58,7 +58,7 @@ real TValorizzazione_mask::valore(const TCodice_articolo& dis, const char* liv)
TArray boom;
// Esplosione ai materiali di base
// raggruppati alla unita' di misura di riferimento
_tree.explode(boom, TRUE, 2);
_tree.explode(boom, TRUE, RAGGR_EXP_BASE);
for (int r = boom.last(); r >= 0; r--)
{
const TRiga_esplosione& esp = (const TRiga_esplosione&)boom[r];
@ -98,14 +98,12 @@ real TValorizzazione_mask::valore(const TCodice_articolo& dis, const char* liv)
total = real(val.decode(dis));
}
break;
case 'V':
default :
{
TDecoder dist(LF_DIST, "PREZZO");
total = real(dist.decode(dis));
}
break;
default :
NFCHECK("L'articolo %s non esiste", (const char*)cod);
}
_valori.add(cod, total);
}
@ -133,7 +131,7 @@ void TValorizzazione_mask::elabora()
TProgind pi(items, "Valorizzazione in corso...", TRUE, TRUE);
TBrowsefile_field& bf = (TBrowsefile_field&)field(F_PREVIEW);
TViswin& vw = *bf.vis_win();
TViswin& vw = bf.vis_win();
vw.destroy_lines();
_valori.destroy();
@ -214,6 +212,7 @@ void TValorizzazione_mask::salva()
lav.rewrite();
}
break;
case 'G':
case 'V':
dis.put("CODDIST", key);
if (dis.read(_isequal, _lock) == NOERR)

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,9 @@ class TCodice_articolo : public TFixed_string
{
char _str20[21];
protected:
virtual TObject* dup() const { return new TCodice_articolo(_str20); }
public:
TCodice_articolo(const char* s = "") : TFixed_string(_str20, 21)
{ set(s); }
@ -46,21 +49,85 @@ class TCodice_um : public TFixed_string
{
char _str2[3];
protected:
virtual TObject* dup() const { return new TCodice_um(_str2); }
public:
TCodice_um(const char* s = "") : TFixed_string(_str2, 3)
{ set(s); }
{ strncpy(s,2); }
TCodice_um(const TString& s) : TFixed_string(_str2, 3)
{ set(s); }
{ strncpy(s,2); }
TCodice_um(const TCodice_um& s) : TFixed_string(_str2, 3)
{ set(s); }
{ strncpy(s,2); }
const TString& operator =(const char* s)
{ return set(s); }
{ strncpy(s,2); return *this; }
const TString& operator =(const TString& s)
{ return set((const char*)s); }
{ strncpy(s,2); return *this; }
const TString& operator =(const TCodice_um& s)
{ return set((const char*)s); }
{ strncpy(s,2); return *this; }
};
///////////////////////////////////////////////////////////
// TLavorazione
///////////////////////////////////////////////////////////
class TUm_tempo : public TObject
{
real _ore;
public:
real & converti_in_ore() {return _ore;}
TUm_tempo(char c);
~TUm_tempo() {}
};
class TLavorazione : public TRectype
{
TString16 _codimp ;
TToken_string _linee ;
protected:
TObject* dup() const { return new TLavorazione(*this); }
public:
const char * codice() const {return get("CODTAB");}
const char * descr() const {return get("S0");}
const char * um() const {return get("S6");}
TUm_tempo um_temporale() const {return (TUm_tempo)get_char("I7");}
void reset_linee();
void get_linee();
void put_linee();
int linee_standard() const;
int linee() const;
const char * cod_impianto(int l);
const char * cod_linea(int l);
// numero addetti impiegati
const int raw_numpers_linea(int l);
const int numpers_linea(int l);
// produttività
const real raw_produttiv_linea(int l);
const real produttiv_linea(int l);
const int find_linea(const TString& linea);
bool set_cod_linea(int l, const char *c);
bool set_numpers_linea(int l, int pers);
bool set_produttiv_linea(int l, real & prod);
// @cmember Legge il file <p f> con il tipo di record
virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock);
// @cmember Legge il file <p f> con il tipo di record alla posizione desiderata
virtual int readat(TBaseisamfile& f, TRecnotype nrec, word lockop = _nolock);
// @cmember Aggiunge il record al file
virtual int write(TBaseisamfile& f) const;
// @cmember Riscrive il record sul file
virtual int rewrite(TBaseisamfile& f) const;
// operatore di copia
virtual TRectype & operator =(const TRectype& rec);
TLavorazione(const char* cod = "") ;
TLavorazione(const TRectype& rec) ;
TLavorazione(const TLavorazione& rec) ;
virtual ~TLavorazione() { }
};
///////////////////////////////////////////////////////////
// TQuantita'
@ -75,8 +142,9 @@ class TQuantita : public TSortable
real _conv; // Fattore di conversione alla base
real _val; // Valore attuale
static TDecoder* _umart1; // Decoder per trovare unita' base
static TDecoder* _umart1; // Decoder per trovare unita' base articolo
static TDecoder* _umart2; // Decoder per trovare conversione
static TDecoder* _umdist; // Decoder per trovare unita' base distinta
protected:
virtual int compare(const TSortable& s) const;
@ -86,12 +154,17 @@ protected:
real get_factor(const TCodice_um& um) const;
void convert(real& val, const TCodice_um& from_um, const TCodice_um& to_um) const;
real find_umbase(TCodice_um& um);
real find_umdist(TCodice_um& um);
public:
virtual bool ok() const { return !_um.blank(); }
const TQuantita& operator =(const TQuantita& q)
{ copy(q); return q; }
const TQuantita& operator +=(const real& q);
const TQuantita& operator -=(const real& q);
const TQuantita& operator +=(const TQuantita& q);
const TQuantita& operator -=(const TQuantita& q);
const TQuantita& operator =(const real& q);
@ -100,18 +173,21 @@ public:
const TCodice_articolo& articolo() const { return _articolo; }
const TCodice_um& um() const { return _um; }
const real& val() const { return _val; }
const real& conv() const { return _conv; }
const real& val() const { return _val; }
real base_val() const;
void set_articolo(const TCodice_articolo& art, const TCodice_um& um);
void set_val(const real& val) {_val=val;}
void set(const TCodice_articolo& art, const TCodice_um& um, const real& val)
{ set_articolo(art, um); _val = val; }
void convert_to_base();
void convert2umbase();
void convert2umdist();
TQuantita();
TQuantita(const TCodice_articolo& art);
TQuantita(const TCodice_articolo& art, const TCodice_um& um, const real& val);
TQuantita(const TQuantita& q);
TQuantita(const TCodice_articolo& art, const TCodice_um& um, const real& val);
virtual ~TQuantita();
};
@ -133,14 +209,33 @@ public:
// TDistinta_tree
///////////////////////////////////////////////////////////
enum TExplosion_grouping
{
RAGGR_EXP_NONE = 0, // Nessun raggruppamento
RAGGR_EXP_EACHUM = 1, // Raggruppa ogni articolo per unità di misura
RAGGR_EXP_BASE = 2, // Non raggruppare ma converti alla UM di base
RAGGR_EXP_UMBASE = 3, // Raggruppa le unità di misura, esprimendo il totale nella UM di base
RAGGR_EXP_DIST = 4, // Non raggruppare ma converti alla UM di distinta
RAGGR_EXP_UMDIST = 5, // Raggruppa le unità di misura, esprimendo il totale nella UM di distinta
};
// _RADICE : CODICE DELLA DISTINTA AL PRIMO LIVELLO
// _DISTINTA : CODICE DELLA DISTINTA
// _MAGAZZINO : CODICE MAGAZZINO/DEPOSITO
// _LIVELLO : LIVELLO DI GIACENZA
// _LINEA : CODICE LINEA DI PRODUZIONE
// _IMPIANTO : CODICE IMPIANTO
class TRiga_esplosione;
class TDistinta_tree : public TBidirectional_tree
{
TCodice_articolo _root;
TString _root;
TToken_string _path;
int _sort, _max_depth;
bool _ignore_ghost;
TDecoder _dist, _vars, _mag, _lav;
TRecord_cache _rdist;
TDecoder _vars, _mag, _lav;
static const TRectype* _curr;
static TToken_string _tmp;
@ -154,7 +249,8 @@ protected:
void add_child();
void kill_child();
const TRectype* find(const TCodice_articolo& father, int child) const;
int build_children_list(const TCodice_articolo& father, TPointer_array& child) const;
int build_children_pointers(const TCodice_articolo& father, TPointer_array& children) const;
int build_children_list(const TCodice_articolo& father, TArray& children) const;
TTypeexp get_var_type(const char* var);
const TString& get_string(const char* var);
@ -166,12 +262,16 @@ protected:
void push_vars();
void pop_vars();
int raggruppa(TArray& boom, int mode) const;
int raggruppa(TArray& boom, TExplosion_grouping mode) const;
protected: // TTree
virtual void node2id(const TObject* node, TString& id) const;
TObject * get_global(const char* name, word classname);
TObject * global_default_str(const char* name);
TObject * global_default_real(const char* name);
public:
static TLavorazione * find_labor(TRiga_esplosione *l);
virtual bool goto_root();
virtual bool goto_firstson();
virtual bool goto_rbrother();
@ -187,27 +287,40 @@ public:
virtual TImage* image(bool selected) const;
virtual TObject* curr_node() const;
bool set_root(const TCodice_articolo& str);
bool set_root(const TQuantita& qta);
bool set_root(const TCodice_articolo& art, const char* um = "", real qta = 1.0);
bool set_root(const TRectype & rec);
long find_node(const TCodice_articolo& str, word flags = SCAN_PRE_ORDER);
void set_sort_key(int k);
int get_sort_key() const { return _sort; }
bool get_ignore_ghost() { return _ignore_ghost; }
void set_max_depth(int m) { _max_depth = m; }
int get_max_depth() const { return _max_depth; }
bool set_ignore_ghost(bool i) { return _ignore_ghost = i; }
void restart(); // reset all and go to root
int explode(TArray& boom, bool mb = FALSE, int gr = 0, int md = 0,
const char* filter = NULL, int sk = 0, bool lq = FALSE);
int explode(TArray& boom, bool mat_base = FALSE,
TExplosion_grouping raggr = RAGGR_EXP_NONE,
int max_depth = 0, const char* filter = NULL,
int sort_key = 0);
bool curr_code(TCodice_articolo& code) const;
bool curr_giac(TString& code) const;
int curr_comp(TString& code) const;
long curr_sort() const;
const char* curr_um(TCodice_um& code) const;
real curr_qta(bool last = FALSE) const;
int curr_depth() const { return _path.items()-1; }
real curr_qta() const;
int curr_depth() const;
char curr_type() const;
TRiga_esplosione *first_labor(TArray & labors, TExplosion_grouping raggum=RAGGR_EXP_UMBASE);
TRiga_esplosione *next_labor(TArray & labors);
TRiga_esplosione *first_critical_labor(TArray & labors, TExplosion_grouping raggum=RAGGR_EXP_UMBASE);
TRiga_esplosione *next_critical_labor(TArray & labors);
bool is_cyclic(const TToken_string& path) const;
bool is_cyclic() const { return is_cyclic(_path); }
bool is_root() const;
@ -216,6 +329,7 @@ public:
bool is_mag(const char* c = NULL) const;
bool is_lav(const char* c = NULL) const;
char get_type(const char* c = NULL) const;
const TString& describe(const TCodice_articolo& codart) const;
void clear_globals();
void set_global(const char* var, const char* val);
@ -233,24 +347,31 @@ struct TExplosion_params;
class TRiga_esplosione : public TQuantita
{
TToken_string _path;
TString16 _giac;
long _sort;
int _livello;
char _tipo;
bool _mat_base;
protected:
virtual TObject* dup() const { return new TRiga_esplosione(*this); }
void init(const TDistinta_tree& tree, const TExplosion_params& ep);
void init(const TDistinta_tree& tree);
public:
const TToken_string& path() const { return _path; }
const TString& giacenza() const { return _giac; }
long ordinamento() const { return _sort; }
int livello() const { return _livello; }
int livello() const { return _path.items() - 1; }
char tipo() const { return _tipo; }
char mat_base() const { return _mat_base; }
void set_tipo(char c) { _tipo = c; }
void set_mat_base(bool b) { _mat_base = b; }
void set_path(const char* p) { _path = p;}
const char * father();
TRiga_esplosione();
TRiga_esplosione(const TDistinta_tree& tree,
const TExplosion_params& ep);
TRiga_esplosione(const TDistinta_tree& tree);
TRiga_esplosione(const TRiga_esplosione& re);
virtual ~TRiga_esplosione() { }
};

View File

@ -1,14 +1,14 @@
#include "../ba/ba3200.h"
PAGE "Stampa tabella ordinamenti "-1 -1 76 15
GROUPBOX DLG_NULL 74 5
GROUPBOX DLG_NULL 74 4
BEGIN
PROMPT 1 1 "Da"
PROMPT 1 2 "Da"
END
STRING F_INIZIO1 1
BEGIN
PROMPT 2 3 ""
PROMPT 2 3 "Codice "
USE ORD
INPUT CODTAB F_INIZIO1
DISPLAY "Codice@10" CODTAB
@ -18,13 +18,13 @@ BEGIN
GROUP 1
FIELD CODTAB
FLAGS "U"
CHECKTYPE SEARCH
CHECKTYPE NORMAL
END
STRING F_INIZIO2 50
STRING F_INIZIO2 25 50
BEGIN
PROMPT 15 3 ""
USE ORD
PROMPT 2 4 "Descrizione "
USE ORD KEY 2
INPUT S0 F_INIZIO2
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
@ -33,17 +33,17 @@ BEGIN
GROUP 1
FIELD S0
FLAGS "U"
CHECKTYPE SEARCH
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 74 5
GROUPBOX DLG_NULL 74 4
BEGIN
PROMPT 1 6 "A"
PROMPT 1 7 "A"
END
STRING F_FINE1 1
BEGIN
PROMPT 2 8 ""
PROMPT 2 8 "Codice "
USE ORD
INPUT CODTAB F_FINE1
DISPLAY "Codice@10" CODTAB
@ -53,13 +53,13 @@ BEGIN
GROUP 2
FIELD CODTAB
FLAGS "U"
CHECKTYPE SEARCH
CHECKTYPE NORMAL
END
STRING F_FINE2 50
STRING F_FINE2 30 50
BEGIN
PROMPT 15 8 ""
USE ORD
PROMPT 2 9 "Descrizione "
USE ORD KEY 2
INPUT S0 F_FINE2
DISPLAY "Descrizione@50" S0
DISPLAY "Codice" CODTAB
@ -68,7 +68,7 @@ BEGIN
GROUP 2
FIELD S0
FLAGS "U"
CHECKTYPE SEARCH
CHECKTYPE NORMAL
END
BUTTON DLG_OK 10 2

View File

@ -1,7 +1,23 @@
#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_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_CODLIN 101
#define F_DESCRLIN 102
#define F_CODIMP 103
#define F_LNUMPERS 104
#define F_LPRODUTTIV 105
#define F_DESCRIMP 120

View File

@ -2,79 +2,238 @@
TOOLBAR "" 0 19 80 3
#include <toolbar.h>
ENDPAGE
PAGE "Anagrafica lavorazioni" -1 -1 65 15
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 1 ""
END
STRING F_CODICE 20
BEGIN
PROMPT 2 2 "Codice "
FIELD CODTAB
KEY 1
USE LAV
INPUT CODTAB F_CODICE
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODICE CODTAB
OUTPUT F_DESCR S0
CHECKTYPE REQUIRED
FLAGS "U"
END
STRING F_DESCR 50
BEGIN
PROMPT 2 4 "Descrizione "
FIELD S0
KEY 2
USE LAV KEY 2
INPUT S0 F_DESCR
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
OUTPUT F_DESCR S0
OUTPUT F_CODICE CODTAB
CHECKTYPE REQUIRED
END
GROUPBOX DLG_NULL 78 8
BEGIN
PROMPT 1 6 ""
END
STRING F_UNMIS 2
BEGIN
PROMPT 2 7 "Unità di misura "
FIELD S6
USE %UMS
INPUT CODTAB F_UNMIS
DISPLAY "Unità di misura@2" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_UNMIS CODTAB
OUTPUT F_UMDESC S0
CHECKTYPE REQUIRED
END
STRING F_UMDESC 50
BEGIN
PROMPT 22 7 " "
USE %UMS KEY 2
INPUT S0 F_UMDESC
DISPLAY "Descrizione@50" S0
DISPLAY "Unità di misura@2" CODTAB
OUTPUT F_UMDESC S0
OUTPUT F_UNMIS CODTAB
CHECKTYPE REQUIRED
END
NUMBER F_COSUNIT 15
BEGIN
PROMPT 2 9 "Costo unitario "
PICTURE "."
FIELD R0
END
BOOLEAN F_STAMPA
BEGIN
PROMPT 2 11 "Stampa nelle esplosioni"
FIELD B0
END
ENDPAGE
ENDMASK
PAGE "Anagrafica lavorazioni" -1 -1 65 15
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 1 ""
END
STRING F_CODICE 20
BEGIN
PROMPT 2 2 "Codice "
FLAGS "U"
FIELD CODTAB
KEY 1
USE LAV
INPUT CODTAB F_CODICE
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODICE CODTAB
OUTPUT F_DESCR S0
CHECKTYPE NORMAL
MESSAGE COPY,F_SEARCHART|CHECK,F_SEARCHART
END
STRING F_SEARCHART 20
BEGIN
FLAGS "HG"
PROMPT 2 3 "Codice "
USE LF_ANAMAG
INPUT CODART F_SEARCHART
OUTPUT F_CODICEART CODART
MESSAGE CHECK,F_CODICEART
MESSAGE EMPTY RESET,F_CODICEART
CHECKTYPE SEARCH
WARNING "ricerca articolo errata"
END
STRING F_CODICEART 20
BEGIN
FLAGS "HG"
PROMPT 42 3 ""
STR_EXPR #F_CODICEART==""
MESSAGE EMPTY RESET,F_CODICEART
MESSAGE RESET,F_CODICEART
WARNING "Il codice e' gia' utilizzato per gli articoli"
END
STRING F_DESCR 50
BEGIN
PROMPT 2 4 "Descrizione "
FIELD S0
KEY 2
USE LAV KEY 2
INPUT S0 F_DESCR
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
OUTPUT F_DESCR S0
OUTPUT F_CODICE CODTAB
CHECKTYPE REQUIRED
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 6 ""
END
STRING F_UNMIS 2
BEGIN
FLAGS "U"
PROMPT 2 7 "Unita' di misura "
FIELD S6
USE %UMS
INPUT CODTAB F_UNMIS
DISPLAY "Unità di misura@2" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_UNMIS CODTAB
OUTPUT F_UMDESC S0
CHECKTYPE REQUIRED
MESSAGE COPY,F_UNMIS2
END
STRING F_UMDESC 50
BEGIN
PROMPT 22 7 " "
USE %UMS KEY 2
INPUT S0 F_UMDESC
DISPLAY "Descrizione@50" S0
DISPLAY "Unità di misura@2" CODTAB
OUTPUT F_UMDESC S0
OUTPUT F_UNMIS CODTAB
CHECKTYPE REQUIRED
END
NUMBER F_COSUNIT 15 3
BEGIN
PROMPT 2 9 "Costo unitario "
PICTURE "."
FIELD R0
END
BOOLEAN F_STAMPA
BEGIN
PROMPT 51 9 "Stampa nelle esplosioni"
FIELD B0
END
ENDPAGE
PAGE "Parametri di MRP" -1 -1 65 15
NUMBER F_NUMPERS 3
BEGIN
PROMPT 1 2 "Persone impiegate in media "
FIELD R2
// CHECKTYPE REQUIRED
END
NUMBER F_PRODUTTIV 8 3
BEGIN
PROMPT 1 3 "Produttivita' media "
FIELD R1
CHECKTYPE REQUIRED
END
STRING F_UNMIS2 2
BEGIN
FLAGS "DG"
PROMPT 38 3 "espressa in "
END
LIST F_UNTEMPO 8
BEGIN
FLAGS "U"
PROMPT 53 3 " per "
FIELD S7
ITEM "H|ora"
ITEM "M|minuto"
ITEM "S|secondo"
END
NUMBER F_LINEESTD 2
BEGIN
FLAGS "U"
PROMPT 1 4 "Numero di linee standard "
FIELD I1
END
SPREADSHEET F_SHEET
BEGIN
FLAGS "I"
PROMPT 0 6 ""
ITEM "Linea@5"
ITEM "Descrizione@30"
ITEM "Impianto"
ITEM "Persone"
ITEM "Produttivita'"
END
ENDPAGE
ENDMASK
PAGE "Righe" -1 -1 66 12
STRING F_CODLIN 5
BEGIN
PROMPT 1 1 "Linea "
FLAGS "U"
USE LNP
JOIN IMP ALIAS 100 INTO CODTAB==S6
INPUT CODTAB F_CODLIN
DISPLAY "Linea" CODTAB
DISPLAY "Descrizione@50" S0
DISPLAY "Impianto" S6
DISPLAY "Descrizione" 100@->S0
OUTPUT F_CODLIN CODTAB
OUTPUT F_DESCRLIN S0
OUTPUT F_CODIMP S6
OUTPUT F_DESCRIMP 100@->S0
CHECKTYPE REQUIRED
END
STRING F_DESCRLIN 50
BEGIN
PROMPT 1 2 "Descrizione "
FLAGS "D"
END
STRING F_CODIMP 5
BEGIN
PROMPT 1 3 "Impianto "
FLAGS "D"
END
STRING F_DESCRIMP 50
BEGIN
PROMPT 1 4 "Descrizione "
FLAGS "D"
END
NUMBER F_LNUMPERS 3
BEGIN
PROMPT 1 6 "N. persone "
END
NUMBER F_LPRODUTTIV 8 3
BEGIN
PROMPT 1 8 "Produttivita'"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -1,6 +1,6 @@
[Headers]
80
Tabella "ORD"
Tabella Ordinamenti di distinte
1|@3g%s|Codice
1|@10g%s|Descrizione
1|@56g%s|Completa
@ -10,4 +10,4 @@ Tabella "ORD"
1|CODTAB|@3g@1,ls
1|S0|@10g@50,ls
1|B0|@60g@5,ls
1|B1|@68g@5,ls
1|B1|@68g@5,ls

View File

@ -23,6 +23,8 @@ BEGIN
OUTPUT F_DESC S0
CHECKTYPE REQUIRED
FLAGS "U"
NUM_EXPR #F_SORT<=5
WARNING "L'ordinamento deve essere compreso tra 0 e 5"
END
STRING F_DESC 50
@ -39,19 +41,20 @@ BEGIN
CHECKTYPE REQUIRED
END
BOOLEAN F_GLOBALE
BEGIN
PROMPT 2 10 "Globale"
FIELD B1
MESSAGE FALSE ENABLE,F_COMPLETA
MESSAGE TRUE CLEAR,F_COMPLETA
END
BOOLEAN F_COMPLETA
BEGIN
PROMPT 2 10 "Completa"
MESSAGE TRUE ENABLE,F_GLOBALE
MESSAGE FALSE CLEAR,F_GLOBALE
PROMPT 20 10 "Completa"
FIELD B0
END
BOOLEAN F_GLOBALE
BEGIN
PROMPT 20 10 "Globale"
FIELD B1
END
ENDPAGE
ENDMASK

View File

@ -35,9 +35,11 @@ ENDPAGE
OUTPUT F_CODICE CODTAB
CHECKTYPE REQUIRED
END
BOOLEAN F_VAR
LISTBOX F_VAR 10
BEGIN
PROMPT 2 6 "Variabile numerica"
PROMPT 2 6 "Tipo "
ITEM "|stringa"
ITEM "X|numerico"
FIELD B0
END
ENDPAGE

View File

@ -1,3 +1,3 @@
112
0
$dist|0|0|121|0|Distinte|||
$dist|0|0|132|0|Distinte|||

View File

@ -1,12 +1,16 @@
112
8
12
CODDIST|1|20|0|Codice distinta
VIRTUALE|8|1|0|Distinta virtuale (non e' un articolo)
ARTPROD|8|1|0|Articolo di produzione
ARTACQ|8|1|0|Articolo di acquisto
DESCR|1|50|0|Descrizione
UMP|1|3|0|Unita' di misura del peso
PESO|4|15|5|Peso
UM|1|3|0|Unita' di misura
PREZZO|4|18|2|Costo
PARAMETRI|11|10|0|Parametri (var1 = valore1, var2= valore2, ecc.)
PREZZO|4|18|2|Costo di produzione
LEADTIME|6|4|0|Lead time espresso in giorni lavorativi per MRP
LEADHOURS|3|5|0|Lead time espresso in ore lavorative per MRP
PARAMETRI|11|10|0|Elenco delle variabili
1
CODDIST|

View File

@ -4,12 +4,12 @@
#endif
#ifndef LIBDIR
#define LIBDIR f:\xvt.450\win_x86\ptk\lib
#define LIBDIR c:\xvt.458\w32_x86\lib
#endif
#ifndef RESDIR
#define RESDIR f:/p.due/bmp
#define QRESDIR "f:/p.due/bmp/"
#define RESDIR c:/p.32/bmp
#define QRESDIR "c:/p.32/bmp/"
#endif
#ifndef QFIRMNAME

View File

@ -642,18 +642,18 @@ void TForm_item::print_on(TToken_string& row) const
const TString& TForm_item::picture() const
{
CHECK(0, "Can't get the picture of a generic form item!");
return _prompt;
NFCHECK("Can't get the picture of a generic form item!");
return EMPTY_STRING;
}
void TForm_item::set_picture(const char*)
{
CHECK(0, "Can't set the picture of a generic form item!");
NFCHECK("Can't set the picture of a generic form item!");
}
TToken_string& TForm_item::memo_info()
{
CHECK(0, "Can't get a memo of a generic form item!");
NFCHECK("Can't get a memo of a generic form item!");
return (TToken_string &) EMPTY_STRING;
}
@ -1077,7 +1077,7 @@ void TForm_string::put_paragraph(const char* s)
#ifdef DBG
if (plen>0 && *s)
yesno_box("Nei form la stampa di un item su più righe con prompt ora non pone più il prompt isolato sulla prima riga ma allinea a sinistra del prompt ");
NFCHECK("Nei form la stampa di un item su più righe con prompt ora non pone più il prompt isolato sulla prima riga ma allinea a sinistra del prompt ");
#endif
for (int i=0; (s = p.get()) != NULL && i < h; i++)
{
@ -3101,37 +3101,12 @@ void TForm::arrange_form()
TString str_pos;
TMask m("ba2100c");
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
/*
char defPrinter[80];
char szDevice[50];
// get default printer driver
GetProfileString ("windows", "device", ",,,", defPrinter, sizeof(defPrinter));
TToken_string pdev (defPrinter, ',');
GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice));
pdev.add(szDevice);
device = pdev.get(2);
device = device.left(4); //Legge solo LPTx...
*/
#else
TString device(printer.printername());
FILE* lpt = fopen(device,"w");
if (lpt == NULL)
fatal_box("Impossibile aprire il device %s.",device);
#endif
// _ipy viene assunto uguale per entrambi i posizionamneti
str_pos = "\017"; // Questo e' 15 in ottale...
for (i=1; i < _ipy; i++) str_pos << "\n";
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
os_spool_row(str_pos);
#else
fprintf(lpt,"%s",(const char*) str_pos);
fflush(lpt); // Salta le righe...
fclose(lpt);
#endif
os_open_spool_row(printer().printername());
os_spool_row(str_pos);
os_close_spool_row();
str_pos = ""; //Azzera la stringa di posizionamento
for (i=1; i < _ipx; i++) str_pos << " "; //Aggiunge gli spazi necessari...
if (_ipx > 0)
@ -3144,16 +3119,9 @@ void TForm::arrange_form()
// TString bspc; bspc.fill('\b',str_pos.len()); // Questi servono per tornare indietro...
do
{
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
os_open_spool_row(printer().printername());
os_spool_row(str_pos);
#else
lpt = fopen(device,"w");
if (lpt == NULL) fatal_box("Impossibile aprire il device %s.",device);
// fprintf(lpt,"%s",(const char*) bspc);
fprintf(lpt,"%s\r",(const char*) str_pos);
fflush(lpt);
fclose(lpt);
#endif
os_close_spool_row();
} while (m.run() == K_ESC); // cicla sulla stampa posizionamento...
/* const int h = height(odd_page);
str_pos.cut(0);

View File

@ -2045,7 +2045,9 @@ int TSystemisamfile::load(
if (fl == NULL)
{
error_box("Impossibile aprire il file %s",from);
return err = 2;
clearerr(fl);
setstatus(2);
return 2;
}
TRecnotype r = 0, e = 0, nitems = 0;
TString16 firm, year, attprev("00000");
@ -2075,8 +2077,8 @@ int TSystemisamfile::load(
}
TScanner f(from);
TToken_string s(1024, fs);
bool fixedlen = (fs == '\0');
TToken_string s(1024, fixedlen ? char(255) : fs);
int nflds = curr().items();
TString_array fld(nflds);
int len[MaxFields];
@ -2266,6 +2268,8 @@ int TSystemisamfile::dump(
rjust.set(j, t == _intfld || t == _longfld || t == _realfld ||
t == _wordfld || t == _intzerofld || t == _longzerofld);
len[j] = (t == _datefld) ? 10 : curr().length(wfld);
if (fixedlen && t == _memofld)
return error_box("Non e' possibile scaricare a lunghezza fissa un file con campi memo");
}
TRecnotype i = 0;
// const TRecnotype nitems = nkey ? items() : filehnd()->d->EOD;

View File

@ -8,8 +8,8 @@
#include <multirec.h>
#endif
#ifndef __MSKSHEET_H
class TSheet_field;
#ifndef __MASK_H
#include <mask.h>
#endif
#ifndef __FORM_H

View File

@ -11,7 +11,6 @@
#include "anamag.h"
#include "mag.h"
#ifndef __CGLIB01_H
#include "..\cg\cglib01.h"
#include "..\ve\veconf.h"
@ -1085,7 +1084,7 @@ real TArticolo_giacenza::giacenza_corretta(const TRectype & rec ,bool giac_eff,b
{
giacenza += rec.get_real(MAG_INCL);
giacenza -= rec.get_real(MAG_ACL);
giacenza += valorizza_componenti ? 0 : (rec.get_real(MAG_PRODFIN)-rec.get_real(MAG_PRODCOMP));
giacenza += valorizza_componenti ? ZERO : (rec.get_real(MAG_PRODFIN)-rec.get_real(MAG_PRODCOMP));
}
return giacenza;
}

View File

@ -20,76 +20,6 @@
// *********************
// movimenti di magazzino
// causali
int TCausale_magazzino::sgn(TTipo_saldomag tiposaldo)
{
static TString *segni=NULL; if (segni==NULL) segni=new TString80;
*segni=get("S2");
switch (tiposaldo)
{
case s_giac:
return atoi(segni->mid(0,2));
case s_acq:
return atoi(segni->mid(2,2));
case s_ent:
return atoi(segni->mid(4,2));
case s_ven:
return atoi(segni->mid(6,2));
case s_usc:
return atoi(segni->mid(8,2));
case s_ordc:
return atoi(segni->mid(10,2));
case s_ordf:
return atoi(segni->mid(12,2));
case s_incl:
return atoi(segni->mid(14,2));
case s_acl:
return atoi(segni->mid(16,2));
case s_prodc:
return atoi(segni->mid(18,2));
case s_prodf:
return atoi(segni->mid(20,2));
case s_rim:
return atoi(segni->mid(22,2));
case s_scart:
return atoi(segni->mid(24,2));
case s_label:
return atoi(segni->mid(26,2));
case s_user1:
return atoi(segni->mid(28,2));
case s_user2:
return atoi(segni->mid(30,2));
case s_user3:
return atoi(segni->mid(32,2));
case s_user4:
return atoi(segni->mid(34,2));
case s_user5:
return atoi(segni->mid(36,2));
case s_user6:
return atoi(segni->mid(38,2));
default:
return 0;
}
}
bool TCausale_magazzino::is_fiscale()
{
return (tipomov()=='S' || tipomov()=='C' );
}
TCausale_magazzino::TCausale_magazzino(const char * codice):
TRectype(LF_TABCOM)
{
TTable f("%CAU");
settab("CAU");
put("CODTAB", codice);
if (TRectype::read(f) != NOERR)
zero();
}
// movimenti
// dati della linea di movimento di magazzino
class TLine_movmag : public TObject
@ -138,7 +68,7 @@ int TLine_movmag::operator==(TLine_movmag &l)
// ********************************
// TMov_mag
TRecord_cache TMov_mag::cache_causali("%CAU");
TRecord_cache TMov_mag::_cache_causali("%CAU");
TMov_mag::TMov_mag() :
TMultiple_rectype(LF_MOVMAG),
@ -151,6 +81,12 @@ TMov_mag::~TMov_mag()
{
}
const TCausale_magazzino& TMov_mag::causale(const char* cod) const
{
if (cod == NULL || *cod == '\0')
cod = get(MOVMAG_CODCAUS);
return (TCausale_magazzino&)_cache_causali.get(cod);
}
void TMov_mag::zero(char c)
{
@ -174,19 +110,11 @@ void TMov_mag::set_body_key(TRectype & rowrec)
}
void TMov_mag::synchronize_bodies()
void TMov_mag::load_rows_file(int logicnum)
{
TMultiple_rectype::synchronize_bodies();
// reset delle strutture per il controlli delle variazioni dei saldi
if (autoload_enabled())
{
_annoes=get(MOVMAG_ANNOES);
lines_to_add.destroy();
lines_to_subtract.destroy();
const int nrows = rows();
for (int i = 1; i<= nrows; i++)
line_deleted(line2key(i), line2data(i));
}
CHECK(logicnum==LF_RMOVMAG,"L'unico file collegabile ai movimenti sono le righe");
TMultiple_rectype::load_rows_file(logicnum);
mark_current_lines();
}
@ -194,8 +122,10 @@ int TMov_mag::remove(TBaseisamfile& f) const
{
int res;
if ((res=TMultiple_rectype::remove(f))==NOERR )
{
// effettua la variazione dei saldi
((TMov_mag *)this)->update_balances();
}
return res;
}
@ -206,9 +136,12 @@ void TMov_mag::add_extrarows() const
if (add_explrows())
add_autorows();
}
bool TMov_mag::add_autorows() const
{
bool added=FALSE;
TString16 codmag;
// aggiunge le righe automatiche
for (int r = rows(); r > 0; r--)
{
@ -217,11 +150,11 @@ bool TMov_mag::add_autorows() const
TString16 codcaus(row.get(RMOVMAG_CODCAUS));
if (codcaus.empty())
codcaus=get(MOVMAG_CODCAUS);
TCausale_magazzino & cau=(TCausale_magazzino & )cache_causali.get(codcaus);
const TCausale_magazzino& cau = causale(codcaus);
codcaus=cau.caus_collegata();
if (codcaus.not_empty())
{
TCausale_magazzino & cau_coll=(TCausale_magazzino & )cache_causali.get(codcaus);
const TCausale_magazzino& cau_coll = causale(codcaus);
// if (!cau_coll.esplodente())
{
// deve esserci una riga collegata
@ -229,8 +162,11 @@ bool TMov_mag::add_autorows() const
{
// manca, la inserisco
TRectype * linea_auto = new TRectype(row);
const char * codmag = cau_coll.default_magdep();
if (codmag != NULL)
codmag = codmag_rauto(r);
if (codmag.empty())
codmag = cau_coll.default_magdep();
if (codmag.not_empty())
linea_auto->put(RMOVMAG_CODMAG, codmag);
const char * prezzo = prezzo_rauto(r);
if (prezzo != NULL)
@ -250,8 +186,10 @@ bool TMov_mag::add_autorows() const
bool TMov_mag::add_explrows() const
{
TDistinta_tree distinta;
TArticolo articolo;
TArray boom;
bool added=FALSE;
// aggiunge le righe da explosione distinta
for (int r = rows(); r > 0; r--)
{
@ -260,15 +198,18 @@ bool TMov_mag::add_explrows() const
TString16 codcaus(row.get(RMOVMAG_CODCAUS));
if (codcaus.empty())
codcaus=get(MOVMAG_CODCAUS);
TCausale_magazzino & cau=(TCausale_magazzino & )cache_causali.get(codcaus);
const TCausale_magazzino& cau = causale(codcaus);
if (cau.esplodente() && !b[r].get_bool(RMOVMAG_ESPLOSA))
{
// devono esserci n righe automatiche esplose
//if (!b.exist(r + 1) || !b[r + 1].get_bool(RMOVMAG_ESPLOSA))
{
// mancano le righe, le inserisco
const char tipo_costo = cau.get("S11")[0];
const int livello = cau.get_int("I0");
// mancano le righe, le inserisco
distinta.set_root(row.get(RMOVMAG_CODART));
distinta.explode(boom);
distinta.explode(boom, FALSE, RAGGR_EXP_NONE, livello, "A");
TString codmag(codmag_rauto(r));
real prezzo(prezzo_rauto(r));
TRectype * linea_auto;
@ -278,11 +219,17 @@ bool TMov_mag::add_explrows() const
linea_auto = new TRectype(row);
linea_auto->put(RMOVMAG_CODART, riga_esp.articolo());
linea_auto->put(RMOVMAG_UM, riga_esp.um());
linea_auto->put(RMOVMAG_QUANT, riga_esp.val()*row.get_real(RMOVMAG_QUANT));
linea_auto->put(RMOVMAG_QUANT, riga_esp.val());
if (codmag.not_empty())
linea_auto->put(RMOVMAG_CODMAG, codmag);
if (!prezzo.is_zero())
linea_auto->put(RMOVMAG_PREZZO, prezzo);
//if (!prezzo.is_zero())
articolo.read(riga_esp.articolo());
if (tipo_costo == 'U')
prezzo = articolo.get_real(ANAMAG_ULTCOS1);
else
if (tipo_costo == 'S')
prezzo = articolo.get_real(ANAMAG_COSTSTD);
linea_auto->put(RMOVMAG_PREZZO, prezzo);
linea_auto->put(RMOVMAG_NRIG, r+1+newrow);
linea_auto->put(RMOVMAG_ESPLOSA, TRUE);
//linea_auto->put(RMOVMAG_TIPORIGA, (char) riga_automatica);
@ -292,26 +239,28 @@ bool TMov_mag::add_explrows() const
}
}
// ora ci sono, mi basta eliminare la riga "padre"
b.destroy_row(r,TRUE);
if (boom.items() > 0)
b.destroy_row(r,TRUE);
}
} // ciclo righe
return added;
}
int TMov_mag::write(TBaseisamfile& f) const
{
int res;
add_extrarows();
TMov_mag &myself=((TMov_mag &)*this);
const int nrows = rows();
for (int i = 1; i <= nrows; i++)
myself.line_inserted(line2key(i), line2data(i));
if ((res=TMultiple_rectype::write(f))==NOERR )
// effettua la variazione dei saldi
{
TMov_mag &myself=((TMov_mag &)*this);
const int nrows = rows();
for (int i = 1; i <= nrows; i++)
myself.line_inserted(line2key(i), line2data(i));
// effettua la variazione dei saldi
myself.update_balances();
}
return res;
}
@ -319,25 +268,33 @@ int TMov_mag::rewrite(TBaseisamfile& f) const
{
int res;
add_extrarows();
// memorizza le variazioni
const int nrows = rows();
for (int i = 1; i <= nrows; i++)
((TMov_mag *)this)->line_inserted(line2key(i), line2data(i));
if ((res=TMultiple_rectype::rewrite(f))==NOERR )
// effettua la variazione dei saldi
((TMov_mag *)this)->update_balances();
{
TMov_mag &myself=((TMov_mag &)*this);
const int nrows = rows();
for (int i = 1; i <= nrows; i++)
myself.line_inserted(line2key(i), line2data(i));
// effettua la variazione dei saldi
myself.update_balances();
}
return res;
}
const char *TMov_mag::get_next_key()
const char* TMov_mag::get_next_key()
{
static TString16 nextcod;
TLocalisamfile f(LF_MOVMAG);
f.last();
int a=atoi(f.get(MOVMAG_NUMREG))+1;
return nextcod.format("%d",a);
long a = f.get_long(MOVMAG_NUMREG)+1;
return nextcod.format("%ld", a);
}
bool TMov_mag::key_complete()
{
const bool ok = head().get_long(MOVMAG_NUMREG) > 0L;
return ok;
}
//*******
@ -347,17 +304,8 @@ const char *TMov_mag::get_next_key()
int TMov_mag::force_update_bal()
{
int res;
// reset delle strutture per il controlli delle variazioni dei saldi
_annoes=get(MOVMAG_ANNOES);
lines_to_add.destroy();
lines_to_subtract.destroy();
// memorizza le variazioni
const int nrows = rows();
for (int i= 1; i <= nrows; i++)
line_inserted(line2key(i), line2data(i));
mark_current_lines(FALSE);
res=update_balances();
return res;
}
@ -375,6 +323,7 @@ TLine_movmag & TMov_mag::line2data(int nrig) const
return line;
}
TToken_string & TMov_mag::line2key(int numriga) const
{
static TToken_string _key;
@ -399,13 +348,13 @@ TString TMov_mag::key2field(TToken_string &key,const char *fieldname)
if (strcmp(fieldname,RMOVMAG_LIVGIAC)==0)
return key.get(2);
CHECKS(FALSE, "Nome di campo non appartenente al file righe mov ", fieldname);
return "";
return EMPTY_STRING;
}
int TMov_mag::line_inserted(TToken_string &k,TLine_movmag &r)
int TMov_mag::line_inserted(TToken_string &k, TLine_movmag &r)
{
if (_annoes != get(MOVMAG_ANNOES))
if (_annoes != get(MOVMAG_ANNOES) || _datacomp != get_date(MOVMAG_DATACOMP))
lines_to_add.add(k,r);
else
{
@ -419,9 +368,10 @@ int TMov_mag::line_inserted(TToken_string &k,TLine_movmag &r)
return 0;
}
int TMov_mag::line_deleted(TToken_string &k,TLine_movmag &r)
int TMov_mag::line_deleted(TToken_string &k, TLine_movmag &r)
{
if (_annoes != get(MOVMAG_ANNOES))
if (_annoes != get(MOVMAG_ANNOES) || _datacomp != get_date(MOVMAG_DATACOMP))
lines_to_subtract.add(k,r);
else
{
@ -435,6 +385,24 @@ int TMov_mag::line_deleted(TToken_string &k,TLine_movmag &r)
return 0;
}
void TMov_mag::mark_current_lines(const bool as_deleted)
{
const int nrows = rows(); // lasciare la riga qui perchè comporta il caricamento del body
_annoes =get(MOVMAG_ANNOES);
_datacomp=get_date(MOVMAG_DATACOMP);
lines_to_add.destroy();
lines_to_subtract.destroy();
for (int i = 1; i<= nrows; i++)
{
if (as_deleted)
line_deleted(line2key(i), line2data(i));
else
line_inserted(line2key(i), line2data(i));
}
}
bool TMov_mag::unlock_anamag(const char *codart)
{
TLocalisamfile anamag(LF_ANAMAG);
@ -487,14 +455,14 @@ int TMov_mag::update_balances()
TString_array keys_to_add,keys_to_remove;
((TMov_mag *)this)->lines_to_add.get_keys(keys_to_add);
((TMov_mag *)this)->lines_to_subtract.get_keys(keys_to_remove);
/*((TMov_mag *)this)->*/lines_to_add.get_keys(keys_to_add);
/*((TMov_mag *)this)->*/lines_to_subtract.get_keys(keys_to_remove);
// aggiunge i saldi nuovi
keys_to_add.sort();
TToken_string * curr_key=(TToken_string *)keys_to_add.first_item();
int nriga=1;
while (curr_key)
{
const TString cod(key2field(*curr_key,RMOVMAG_CODART)) ;
@ -503,11 +471,11 @@ int TMov_mag::update_balances()
{
// lock gained
TLine_movmag & line_mov=(TLine_movmag &)lines_to_add[*curr_key];
TCausale_magazzino & causmag=(TCausale_magazzino &)cache_causali.get(line_mov.codcaus());
const TCausale_magazzino& causmag = causale(line_mov.codcaus());
if (causmag.update_ultcos())
{
curr_art.update_ultcosti(line_mov.prezzo(),get_date("DATACOMP"));
curr_art.update_ultcosti(line_mov.prezzo(),get_date("DATACOMP"), get_long("NUMREG"),nriga++);
curr_art.rewrite();
}
giac_putkey(mag,get(MOVMAG_ANNOES),*curr_key);
@ -570,6 +538,8 @@ int TMov_mag::update_balances()
updated_bal=FALSE;
curr_key=(TToken_string *)keys_to_remove.succ_item();
}
mark_current_lines();
return updated_bal;
}
@ -577,7 +547,7 @@ int TMov_mag::update_balances()
// in base alla causale e alla modifica fatta (con segno + o -)
int TMov_mag::update_balances(TRectype & magrec, const TLine_movmag &l,int rett_sign)
{
TCausale_magazzino & caus=(TCausale_magazzino &)cache_causali.get(l.codcaus());
const TCausale_magazzino& caus = causale(l.codcaus());
TLocalisamfile umart(LF_UMART);
real diff,diff_val;
@ -640,7 +610,7 @@ void TMov_mag::update_balance(TRectype & magrec, const char * fieldname, real di
HIDDEN TEsercizi_contabili _esercizi;
int TMov_mag::codice_esercizio(TDate &d)
int TMov_mag::codice_esercizio(const TDate &d)
{
return _esercizi.date2esc(d);
}
@ -693,7 +663,7 @@ void copy_oldbalances(TRectype & oldmag,TRectype & mag)
//**********************
bool rebuild_balances(const TString16 annoes,
bool rebuild_balances(const TString& annoes,
const TTipo_valorizz tipo_valorizz, const char* catven, const char* codlis)
{
@ -705,7 +675,7 @@ bool rebuild_balances(const TString16 annoes,
TArticolo_giacenza * a_g= new TArticolo_giacenza; // record dell'articolo di magazzino
rel2.lfile().set_curr(a_g);
int ok=TRUE;
bool ok=TRUE;
// Aggiorna il cazzillo per caricare eventuali date di chiusura e altre amenita' simili
_esercizi.update();
@ -719,7 +689,7 @@ bool rebuild_balances(const TString16 annoes,
const long maxart=cur2.objects();
information.format("Ricostruzione saldi esercizio %s: azzeramento...",(const char *)annoes);
TProgind barra_art(maxart,information, TRUE, TRUE, 60);
TProgind barra_art(maxart,information, FALSE, TRUE);
for (long a=0; a<maxart; a++)
{
barra_art.addstatus(1);
@ -727,15 +697,15 @@ bool rebuild_balances(const TString16 annoes,
TArticolo_giacenza & articolo=(TArticolo_giacenza &)cur2.file().curr();
if (articolo.lock_and_prompt(articolo.codice()))
{
if (reset_giac)
articolo.azzera_saldi(annoes);
else
articolo.riporta_saldi(pred_es, annoes, tipo_valorizz, catven, codlis);
if (reset_giac)
articolo.azzera_saldi(annoes);
else
articolo.riporta_saldi(pred_es, annoes, tipo_valorizz, catven, codlis);
articolo.unlock();
}
else
ok=FALSE;
do_events();
// do_events(); // Lo fa' gia' la addstatus
}
// ricostruisce i saldi (ciclo sui movimenti)
@ -745,7 +715,7 @@ bool rebuild_balances(const TString16 annoes,
const long maxmov=cur.objects();
information.format("Ricostruzione saldi esercizio %s: ricalcolo ...",(const char *)annoes);
TProgind barra_mov(maxmov,information,TRUE, TRUE, 60);
TProgind barra_mov(maxmov,information, FALSE, TRUE);
for (long m=0; m<maxmov; m++)
{

View File

@ -331,7 +331,7 @@ int TRata::compare(const TSortable& s) const
if (_nrata > r.rata())
return 1; // Numero maggiore
else
if (_nrata < r.rata());
if (_nrata < r.rata())
return -1; // Numero minore
return 0; // Stesso numero di rata

View File

@ -6,8 +6,7 @@
#endif
#ifndef __VELIB_H
class TMask;
class TDocumento_mask;
#include "velib.h"
#endif
#ifndef __CONFIG_H

View File

@ -1,5 +1,5 @@
#define APPNAME campo
#define QAPPNAME "campo"
#define APPNAME eurocamp
#define QAPPNAME "eurocampo"
#define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url>

View File

@ -205,45 +205,6 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
}
// Riempie lo sheet con le righe documento specificate nel .ini
void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
{
TRelation_application::ini2mask(ini, msk, query); // Default processing
if (query)
{
}
else
{
TSheet_field& f = msk.sfield(F_SHEET);
TTipo_riga_documento tr;
// Scorre tutti i pragrafi delle righe documento
for (int i = 1; ini.set_paragraph(format("%d,%d", LF_RIGHEDOC, i)); i++)
{
// Considera solo i tipi riga validi
const TString16 tipo = ini.get(RDOC_TIPORIGA);
if (tr.read(tipo) == NOERR)
{
// Crea una nuova riga documento
TRiga_documento& rec = _doc->new_row(tipo);
// Riempie i campi della nuova riga
TAssoc_array& var = ini.list_variables();
FOR_EACH_ASSOC_STRING(var, obj, key, val)
{
if (stricmp(key, RDOC_NRIGA) != 0) // Ignora il numero riga
rec.put(key, val);
}
// solo la insert chiama la post_insert necessaria alla disabilitazione verifichiamo
// l'autoload ??
// f.insert(-1, FALSE);
// Aggiunge la riga allo sheet
rec.autoload(f);
f.check_row(rec.numero()-1);
}
}
}
}
void TMotore_application::open_files(int logicnum, ...)
{
va_list marker;

View File

@ -68,7 +68,6 @@ protected:
void ini2mask(TConfig& ini, TMask& m, bool query);
public:
virtual TRelation* get_relation( ) const { return _rel;}
virtual bool get_next_key(TToken_string& key);
// Funzioni di accesso alle variabili private
@ -84,13 +83,6 @@ public:
virtual ~TMotore_application( ) { }
virtual const char* get_next_key( );
const char tipocf( ) { return _tipocf; }
void tipocf( const char tcf ) { _tipocf = tcf; }
TSheet_field & ss( ) const { return *_sheet; }
TMotore_application( ) { _pro = NULL; }
virtual ~TMotore_application( ) { if ( _pro ) delete _pro; }
};
inline TMotore_application& app() { return (TMotore_application &) main_app(); }

View File

@ -14,3 +14,4 @@
#define F_TIPOCF_ELAB 114
#define F_CODCF_ELAB 115
#define F_DATADOC_ELAB 116
#define F_UPDATE_HEADER 117

View File

@ -346,8 +346,6 @@ public:
TObject* dup() const { return new TTipo_riga_documento(codice()); }
public:
int read(const char* tiporig);
const TString& profile_name() const { return _name;}
const TString& mask_name() const { return profile_name();}
const TString& codice() const { return get("CODTAB");}

View File

@ -2,8 +2,8 @@
#include <prefix.h>
#include <tabutil.h>
#include "sconti.h"
#include "velib.h"
#include "sconti.h"
#include "vepriv.h"
#include "verig.h"
#include "../mg/mglib.h"

View File

@ -4,9 +4,9 @@
#include <tabutil.h>
#include <utility.h>
#include "sconti.h"
#include "veini.h"
#include "velib.h"
#include "sconti.h"
#include "vepriv.h"
#include "veuml.h"
@ -2621,7 +2621,7 @@ bool TDocumento::is_nota_credito() const
TLocalisamfile rcaus(LF_RCAUSALI);
TCausale c(codcaus, data().year());
const char sez = c.sezione_clifo();
swap = (c.reg().iva() == iva_vendite) ^ sez == 'D';
swap = ((c.reg().iva() == iva_vendite) ^ (sez == 'D'));
}
return swap;
}