Modificata gestione deleghe IVA

git-svn-id: svn://10.65.10.50/trunk@812 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-01-03 14:18:24 +00:00
parent 9c3b45cb4a
commit 9693095752
7 changed files with 305 additions and 259 deletions

View File

@ -13,9 +13,14 @@
class TStampa_deleghe_IVA : public TApplication class TStampa_deleghe_IVA : public TApplication
{ {
TLocalisamfile *_nditte, *_anag, *_comuni;
TTable* _banche;
TArray_sheet* _ditte; TArray_sheet* _ditte;
int _mese, _anno, _tipo; int _mese, _anno, _tipo;
TString16 _azienda, _dipendenza; TString16 _azienda, _dipendenza;
TFilename _profilo;
bool _stampa_distinte, _aggiorna_codici, _stampa_prova; bool _stampa_distinte, _aggiorna_codici, _stampa_prova;
protected: protected:
@ -24,7 +29,7 @@ protected:
virtual bool menu(MENU_TAG); virtual bool menu(MENU_TAG);
virtual void print(); virtual void print();
int select(); int select(bool cf);
bool print_deleghe(); bool print_deleghe();
void print_distinta(); void print_distinta();
@ -33,12 +38,22 @@ public:
}; };
bool TStampa_deleghe_IVA::create() bool TStampa_deleghe_IVA::create()
{ {
TApplication::create(); TApplication::create();
CHECK(_ditte == NULL, "Eh la vaca!");
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Deleghe da stampare" ,"@1|Cod.@5|Ragione Sociale@50|Importo@15|Azienda|Dipend."); _nditte = new TLocalisamfile(LF_NDITTE);
_anag = new TLocalisamfile(LF_ANAG);
_comuni = new TLocalisamfile(LF_COMUNI);
_banche = new TTable("%BAN");
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Deleghe da stampare",
"@1|Cod.@5|Ragione Sociale@50|Importo@15|Azienda|Dipendenza");
TConfig c(CONFIG_STUDIO, "cg");
_azienda = c.get("CodABI");
_dipendenza = c.get("CodCAB");
dispatch_e_menu(BAR_ITEM(1)); dispatch_e_menu(BAR_ITEM(1));
return TRUE; return TRUE;
} }
@ -46,17 +61,22 @@ bool TStampa_deleghe_IVA::create()
bool TStampa_deleghe_IVA::destroy() bool TStampa_deleghe_IVA::destroy()
{ {
delete _ditte; delete _ditte;
delete _nditte;
delete _anag;
delete _comuni;
delete _banche;
return TApplication::destroy(); return TApplication::destroy();
} }
int TStampa_deleghe_IVA::select() int TStampa_deleghe_IVA::select(bool cf)
{ {
{ TMask m(cf ? "cg1400b" : "cg1400a");
TMask m("cg1400a");
TConfig c(CONFIG_STUDIO, "cg"); TConfig c(CONFIG_STUDIO, "cg");
m.set(F_ABI, c.get("CodABI")); m.set(F_ABI, _azienda);
m.set(F_CAB, c.get("CodCAB")); m.set(F_CAB, _dipendenza);
if (m.run() != K_ENTER) if (m.run() != K_ENTER)
return 0; return 0;
@ -67,67 +87,72 @@ int TStampa_deleghe_IVA::select()
_anno = m.get_int(F_ANNO); _anno = m.get_int(F_ANNO);
_tipo = m.get_int(F_TIPO); _tipo = m.get_int(F_TIPO);
_stampa_prova = m.get_bool(F_PROVA); _stampa_prova = !m.get_bool(F_DEFINITIVA);
_stampa_distinte = m.get_bool(F_DISTINTA); _stampa_distinte = m.get_bool(F_DISTINTA);
_aggiorna_codici = m.get_bool(F_AGGIORNA); _aggiorna_codici = m.get_bool(F_AGGIORNA);
const TDate d(m.get(F_DATA)); if (m.get_bool(F_CONTOFIS))
printer().setdate(d); _profilo = m.get(F_PROFILO);
} else
TLocalisamfile nditte(LF_NDITTE);
TTable deleghe("%DEL");
TString16 chiave;
TToken_string d(80);
_ditte->destroy();
for (nditte.first(); !nditte.eof(); nditte.next())
{
const long dit = nditte.get_long("CODDITTA");
chiave.format("%05ld", dit);
chiave << format("%04d%02d%d", _anno, _mese, _tipo);
deleghe.put("CODTAB", chiave);
if (deleghe.read() == NOERR && deleghe.get_bool("B0") == FALSE) // Da stampare
{ {
d = " "; // Selezione _profilo = "del";
d.add(chiave.left(5)); // Codice ditta _profilo << _azienda;
d.add(nditte.get("RAGSOC")); // Ragione sociale
const real importo(deleghe.get("R0"));
d.add(importo.string(".")); // Importo
const long az = deleghe.get_long("I0");
d.add(format("%05ld", az)); // Azienda
const long di = deleghe.get_long("I1");
d.add(format("%05ld", di)); // Dipendenza
_ditte->add(d);
} }
const TDate pd(m.get(F_DATA));
printer().setdate(pd);
TLocalisamfile nditte(LF_NDITTE);
TTable deleghe("%DEL");
TString16 chiave;
TToken_string d(80);
_ditte->destroy();
for (nditte.first(); !nditte.eof(); nditte.next())
{
const long dit = nditte.get_long("CODDITTA");
chiave.format("%05ld", dit);
chiave << format("%04d%02d%d", _anno, _mese, _tipo);
deleghe.put("CODTAB", chiave);
if (deleghe.read() == NOERR && deleghe.get_bool("B0") == FALSE) // Da stampare
{
d = " "; // Selezione
d.add(chiave.left(5)); // Codice ditta
d.add(nditte.get("RAGSOC")); // Ragione sociale
const real importo(deleghe.get("R0"));
d.add(importo.string(".")); // Importo
const long az = deleghe.get_long("I0");
d.add(format("%05ld", az)); // Azienda
const long di = deleghe.get_long("I1");
d.add(format("%05ld", di)); // Dipendenza
_ditte->add(d);
}
}
if (_ditte->items() > 0)
{
const bool ok = _ditte->run() == K_ENTER;
enable_menu_item(M_FILE_PRINT, ok);
}
else
{
warning_box("Nessuna ditta ha deleghe da stampare");
disable_menu_item(M_FILE_PRINT);
return 2;
}
return 1;
} }
if (_ditte->items() > 0) bool TStampa_deleghe_IVA::menu(MENU_TAG mt)
{
const bool ok = _ditte->run() == K_ENTER;
if (ok) enable_menu_item(M_FILE_PRINT);
}
else
{
warning_box("Nessuna ditta ha deleghe da stampare");
return 2;
}
return 1;
}
bool TStampa_deleghe_IVA::menu(MENU_TAG)
{ {
int s = 0; int s = 0;
while ((s = select()) != 0) while ((s = select(mt == BAR_ITEM(2))) != 0)
if (s == 1) print(); if (s == 1) print();
return FALSE; return TRUE;
} }
void TStampa_deleghe_IVA::print() void TStampa_deleghe_IVA::print()
@ -135,8 +160,8 @@ void TStampa_deleghe_IVA::print()
print_deleghe(); print_deleghe();
if (_stampa_distinte) if (_stampa_distinte)
{ {
bool ok = yesno_box("Inserire il modulo continuo nella stampante " const bool ok = yesno_box("Inserire il modulo continuo nella stampante "
"e confermare la stampa della distinta"); "e confermare la stampa della distinta");
if (ok) print_distinta(); if (ok) print_distinta();
} }
} }
@ -149,30 +174,18 @@ void TStampa_deleghe_IVA::print_distinta()
printer().open(); printer().open();
TLocalisamfile ditte(LF_NDITTE);
TRectype& ditta = ditte.curr();
TLocalisamfile anagrafiche(LF_ANAG);
TRectype& anag = anagrafiche.curr();
TLocalisamfile comuni(LF_COMUNI);
TRectype& comune = comuni.curr();
TTable banche("%BAN");
TRectype& banca = banche.curr();
TString16 codban; TString16 codban;
if (_azienda.not_empty()) if (_azienda.not_empty())
{ {
codban = _azienda; codban << _dipendenza; codban = _azienda; codban << _dipendenza;
banca.put("CODTAB", codban); _banche->put("CODTAB", codban);
banche.read(); _banche->read();
} }
TPrintrow row; TPrintrow row;
if (atol(_azienda)) if (atol(_azienda))
row.put(banca.get("S0"), 0); row.put(_banche->get("S0"), 0);
row.put("DISTINTA DELEGHE DI VERSAMENTO", 60); row.put("DISTINTA DELEGHE DI VERSAMENTO", 60);
row.put("Data @>", 110); row.put("Data @>", 110);
row.put("Pag.@#", 124); row.put("Pag.@#", 124);
@ -180,16 +193,18 @@ void TStampa_deleghe_IVA::print_distinta()
row.reset(); row.reset();
if (atol(_dipendenza)) if (atol(_dipendenza))
row.put(banca.get("S1"), 0); row.put(_banche->get("S1"), 0);
TString t(132); TString256 t("Dichiarazione ");
t = "Dichiarazione ";
switch (_tipo) switch (_tipo)
{ {
case 2 : t << "annuale : "; break; case 2:
case 7 : t << "acconti IVA : "; break; t << "annuale : "; break;
default: t << "periodica : " << _mese << '-'; break; case 7:
} t << "acconti IVA : "; break;
default:
t << "periodica : " << _mese << '-'; break;
}
t << _anno; t << _anno;
row.put(t, 60); row.put(t, 60);
printer().setheaderline(1, row); printer().setheaderline(1, row);
@ -212,24 +227,24 @@ void TStampa_deleghe_IVA::print_distinta()
for (int i = 0; i < _ditte->items(); i++) for (int i = 0; i < _ditte->items(); i++)
if (_ditte->checked(i)) if (_ditte->checked(i))
{ {
const TString cod(_ditte->row(i).get(1)); const TString16 cod(_ditte->row(i).get(1));
ditta.put("CODDITTA", cod); _nditte->put("CODDITTA", cod);
ditte.read(); _nditte->read();
anag.put("TIPOA", ditta.get("TIPOA")); _anag->put("TIPOA", _nditte->get("TIPOA"));
anag.put("CODANAGR", ditta.get("CODANAGR")); _anag->put("CODANAGR", _nditte->get("CODANAGR"));
anagrafiche.read(); _anag->read();
comune.put("STATO", anag.get("STATORF")); _comuni->put("STATO", _anag->get("STATORF"));
comune.put("COM", anag.get("COMRF")); _comuni->put("COM", _anag->get("COMRF"));
comuni.read(); _comuni->read();
TParagraph_string dencom(comune.get("DENCOM"), 18); TParagraph_string dencom(_comuni->get("DENCOM"), 18);
row.reset(); row.reset();
row.put(ditta.get("RAGSOC"), TAB_DITTA); row.put(_nditte->get("RAGSOC"), TAB_DITTA);
row.put(dencom.get(), 52); row.put(dencom.get(), TAB_SEDE);
row.put(comune.get("PROVCOM"), TAB_PROV); row.put(_comuni->get("PROVCOM"), TAB_PROV);
TString imp(_ditte->row(i).get(3)); TString imp(_ditte->row(i).get(3));
row.put(imp, TAB_IMPORTO); row.put(imp, TAB_IMPORTO);
@ -243,7 +258,7 @@ void TStampa_deleghe_IVA::print_distinta()
while ((r = dencom.get()) != NULL) while ((r = dencom.get()) != NULL)
{ {
row.reset(); row.reset();
row.put(r, 52); row.put(r, TAB_SEDE);
printer().print(row); printer().print(row);
} }
} }
@ -262,19 +277,17 @@ bool TStampa_deleghe_IVA::print_deleghe()
bool ok = printer().open(); bool ok = printer().open();
if (!ok) return FALSE; if (!ok) return FALSE;
TFilename name; TForm f(_profilo);
name << "del" << _azienda;
TForm f(name);
for (int i = 0; ok && i < _ditte->items(); i++) for (int i = 0; ok && i < _ditte->items(); i++)
if (_ditte->checked(i)) if (_ditte->checked(i))
{ {
const TString d(_ditte->row(i).get(1)); const TString16 d(_ditte->row(i).get(1));
TRectype& delega = f.cursor()->curr(); TRectype& delega = f.cursor()->curr();
TString chiave(16); TString16 chiave;
chiave = d; chiave << format("%04d%02d%d", _anno, _mese, _tipo); chiave = d; chiave << format("%04d%02d%d", _anno, _mese, _tipo);
delega.put("CODTAB", chiave); delega.put("CODTAB", chiave);
f.cursor()->file().read(); f.cursor()->file().read();
@ -285,9 +298,9 @@ bool TStampa_deleghe_IVA::print_deleghe()
delega.put("S8", _dipendenza); delega.put("S8", _dipendenza);
f.cursor()->file().rewrite(); f.cursor()->file().rewrite();
} }
f.cursor()->read(); // Posiziona il cursore f.cursor()->read(); // Posiziona il cursore
ok = f.print(-1); // Stampa solo il record corrente ok = f.print(-1); // Stampa solo il record corrente
if (!ok) break; if (!ok) break;
bool scrivi = _aggiorna_codici && !cera; bool scrivi = _aggiorna_codici && !cera;

