Ritocchi ai messaggi d'errore
git-svn-id: svn://10.65.10.50/trunk@671 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ba5e917cef
commit
2fd3e79e44
342
ba/bacnv.cpp
342
ba/bacnv.cpp
@ -1,169 +1,173 @@
|
|||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
#include <applicat.h>
|
|
||||||
#include <checks.h>
|
#include <applicat.h>
|
||||||
#include <isam.h>
|
#include <isam.h>
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <lffiles.h>
|
#include <progind.h>
|
||||||
#include <utility.h>
|
#include <prefix.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <progind.h>
|
#include <utility.h>
|
||||||
#include <rmov.h>
|
|
||||||
#include <prefix.h>
|
#include <rmov.h>
|
||||||
|
|
||||||
#define usage "Errore - uso : bacnv -1"
|
#define usage "Errore - uso : bacnv 1 ditta"
|
||||||
|
|
||||||
class TConversione_archivi : public TApplication
|
class TConversione_archivi : public TApplication
|
||||||
{
|
{
|
||||||
int _nconv;
|
int _nconv;
|
||||||
long _codditta;
|
long _codditta;
|
||||||
long _oldditta;
|
long _oldditta;
|
||||||
int _error;
|
int _error;
|
||||||
|
|
||||||
virtual bool create() ;
|
protected:
|
||||||
virtual bool destroy() ;
|
virtual bool create() ;
|
||||||
bool menu(MENU_TAG);
|
virtual bool destroy() ;
|
||||||
bool convert_rmov(TLocalisamfile & rmov, TArray & recs, int nrecs);
|
virtual bool menu(MENU_TAG);
|
||||||
void contropartita_rmov();
|
|
||||||
|
bool convert_rmov(TLocalisamfile & rmov, TArray & recs, int nrecs);
|
||||||
public:
|
void contropartita_rmov();
|
||||||
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
|
|
||||||
};
|
public:
|
||||||
|
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
|
||||||
bool TConversione_archivi::create()
|
};
|
||||||
{
|
|
||||||
if (argc() < 3)
|
bool TConversione_archivi::create()
|
||||||
{
|
{
|
||||||
_error = 101;
|
if (argc() < 3)
|
||||||
TMessage msg("ba1100", 0, format("%d", _error));
|
{
|
||||||
|
_error = 101;
|
||||||
msg.send();
|
TMessage msg("ba1100", 0, format("%d", _error));
|
||||||
return FALSE;
|
|
||||||
}
|
msg.send();
|
||||||
else
|
return FALSE;
|
||||||
{
|
}
|
||||||
_oldditta = get_firm();
|
else
|
||||||
_codditta = atol(argv(argc() - 1));
|
{
|
||||||
_nconv = atoi(argv(1));
|
_oldditta = get_firm();
|
||||||
if (_codditta != _oldditta)
|
_codditta = atol(argv(argc() - 1));
|
||||||
{
|
_nconv = atoi(argv(1));
|
||||||
if (_codditta == 0) prefhndl->set("com");
|
if (_codditta != _oldditta)
|
||||||
else set_firm(_codditta);
|
{
|
||||||
}
|
if (_codditta == 0) prefhndl->set("com");
|
||||||
dispatch_e_menu(MENU_ITEM(1));
|
else set_firm(_codditta);
|
||||||
return TRUE;
|
}
|
||||||
}
|
dispatch_e_menu(MENU_ITEM(1));
|
||||||
}
|
return TRUE;
|
||||||
|
}
|
||||||
bool TConversione_archivi::destroy()
|
}
|
||||||
{
|
|
||||||
if (_codditta != _oldditta)
|
bool TConversione_archivi::destroy()
|
||||||
{
|
{
|
||||||
if (_oldditta == 0) prefhndl->set("com");
|
if (_codditta != _oldditta)
|
||||||
else set_firm(_oldditta);
|
{
|
||||||
}
|
if (_oldditta == 0) prefhndl->set("com");
|
||||||
if (_error > 0)
|
else set_firm(_oldditta);
|
||||||
{
|
}
|
||||||
TMessage msg("ba1100", 0, format("%d", _error));
|
if (_error > 0)
|
||||||
msg.send();
|
{
|
||||||
}
|
TMessage msg("ba1100", 0, format("%d", _error));
|
||||||
return TRUE;
|
msg.send();
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
bool TConversione_archivi::menu(MENU_TAG)
|
}
|
||||||
{
|
|
||||||
switch (_nconv)
|
bool TConversione_archivi::menu(MENU_TAG)
|
||||||
{
|
{
|
||||||
case 1:
|
switch (_nconv)
|
||||||
contropartita_rmov();
|
{
|
||||||
}
|
case 1:
|
||||||
return FALSE;
|
contropartita_rmov(); break;
|
||||||
}
|
default:
|
||||||
|
break;
|
||||||
bool TConversione_archivi::convert_rmov(TLocalisamfile & rmov, TArray & recs, int nrecs)
|
}
|
||||||
{
|
return FALSE;
|
||||||
const TRecnotype pos = rmov.recno();
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nrecs; i++)
|
bool TConversione_archivi::convert_rmov(TLocalisamfile & rmov, TArray & recs, int nrecs)
|
||||||
{
|
{
|
||||||
TRectype & r0 = (TRectype &) recs[i];
|
const TRecnotype pos = rmov.recno();
|
||||||
const int rcontr = r0.get_int(RMV_RCONTR) - 1;
|
|
||||||
|
for (int i = 0; i < nrecs; i++)
|
||||||
if (rcontr >= 0 && rcontr < nrecs)
|
{
|
||||||
{
|
TRectype & r0 = (TRectype &) recs[i];
|
||||||
const TRectype & r1 = (const TRectype &) recs[rcontr];
|
const int rcontr = r0.get_int(RMV_RCONTR) - 1;
|
||||||
|
|
||||||
r0.put(RMV_TIPOCC, r1.get(RMV_TIPOC));
|
if (rcontr >= 0 && rcontr < nrecs)
|
||||||
r0.put(RMV_GRUPPOC, r1.get_int(RMV_GRUPPO));
|
{
|
||||||
r0.put(RMV_CONTOC, r1.get_int(RMV_CONTO));
|
const TRectype & r1 = (const TRectype &) recs[rcontr];
|
||||||
r0.put(RMV_SOTTOCONTOC, r1.get_long(RMV_SOTTOCONTO));
|
|
||||||
}
|
r0.put(RMV_TIPOCC, r1.get(RMV_TIPOC));
|
||||||
r0.zero(RMV_RCONTR);
|
r0.put(RMV_GRUPPOC, r1.get_int(RMV_GRUPPO));
|
||||||
if (rmov.rewrite(r0) != NOERR)
|
r0.put(RMV_CONTOC, r1.get_int(RMV_CONTO));
|
||||||
{
|
r0.put(RMV_SOTTOCONTOC, r1.get_long(RMV_SOTTOCONTO));
|
||||||
const long reg = r0.get_long(RMV_NUMREG);
|
}
|
||||||
error_box("Non riesco ad aggiornare la riga contabile %ld / %d\nErrore n. %d", reg, i + 1, rmov.status());
|
r0.zero(RMV_RCONTR);
|
||||||
rmov.readat(pos);
|
if (rmov.rewrite(r0) != NOERR)
|
||||||
_error = 102;
|
{
|
||||||
return FALSE;
|
const long reg = r0.get_long(RMV_NUMREG);
|
||||||
}
|
error_box("Non riesco ad aggiornare la riga contabile %ld / %d\nErrore n. %d", reg, i + 1, rmov.status());
|
||||||
}
|
rmov.readat(pos);
|
||||||
rmov.readat(pos);
|
_error = 102;
|
||||||
return TRUE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void TConversione_archivi::contropartita_rmov()
|
rmov.readat(pos);
|
||||||
{
|
return TRUE;
|
||||||
TDir d;
|
}
|
||||||
d.get(LF_RMOV);
|
|
||||||
if (d.eox() == 0) return;
|
void TConversione_archivi::contropartita_rmov()
|
||||||
|
{
|
||||||
TLocalisamfile rmov(LF_RMOV);
|
TDir d;
|
||||||
const TRecnotype nitems = rmov.items();
|
d.get(LF_RMOV);
|
||||||
TArray recs;
|
if (d.eox() == 0) return;
|
||||||
long oldreg = -1;
|
|
||||||
long reg = -1;
|
TLocalisamfile rmov(LF_RMOV);
|
||||||
int nrow = 0;
|
const TRecnotype nitems = rmov.items();
|
||||||
TProgind p(nitems ? nitems : 1,
|
TArray recs;
|
||||||
format("Conversione righe di movimento della ditta %ld", get_firm()),
|
long oldreg = -1;
|
||||||
TRUE, TRUE, 70);
|
long reg = -1;
|
||||||
for (rmov.first(); rmov.good(); rmov.next())
|
int nrow = 0;
|
||||||
{
|
TProgind p(nitems ? nitems : 1,
|
||||||
p.addstatus(1);
|
format("Conversione righe di movimento della ditta %ld", get_firm()),
|
||||||
reg = rmov.get_long(RMV_NUMREG);
|
TRUE, TRUE, 70);
|
||||||
if (oldreg != reg)
|
for (rmov.first(); rmov.good(); rmov.next())
|
||||||
{
|
{
|
||||||
if (oldreg > 0)
|
p.addstatus(1);
|
||||||
if (convert_rmov(rmov, recs, nrow) == FALSE)
|
reg = rmov.get_long(RMV_NUMREG);
|
||||||
return;
|
if (oldreg != reg)
|
||||||
oldreg = reg;
|
{
|
||||||
nrow = 0;
|
if (oldreg > 0)
|
||||||
}
|
if (convert_rmov(rmov, recs, nrow) == FALSE)
|
||||||
recs.add(rmov.curr(), nrow++);
|
return;
|
||||||
CHECKD(nrow == rmov.get_int(RMV_NUMRIG), "Missed row ", nrow);
|
oldreg = reg;
|
||||||
}
|
nrow = 0;
|
||||||
if (oldreg > 0)
|
}
|
||||||
if (convert_rmov(rmov, recs, nrow) == FALSE)
|
recs.add(rmov.curr(), nrow++);
|
||||||
return;
|
CHECKD(nrow == rmov.get_int(RMV_NUMRIG), "Missed row ", nrow);
|
||||||
}
|
}
|
||||||
|
if (oldreg > 0)
|
||||||
HIDDEN void bacnv(int argc, char** argv)
|
if (convert_rmov(rmov, recs, nrow) == FALSE)
|
||||||
{
|
return;
|
||||||
TConversione_archivi a ;
|
}
|
||||||
a.run(argc, argv, "Conversione archivi");
|
|
||||||
}
|
HIDDEN void bacnv(int argc, char** argv)
|
||||||
|
{
|
||||||
int main(int argc,char** argv)
|
TConversione_archivi a ;
|
||||||
{
|
a.run(argc, argv, "Conversione archivi");
|
||||||
const int r = (argc > 1) ? atoi(argv[1]) : 0;
|
}
|
||||||
|
|
||||||
if (r <= 0 || r > 1)
|
int main(int argc,char** argv)
|
||||||
{
|
{
|
||||||
error_box(usage);
|
const int r = (argc > 1) ? atoi(argv[1]) : 0;
|
||||||
return 100;
|
|
||||||
}
|
if (r <= 0 || r > 1)
|
||||||
|
{
|
||||||
bacnv(argc, argv);
|
error_box(usage);
|
||||||
return 0;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bacnv(argc, argv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user