Aggiunto programma di copia piano dei conti, causali, clienti e fornitori, iv direttiva
git-svn-id: svn://10.65.10.50/trunk@594 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4cbe1136ee
commit
dff0cc5195
1
cg/cg4.h
1
cg/cg4.h
@ -2,6 +2,7 @@
|
|||||||
#define __CG4_H
|
#define __CG4_H
|
||||||
|
|
||||||
int cg4100(int argc, char* argv[]);
|
int cg4100(int argc, char* argv[]);
|
||||||
|
int cg4200(int argc, char* argv[]);
|
||||||
int cg4300(int argc, char* argv[]);
|
int cg4300(int argc, char* argv[]);
|
||||||
int cg4400(int argc, char* argv[]);
|
int cg4400(int argc, char* argv[]);
|
||||||
int cg4500(int argc, char* argv[]);
|
int cg4500(int argc, char* argv[]);
|
||||||
|
@ -8,6 +8,12 @@ MENU TASK_MENUBAR
|
|||||||
ITEM BAR_ITEM(2) "~Saldi"
|
ITEM BAR_ITEM(2) "~Saldi"
|
||||||
|
|
||||||
|
|
||||||
|
/* cg4 -1 Copia archivi piano conti, causali, clienti/fornitori iv direttiva */
|
||||||
|
MENUBAR MENU_BAR(1)
|
||||||
|
|
||||||
|
MENU MENU_BAR(1)
|
||||||
|
SUBMENU MENU_FILE "~File"
|
||||||
|
|
||||||
/* cg4 -2 Calcolo liquidazione IVA */
|
/* cg4 -2 Calcolo liquidazione IVA */
|
||||||
|
|
||||||
MENUBAR MENU_BAR(2)
|
MENUBAR MENU_BAR(2)
|
||||||
|
240
cg/cg4200.cpp
Executable file
240
cg/cg4200.cpp
Executable file
@ -0,0 +1,240 @@
|
|||||||
|
#include <applicat.h>
|
||||||
|
#include <lffiles.h>
|
||||||
|
#include <mask.h>
|
||||||
|
#include <isam.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)
|
||||||
|
{
|
||||||
|
set_firm(to_firm);
|
||||||
|
TLocalisamfile mov(LF_MOV);
|
||||||
|
|
||||||
|
if (mov.eod() == 0)
|
||||||
|
{
|
||||||
|
if (prefhndl->exist(to_firm))
|
||||||
|
{
|
||||||
|
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("Gli archivi della ditta %d non sono stati ancora generati",to_firm);
|
||||||
|
}
|
||||||
|
else error_box("La copia si puo' effettuare solo se non sono stati registrati movimenti");
|
||||||
|
set_firm(_default_firm);
|
||||||
|
_msk->reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cg4200(int argc, char** argv)
|
||||||
|
{
|
||||||
|
TCopia_archivi a ;
|
||||||
|
a.run(argc, argv, "Copia archivi");
|
||||||
|
return 0;
|
||||||
|
}
|
10
cg/cg4200.h
Executable file
10
cg/cg4200.h
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#define F_FROMTYPE 101
|
||||||
|
#define F_FROMFIRM 102
|
||||||
|
#define F_DFROMFIRM 103
|
||||||
|
#define F_TOFIRM 104
|
||||||
|
#define F_DTOFIRM 105
|
||||||
|
#define F_PCON 106
|
||||||
|
#define F_CAUS 107
|
||||||
|
#define F_CLIFO 108
|
||||||
|
#define F_IVD 109
|
||||||
|
|
118
cg/cg4200a.uml
Executable file
118
cg/cg4200a.uml
Executable file
@ -0,0 +1,118 @@
|
|||||||
|
#include "cg4200.h"
|
||||||
|
|
||||||
|
PAGE "Copia da ditta a ditta" -1 -1 78 16
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 76 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "Copia da"
|
||||||
|
END
|
||||||
|
|
||||||
|
RADIOBUTTON F_FROMTYPE 60
|
||||||
|
BEGIN
|
||||||
|
PROMPT 13 2 ""
|
||||||
|
ITEMS "C|Archivi Comuni"
|
||||||
|
MESSAGE CLEAR,F_FROMFIRM|CLEAR,F_DFROMFIRM
|
||||||
|
ITEMS "D|Archivi Ditta"
|
||||||
|
MESSAGE ENABLE,F_FROMFIRM|ENABLE,F_DFROMFIRM
|
||||||
|
FLAGS "Z"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_FROMFIRM 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 4 5 "Ditta "
|
||||||
|
FLAGS "R"
|
||||||
|
USE LF_NDITTE KEY 1
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
INPUT CODDITTA F_FROMFIRM
|
||||||
|
DISPLAY "Codice" CODDITTA
|
||||||
|
DISPLAY "Ragione sociale @50" RAGSOC
|
||||||
|
OUTPUT F_FROMFIRM CODDITTA
|
||||||
|
OUTPUT F_DFROMFIRM RAGSOC
|
||||||
|
HELP "Codice della ditta da cui prelevare i dati"
|
||||||
|
WARNING "Ditta assente"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DFROMFIRM 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 20 5 ""
|
||||||
|
USE LF_NDITTE KEY 2
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
INPUT RAGSOC F_DFROMFIRM
|
||||||
|
DISPLAY "Ragione sociale @50" RAGSOC
|
||||||
|
DISPLAY "Codice" CODDITTA
|
||||||
|
COPY OUTPUT F_FROMFIRM
|
||||||
|
HELP "Ragione sociale della ditta da cui prelevare i dati"
|
||||||
|
WARNING "Ditta assente"
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 76 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 7 "Copia su"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_TOFIRM 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 4 8 "Ditta "
|
||||||
|
FLAGS "FR"
|
||||||
|
COPY USE F_FROMFIRM
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
INPUT CODDITTA F_TOFIRM
|
||||||
|
DISPLAY "Codice" CODDITTA
|
||||||
|
DISPLAY "Ragione sociale @50" RAGSOC
|
||||||
|
OUTPUT F_TOFIRM CODDITTA
|
||||||
|
OUTPUT F_DTOFIRM RAGSOC
|
||||||
|
HELP "Codice della ditta su cui duplicare i dati"
|
||||||
|
WARNING "Ditta assente"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DTOFIRM 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 20 8 ""
|
||||||
|
COPY USE F_DFROMFIRM
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
INPUT RAGSOC F_DTOFIRM
|
||||||
|
COPY DISPLAY F_DFROMFIRM
|
||||||
|
COPY OUTPUT F_TOFIRM
|
||||||
|
HELP "Descrizione della ditta su cui duplicare i dati"
|
||||||
|
WARNING "Ditta assente"
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 76 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 10 "Archivi da duplicare"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PCON
|
||||||
|
BEGIN
|
||||||
|
PROMPT 4 11 "Piano dei conti"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CAUS
|
||||||
|
BEGIN
|
||||||
|
PROMPT 34 11 "Causali"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CLIFO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 54 11 "Clienti/Fornitori"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_IVD
|
||||||
|
BEGIN
|
||||||
|
PROMPT 4 12 "IV Direttiva C.E.E."
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_OK 9 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_QUIT 9 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -22 -1 ""
|
||||||
|
MESSAGE EXIT,K_QUIT
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user