Correzioni alla stampa registri IVA
git-svn-id: svn://10.65.10.50/trunk@1005 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9b6ce7f444
commit
9bce813359
178
cg/cg4400.cpp
178
cg/cg4400.cpp
@ -672,7 +672,7 @@ bool CG4400_application::user_create()
|
||||
_tablia = new TTable("%LIA");
|
||||
_tabpla = new TTable("%PLA");
|
||||
_tabppa = new TTable("PPA");
|
||||
_tabvid = new TTable("VID");
|
||||
_tabvid = new TTable("%VID");
|
||||
_clifo = new TLocalisamfile(LF_CLIFO);
|
||||
_occas = new TLocalisamfile(LF_OCCAS);
|
||||
|
||||
@ -2028,17 +2028,11 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG4400_application::aggiorna_reg()
|
||||
void CG4400_application::aggiorna_reg(const bool aggiorna_vidi)
|
||||
{
|
||||
TString16 codtab;
|
||||
TTable Tabreg ("REG");
|
||||
TLocalisamfile IndBil (LF_INDLIB);
|
||||
int mese;
|
||||
|
||||
word ultimast = get_page_number();
|
||||
|
||||
//if (_stampa_tutti_i_registri)
|
||||
// --ultimast;
|
||||
|
||||
codtab << _annoes << _codreg;
|
||||
Tabreg.zero();
|
||||
@ -2068,40 +2062,43 @@ void CG4400_application::aggiorna_reg()
|
||||
|
||||
Tabreg.rewrite();
|
||||
}
|
||||
|
||||
if (_tipo_stampa == 3) //stampa su libro unico
|
||||
//sul file indlib (indice libro unico) devo generare una riga per ogni registro stampato (ricordarsi che la stampa su libro unico deve avvenire mese per mese!
|
||||
//inoltre non posso stampare due volte lo stesso mese perche' la stampa avviene a fine mese
|
||||
//if (!_mov_empty || _ok_vidi) //se ho stampato almeno un movimento oppure ho stampato la vidimazione
|
||||
if (!_ok_vidi)
|
||||
|
||||
// sul file indlib (indice libro unico) devo generare una riga per ogni
|
||||
// registro stampato (ricordarsi che la stampa su libro unico deve
|
||||
// avvenire mese per mese!)
|
||||
// inoltre non posso stampare due volte lo stesso mese perche' la stampa
|
||||
// avviene a fine mese
|
||||
|
||||
{
|
||||
long numero_riga = 1L;
|
||||
if (!aggiorna_vidi)
|
||||
{
|
||||
bool trovato = FALSE;
|
||||
|
||||
IndBil.zero();
|
||||
|
||||
TRectype nuovo (IndBil.curr());
|
||||
TRectype recprec (IndBil.curr());
|
||||
|
||||
IndBil.put("ANNO", _annoes);
|
||||
IndBil.put("CODLIB", _codlib);
|
||||
TRectype rec (IndBil.curr());
|
||||
|
||||
for (IndBil.read(_isgteq); !IndBil.eof(); IndBil.next())
|
||||
{
|
||||
if (IndBil.curr() != rec) break;
|
||||
|
||||
mese = IndBil.get_int("MESEREG");
|
||||
trovato = TRUE;
|
||||
recprec = IndBil.curr();
|
||||
if (mese == _fino_a_mese) break; //cosi' mi posiziono su quel mese (altrimenti rischio di generare due righe per lo stesso mese e registro => la stampa di vidimazione mi sballa tutta!!!
|
||||
}
|
||||
if (trovato && mese != _fino_a_mese)
|
||||
{
|
||||
long numero_riga = recprec.get_long("NUMREG") + 1;
|
||||
nuovo = recprec;
|
||||
nuovo.put("NUMREG", numero_riga);
|
||||
}
|
||||
else if (trovato) nuovo = rec;
|
||||
else //trovato e' rimasto FALSE
|
||||
{
|
||||
nuovo = rec;
|
||||
nuovo.put("NUMREG", 1L);
|
||||
}
|
||||
trovato = TRUE;
|
||||
numero_riga = IndBil.get_long("NUMREG") + 1;
|
||||
// cosi' mi posiziono su quel mese (altrimenti rischio di generare
|
||||
// due righe per lo stesso mese e registro => la stampa di vidimazione
|
||||
// mi sballa tutta!!!
|
||||
}
|
||||
nuovo.put("ANNO", _annoes);
|
||||
nuovo.put("CODLIB", _codlib);
|
||||
nuovo.put("NUMREG", numero_riga);
|
||||
|
||||
nuovo.put("ANNOREG", _annoes);
|
||||
nuovo.put("MESEREG", _fino_a_mese); // su libro unico ho un solo mese in gioco!
|
||||
nuovo.put("PAGINI", _primast + 1); // numero iniziale pagina libro unico
|
||||
@ -2112,14 +2109,13 @@ void CG4400_application::aggiorna_reg()
|
||||
nuovo.put("PAGINIUT", _numini + 1);
|
||||
nuovo.put("PAGFINUT", _pagine_stampate);
|
||||
|
||||
if (mese == _fino_a_mese)
|
||||
IndBil.rewrite(nuovo);
|
||||
else
|
||||
IndBil.write(nuovo);
|
||||
IndBil.write(nuovo);
|
||||
|
||||
_primast = _u_stampata; //per la numerazione dei registri successivi
|
||||
}
|
||||
aggiorna_lib();
|
||||
// _primast = _u_stampata; //per la numerazione dei registri successivi
|
||||
}
|
||||
_primast = _u_stampata; //per la numerazione dei registri successivi
|
||||
aggiorna_lib();
|
||||
}
|
||||
}
|
||||
|
||||
void CG4400_application::aggiorna_lib()
|
||||
@ -2161,21 +2157,21 @@ bool CG4400_application::stampo_liquidazione(int mese)
|
||||
void CG4400_application::stampa_vidi()
|
||||
{
|
||||
TLocalisamfile IndBil (LF_INDLIB);
|
||||
TTable TabVid ("VID");
|
||||
TTable TabVid ("%VID");
|
||||
TString16 codreg;
|
||||
TString16 vid;
|
||||
long ditta;
|
||||
int mese;
|
||||
_ok_vidi = FALSE;
|
||||
long ditta, pagfin, pagfinut;
|
||||
int mese;
|
||||
TPrintrow row;
|
||||
|
||||
_ok_vidi = FALSE;
|
||||
|
||||
if (!printer().isopen())
|
||||
printer().open();
|
||||
|
||||
IndBil.zero();
|
||||
IndBil.put("ANNO", _annoes);
|
||||
IndBil.put("CODLIB", _codlib);
|
||||
|
||||
TRectype rec (IndBil.curr());
|
||||
IndBil.read (_isgteq);
|
||||
for (; !IndBil.eof(); IndBil.next())
|
||||
@ -2192,12 +2188,23 @@ void CG4400_application::stampa_vidi()
|
||||
_ok_vidi = TRUE;
|
||||
}
|
||||
mese = IndBil.get_int("MESEREG");
|
||||
pagfin = IndBil.get_long("PAGFIN");
|
||||
pagfinut = IndBil.get_long("PAGFINUT");
|
||||
if (mese == 12)
|
||||
{
|
||||
++pagfin;
|
||||
++pagfinut;
|
||||
TRectype nuovo (IndBil.curr());
|
||||
nuovo.put("PAGFIN", pagfin);
|
||||
nuovo.put("PAGFINUT", pagfinut);
|
||||
IndBil.rewrite(nuovo);
|
||||
}
|
||||
row.reset();
|
||||
row.put(format("%s", itom(mese)), 0);
|
||||
row.put(format("%5ld", IndBil.get_long("PAGINI")), 10);
|
||||
row.put(format("%5ld", _u_stampata), 17);
|
||||
row.put(format("%5ld", pagfin), 17);
|
||||
row.put(format("%5ld", IndBil.get_long("PAGINIUT")), 25);
|
||||
row.put(format("%5ld", _pagine_stampate), 32);
|
||||
row.put(format("%5ld", pagfinut), 32);
|
||||
vid = IndBil.get("CODVID");
|
||||
TabVid.zero();
|
||||
TabVid.put("CODTAB", vid);
|
||||
@ -2905,7 +2912,8 @@ void CG4400_application::preprocess_header()
|
||||
if (_stampa_ind_ditta)
|
||||
r = stampa_intestazione();
|
||||
}
|
||||
else //se stampa di prova o su libro unico l'intestazione della ditta va sempre stampata
|
||||
else // se stampa di prova o su libro unico l'intestazione della ditta
|
||||
// va sempre stampata
|
||||
r = stampa_intestazione();
|
||||
|
||||
if (_tipo_stampa == 3 && !_intesta_vidi)
|
||||
@ -2920,8 +2928,10 @@ void CG4400_application::preprocess_header()
|
||||
if (_tipo_stampa == 3)
|
||||
//set_header(r, "@94gProgr.Studio %ld@114gProgr.Utente @#", _u_stampata);
|
||||
set_header(r, "@94gProgr.Studio %ld@114gProgr.Utente %ld", _u_stampata, _pagine_stampate);
|
||||
|
||||
if (_tipo_stampa != 1) aggiorna_reg(); //cosi' sono sicura che l'aggiornamento viene fatto ad ogni salto pagina (cioe' a rottura di mese)
|
||||
|
||||
// cosi' sono sicura che l'aggiornamento viene fatto ad ogni salto pagina
|
||||
// (cioe' a rottura di mese)
|
||||
if (_tipo_stampa != 1) aggiorna_reg(_ok_vidi);
|
||||
|
||||
r++;
|
||||
|
||||
@ -2993,46 +3003,46 @@ void CG4400_application::preprocess_header()
|
||||
r++;
|
||||
}
|
||||
}
|
||||
else if (!_intesta_vidi)
|
||||
{
|
||||
if (_stampa_width == 132)
|
||||
else if (!_intesta_vidi)
|
||||
{
|
||||
//set_header(r,"@10gNum.@19gDocumento@68gT Tipo@76gIncassi/Pag.@103gCod %c@124gT %c", nd1, tipo);
|
||||
set_header(r,"@10gNum.@19gDocumento@68gT Tipo@103gCod %c@124gT %c", nd1, tipo);
|
||||
if (_tipo_stampa == 4) //stampa definitiva con rif. al libro giornale
|
||||
set_header(r, "@128gNum.");
|
||||
r++;
|
||||
set_header(r, "Data reg. prot.@17gData@24gNumero Codice Ragione sociale/descrizione@68gO Doc.@76gTotale doc.@91gImponibile Iva %c@116gImposta@124g%c %c",
|
||||
nd2, cor, type);
|
||||
if (_tipo_stampa == 4)
|
||||
set_header(r, "@128gop.");
|
||||
r++;
|
||||
if (_stampa_width == 132)
|
||||
{
|
||||
//set_header(r,"@10gNum.@19gDocumento@68gT Tipo@76gIncassi/Pag.@103gCod %c@124gT %c", nd1, tipo);
|
||||
set_header(r,"@10gNum.@19gDocumento@68gT Tipo@103gCod %c@124gT %c", nd1, tipo);
|
||||
if (_tipo_stampa == 4) //stampa definitiva con rif. al libro giornale
|
||||
set_header(r, "@128gNum.");
|
||||
r++;
|
||||
set_header(r, "Data reg. prot.@17gData@24gNumero Codice Ragione sociale/descrizione@68gO Doc.@76gTotale doc.@91gImponibile Iva %c@116gImposta@124g%c %c",
|
||||
nd2, cor, type);
|
||||
if (_tipo_stampa == 4)
|
||||
set_header(r, "@128gop.");
|
||||
r++;
|
||||
}
|
||||
else //stampa a 198
|
||||
{
|
||||
//set_header(r,"Registrazione Documento@68gT Tipo@80gTot.Inc./Pag.@110gCod %c@132g%c T", nd1, tipo);
|
||||
set_header(r,"Registrazione Documento@68gT Tipo@110gCod %c@132g%c T", nd1, tipo);
|
||||
if (_tipo_stampa == 4)
|
||||
set_header(r, "@139gNum.");
|
||||
r++;
|
||||
set_header(r, "Data Protocollo Data@24gNumero Codice Ragione sociale/descrizione@68gO Documento@80gTot.Documento@99gImponibile Iva %c@124gImposta@132g%c %c", nd2, type, cor);
|
||||
if (_tipo_stampa == 4)
|
||||
set_header(r, "@139gop. @144gCodice conto @160gDescrizione sottoconto");
|
||||
r++;
|
||||
}
|
||||
}
|
||||
else //stampa a 198
|
||||
else if (_tipo_stampa == 3 && _intesta_vidi)
|
||||
{
|
||||
//set_header(r,"Registrazione Documento@68gT Tipo@80gTot.Inc./Pag.@110gCod %c@132g%c T", nd1, tipo);
|
||||
set_header(r,"Registrazione Documento@68gT Tipo@110gCod %c@132g%c T", nd1, tipo);
|
||||
if (_tipo_stampa == 4)
|
||||
set_header(r, "@139gNum.");
|
||||
r++;
|
||||
set_header(r, "Data Protocollo Data@24gNumero Codice Ragione sociale/descrizione@68gO Documento@80gTot.Documento@99gImponibile Iva %c@124gImposta@132g%c %c", nd2, type, cor);
|
||||
if (_tipo_stampa == 4)
|
||||
set_header(r, "@139gop. @144gCodice conto @160gDescrizione sottoconto");
|
||||
r++;
|
||||
}
|
||||
}
|
||||
else if (_tipo_stampa == 3 && _intesta_vidi)
|
||||
{
|
||||
TString tr(52);
|
||||
tr.fill('-');
|
||||
set_header(r++,"@10gPagine studio Pagine utente ---------------- V I D I M A Z I O N E %s", (const char*)tr);
|
||||
set_header(r++,"Mese@12gda@20ga@27gda@35ga Intestatario@71gN.fogli Pag.in. Pag.fin. Data Ufficio");
|
||||
}
|
||||
if (_stampa_ind_comp && !_intesta_vidi)
|
||||
set_header(r++, "@38gGeneralita'");
|
||||
|
||||
set_header(r, riga);
|
||||
}
|
||||
TString tr(52);
|
||||
tr.fill('-');
|
||||
set_header(r++,"@10gPagine studio Pagine utente ---------------- V I D I M A Z I O N E %s", (const char*)tr);
|
||||
set_header(r++,"Mese@12gda@20ga@27gda@35ga Intestatario@71gN.fogli Pag.in. Pag.fin. Data Ufficio");
|
||||
}
|
||||
if (_stampa_ind_comp && !_intesta_vidi)
|
||||
set_header(r++, "@38gGeneralita'");
|
||||
|
||||
set_header(r, riga);
|
||||
}
|
||||
}
|
||||
|
||||
int cg4400 (int argc, char * argv[])
|
||||
|
@ -90,7 +90,7 @@ protected:
|
||||
void cerca_reg(const TString&, byte*);
|
||||
void set_page_tot_reg();
|
||||
void send_message(char, const TFilename&,int);
|
||||
void aggiorna_reg();
|
||||
void aggiorna_reg(const bool aggiorna_vidi);
|
||||
void aggiorna_lib();
|
||||
void calcola_progressivi();
|
||||
void stampa_liq_mesi_succ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user