Corretto errore n. 1191 sulla stampa conti

Corretti errori n. MI2014 MI2015 MI2016 MI2020 MI2021 sulla stampa registri


git-svn-id: svn://10.65.10.50/trunk@476 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1994-10-28 11:33:56 +00:00
parent 86f781e5e8
commit 5e41aa2169
6 changed files with 1070 additions and 396 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,8 @@
#define F_DATA_STAMPA 100 #define F_DATA_STAMPA 100
#define F_SCELTA_STAMPA 101 #define F_SCELTA_STAMPA 101
#define F_SALTO_PAGINA 102 #define F_SALTO_PAGINA 102
#define F_CODDITTA 103
#define F_RAGSOC 104
#endif #endif

View File

@ -1,27 +1,47 @@
#include "cg1100.h" #include "cg1100.h"
PAGE "" -1 -1 49 12 PAGE "" -1 -1 70 18
NUMBER F_CODDITTA 5
BEGIN
PROMPT 2 1 "Ditta "
FLAGS "FRD"
USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA
DISPLAY "Ragione sociale @50" RAGSOC
OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
END
STRING F_RAGSOC 50
BEGIN
PROMPT 2 2 "Ragione sociale "
FLAGS "D"
END
DATE F_DATA_STAMPA DATE F_DATA_STAMPA
BEGIN BEGIN
PROMPT 2 1 "Data di stampa " PROMPT 2 4 "Data di stampa "
FLAGS "A" FLAGS "A"
END END
RADIOBUTTON F_SCELTA_STAMPA 42 RADIOBUTTON F_SCELTA_STAMPA 47
BEGIN BEGIN
PROMPT 2 2 "Tipo di stampa " PROMPT 2 6 "Tipo di stampa "
HELP "Scegliere il tipo di stampa desiderata" HELP "Scegliere il tipo di stampa desiderata"
ITEM "1|Completa" ITEM "1|Completa per IV direttiva"
ITEM "2|Conti riclassificati per IV direttiva" ITEM "2|Conti riclassificati per IV direttiva"
ITEM "3|Conti non collegati IV direttiva" ITEM "3|Conti non collegati per IV direttiva"
ITEM "4|Conti collegati analisi di bilancio" ITEM "4|Completa per analisi di bilancio"
ITEM "5|Conti non collegati analisi di bilancio" ITEM "5|Conti riclassificati per analisi di bilancio"
ITEM "6|Conti non collegati per analisi di bilancio"
END END
BOOLEAN F_SALTO_PAGINA BOOLEAN F_SALTO_PAGINA
BEGIN BEGIN
PROMPT 3 9 "Salto pagina per cambio gruppo " PROMPT 3 14 "Salto pagina per cambio gruppo "
HELP "Indicare se si desidera un salto pagina ogni volta che cambia il gruppo" HELP "Indicare se si desidera un salto pagina ogni volta che cambia il gruppo"
END END

View File