View File

@ -1,9 +1,19 @@
#define F_ABI 101 #define F_ABI 101
#define F_CAB 102 #define F_CAB 102
#define F_DATA 103 #define F_DESC_BAN 103
#define F_TIPO 104 #define F_DATA 104
#define F_ANNO 105 #define F_TIPO 105
#define F_MESE 106 #define F_ANNO 106
#define F_AGGIORNA 107 #define F_MESE 107
#define F_DISTINTA 108 #define F_AGGIORNA 108
#define F_PROVA 109 #define F_DISTINTA 109
#define F_DEFINITIVA 110
#define F_CONCESSIONE 120
#define F_DESC_CONC 121
#define F_SOLO_ABI 122
#define F_SOLO_CAB 123
#define F_DESC_SOLO_BAN 125
#define F_CONTOFIS 126
#define F_PROFILO 127

View File

@ -5,8 +5,8 @@ PAGE "STAMPA DELEGHE IVA" -1 -1 58 11
NUMBER F_ABI 5 NUMBER F_ABI 5
BEGIN BEGIN
PROMPT 1 1 "Codice ABI " PROMPT 1 1 "Codice ABI "
HELP "Codice ABI della banca per la presentazione della delega" HELP "Codice ABI della banca per la presentazione delle deleghe"
FLAGS "RZ" FLAGS "Z"
FIELD CNF_STUDIO->cg.CodABI FIELD CNF_STUDIO->cg.CodABI
USE %BAN USE %BAN
INPUT CODTAB[1,5] F_ABI INPUT CODTAB[1,5] F_ABI
@ -14,16 +14,16 @@ BEGIN
DISPLAY "Azienda" CODTAB[1,5] DISPLAY "Azienda" CODTAB[1,5]
DISPLAY "Dipendenza" CODTAB[6,10] DISPLAY "Dipendenza" CODTAB[6,10]
DISPLAY "Nome@50" S0 DISPLAY "Nome@50" S0
DISPLAY "Filiale@50" S1
OUTPUT F_ABI CODTAB[1,5] OUTPUT F_ABI CODTAB[1,5]
OUTPUT F_CAB CODTAB[6,10] OUTPUT F_CAB CODTAB[6,10]
CHECKTYPE NORMAL
END END
NUMBER F_CAB 5 NUMBER F_CAB 5
BEGIN BEGIN
PROMPT 22 1 "Codice CAB " PROMPT 22 1 "Codice CAB "
HELP "Codice CAB della banca per la presentazione della delega" HELP "Codice CAB della banca per la presentazione della delega"
FLAGS "RZ" FLAGS "Z"
FIELD CNF_STUDIO->cg.CodCAB FIELD CNF_STUDIO->cg.CodCAB
COPY USE F_ABI COPY USE F_ABI
INPUT CODTAB[1,5] F_ABI INPUT CODTAB[1,5] F_ABI
@ -34,19 +34,20 @@ BEGIN
DISPLAY "Filiale@50" S1 DISPLAY "Filiale@50" S1
OUTPUT F_ABI CODTAB[1,5] OUTPUT F_ABI CODTAB[1,5]
OUTPUT F_CAB CODTAB[6,10] OUTPUT F_CAB CODTAB[6,10]
CHECKTYPE NORMAL
END END
DATA F_DATA DATA F_DATA
BEGIN BEGIN
PROMPT 1 3 "Data di stampa " PROMPT 1 3 "Data di stampa "
HELP "Data che viene stampata sulla delega" HELP "Data che viene stampata sulla delega"
FLAGS "A" FLAGS "A"
END END
LIST F_TIPO 21 LIST F_TIPO 21
BEGIN BEGIN
PROMPT 28 3 "Tipo " PROMPT 28 3 "Tipo "
HELP "Tipo di delega da stampare" HELP "Tipo di delega da stampare"
ITEM "1|Periodica" MESSAGE ENABLE,F_MESE ITEM "1|Periodica" MESSAGE ENABLE,F_MESE
ITEM "2|Annuale" MESSAGE "13",F_MESE|DISABLE,F_MESE ITEM "2|Annuale" MESSAGE "13",F_MESE|DISABLE,F_MESE
ITEM "7|Acconti IVA" MESSAGE "12",F_MESE|DISABLE,F_MESE ITEM "7|Acconti IVA" MESSAGE "12",F_MESE|DISABLE,F_MESE
@ -55,22 +56,21 @@ END
NUMBER F_ANNO 4 NUMBER F_ANNO 4
BEGIN BEGIN
PROMPT 1 5 "Anno " PROMPT 1 5 "Anno "
HELP "Anno di cui si vuole stampare la delega" HELP "Anno di cui si vuole stampare la delega"
FLAGS "A" FLAGS "A"
END END
LIST F_MESE 10 LIST F_MESE 10
BEGIN BEGIN
PROMPT 13 5 "Mese " PROMPT 13 5 "Mese "
HELP "Mese di cui si vuole stampare la delega" HELP "Mese di cui si vuole stampare la delega"
FLAGS "MA" FLAGS "MA"
ITEM "13|Annuale" MESSAGE "2",F_TIPO ITEM "13|Annuale" MESSAGE "2",F_TIPO
END END
BOOLEAN F_PROVA BOOLEAN F_DEFINITIVA
BEGIN BEGIN
PROMPT 1 7 "Stampa di prova" PROMPT 1 7 "Stampa definitiva"
HELP "Indicare se si tratta di una stampa di controllo"
END END
BOOLEAN F_AGGIORNA BOOLEAN F_AGGIORNA
@ -88,7 +88,7 @@ END
BUTTON DLG_SELECT 9 2 BUTTON DLG_SELECT 9 2
BEGIN BEGIN
PROMPT 45 6 "Selezione" PROMPT 45 6 "Selezione"
HELP "Permette di selezionare le ditte di cui stampare le deleghe" HELP "Selezione delle ditte di cui stampare le deleghe"
MESSAGE EXIT,K_ENTER MESSAGE EXIT,K_ENTER
END END

