Separati i programmi di rinumerazione e ricalcolo saldi
Corretta segnalazione nelle copie git-svn-id: svn://10.65.10.50/trunk@668 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
00bfa3954b
commit
30ff853857
@ -4,9 +4,6 @@
|
||||
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM BAR_ITEM(1) "~Movimenti"
|
||||
ITEM BAR_ITEM(2) "~Saldi"
|
||||
|
||||
|
||||
/* cg4 -1 Copia archivi piano conti, causali, clienti/fornitori iv direttiva */
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
@ -49,13 +49,14 @@ struct therec {
|
||||
class CG4100_App : public TApplication
|
||||
{
|
||||
TString _year;
|
||||
char _optype;
|
||||
|
||||
public:
|
||||
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
|
||||
bool set_parms(bool year);
|
||||
bool set_parms();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
|
||||
void restore_mov(TSystemisamfile& a, TSystemisamfile& b, TSystemisamfile& c);
|
||||
@ -63,8 +64,7 @@ public:
|
||||
bool sort_mov();
|
||||
bool sort_sal();
|
||||
|
||||
CG4100_App() : TApplication(), _year(4)
|
||||
{ }
|
||||
CG4100_App() : TApplication(), _year(4), _optype('S') {}
|
||||
virtual ~CG4100_App() {}
|
||||
};
|
||||
|
||||
@ -85,7 +85,9 @@ bool CG4100_App::create()
|
||||
if (fexist("__mov__.sav"))
|
||||
warning_box("Un'operazione di riordino movimenti si e' conclusa"
|
||||
" impropriamente. Si raccomanda di rieseguirla");
|
||||
|
||||
if (argc() > 2)
|
||||
_optype = toupper(argv(2)[0]);
|
||||
dispatch_e_menu(MENU_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -99,16 +101,17 @@ bool CG4100_App::destroy()
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
bool CG4100_App::set_parms(bool year)
|
||||
bool CG4100_App::set_parms()
|
||||
{
|
||||
TMask m("cg4100a");
|
||||
|
||||
if (!year)
|
||||
m.hide(FLD_CG41_YEAR);
|
||||
const bool saldi = _optype == 'S';
|
||||
TMask m(saldi ? "cg4100b" : "cg4100a");
|
||||
|
||||
m.run();
|
||||
|
||||
_year = m.get(FLD_CG41_YEAR);
|
||||
if (saldi)
|
||||
_year = m.get(FLD_CG41_YEAR);
|
||||
else
|
||||
_year = 0;
|
||||
|
||||
return m.last_key() == K_ENTER;
|
||||
}
|
||||
@ -116,16 +119,12 @@ bool CG4100_App::set_parms(bool year)
|
||||
|
||||
bool CG4100_App::menu(MENU_TAG m)
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case BAR_ITEM(1):
|
||||
sort_mov();
|
||||
break;
|
||||
case BAR_ITEM(2):
|
||||
if (_optype == 'S')
|
||||
sort_sal();
|
||||
break;
|
||||
}
|
||||
return TApplication::menu(m);
|
||||
else
|
||||
if (_optype == 'M')
|
||||
sort_mov();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -187,7 +186,7 @@ void CG4100_App::restore_mov(TSystemisamfile& mov, TSystemisamfile& rmov,
|
||||
|
||||
bool CG4100_App::sort_mov()
|
||||
{
|
||||
if (!set_parms(FALSE))
|
||||
if (!set_parms())
|
||||
return FALSE;
|
||||
|
||||
TSystemisamfile mov(LF_MOV);
|
||||
@ -238,7 +237,7 @@ bool CG4100_App::sort_mov()
|
||||
strcpy(rbuf.REG, mov.get(MOV_REG));
|
||||
d = mov.get(MOV_DATADOC);
|
||||
s = mov.get(MOV_PROTIVA);
|
||||
if (isdigit(s[s.len() - 1])) s << " ";
|
||||
if (s.len() > 0 && isdigit(s[s.len() - 1])) s << " ";
|
||||
s.right_just(8);
|
||||
strcpy(rbuf.NUMPROT, (const char *) s);
|
||||
strcpy(rbuf.DATADOC, d.string(ANSI));
|
||||
@ -347,7 +346,7 @@ bool CG4100_App::sort_mov()
|
||||
bool CG4100_App::sort_sal()
|
||||
{
|
||||
|
||||
if (!set_parms(TRUE))
|
||||
if (!set_parms())
|
||||
return FALSE;
|
||||
|
||||
FILE* fp = fopen ("__sal__.sav","w");
|
||||
|
@ -1,6 +1,4 @@
|
||||
#define FLD_CG41_YEAR 100
|
||||
|
||||
PAGE "Riordino Movimenti/Saldi" -1 -1 47 10
|
||||
PAGE "Riordino Movimenti" -1 -1 47 10
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
@ -17,22 +15,14 @@ BEGIN
|
||||
PROMPT 3 4 "tempo. Siate certi di voler proseguire."
|
||||
END
|
||||
|
||||
NUMBER FLD_CG41_YEAR 4
|
||||
BEGIN
|
||||
PROMPT 3 6 "Anno da riordinare "
|
||||
FLAGS "A"
|
||||
HELP "Anno del quale si desidera il riordino degli archivi"
|
||||
END
|
||||
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 "Conferma"
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 9 2
|
||||
BUTTON DLG_QUIT 9 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 "Annulla"
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
46
cg/cg4100b.uml
Executable file
46
cg/cg4100b.uml
Executable file
@ -0,0 +1,46 @@
|
||||
#define FLD_CG41_YEAR 100
|
||||
|
||||
PAGE "Ricalcolo Saldi" -1 -1 47 10
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 16 1 "ATTENZIONE"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 3 "Il ricalcolo degli saldi puo' richiedere"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 3 4 "tempo. Siate certi di voler proseguire."
|
||||
END
|
||||
|
||||
NUMBER FLD_CG41_YEAR 4
|
||||
BEGIN
|
||||
PROMPT 3 6 "Anno di esercizio "
|
||||
USE ESC
|
||||
INPUT CODTAB FLD_CG41_YEAR
|
||||
DISPLAY "Anno Esercizio" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio " D1
|
||||
OUTPUT FLD_CG41_YEAR CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
HELP "Anno del quale si desidera il ricalcolo dei saldi"
|
||||
WARNING "L' anno di esercizio e' obbligatorio"
|
||||
END
|
||||
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 "Conferma"
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 9 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
484
cg/cg4200.cpp
484
cg/cg4200.cpp
@ -1,240 +1,244 @@
|
||||
#include <applicat.h>
|
||||
#include <isam.h>
|
||||
#include <mask.h>
|
||||
|
||||
#include <pconti.h>
|
||||
#include <assoc.h>
|
||||
#include <urldefid.h>
|
||||
#include <prefix.h>
|
||||
|
||||
#include "cg4.h"
|
||||
#include "cg4200.h"
|
||||
|
||||
class TCopia_archivi : public TApplication
|
||||
{
|
||||
TMask* _msk;
|
||||
long _default_firm;
|
||||
|
||||
virtual bool create() ;
|
||||
virtual bool destroy() ;
|
||||
bool menu(MENU_TAG);
|
||||
bool copyfile(int logicnum, long from, long to);
|
||||
void clearivd(long to);
|
||||
void copyivd(long from, long to);
|
||||
|
||||
public:
|
||||
TCopia_archivi() : _msk(NULL) {}
|
||||
};
|
||||
|
||||
bool TCopia_archivi::copyfile(int logicnum, long from, long to)
|
||||
{
|
||||
if (from > 0) set_firm(from);
|
||||
else prefhndl->set("com");
|
||||
TSystemisamfile file(logicnum);
|
||||
TFilename t; t.tempdir(); t << "/tr" << logicnum;
|
||||
|
||||
if (file.dump(t) != NOERR)
|
||||
return error_box("Impossibile leggere i dati da copiare errore n. %d", file.status());
|
||||
set_firm(to);
|
||||
TFilename s; s.tempdir(); s << "/sv" << logicnum;
|
||||
|
||||
if (file.dump(s) != NOERR)
|
||||
return error_box("Impossibile salvare i dati originali errore n. %d", file.status());
|
||||
|
||||
TDir dir;
|
||||
|
||||
dir.get(logicnum, _lock, _nordir, _sysdirop);
|
||||
dir.eod() = 0L;
|
||||
dir.put(logicnum, _nordir, _sysdirop);
|
||||
file.packindex();
|
||||
if (file.load(t) != NOERR)
|
||||
{
|
||||
error_box("Impossibile scrivere i dati errore n. %d. Cerco di ripristinare i dati originali.", file.status());
|
||||
dir.get(logicnum, _lock, _nordir, _sysdirop);
|
||||
dir.eod() = 0L;
|
||||
dir.put(logicnum, _nordir, _sysdirop);
|
||||
file.packindex();
|
||||
if (file.load(s))
|
||||
error_box("Impossibile scrivere i dati originali errore n. %d", file.status());
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TCopia_archivi::clearivd(long to)
|
||||
{
|
||||
TLocalisamfile pcon(LF_PCON);
|
||||
|
||||
for (pcon.first(); pcon.good(); pcon.next())
|
||||
{
|
||||
pcon.put(PCN_SEZIVD, "0");
|
||||
pcon.zero(PCN_LETTIVD);
|
||||
pcon.zero(PCN_NUMRIVD);
|
||||
pcon.zero(PCN_NUMIVD);
|
||||
pcon.put(PCN_SEZIVDOPP, "0");
|
||||
pcon.zero(PCN_LETTIVDOPP);
|
||||
pcon.zero(PCN_NUMRIVDOPP);
|
||||
pcon.zero(PCN_NUMIVDOPP);
|
||||
pcon.rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
void TCopia_archivi::copyivd(long from, long to)
|
||||
{
|
||||
if (from > 0) set_firm(from);
|
||||
else prefhndl->set("com");
|
||||
TLocalisamfile pcon(LF_PCON);
|
||||
TAssoc_array riclass;
|
||||
|
||||
for (pcon.first(); pcon.good(); pcon.next())
|
||||
{
|
||||
TString16 key;
|
||||
TToken_string data;
|
||||
|
||||
key.format("%03d%03d%06ld", pcon.get_int(PCN_GRUPPO),
|
||||
pcon.get_int(PCN_CONTO), pcon.get_long(PCN_SOTTOCONTO));
|
||||
data.add(pcon.get(PCN_SEZIVD));
|
||||
data.add(pcon.get(PCN_LETTIVD));
|
||||
data.add(pcon.get(PCN_NUMRIVD));
|
||||
data.add(pcon.get(PCN_NUMIVD));
|
||||
data.add(pcon.get(PCN_SEZIVDOPP));
|
||||
data.add(pcon.get(PCN_LETTIVDOPP));
|
||||
data.add(pcon.get(PCN_NUMRIVDOPP));
|
||||
data.add(pcon.get(PCN_NUMIVDOPP));
|
||||
riclass.add(key, data);
|
||||
}
|
||||
set_firm(to);
|
||||
for (pcon.first(); pcon.good(); pcon.next())
|
||||
{
|
||||
TString16 key;
|
||||
|
||||
key.format("%03d%03d%06ld", pcon.get_int(PCN_GRUPPO),
|
||||
pcon.get_int(PCN_CONTO), pcon.get_long(PCN_SOTTOCONTO));
|
||||
|
||||
TToken_string * data = (TToken_string *) riclass.objptr(key);
|
||||
|
||||
if (data == NULL)
|
||||
{
|
||||
pcon.put(PCN_SEZIVD, "0");
|
||||
pcon.zero(PCN_LETTIVD);
|
||||
pcon.zero(PCN_NUMRIVD);
|
||||
pcon.zero(PCN_NUMIVD);
|
||||
pcon.put(PCN_SEZIVDOPP, "0");
|
||||
pcon.zero(PCN_LETTIVDOPP);
|
||||
pcon.zero(PCN_NUMRIVDOPP);
|
||||
pcon.zero(PCN_NUMIVDOPP);
|
||||
}
|
||||
else
|
||||
{
|
||||
pcon.put(PCN_SEZIVD, data->get(0));
|
||||
pcon.put(PCN_LETTIVD, data->get());
|
||||
pcon.put(PCN_NUMRIVD, data->get());
|
||||
pcon.put(PCN_NUMIVD, data->get());
|
||||
pcon.put(PCN_SEZIVDOPP, data->get());
|
||||
pcon.put(PCN_LETTIVDOPP, data->get());
|
||||
pcon.put(PCN_NUMRIVDOPP, data->get());
|
||||
pcon.put(PCN_NUMIVDOPP, data->get());
|
||||
}
|
||||
pcon.rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
bool TCopia_archivi::create()
|
||||
{
|
||||
_msk = new TMask("cg4200a") ;
|
||||
_default_firm = get_firm();
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TCopia_archivi::destroy()
|
||||
{
|
||||
if (_msk != NULL) delete _msk;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TCopia_archivi::menu(MENU_TAG)
|
||||
{
|
||||
while (_msk->run() == K_ENTER)
|
||||
{
|
||||
const long from_firm = _msk->get_long(F_FROMFIRM);
|
||||
const long to_firm = _msk->get_long(F_TOFIRM);
|
||||
const bool copy_pcon = _msk->get_bool(F_PCON);
|
||||
const bool copy_causali = _msk->get_bool(F_CAUS);
|
||||
const bool copy_clifo = _msk->get_bool(F_CLIFO);
|
||||
const bool copy_ivd = _msk->get_bool(F_IVD);
|
||||
if (copy_pcon || copy_causali || copy_clifo || copy_ivd)
|
||||
{
|
||||
if (prefhndl->exist(to_firm))
|
||||
{
|
||||
set_firm(to_firm);
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
|
||||
if ((mov.eod() == 0) || (!copy_pcon && !copy_causali && !copy_clifo))
|
||||
{
|
||||
TString mess("Attenzione ");
|
||||
int count = 0;
|
||||
|
||||
if (copy_pcon)
|
||||
{
|
||||
mess << "il piano dei conti";
|
||||
count++;
|
||||
}
|
||||
if (copy_causali)
|
||||
{
|
||||
if (count > 0) mess << ",";
|
||||
mess << " le causali";
|
||||
count++;
|
||||
}
|
||||
if (copy_clifo)
|
||||
{
|
||||
if (count > 0) mess << ",";
|
||||
mess << " i clienti e fornitori";
|
||||
count++;
|
||||
}
|
||||
if (copy_ivd)
|
||||
{
|
||||
if (count > 0) mess << ",";
|
||||
mess << " la riclassificazione IV direttiva";
|
||||
count++;
|
||||
}
|
||||
mess << " della ditta " << to_firm;
|
||||
if (count > 1)
|
||||
mess << " saranno sovrascritti";
|
||||
else
|
||||
mess << " sara' sovrascritto";
|
||||
mess << ". Devo continuare";
|
||||
if (yesno_box((const char *) mess))
|
||||
{
|
||||
if (copy_pcon)
|
||||
{
|
||||
if (copyfile(LF_PCON, from_firm, to_firm) && !copy_ivd)
|
||||
clearivd(to_firm);
|
||||
}
|
||||
if (copy_causali)
|
||||
{
|
||||
if (copyfile(LF_CAUSALI, from_firm, to_firm))
|
||||
copyfile(LF_RCAUSALI, from_firm, to_firm);
|
||||
}
|
||||
if (copy_clifo)
|
||||
copyfile(LF_CLIFO, from_firm, to_firm);
|
||||
if (!copy_pcon && copy_ivd)
|
||||
copyivd(from_firm, to_firm);
|
||||
}
|
||||
}
|
||||
else error_box("La copia si puo' effettuare solo se non sono stati registrati movimenti");
|
||||
set_firm(_default_firm);
|
||||
}
|
||||
else error_box("Gli archivi della ditta %d non sono stati ancora generati",to_firm);
|
||||
_msk->reset();
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int cg4200(int argc, char* argv[])
|
||||
{
|
||||
TCopia_archivi a ;
|
||||
a.run(argc, argv, "Copia archivi");
|
||||
return 0;
|
||||
}
|
||||
#include <applicat.h>
|
||||
#include <isam.h>
|
||||
#include <mask.h>
|
||||
|
||||
#include <pconti.h>
|
||||
#include <assoc.h>
|
||||
#include <urldefid.h>
|
||||
#include <prefix.h>
|
||||
|
||||
#include "cg4.h"
|
||||
#include "cg4200.h"
|
||||
|
||||
class TCopia_archivi : public TApplication
|
||||
{
|
||||
TMask* _msk;
|
||||
long _default_firm;
|
||||
|
||||
virtual bool create() ;
|
||||
virtual bool destroy() ;
|
||||
bool menu(MENU_TAG);
|
||||
bool copyfile(int logicnum, long from, long to);
|
||||
void clearivd(long to);
|
||||
void copyivd(long from, long to);
|
||||
|
||||
public:
|
||||
TCopia_archivi() : _msk(NULL) {}
|
||||
};
|
||||
|
||||
bool TCopia_archivi::copyfile(int logicnum, long from, long to)
|
||||
{
|
||||
if (from > 0) set_firm(from);
|
||||
else prefhndl->set("com");
|
||||
TSystemisamfile file(logicnum);
|
||||
TFilename t; t.tempdir(); t << "/tr" << logicnum;
|
||||
|
||||
if (file.dump(t) != NOERR)
|
||||
return error_box("Impossibile leggere i dati da copiare errore n. %d", file.status());
|
||||
set_firm(to);
|
||||
TFilename s; s.tempdir(); s << "/sv" << logicnum;
|
||||
|
||||
if (file.dump(s) != NOERR)
|
||||
return error_box("Impossibile salvare i dati originali errore n. %d", file.status());
|
||||
|
||||
TDir dir;
|
||||
|
||||
dir.get(logicnum, _lock, _nordir, _sysdirop);
|
||||
dir.eod() = 0L;
|
||||
dir.put(logicnum, _nordir, _sysdirop);
|
||||
file.packindex();
|
||||
if (file.load(t) != NOERR)
|
||||
{
|
||||
error_box("Impossibile scrivere i dati errore n. %d. Cerco di ripristinare i dati originali.", file.status());
|
||||
dir.get(logicnum, _lock, _nordir, _sysdirop);
|
||||
dir.eod() = 0L;
|
||||
dir.put(logicnum, _nordir, _sysdirop);
|
||||
file.packindex();
|
||||
if (file.load(s))
|
||||
error_box("Impossibile scrivere i dati originali errore n. %d", file.status());
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TCopia_archivi::clearivd(long to)
|
||||
{
|
||||
TLocalisamfile pcon(LF_PCON);
|
||||
|
||||
for (pcon.first(); pcon.good(); pcon.next())
|
||||
{
|
||||
pcon.put(PCN_SEZIVD, "0");
|
||||
pcon.zero(PCN_LETTIVD);
|
||||
pcon.zero(PCN_NUMRIVD);
|
||||
pcon.zero(PCN_NUMIVD);
|
||||
pcon.put(PCN_SEZIVDOPP, "0");
|
||||
pcon.zero(PCN_LETTIVDOPP);
|
||||
pcon.zero(PCN_NUMRIVDOPP);
|
||||
pcon.zero(PCN_NUMIVDOPP);
|
||||
pcon.rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
void TCopia_archivi::copyivd(long from, long to)
|
||||
{
|
||||
if (from > 0) set_firm(from);
|
||||
else prefhndl->set("com");
|
||||
TLocalisamfile pcon(LF_PCON);
|
||||
TAssoc_array riclass;
|
||||
|
||||
for (pcon.first(); pcon.good(); pcon.next())
|
||||
{
|
||||
TString16 key;
|
||||
TToken_string data;
|
||||
|
||||
key.format("%03d%03d%06ld", pcon.get_int(PCN_GRUPPO),
|
||||
pcon.get_int(PCN_CONTO), pcon.get_long(PCN_SOTTOCONTO));
|
||||
data.add(pcon.get(PCN_SEZIVD));
|
||||
data.add(pcon.get(PCN_LETTIVD));
|
||||
data.add(pcon.get(PCN_NUMRIVD));
|
||||
data.add(pcon.get(PCN_NUMIVD));
|
||||
data.add(pcon.get(PCN_SEZIVDOPP));
|
||||
data.add(pcon.get(PCN_LETTIVDOPP));
|
||||
data.add(pcon.get(PCN_NUMRIVDOPP));
|
||||
data.add(pcon.get(PCN_NUMIVDOPP));
|
||||
riclass.add(key, data);
|
||||
}
|
||||
set_firm(to);
|
||||
for (pcon.first(); pcon.good(); pcon.next())
|
||||
{
|
||||
TString16 key;
|
||||
|
||||
key.format("%03d%03d%06ld", pcon.get_int(PCN_GRUPPO),
|
||||
pcon.get_int(PCN_CONTO), pcon.get_long(PCN_SOTTOCONTO));
|
||||
|
||||
TToken_string * data = (TToken_string *) riclass.objptr(key);
|
||||
|
||||
if (data == NULL)
|
||||
{
|
||||
pcon.put(PCN_SEZIVD, "0");
|
||||
pcon.zero(PCN_LETTIVD);
|
||||
pcon.zero(PCN_NUMRIVD);
|
||||
pcon.zero(PCN_NUMIVD);
|
||||
pcon.put(PCN_SEZIVDOPP, "0");
|
||||
pcon.zero(PCN_LETTIVDOPP);
|
||||
pcon.zero(PCN_NUMRIVDOPP);
|
||||
pcon.zero(PCN_NUMIVDOPP);
|
||||
}
|
||||
else
|
||||
{
|
||||
pcon.put(PCN_SEZIVD, data->get(0));
|
||||
pcon.put(PCN_LETTIVD, data->get());
|
||||
pcon.put(PCN_NUMRIVD, data->get());
|
||||
pcon.put(PCN_NUMIVD, data->get());
|
||||
pcon.put(PCN_SEZIVDOPP, data->get());
|
||||
pcon.put(PCN_LETTIVDOPP, data->get());
|
||||
pcon.put(PCN_NUMRIVDOPP, data->get());
|
||||
pcon.put(PCN_NUMIVDOPP, data->get());
|
||||
}
|
||||
pcon.rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
bool TCopia_archivi::create()
|
||||
{
|
||||
_msk = new TMask("cg4200a") ;
|
||||
_default_firm = get_firm();
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TCopia_archivi::destroy()
|
||||
{
|
||||
if (_msk != NULL) delete _msk;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TCopia_archivi::menu(MENU_TAG)
|
||||
{
|
||||
while (_msk->run() == K_ENTER)
|
||||
{
|
||||
const long from_firm = _msk->get_long(F_FROMFIRM);
|
||||
const long to_firm = _msk->get_long(F_TOFIRM);
|
||||
const bool copy_pcon = _msk->get_bool(F_PCON);
|
||||
const bool copy_causali = _msk->get_bool(F_CAUS);
|
||||
const bool copy_clifo = _msk->get_bool(F_CLIFO);
|
||||
const bool copy_ivd = _msk->get_bool(F_IVD);
|
||||
if (copy_pcon || copy_causali || copy_clifo || copy_ivd)
|
||||
{
|
||||
if (prefhndl->exist(to_firm))
|
||||
{
|
||||
set_firm(to_firm);
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
|
||||
if ((mov.eod() == 0) || (!copy_pcon && !copy_causali && !copy_clifo))
|
||||
{
|
||||
TString mess("Attenzione \n");
|
||||
int count = 0;
|
||||
|
||||
if (copy_pcon)
|
||||
{
|
||||
mess << "il piano dei conti";
|
||||
count++;
|
||||
}
|
||||
if (copy_causali)
|
||||
{
|
||||
if (count > 0) mess << ",\n";
|
||||
mess << " le causali";
|
||||
count++;
|
||||
}
|
||||
if (copy_clifo)
|
||||
{
|
||||
if (count > 0) mess << ",\n";
|
||||
mess << " i clienti e fornitori";
|
||||
count++;
|
||||
}
|
||||
if (copy_ivd)
|
||||
{
|
||||
if (count > 0) mess << ",\n";
|
||||
mess << " la riclassificazione IV direttiva";
|
||||
count++;
|
||||
}
|
||||
mess << "\n della ditta " << to_firm;
|
||||
if (count > 1)
|
||||
mess << " saranno sovrascritti";
|
||||
else
|
||||
mess << " sara' sovrascritto";
|
||||
mess << ". Devo continuare";
|
||||
if (yesno_box((const char *) mess))
|
||||
{
|
||||
mess.rtrim(16); mess << " Devo veramente continuare";
|
||||
if (yesno_box((const char *) mess))
|
||||
{
|
||||
if (copy_pcon)
|
||||
{
|
||||
if (copyfile(LF_PCON, from_firm, to_firm) && !copy_ivd)
|
||||
clearivd(to_firm);
|
||||
}
|
||||
if (copy_causali)
|
||||
{
|
||||
if (copyfile(LF_CAUSALI, from_firm, to_firm))
|
||||
copyfile(LF_RCAUSALI, from_firm, to_firm);
|
||||
}
|
||||
if (copy_clifo)
|
||||
copyfile(LF_CLIFO, from_firm, to_firm);
|
||||
if (!copy_pcon && copy_ivd)
|
||||
copyivd(from_firm, to_firm);
|
||||
}
|
||||
}
|
||||
}
|
||||
else error_box("La copia si puo' effettuare solo se non sono stati registrati movimenti");
|
||||
set_firm(_default_firm);
|
||||
}
|
||||
else error_box("Gli archivi della ditta %d non sono stati ancora generati",to_firm);
|
||||
_msk->reset();
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int cg4200(int argc, char* argv[])
|
||||
{
|
||||
TCopia_archivi a ;
|
||||
a.run(argc, argv, "Copia archivi");
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user