@ -134,8 +134,7 @@ bool CG4400_application::mask_cod (TMask_field& f, KEY k)
TString codtab; TString codtab;
int anno; int anno;
//if ( (k == K_TAB) && f.mask().is_running() ) if (k == K_TAB || f.focusdirty())
if (k == K_SPACE || k == K_TAB)
{ {
TString codlib = f.mask().get(CODICE_LIB_UN); TString codlib = f.mask().get(CODICE_LIB_UN);
anno = f.mask().get_int(ANNO); anno = f.mask().get_int(ANNO);
@ -170,6 +169,18 @@ bool CG4400_application::mask_data (TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
bool CG4400_application::mask_tipo (TMask_field& f, KEY k)
{
if (k == K_TAB)
{
TDate data(f.get());
if (data.ok())
if ( data.day() == 31 && data.month() == 12 )
f.mask().show (TIPO_RIEPILOGATIVO);
}
return TRUE;
}
/* /*
bool mask_fino_a_mese (TMask_field& f, KEY k) bool mask_fino_a_mese (TMask_field& f, KEY k)
{ {
@ -385,17 +396,18 @@ void CG4400_application::user_create()
_tab = new TLocalisamfile(LF_TAB); _tab = new TLocalisamfile(LF_TAB);
_tabcom = new TLocalisamfile(LF_TABCOM); _tabcom = new TLocalisamfile(LF_TABCOM);
_tabreg = new TTable("REG"); _tabreg = new TTable("REG");
_tabiva = new TTable("%IVA");
_tablbu = new TTable("%LBU"); _tablbu = new TTable("%LBU");
_tabinl = new TTable("%INL"); _tabinl = new TTable("%INL");
_tablim = new TTable("LIM"); _tablim = new TTable("LIM");
_tabpim = new TTable("PIM"); _tabpim = new TTable("PIM");
_tablia = new TTable("LIA");
_clifo = new TLocalisamfile(LF_CLIFO); _clifo = new TLocalisamfile(LF_CLIFO);
_occas = new TLocalisamfile(LF_OCCAS); _occas = new TLocalisamfile(LF_OCCAS);
_rel = new TRelation (LF_MOV); _rel = new TRelation (LF_MOV);
_rel->add(LF_CAUSALI,"CODCAUS=CODCAUS",1,LF_MOV); _rel->add(LF_CAUSALI,"CODCAUS=CODCAUS",1,LF_MOV);
_rel->add(LF_RMOVIVA,"NUMREG=NUMREG",1,LF_MOV); _rel->add(LF_RMOVIVA,"NUMREG=NUMREG",1,LF_MOV);
_cur = new TCursor(_rel, "", 1); _cur = new TCursor(_rel, "", 1);
//_cur->set_filterfunction(filter_func);
add_cursor(_cur); add_cursor(_cur);
add_file(LF_MOV); add_file(LF_MOV);
@ -472,20 +484,20 @@ int CG4400_application::riga_rmoviva()
codiva = iva.get(RMI_CODIVA); codiva = iva.get(RMI_CODIVA);
impop = imposp = 0.00; impop = imposp = 0.00;
_riga_rmi.add_riga(impo,impos,codiva,tipodet,impop,imposp); _riga_rmi.add_riga(impo,impos,codiva,tipodet,tipocr,impop,imposp);
if (_tipo_reg == 2) //registro acquisti if (_tipo_reg == 2) //registro acquisti
{ {
if (_tipo_stampa != 3) //stampa definitiva if (_tipo_stampa != 3) //stampa definitiva
calcola_progressivi(impop,imposp,codiva,tipocr); calcola_progressivi(impop,imposp,codiva,tipocr);
_iva_array.add_riga(impo,impos,codiva,tipodet,impop,imposp); _iva_array.add_riga(impo,impos,codiva,tipodet,tipocr,impop,imposp);
} }
impop = imposp = 0.00; impop = imposp = 0.00;
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
calcola_progressivi(impop,imposp,codiva,tipocr); calcola_progressivi(impop,imposp,codiva,tipocr);
_tot_iva_array.add_riga(impo,impos,codiva,impop,imposp); _tot_iva_array.add_riga(impo,impos,codiva,_tipodoc,impop,imposp);
ok = _cur->next_match(LF_RMOVIVA); ok = _cur->next_match(LF_RMOVIVA);
} }
@ -520,19 +532,28 @@ bool CG4400_application::controlla_liquidazione()
{ {
TTable lim ("LIM"); TTable lim ("LIM");
TTable pim ("PIM"); TTable pim ("PIM");
TString16 mesi_ric = ""; TTable lia ("LIA");
TString16 mesi_cal = ""; TString mesi_ric = "";
TString mesi_cal = "";
TString16 chiave = ""; TString16 chiave = "";
TString16 ditta = "";
int i; int i;
ditta << get_firm();
if (lim.empty()) if (lim.empty())
return yesno_box("Non esiste la tabella liquidazione iva mensile! Vuoi ugualmente continuare la stampa?"); return yesno_box("Ditta %s : non esiste la tabella liquidazione iva mensile! Vuoi ugualmente continuare la stampa?", (const char*) ditta);
if (pim.empty()) if (pim.empty())
return yesno_box("Non esiste la tabella progressivi iva mensile! Vuoi ugualmente continuare la stampa?"); return yesno_box("Ditta %s : non esiste la tabella progressivi iva mensile! Vuoi ugualmente continuare la stampa?", (const char*) ditta);
chiave << _annoes;
lia.put("CODTAB", chiave);
if (lia.read() == NOERR)
_frequiva = lia.get("S7")[0];
if (_frequiva == 'T') //nella tabella LIM ho solo i mesi 3, 6, 9, 12 if (_frequiva == 'T') //nella tabella LIM ho solo i mesi 3, 6, 9, 12
{ {
for (i=3; i<=_fino_a_mese+3; i+=3) for (i=3; i<=_fino_a_mese; i+=3)
{ {
chiave = ""; chiave = "";
chiave << _annoes << i; chiave << _annoes << i;
@ -543,41 +564,41 @@ bool CG4400_application::controlla_liquidazione()
if (!calcolato) if (!calcolato)
// return yesno_box("La liquidazione relativa al mese di %s deve essere ricalcolata. Vuoi ugualmente continuare la stampa?", itom(i) ); // return yesno_box("La liquidazione relativa al mese di %s deve essere ricalcolata. Vuoi ugualmente continuare la stampa?", itom(i) );
mesi_ric << itom(i) << "\n\r"; mesi_ric << itom(i) << "\n";
} }
else else
// return yesno_box("La liquidazione relativa al mese di %s non e' stata calcolata. Vuoi ugualmente continuare la stampa?", itom(i) ); // return yesno_box("La liquidazione relativa al mese di %s non e' stata calcolata. Vuoi ugualmente continuare la stampa?", itom(i) );
mesi_cal << itom(i) << "\n\r"; mesi_cal << itom(i) << "\n";
} }
} }
if (_frequiva == 'M') if (_frequiva == 'M')
{ {
for (i=1; i<=_fino_a_mese; i++); for (i=1 ; i<=_fino_a_mese; i++)
{
chiave = "";
chiave << _annoes << i;
lim.put("CODTAB", chiave);
if (lim.read() == NOERR)
{ {
bool calcolato = lim.get_bool("B0"); chiave = "";
if (!calcolato) chiave << _annoes << i;
// return yesno_box("La liquidazione relativa al mese di %s deve essere ricalcolata. Vuoi ugualmente continuare la stampa?", itom(i) ); lim.put("CODTAB", chiave);
mesi_ric << itom(i) << "\n\r"; if (lim.read() == NOERR)
{
bool calcolato = lim.get_bool("B0");
if (!calcolato)
// return yesno_box("La liquidazione relativa al mese di %s deve essere ricalcolata. Vuoi ugualmente continuare la stampa?", itom(i) );
mesi_ric << itom(i) << "\n";
}
else
// return yesno_box("La liquidazione relativa al mese di %s non e' stata calcolata. Vuoi ugualmente continuare la stampa?", itom(i) );
mesi_cal << itom(i) << "\n";
} }
else
// return yesno_box("La liquidazione relativa al mese di %s non e' stata calcolata. Vuoi ugualmente continuare la stampa?", itom(i) );
mesi_cal << itom(i) << "\n\r";
}
}
if (mesi_ric.not_empty())
{
warning_box ("Deve essere ricalcolata la liquidazione relativa ai mesi di:\n %s ", (const char *)mesi_ric);
return yesno_box("Vuoi ugualmente continuare la stampa?");
} }
if (mesi_ric.not_empty())
{
warning_box ("Ditta %s : deve essere ricalcolata la liquidazione relativa ai mesi di:\n %s ", (const char*)ditta, (const char *)mesi_ric);
return yesno_box("Vuoi ugualmente continuare la stampa?");
}
if (mesi_cal.not_empty()) if (mesi_cal.not_empty())
{ {
warning_box ("La liquidazione relativa al mese di %s non e' stata calcolata", (const char *)mesi_cal); warning_box ("Ditta %s : la liquidazione relativa ai mesi di \n %s non e' stata ancora calcolata", (const char*)ditta, (const char *)mesi_cal);
return yesno_box("Vuoi ugualmente continuare la stampa?"); return yesno_box("Vuoi ugualmente continuare la stampa?");
} }
return TRUE; return TRUE;
@ -589,6 +610,7 @@ bool CG4400_application::controlla_mov()
TLocalisamfile mov (LF_MOV); TLocalisamfile mov (LF_MOV);
bool ok = TRUE; bool ok = TRUE;
byte tipo; byte tipo;
TString16 ditta = "";
TDate udata; TDate udata;
TDate data = format("01/01/%4d", _annoes - 1); TDate data = format("01/01/%4d", _annoes - 1);
TRecnotype rec = _tabreg->recno(); TRecnotype rec = _tabreg->recno();
@ -603,11 +625,13 @@ bool CG4400_application::controlla_mov()
|| ((!_stampa_tutti_i_registri)&&(reg == _codreg)) ) || ((!_stampa_tutti_i_registri)&&(reg == _codreg)) )
if ( (datareg >= data) && (datareg <= udata) ) if ( (datareg >= data) && (datareg <= udata) )
{ {
bool stampato = mov.get_bool(MOV_STAMPATO); bool stampato = mov.get_bool(MOV_REGST);
long numreg = mov.get_long(MOV_NUMREG); long numreg = mov.get_long(MOV_NUMREG);
if (!stampato) if (!stampato)
{ {
warning_box("Il movimento con numero di registrazione %ld non e' ancora stato stampato in forma definitiva!", numreg); ditta = "";
ditta << get_firm();
warning_box("Ditta %s : il movimento con numero di registrazione %ld non e' ancora stato stampato in forma definitiva!", (const char*)ditta, numreg);
ok = FALSE; ok = FALSE;
} }
} }
@ -685,13 +709,27 @@ void CG4400_application::cerca_reg(const TString& c, byte& t, TDate& d)
} }
*/ */
void CG4400_application::set_page_tot_reg() bool CG4400_application::ventilazione(const char* iva)
{ {
reset_print(); TTable tabiva ("%IVA");
TString riga(_stampa_width); TString16 chiave = "";
int r=1, rr=0, row=0; chiave << iva;
real tot_imponib, tot_imposta, tot_imponibp, tot_impostap; tabiva.put("CODTAB", chiave);
if (tabiva.read()==NOERR)
{
TString16 vent = tabiva.get("S1");
if (vent == "VE")
return TRUE;
}
return FALSE;
}
int CG4400_application::stampa_prospetto()
{
TString riga(_stampa_width);
int r=1, rr=0;
reset_print();
riga.fill('-'); riga.fill('-');
set_row(r, "%s", (const char *) riga); set_row(r, "%s", (const char *) riga);
r++; r++;
@ -718,7 +756,10 @@ void CG4400_application::set_page_tot_reg()
if (_nrec > 0) //numero records di rmoviva if (_nrec > 0) //numero records di rmoviva
{ {
set_row(++rr, "@26g---------- P E R I O D O ----------"); if (_corrispettivi)
set_row(++rr, "@26g------------------ P E R I O D O -------------------");
else
set_row(++rr, "@26g---------- P E R I O D O -----------");
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
set_row(rr,"@82g------ P R O G R E S S I V I ------"); set_row(rr,"@82g------ P R O G R E S S I V I ------");
rr++; rr++;
@ -729,129 +770,240 @@ void CG4400_application::set_page_tot_reg()
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
set_row(rr, "@92gA C Q U I S T I"); set_row(rr, "@92gA C Q U I S T I");
} }
if (_tipo_reg == 1) if (_tipo_reg == 1) //un registro corrispettivi puo' solo essere un registro vendite
{ {
set_row(rr, "@37gV E N D I T E"); set_row(rr, "@37gV E N D I T E");
if (_corrispettivi)
set_row(rr, "@63gCORRISPETTIVI");
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
set_row(rr, "@93gV E N D I T E"); set_row(rr, "@93gV E N D I T E");
} }
rr++; rr++;
set_row(rr, "iva Descrizione@30gImponibile@49gImposta"); set_row(rr, "iva Descrizione@30gImponibile@49gImposta");
if (_corrispettivi)
set_row(rr, "@63gImporti lordi");
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
set_row(rr++, "@86gImponibile@106gImposta"); set_row(rr++, "@86gImponibile@106gImposta");
else rr++; else rr++;
rr++; rr++;
}
return rr;
}
//la stampa "tipi di indetraibilita'" viene fatta solo per gli acquisti
void CG4400_application::stampa_acquisti(int row)
{
if (_tipo_reg == 2)
{
real tot_imponib, tot_imposta, tot_imponibp, tot_impostap;
row+=2;
int tdetprec = -1;
int rw = row;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00; tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_iva_array.sort(compare_fields);
for (int s = 0; s < _iva_array.items(); s++)
{
TRigaiva& riga = (TRigaiva&)_iva_array[s];
switch (riga._tipodet)
{
case 1: if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Indetraibile su op.es. -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 3: if (tdetprec == 1)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Passaggi interni -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 9: if ( (tdetprec == 1) || (tdetprec == 3) )
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- N.D. 9 - acquisti indeducibili per ART.19 -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
default: break;
}
}
if (tdetprec == 9)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
}
_iva_array.destroy();
}
}
void CG4400_application::set_page_tot_reg()
{
TString16 codivaprec = "";
int row=0, rr=0;
rr = stampa_prospetto();
if (_nrec > 0) //numero di records di rmoviva
{
real tot_imponib, tot_imposta, tot_imponibp, tot_impostap, tot_lordo;
real dep_imponib, dep_imposta, dep_lordo;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = tot_lordo = ZERO;
dep_imponib = dep_imposta = dep_lordo = ZERO;
_tot_iva_array.sort(compare_rows); _tot_iva_array.sort(compare_rows);
for (int k = 0; k < _tot_iva_array.items(); k++) for (int k = 0; k < _tot_iva_array.items(); k++)
{ {
TRiga& riga = (TRiga&)_tot_iva_array[k]; TRiga& riga = (TRiga&)_tot_iva_array[k];
row = rr+k; //row = rr+k;
set_row(row, "%3s", (const char*)riga._codiva); if (codivaprec == "")
TString descr = descr_iva(riga._codiva); codivaprec = riga._codiva;
set_row(row, "@5g%s", (const char*)descr); if (codivaprec != riga._codiva)
set_row(row, "@25g%r", &riga._imponibile);
set_row(row, "@41g%r", &riga._imposta);
if (_tipo_stampa != 3)
{ {
set_row(row, "@81g%r", &riga._imponibilep); set_row(rr, "%3s", (const char*)codivaprec);
set_row(row, "@98g%r", &riga._impostap); TString descr = descr_iva(codivaprec);
set_row(rr, "@5g%s", (const char*)descr);
if (dep_imponib != ZERO)
set_row(rr, "@25g%r", &dep_imponib);
if (dep_imposta != ZERO)
set_row(rr, "@41g%r", &dep_imposta);
if (dep_lordo != ZERO)
set_row(rr, "@61g%r", &dep_lordo);
if (_tipo_stampa != 3)
{
set_row(rr, "@81g%r", &riga._imponibilep);
set_row(rr, "@98g%r", &riga._impostap);
}
rr++;
codivaprec = riga._codiva;
dep_imponib = dep_imposta = dep_lordo = ZERO;
} }
tot_imponib += riga._imponibile; if (_corrispettivi)
tot_imposta += riga._imposta; {
tot_imponibp += riga._imponibilep; if (riga._tipodoc == "CR" || riga._tipodoc == "RF" || riga._tipodoc == "SC")
tot_impostap += riga._impostap; {
dep_lordo += riga._imponibile;
dep_imposta += riga._imposta;
tot_lordo += riga._imponibile;
tot_imposta += riga._imposta;
}
else if (riga._tipodoc == "CN" || riga._tipodoc == "RN" || riga._tipodoc == "SN" || riga._tipodoc != "FS")
{
dep_imponib += riga._imponibile;
dep_imposta += riga._imposta;
tot_imponib += riga._imponibile;
tot_imposta += riga._imposta;
}
if (riga._tipodoc == "FS")
{
real somma = riga._imponibile + riga._imposta;
if (ventilazione(riga._codiva)) //con ventilazione
{
dep_imponib += somma;
tot_imponib += somma;
somma = -somma;
dep_lordo += somma;
}
else //senza ventilazione
{
dep_imponib += riga._imponibile;
tot_imponib += riga._imponibile;
dep_imposta += riga._imposta;
tot_imposta += riga._imposta;
somma = -somma;
dep_lordo += somma;
}
tot_lordo += somma;
}
}
else //non e' un registro corrispettivo
{
//set_row(row, "@25g%r", &riga._imponibile);
//set_row(row, "@41g%r", &riga._imposta);
dep_imponib += riga._imponibile;
dep_imposta += riga._imposta;
tot_imponib += riga._imponibile;
tot_imposta += riga._imposta;
tot_imponibp += riga._imponibilep;
tot_impostap += riga._impostap;
}
if (k == (_tot_iva_array.items()-1))
{
set_row(rr, "%3s", (const char*)riga._codiva);
TString descr = descr_iva(riga._codiva);
set_row(rr, "@5g%s", (const char*)descr);
if (dep_imponib != ZERO)
set_row(rr, "@25g%r", &dep_imponib);
if (dep_imposta != ZERO)
set_row(rr, "@41g%r", &dep_imposta);
if (dep_lordo != ZERO)
set_row(rr, "@61g%r", &dep_lordo);
if (_tipo_stampa != 3)
{
set_row(rr, "@81g%r", &riga._imponibilep);
set_row(rr, "@98g%r", &riga._impostap);
}
}
/*
if (_tipo_stampa != 3)
{
set_row(rr, "@81g%r", &riga._imponibilep);
set_row(rr, "@98g%r", &riga._impostap);
}
*/
} }
_tot_iva_array.destroy(); _tot_iva_array.destroy();
row++; rr++;
set_row(++row, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta); set_row(++rr, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_corrispettivi)
if (tot_lordo != ZERO)
set_row(rr, "@61g%r", &tot_lordo);
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
set_row(row, "@81g%r@98g%r", &tot_imponibp, &tot_impostap); set_row(rr, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
//la stampa "tipi di indetraibilita'" viene fatta solo per gli acquisti
if (_tipo_reg == 2)
{
row+=2;
int tdetprec = -1;
int rw = row;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
_iva_array.sort(compare_fields); stampa_acquisti(rr);
for (int s = 0; s < _iva_array.items(); s++)
{
TRigaiva& riga = (TRigaiva&)_iva_array[s];
switch (riga._tipodet)
{
case 1: if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Indetraibile su op.es. -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 3: if (tdetprec == 1)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- Passaggi interni -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
case 9: if ( (tdetprec == 1) || (tdetprec == 3) )
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2;
}
if (riga._tipodet != tdetprec)
{
set_row(rw++, "----- N.D. 9 - acquisti indeducibili per ART.19 -----");
set_row(rw, "Cod.");
rw++;
set_row(rw, "iva Descrizione@30gImponibile@49gImposta");
if (_tipo_stampa != 3)
set_row(rw++, "@86gImponibile@106gImposta");
else rw++;
rw++;
}
rw = setta_riga(rw, riga, tot_imponib, tot_imposta, tot_imponibp, tot_impostap);
tdetprec = riga._tipodet;
break;
default: break;
}
}
if (tdetprec == 9)
{
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
if (_tipo_stampa != 3)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
}
_iva_array.destroy();
}
} }
} }
@ -894,6 +1046,7 @@ bool CG4400_application::compila_reg(const TMask& m)
{ {
_tipo_reg = _tabreg->get_int("I0"); _tipo_reg = _tabreg->get_int("I0");
_pagine_stampate = _tabreg->get_int("I1"); _pagine_stampate = _tabreg->get_int("I1");
_corrispettivi = _tabreg->get_bool("B0");
//_pagine_numerate = tab_reg.get_int("I2"); //_pagine_numerate = tab_reg.get_int("I2");
//_stampa_ok = tab_reg.get_int("I7"); //_stampa_ok = tab_reg.get_int("I7");
//_nprog_da = tab_reg.get_long ("I6"); //_nprog_da = tab_reg.get_long ("I6");
@ -902,10 +1055,10 @@ bool CG4400_application::compila_reg(const TMask& m)
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
_data_da = _tabreg->get_date ("D3"); _data_da = _tabreg->get_date ("D3");
if ( _tipo_stampa == 1 || _tipo_stampa == 4 ) if ( _tipo_stampa == 1 || _tipo_stampa == 4 )
if ( _data_a < _data_da) if ( _data_a <= _data_da)
{ {
TString16 datas = format("%02d/%4d", _data_da.month(), _data_da.year()); TString16 datas = format("%02d/%4d", _data_da.month(), _data_da.year());
warning_box ("La data specificata non deve essere inferiore al %s (ultima data di stampa specificata sul registro)", (const char*)datas); warning_box ("La data specificata deve essere superiore al %s (ultima data di stampa specificata sul registro)", (const char*)datas);
return FALSE; return FALSE;
} }
//_stampa_intesta = _tabreg->get_bool ("B9"); //_stampa_intesta = _tabreg->get_bool ("B9");
@ -990,6 +1143,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
if (file == LF_MOV) if (file == LF_MOV)
{ {
if (counter) return TRUE; if (counter) return TRUE;
reset_print();
int rr = 0; int rr = 0;
TString ragsoc; TString ragsoc;
TString tipo_op = ""; TString tipo_op = "";
@ -997,20 +1151,10 @@ bool CG4400_application::preprocess_page(int file, int counter)
TLocalisamfile& mov = _cur->file(LF_MOV); TLocalisamfile& mov = _cur->file(LF_MOV);
TLocalisamfile& caus = _cur->file(LF_CAUSALI); TLocalisamfile& caus = _cur->file(LF_CAUSALI);
//long annoes = mov->get_long(MOV_ANNOES);
//TString16 codreg = mov->get(MOV_REG);
_datareg = mov.get_date(MOV_DATAREG); _datareg = mov.get_date(MOV_DATAREG);
//if (codreg != _codreg || annoes != _annoes)
// return FALSE;
//if (_data_da.string() != "" && _data_a.string() != "")
// if ( (_datareg < _data_da || _datareg > _data_a) || (!_datareg.ok()) )
// return FALSE;
_mov_empty = FALSE; _mov_empty = FALSE;
//if ( (_tipo_stampa == 1) || (_tipo_stampa == 4) )
if ( (_datareg.month() != _dataregp.month()) && (_dataregp.ok()) ) if ( (_datareg.month() != _dataregp.month()) && (_dataregp.ok()) )
{ {
if (_tipo_stampa == 2) if (_tipo_stampa == 2)
@ -1030,7 +1174,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
TString ocfpi = mov.get(MOV_OCFPI); TString ocfpi = mov.get(MOV_OCFPI);
long codcf = mov.get_long(MOV_CODCF); long codcf = mov.get_long(MOV_CODCF);
long numgio = mov.get_long(MOV_NUMGIO); long numgio = mov.get_long(MOV_NUMGIO);
bool stampato = mov.get_bool(MOV_STAMPATO); bool stampato = mov.get_bool(MOV_REGST);
bool intra = caus.get_bool(CAU_INTRACOM); bool intra = caus.get_bool(CAU_INTRACOM);
bool autof = caus.get_bool(CAU_AUTOFATT); bool autof = caus.get_bool(CAU_AUTOFATT);
TString descrcau = caus.get(CAU_DESCR); TString descrcau = caus.get(CAU_DESCR);
@ -1039,7 +1183,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
if (!stampato) if (!stampato)
{ {
mov.put(MOV_STAMPATO,TRUE); mov.put(MOV_REGST,TRUE);
mov.rewrite(); mov.rewrite();
} }
@ -1092,10 +1236,9 @@ bool CG4400_application::preprocess_page(int file, int counter)
if (_tipo_reg == 2) if (_tipo_reg == 2)
set_row(rr, "@107g%d", riga._tipodet); set_row(rr, "@107g%d", riga._tipodet);
set_row(rr, "@108g%r", &riga._imposta); set_row(rr, "@108g%r", &riga._imposta);
set_row(rr, "@124g%d", riga._tipocr);
} }
_riga_rmi.destroy(); _riga_rmi.destroy();
int tipocr = _cur->file(LF_RMOVIVA).get_int(RMI_TIPOCR);
set_row(_r, "@124g%d", tipocr);
} }
//int tipocr = _cur->file(LF_RMOVIVA)->get_int(RMI_TIPOCR); //int tipocr = _cur->file(LF_RMOVIVA)->get_int(RMI_TIPOCR);
//set_row(_r, "@124g%d", tipocr); //set_row(_r, "@124g%d", tipocr);
@ -1313,7 +1456,9 @@ print_action CG4400_application::postprocess_print(int file, int counter)
bool CG4400_application::set_print(int n) bool CG4400_application::set_print(int n)
{ {
TMask m("cg4400a"); TMask m("cg4400a");
int giorni_del_mese;
// bool ok = set_ditte(m);
if (set_ditte(m)) if (set_ditte(m))
if (_selected.ones() > 0l) if (_selected.ones() > 0l)
{ {
@ -1343,18 +1488,24 @@ bool CG4400_application::set_print(int n)
_u_stampata = m.get_int(ULTIMA_PAGINA); _u_stampata = m.get_int(ULTIMA_PAGINA);
//set_page_number(_u_stampata + 1); //set_page_number(_u_stampata + 1);
} }
if (_fino_a_mese == 12)
const int giorni_del_mese = TDate::last_day(_fino_a_mese, _annoes); giorni_del_mese = 31;
_data_a=TDate(giorni_del_mese,_fino_a_mese,_annoes); else
{
TDate primo = format("01/%02d/%4d", _fino_a_mese+1, _annoes);
--primo;
giorni_del_mese = primo.day();
}
_data_a=format("%02d/%02d/%4d",giorni_del_mese,_fino_a_mese,_annoes);
// NB data_da viene letta nella preprocess_page // NB data_da viene letta nella preprocess_page
} }
if (_tipo_stampa == 2) if (_tipo_stampa == 2)
compila_lib(); compila_lib();
stampa_registri_IVA(m); stampa_registri_IVA(m);
} }
else warning_box("Nessuna ditta selezionata!"); else warning_box("Nessuna ditta selezionata!");
return FALSE; return FALSE;
// return ok;
} }
void CG4400_application::stampa_registri_IVA(const TMask& m) void CG4400_application::stampa_registri_IVA(const TMask& m)
@ -1379,7 +1530,13 @@ void CG4400_application::stampa_registri_IVA(const TMask& m)
if (!ok) continue; if (!ok) continue;
if (!_stampa_tutti_i_registri) if (!_stampa_tutti_i_registri)
print(); {
(*_cur) = 0L;
const long item = _cur->items();
if (item > 0)
print();
if (_tipo_stampa != 3) aggiorna_reg();
}
else else
{ {
TString16 codtab; TString16 codtab;
@ -1395,7 +1552,7 @@ void CG4400_application::stampa_registri_IVA(const TMask& m)
if ( tipo == 1 || tipo == 2 ) //registro iva if ( tipo == 1 || tipo == 2 ) //registro iva
{ {
_tipo_reg = _tabreg->get_int("I0"); _tipo_reg = _tabreg->get_int("I0");
_desc_lib = _tabreg->get("S0"); _corrispettivi = _tabreg->get_bool("B0");
if (_tipo_stampa != 3) if (_tipo_stampa != 3)
_data_da = _tabreg->get_date("D3"); _data_da = _tabreg->get_date("D3");
_pagine_stampate = _tabreg->get_int("I1"); _pagine_stampate = _tabreg->get_int("I1");
@ -1441,6 +1598,7 @@ bool CG4400_application::set_ditte(TMask& m)
m.set_handler (A_CODICE, mask_firm_to); m.set_handler (A_CODICE, mask_firm_to);
m.set_handler (DA_DATA, mask_data); m.set_handler (DA_DATA, mask_data);
m.set_handler (A_DATA, mask_data); m.set_handler (A_DATA, mask_data);
m.set_handler (A_DATA, mask_tipo);
m.set_handler (MESE, mask_mese); m.set_handler (MESE, mask_mese);
m.set_handler (CODICE_LIB_UN, mask_cod); m.set_handler (CODICE_LIB_UN, mask_cod);
m.set_handler (DLG_SELECT, mask_select); m.set_handler (DLG_SELECT, mask_select);
@ -1537,8 +1695,8 @@ int CG4400_application::stampa_intestazione()
//printer().setdate(_data); //printer().setdate(_data);
if (_tipo_stampa == 3) if (_tipo_stampa == 3)
riga = "STAMPA DI PROVA Data @<"; riga = "STAMPA DI PROVA Data @<";
else //else
riga = "Data @<"; // riga = "Data @<";
riga.right_just(_stampa_width-6); riga.right_just(_stampa_width-6);
//riga.right_just(127); //riga.right_just(127);
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi)); riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));