View File

@ -723,7 +723,7 @@ bool TCaus_app::fill_sheet(TMask& m)
const int m770 = m.get_int(F_M_770); const int m770 = m.get_int(F_M_770);
int tpr = m.get_int(F_TIPO_REG); int tpr = m.get_int(F_TIPO_REG);
if (!m.running()) if (!m.is_running())
{ {
TString16 chiave; chiave << anno_iva() << codreg; TString16 chiave; chiave << anno_iva() << codreg;
TTable reg("REG"); TTable reg("REG");

View File

@ -13,9 +13,14 @@
class TStampa_deleghe_IVA : public TApplication class TStampa_deleghe_IVA : public TApplication
{ {
TLocalisamfile *_nditte, *_anag, *_comuni;
TTable* _banche;
TArray_sheet* _ditte; TArray_sheet* _ditte;
int _mese, _anno, _tipo; int _mese, _anno, _tipo;
TString16 _azienda, _dipendenza; TString16 _azienda, _dipendenza;
TFilename _profilo;
bool _stampa_distinte, _aggiorna_codici, _stampa_prova; bool _stampa_distinte, _aggiorna_codici, _stampa_prova;
protected: protected:
@ -24,7 +29,7 @@ protected:
virtual bool menu(MENU_TAG); virtual bool menu(MENU_TAG);
virtual void print(); virtual void print();
int select(); int select(bool cf);
bool print_deleghe(); bool print_deleghe();
void print_distinta(); void print_distinta();
@ -33,12 +38,22 @@ public:
}; };
bool TStampa_deleghe_IVA::create() bool TStampa_deleghe_IVA::create()
{ {
TApplication::create(); TApplication::create();
CHECK(_ditte == NULL, "Eh la vaca!");
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Deleghe da stampare" ,"@1|Cod.@5|Ragione Sociale@50|Importo@15|Azienda|Dipend."); _nditte = new TLocalisamfile(LF_NDITTE);
_anag = new TLocalisamfile(LF_ANAG);
_comuni = new TLocalisamfile(LF_COMUNI);
_banche = new TTable("%BAN");
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Deleghe da stampare",
"@1|Cod.@5|Ragione Sociale@50|Importo@15|Azienda|Dipendenza");
TConfig c(CONFIG_STUDIO, "cg");
_azienda = c.get("CodABI");
_dipendenza = c.get("CodCAB");
dispatch_e_menu(BAR_ITEM(1)); dispatch_e_menu(BAR_ITEM(1));
return TRUE; return TRUE;
} }
@ -46,17 +61,22 @@ bool TStampa_deleghe_IVA::create()
bool TStampa_deleghe_IVA::destroy() bool TStampa_deleghe_IVA::destroy()
{ {
delete _ditte; delete _ditte;
delete _nditte;
delete _anag;
delete _comuni;
delete _banche;
return TApplication::destroy(); return TApplication::destroy();
} }
int TStampa_deleghe_IVA::select() int TStampa_deleghe_IVA::select(bool cf)
{ {
{ TMask m(cf ? "cg1400b" : "cg1400a");
TMask m("cg1400a");
TConfig c(CONFIG_STUDIO, "cg"); TConfig c(CONFIG_STUDIO, "cg");
m.set(F_ABI, c.get("CodABI")); m.set(F_ABI, _azienda);
m.set(F_CAB, c.get("CodCAB")); m.set(F_CAB, _dipendenza);
if (m.run() != K_ENTER) if (m.run() != K_ENTER)
return 0; return 0;
@ -67,67 +87,72 @@ int TStampa_deleghe_IVA::select()
_anno = m.get_int(F_ANNO); _anno = m.get_int(F_ANNO);
_tipo = m.get_int(F_TIPO); _tipo = m.get_int(F_TIPO);
_stampa_prova = m.get_bool(F_PROVA); _stampa_prova = !m.get_bool(F_DEFINITIVA);
_stampa_distinte = m.get_bool(F_DISTINTA); _stampa_distinte = m.get_bool(F_DISTINTA);
_aggiorna_codici = m.get_bool(F_AGGIORNA); _aggiorna_codici = m.get_bool(F_AGGIORNA);
const TDate d(m.get(F_DATA)); if (m.get_bool(F_CONTOFIS))
printer().setdate(d); _profilo = m.get(F_PROFILO);
} else
TLocalisamfile nditte(LF_NDITTE);
TTable deleghe("%DEL");
TString16 chiave;
TToken_string d(80);
_ditte->destroy();
for (nditte.first(); !nditte.eof(); nditte.next())
{
const long dit = nditte.get_long("CODDITTA");
chiave.format("%05ld", dit);
chiave << format("%04d%02d%d", _anno, _mese, _tipo);
deleghe.put("CODTAB", chiave);
if (deleghe.read() == NOERR && deleghe.get_bool("B0") == FALSE) // Da stampare
{ {
d = " "; // Selezione _profilo = "del";
d.add(chiave.left(5)); // Codice ditta _profilo << _azienda;
d.add(nditte.get("RAGSOC")); // Ragione sociale
const real importo(deleghe.get("R0"));
d.add(importo.string(".")); // Importo
const long az = deleghe.get_long("I0");
d.add(format("%05ld", az)); // Azienda
const long di = deleghe.get_long("I1");
d.add(format("%05ld", di)); // Dipendenza
_ditte->add(d);
} }
const TDate pd(m.get(F_DATA));
printer().setdate(pd);
TLocalisamfile nditte(LF_NDITTE);
TTable deleghe("%DEL");
TString16 chiave;
TToken_string d(80);
_ditte->destroy();
for (nditte.first(); !nditte.eof(); nditte.next())
{
const long dit = nditte.get_long("CODDITTA");
chiave.format("%05ld", dit);
chiave << format("%04d%02d%d", _anno, _mese, _tipo);
deleghe.put("CODTAB", chiave);
if (deleghe.read() == NOERR && deleghe.get_bool("B0") == FALSE) // Da stampare
{
d = " "; // Selezione
d.add(chiave.left(5)); // Codice ditta
d.add(nditte.get("RAGSOC")); // Ragione sociale
const real importo(deleghe.get("R0"));
d.add(importo.string(".")); // Importo
const long az = deleghe.get_long("I0");
d.add(format("%05ld", az)); // Azienda
const long di = deleghe.get_long("I1");
d.add(format("%05ld", di)); // Dipendenza
_ditte->add(d);
}
}
if (_ditte->items() > 0)
{
const bool ok = _ditte->run() == K_ENTER;
enable_menu_item(M_FILE_PRINT, ok);
}
else
{
warning_box("Nessuna ditta ha deleghe da stampare");
disable_menu_item(M_FILE_PRINT);
return 2;
}
return 1;
} }
if (_ditte->items() > 0) bool TStampa_deleghe_IVA::menu(MENU_TAG mt)
{
const bool ok = _ditte->run() == K_ENTER;
if (ok) enable_menu_item(M_FILE_PRINT);
}
else
{
warning_box("Nessuna ditta ha deleghe da stampare");
return 2;
}
return 1;
}
bool TStampa_deleghe_IVA::menu(MENU_TAG)
{ {
int s = 0; int s = 0;
while ((s = select()) != 0) while ((s = select(mt == BAR_ITEM(2))) != 0)
if (s == 1) print(); if (s == 1) print();
return FALSE; return TRUE;
} }
void TStampa_deleghe_IVA::print() void TStampa_deleghe_IVA::print()
@ -135,8 +160,8 @@ void TStampa_deleghe_IVA::print()
print_deleghe(); print_deleghe();
if (_stampa_distinte) if (_stampa_distinte)
{ {
bool ok = yesno_box("Inserire il modulo continuo nella stampante " const bool ok = yesno_box("Inserire il modulo continuo nella stampante "
"e confermare la stampa della distinta"); "e confermare la stampa della distinta");
if (ok) print_distinta(); if (ok) print_distinta();
} }
} }
@ -149,30 +174,18 @@ void TStampa_deleghe_IVA::print_distinta()
printer().open(); printer().open();
TLocalisamfile ditte(LF_NDITTE);
TRectype& ditta = ditte.curr();
TLocalisamfile anagrafiche(LF_ANAG);
TRectype& anag = anagrafiche.curr();
TLocalisamfile comuni(LF_COMUNI);
TRectype& comune = comuni.curr();
TTable banche("%BAN");
TRectype& banca = banche.curr();
TString16 codban; TString16 codban;
if (_azienda.not_empty()) if (_azienda.not_empty())
{ {
codban = _azienda; codban << _dipendenza; codban = _azienda; codban << _dipendenza;
banca.put("CODTAB", codban); _banche->put("CODTAB", codban);
banche.read(); _banche->read();
} }
TPrintrow row; TPrintrow row;
if (atol(_azienda)) if (atol(_azienda))
row.put(banca.get("S0"), 0); row.put(_banche->get("S0"), 0);
row.put("DISTINTA DELEGHE DI VERSAMENTO", 60); row.put("DISTINTA DELEGHE DI VERSAMENTO", 60);
row.put("Data @>", 110); row.put("Data @>", 110);
row.put("Pag.@#", 124); row.put("Pag.@#", 124);
@ -180,16 +193,18 @@ void TStampa_deleghe_IVA::print_distinta()
row.reset(); row.reset();
if (atol(_dipendenza)) if (atol(_dipendenza))
row.put(banca.get("S1"), 0); row.put(_banche->get("S1"), 0);
TString t(132); TString256 t("Dichiarazione ");
t = "Dichiarazione ";
switch (_tipo) switch (_tipo)
{ {
case 2 : t << "annuale : "; break; case 2:
case 7 : t << "acconti IVA : "; break; t << "annuale : "; break;
default: t << "periodica : " << _mese << '-'; break; case 7:
} t << "acconti IVA : "; break;
default:
t << "periodica : " << _mese << '-'; break;
}
t << _anno; t << _anno;
row.put(t, 60); row.put(t, 60);
printer().setheaderline(1, row); printer().setheaderline(1, row);
@ -212,24 +227,24 @@ void TStampa_deleghe_IVA::print_distinta()
for (int i = 0; i < _ditte->items(); i++) for (int i = 0; i < _ditte->items(); i++)
if (_ditte->checked(i)) if (_ditte->checked(i))
{ {
const TString cod(_ditte->row(i).get(1)); const TString16 cod(_ditte->row(i).get(1));
ditta.put("CODDITTA", cod); _nditte->put("CODDITTA", cod);
ditte.read(); _nditte->read();
anag.put("TIPOA", ditta.get("TIPOA")); _anag->put("TIPOA", _nditte->get("TIPOA"));
anag.put("CODANAGR", ditta.get("CODANAGR")); _anag->put("CODANAGR", _nditte->get("CODANAGR"));
anagrafiche.read(); _anag->read();
comune.put("STATO", anag.get("STATORF")); _comuni->put("STATO", _anag->get("STATORF"));
comune.put("COM", anag.get("COMRF")); _comuni->put("COM", _anag->get("COMRF"));
comuni.read(); _comuni->read();
TParagraph_string dencom(comune.get("DENCOM"), 18); TParagraph_string dencom(_comuni->get("DENCOM"), 18);
row.reset(); row.reset();
row.put(ditta.get("RAGSOC"), TAB_DITTA); row.put(_nditte->get("RAGSOC"), TAB_DITTA);
row.put(dencom.get(), 52); row.put(dencom.get(), TAB_SEDE);
row.put(comune.get("PROVCOM"), TAB_PROV); row.put(_comuni->get("PROVCOM"), TAB_PROV);
TString imp(_ditte->row(i).get(3)); TString imp(_ditte->row(i).get(3));
row.put(imp, TAB_IMPORTO); row.put(imp, TAB_IMPORTO);
@ -243,7 +258,7 @@ void TStampa_deleghe_IVA::print_distinta()
while ((r = dencom.get()) != NULL) while ((r = dencom.get()) != NULL)
{ {
row.reset(); row.reset();
row.put(r, 52); row.put(r, TAB_SEDE);
printer().print(row); printer().print(row);
} }
} }
@ -262,19 +277,17 @@ bool TStampa_deleghe_IVA::print_deleghe()
bool ok = printer().open(); bool ok = printer().open();
if (!ok) return FALSE; if (!ok) return FALSE;
TFilename name; TForm f(_profilo);
name << "del" << _azienda;
TForm f(name);
for (int i = 0; ok && i < _ditte->items(); i++) for (int i = 0; ok && i < _ditte->items(); i++)
if (_ditte->checked(i)) if (_ditte->checked(i))
{ {
const TString d(_ditte->row(i).get(1)); const TString16 d(_ditte->row(i).get(1));
TRectype& delega = f.cursor()->curr(); TRectype& delega = f.cursor()->curr();
TString chiave(16); TString16 chiave;
chiave = d; chiave << format("%04d%02d%d", _anno, _mese, _tipo); chiave = d; chiave << format("%04d%02d%d", _anno, _mese, _tipo);
delega.put("CODTAB", chiave); delega.put("CODTAB", chiave);
f.cursor()->file().read(); f.cursor()->file().read();
@ -285,9 +298,9 @@ bool TStampa_deleghe_IVA::print_deleghe()
delega.put("S8", _dipendenza); delega.put("S8", _dipendenza);
f.cursor()->file().rewrite(); f.cursor()->file().rewrite();
} }
f.cursor()->read(); // Posiziona il cursore f.cursor()->read(); // Posiziona il cursore
ok = f.print(-1); // Stampa solo il record corrente ok = f.print(-1); // Stampa solo il record corrente
if (!ok) break; if (!ok) break;
bool scrivi = _aggiorna_codici && !cera; bool scrivi = _aggiorna_codici && !cera;