View File

@ -21,7 +21,6 @@
#include "cglib03.h" #include "cglib03.h"
//enum STAMPA { bollati=1, unici=2 };
const int TABREG = (int)TTable::name2log("REG"); const int TABREG = (int)TTable::name2log("REG");
class CG4400_application : public TPrintapp class CG4400_application : public TPrintapp
@ -29,7 +28,7 @@ class CG4400_application : public TPrintapp
TCursor * _cur; TCursor * _cur;
TRelation *_rel; TRelation *_rel;
TLocalisamfile *_clifo, *_nditte, *_occas, *_tab, *_tabcom, *_com, *_anag; TLocalisamfile *_clifo, *_nditte, *_occas, *_tab, *_tabcom, *_com, *_anag;
TTable *_tabreg, *_tablbu, *_tabinl, *_tablim, *_tabpim; TTable *_tabreg, *_tablbu, *_tabinl, *_tablim, *_tabpim, *_tablia, *_tabiva;
TRigaiva_array _iva_array, _riga_rmi; TRigaiva_array _iva_array, _riga_rmi;
TTipodoc_array _doc_array; TTipodoc_array _doc_array;
TRiga_array _tot_iva_array; TRiga_array _tot_iva_array;
@ -39,6 +38,7 @@ class CG4400_application : public TPrintapp
TRecnotype _nrec; TRecnotype _nrec;
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf; bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf;
bool _corrispettivi;
char _frequiva; char _frequiva;
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg; TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
long _n_ditte, _u_stampata, _primast; long _n_ditte, _u_stampata, _primast;
@ -63,6 +63,7 @@ protected:
bool compila_lib(); bool compila_lib();
bool controlla_liquidazione(); bool controlla_liquidazione();
bool controlla_mov(); bool controlla_mov();
bool ventilazione(const char*);
void cerca_reg(const TString&, byte&, TDate&); void cerca_reg(const TString&, byte&, TDate&);
//void leggi_movimenti(const TDate&, const TString&, bool&); //void leggi_movimenti(const TDate&, const TString&, bool&);
void stampa_registri_IVA(const TMask&); void stampa_registri_IVA(const TMask&);
@ -70,12 +71,14 @@ protected:
void aggiorna_reg(); void aggiorna_reg();
void aggiorna_lib(); void aggiorna_lib();
void calcola_progressivi(real&, real&, const char*, const int); void calcola_progressivi(real&, real&, const char*, const int);
void user_create(); void user_create();
void user_destroy(); void user_destroy();
bool preprocess_page(int, int); bool preprocess_page(int, int);
int stampa_intestazione(); int stampa_intestazione();
void get_dati_ditta(); int stampa_prospetto();
bool preprocess_print(int, int); void get_dati_ditta();
void stampa_acquisti(int);
bool preprocess_print(int, int);
print_action postprocess_print(int, int); print_action postprocess_print(int, int);
print_action postprocess_page (int, int); print_action postprocess_page (int, int);
void preprocess_header(); void preprocess_header();
@ -86,6 +89,7 @@ protected:
static bool mask_firm_to (TMask_field&, KEY); static bool mask_firm_to (TMask_field&, KEY);
static bool mask_cod (TMask_field&, KEY); static bool mask_cod (TMask_field&, KEY);
static bool mask_data (TMask_field&, KEY); static bool mask_data (TMask_field&, KEY);
static bool mask_tipo (TMask_field&, KEY);
static bool mask_mese (TMask_field&, KEY); static bool mask_mese (TMask_field&, KEY);
static bool mask_fino_a_mese (TMask_field&, KEY); static bool mask_fino_a_mese (TMask_field&, KEY);
static bool mask_select (TMask_field&, KEY); static bool mask_select (TMask_field&, KEY);