View File

@ -1,9 +1,19 @@
#define F_ABI 101 #define F_ABI 101
#define F_CAB 102 #define F_CAB 102
#define F_DATA 103 #define F_DESC_BAN 103
#define F_TIPO 104 #define F_DATA 104
#define F_ANNO 105 #define F_TIPO 105
#define F_MESE 106 #define F_ANNO 106
#define F_AGGIORNA 107 #define F_MESE 107
#define F_DISTINTA 108 #define F_AGGIORNA 108
#define F_PROVA 109 #define F_DISTINTA 109
#define F_DEFINITIVA 110
#define F_CONCESSIONE 120
#define F_DESC_CONC 121
#define F_SOLO_ABI 122
#define F_SOLO_CAB 123
#define F_DESC_SOLO_BAN 125
#define F_CONTOFIS 126
#define F_PROFILO 127

View File

@ -5,8 +5,8 @@ PAGE "STAMPA DELEGHE IVA" -1 -1 58 11
NUMBER F_ABI 5 NUMBER F_ABI 5
BEGIN BEGIN
PROMPT 1 1 "Codice ABI " PROMPT 1 1 "Codice ABI "
HELP "Codice ABI della banca per la presentazione della delega" HELP "Codice ABI della banca per la presentazione delle deleghe"
FLAGS "RZ" FLAGS "Z"
FIELD CNF_STUDIO->cg.CodABI FIELD CNF_STUDIO->cg.CodABI
USE %BAN USE %BAN
INPUT CODTAB[1,5] F_ABI INPUT CODTAB[1,5] F_ABI
@ -14,16 +14,16 @@ BEGIN
DISPLAY "Azienda" CODTAB[1,5] DISPLAY "Azienda" CODTAB[1,5]
DISPLAY "Dipendenza" CODTAB[6,10] DISPLAY "Dipendenza" CODTAB[6,10]
DISPLAY "Nome@50" S0 DISPLAY "Nome@50" S0
DISPLAY "Filiale@50" S1
OUTPUT F_ABI CODTAB[1,5] OUTPUT F_ABI CODTAB[1,5]
OUTPUT F_CAB CODTAB[6,10] OUTPUT F_CAB CODTAB[6,10]
CHECKTYPE NORMAL
END END
NUMBER F_CAB 5 NUMBER F_CAB 5
BEGIN BEGIN
PROMPT 22 1 "Codice CAB " PROMPT 22 1 "Codice CAB "
HELP "Codice CAB della banca per la presentazione della delega" HELP "Codice CAB della banca per la presentazione della delega"
FLAGS "RZ" FLAGS "Z"
FIELD CNF_STUDIO->cg.CodCAB FIELD CNF_STUDIO->cg.CodCAB
COPY USE F_ABI COPY USE F_ABI
INPUT CODTAB[1,5] F_ABI INPUT CODTAB[1,5] F_ABI
@ -34,19 +34,20 @@ BEGIN
DISPLAY "Filiale@50" S1 DISPLAY "Filiale@50" S1
OUTPUT F_ABI CODTAB[1,5] OUTPUT F_ABI CODTAB[1,5]
OUTPUT F_CAB CODTAB[6,10] OUTPUT F_CAB CODTAB[6,10]
CHECKTYPE NORMAL
END END
DATA F_DATA DATA F_DATA
BEGIN BEGIN
PROMPT 1 3 "Data di stampa " PROMPT 1 3 "Data di stampa "
HELP "Data che viene stampata sulla delega" HELP "Data che viene stampata sulla delega"
FLAGS "A" FLAGS "A"
END END
LIST F_TIPO 21 LIST F_TIPO 21
BEGIN BEGIN
PROMPT 28 3 "Tipo " PROMPT 28 3 "Tipo "
HELP "Tipo di delega da stampare" HELP "Tipo di delega da stampare"
ITEM "1|Periodica" MESSAGE ENABLE,F_MESE ITEM "1|Periodica" MESSAGE ENABLE,F_MESE
ITEM "2|Annuale" MESSAGE "13",F_MESE|DISABLE,F_MESE ITEM "2|Annuale" MESSAGE "13",F_MESE|DISABLE,F_MESE
ITEM "7|Acconti IVA" MESSAGE "12",F_MESE|DISABLE,F_MESE ITEM "7|Acconti IVA" MESSAGE "12",F_MESE|DISABLE,F_MESE
@ -55,22 +56,21 @@ END
NUMBER F_ANNO 4 NUMBER F_ANNO 4
BEGIN BEGIN
PROMPT 1 5 "Anno " PROMPT 1 5 "Anno "
HELP "Anno di cui si vuole stampare la delega" HELP "Anno di cui si vuole stampare la delega"
FLAGS "A" FLAGS "A"
END END
LIST F_MESE 10 LIST F_MESE 10
BEGIN BEGIN
PROMPT 13 5 "Mese " PROMPT 13 5 "Mese "
HELP "Mese di cui si vuole stampare la delega" HELP "Mese di cui si vuole stampare la delega"
FLAGS "MA" FLAGS "MA"
ITEM "13|Annuale" MESSAGE "2",F_TIPO ITEM "13|Annuale" MESSAGE "2",F_TIPO
END END
BOOLEAN F_PROVA BOOLEAN F_DEFINITIVA
BEGIN BEGIN
PROMPT 1 7 "Stampa di prova" PROMPT 1 7 "Stampa definitiva"
HELP "Indicare se si tratta di una stampa di controllo"
END END
BOOLEAN F_AGGIORNA BOOLEAN F_AGGIORNA
@ -88,7 +88,7 @@ END
BUTTON DLG_SELECT 9 2 BUTTON DLG_SELECT 9 2
BEGIN BEGIN
PROMPT 45 6 "Selezione" PROMPT 45 6 "Selezione"
HELP "Permette di selezionare le ditte di cui stampare le deleghe" HELP "Selezione delle ditte di cui stampare le deleghe"
MESSAGE EXIT,K_ENTER MESSAGE EXIT,K_ENTER
END END