View File

@ -10,30 +10,15 @@ LISTBOX TIPO_STAMPA 1 48
BEGIN BEGIN
PROMPT 2 1 "Tipo " PROMPT 2 1 "Tipo "
ITEM "1|Libri bollati della ditta" ITEM "1|Libri bollati della ditta"
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@ MESSAGE SHOW,1@|HIDE,2@|RESET,2@|HIDE,3@|RESET,3@
ITEM "2|Libri unici dello studio" ITEM "2|Libri unici dello studio"
MESSAGE SHOW,2@|HIDE,1@|HIDE,3@ MESSAGE SHOW,2@|HIDE,1@|RESET,1@|HIDE,3@|RESET,3@
ITEM "3|Stampa di prova" ITEM "3|Stampa di prova"
MESSAGE SHOW,3@|HIDE,1@|HIDE,2@|SHOW,CODICE_LIBRO MESSAGE SHOW,3@|HIDE,1@|RESET,1@|HIDE,2@|RESET,2@|SHOW,CODICE_LIBRO
ITEM "4|Libri con riferimenti al libro giornale" ITEM "4|Libri con riferimenti al libro giornale"
MESSAGE SHOW,1@|HIDE,2@|HIDE,3@ MESSAGE SHOW,1@|HIDE,2@|RESET,2@|HIDE,3@|RESET,3@
END END
/*
NUMBER TIPO_STAMPA 1
BEGIN
PROMPT 2 1 "Tipo stampa "
SHEET "Cod|Descrizione@50"
INPUT TIPO_STAMPA
OUTPUT TIPO_STAMPA
ITEM "1|Libri bollati della ditta"
ITEM "2|Libri unici dello studio"
ITEM "3|Stampa di prova"
ITEM "4|Libri con riferimenti al libro giornale"
END
*/
GROUPBOX DLG_NULL 35 5 GROUPBOX DLG_NULL 35 5
BEGIN BEGIN
PROMPT 20 2 "Scelta ditte" PROMPT 20 2 "Scelta ditte"
@ -158,6 +143,8 @@ END
DATE A_DATA DATE A_DATA
BEGIN BEGIN
PROMPT 30 9 "Alla data " PROMPT 30 9 "Alla data "
VALIDATE DATE_CMP_FUNC >= DA_DATA
WARNING "Inserire una data non inferiore alla data limite inferiore"
GROUP 3 GROUP 3
END END