Correzioni ai libri IVA

git-svn-id: svn://10.65.10.50/trunk@918 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1995-01-26 16:25:46 +00:00
parent f0dc876f49
commit 983fe25a83
2 changed files with 69 additions and 52 deletions

View File

@ -479,7 +479,7 @@ void CG4400_application::build_ditte_sheet()
_ditte->destroy();
for (int i = 0; i < _nomiditte.items(); i++)
{
TToken_string* d = new TToken_string(64);
TToken_string* d = new TToken_string(74);
*d = (TToken_string&)_nomiditte[i];
const char vers = d->get_char(2);
bool selectable = vers == '?';
@ -622,12 +622,17 @@ void CG4400_application::build_nomiditte()
if (!look_lia()) good = FALSE;
}
_n_ditte++;
TToken_string* d = new TToken_string(64);
TToken_string* d = new TToken_string(74);
// add record
d->add(dt.get("CODDITTA"));
d->add(dt.get("RAGSOC"));
if (good) d->add(_tablia->get("S7"));
else d->add("??");
if (good)
{
d->add(_tablia->get("S7"));
real c = _tablia->get_real("R0");
d->add(c.string("###.###.###.###"));
}
else d->add("??");
_nomiditte.add(d);
}
TApplication::set_firm(__firm);
@ -663,7 +668,7 @@ bool CG4400_application::user_create()
_cur = new TCursor(_rel, "", 2);
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte",
"@1|Cod.@5|Ragione Sociale@50|Vers.");
"@1|Cod.@5|Ragione Sociale@50|Vers.|Credito inizio anno");
_n_ditte = 0l;
__firm = TApplication::get_firm();
@ -925,8 +930,11 @@ bool CG4400_application::controlla_liquidazione()
chiave = "";
chiave << _annoes << i;
lim.put("CODTAB", chiave);
if (lim.read() != NOERR)
mesi_cal << itom(i) << "\n";
if (lim.read() != NOERR)
{
mesi_cal << itom(i) << "\n";
_st_liq[i] = TRUE;
}
}
}
if (_frequiva == 'M')
@ -937,12 +945,14 @@ bool CG4400_application::controlla_liquidazione()
chiave << _annoes << i;
lim.put("CODTAB", chiave);
if (lim.read() != NOERR)
mesi_cal << itom(i) << "\n";
{
mesi_cal << itom(i) << "\n";
_st_liq[i] = TRUE;
}
}
}
if (mesi_cal.not_empty())
{
//_liquidazione = FALSE;
warning_box ("Ditta %s: la liquidazione da stampare sul registro %s relativa ai mesi di \n %s non e' stata ancora calcolata", (const char*)ditta, (const char*) _codreg, (const char *)mesi_cal);
return yesno_box("Vuoi ugualmente continuare la stampa?");
}
@ -954,10 +964,7 @@ bool CG4400_application::controlla_liquidazione()
chiave << _annoes << 13;
lim.put("CODTAB", chiave);
if (lim.read() != NOERR)
{
//_liquidazione = FALSE;
return yesno_box("Ditta %s: non eseguito calcolo liquidazione da stampare sul registro %s. Vuoi ugualmente continuare la stampa?", (const char*)ditta, (const char*) _codreg);
}
}
return TRUE;
}
@ -1093,10 +1100,11 @@ int CG4400_application::stampa_prospetto()
rr = r;
if (_stampa && _tipo_reg == 2)
if (_stampa_cred_pre && _mese_credito==0 && _credito > ZERO)
//if (_stampa_cred_pre && _mese_credito==0 && _credito > ZERO)
if (_stampa_cred_pre && _mese_credito==0 && _credito.not_empty() )
{
//set_row (++rr, "** CREDITO INIZIO ANNO %r = credito iva anno precedente", &_credito);
set_row (++rr, "** CREDITO INIZIO ANNO @39g%r", &_credito);
//set_row (++rr, "** CREDITO INIZIO ANNO @39g%r", &_credito);
set_row (++rr, "** CREDITO INIZIO ANNO @39g%s", (const char*)_credito);
rr++;
}
@ -1729,7 +1737,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
TLocalisamfile& mov = _cur->file(LF_MOV);
TLocalisamfile& caus = _cur->file(LF_CAUSALI);
_datareg = mov.get_date(MOV_DATAREG);
if (_tipo_stampa != 3 && _liquidazione)
@ -1738,7 +1746,8 @@ bool CG4400_application::preprocess_page(int file, int counter)
if (_tipo_stampa == 1)
da = _data_da.month();
else da = 1;
for (int m = da; m > 0 && m < _datareg.month(); m++)
int a = _datareg.month();
for (int m = da; m < a; m++)
{
if (!_st_liq[m])
if (stampo_liquidazione(m))
@ -1746,21 +1755,23 @@ bool CG4400_application::preprocess_page(int file, int counter)
_datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header (intestazione per la stampa liquidazione)
TFilename t;
t.temp();
if (_tipo_stampa == 1)
send_message('L',t, m);
else send_message('l',t,m);
send_message(_tipo_stampa == 1 ? 'L': 'l', t, m);
TString80 nomef; nomef = t.path(); nomef << "\\" << t.name();
if (fexist(nomef))
{
_intesta_liq = TRUE;
if (m > da) printer().formfeed();
merge_export_file(t,FALSE,TRUE);
_intesta_liq = FALSE;
printer().formfeed();
_intesta_liq = FALSE;
reset_print();
}
}
_st_liq[m] = TRUE;
}
}
}
}
_datareg = mov.get_date(MOV_DATAREG);
_mov_empty = FALSE;
@ -2031,7 +2042,8 @@ void CG4400_application::aggiorna_reg()
Tabreg.put("I1", _pagine_stampate);
if (_tipo_reg == 2 && _stampa_cred_pre)
if (_mese_credito == 0 && _credito > ZERO)
//if (_mese_credito == 0 && _credito > ZERO)
if (_mese_credito == 0 && _credito.not_empty())
if (_mov_empty)
Tabreg.put("I8", (long)_fino_a_mese);
else Tabreg.put("I8", (long)_datareg.month());
@ -2216,7 +2228,7 @@ print_action CG4400_application::postprocess_page (int file, int counter)
{
_st_liq[_datareg.month()] = TRUE;
TFilename t;
t.temp();
t.temp("rg");
if (_tipo_stampa == 1)
send_message('L',t, _datareg.month()); //stampa liquidazione
else send_message('l',t, _datareg.month());
@ -2382,24 +2394,24 @@ bool CG4400_application::look_lia()
return ok;
}
void CG4400_application::clear_stliq()
{
for (int i=0; i < 12; i++)
_st_liq[i] = FALSE;
}
bool CG4400_application::stampa_registri_IVA(const TMask& m)
{
bool ok = FALSE;
for (int i = 0; i < _ditte->items(); i++)
{
if (_selected[i])
if (_selected[(long)i])
{
_ditta = _ditte->row(i).get_long(1);
_frequiva = _ditte->row(i).get_char(3);
_credito = _ditte->row(i).get(4); //credito iva anno precedente
bool msg = TRUE;
_ditta = _ditte->row(i).get_long(1);
TApplication::set_firm(_ditta);
TString16 y; y << _annoes;
_tablia->zero();
_tablia->put("CODTAB", y);
if (_tablia->read() == NOERR)
{
_frequiva = _tablia->get("S7")[0];
_credito = _tablia->get_real("R0"); //credito iva anno precedente
}
ok = compila_reg(m);
if (!ok) continue;
if (_tipo_stampa == 2 || _tipo_stampa == 4)
@ -2414,10 +2426,9 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
{
if (_liquidazione)
{
clear_stliq();
ok = controlla_liquidazione();
if (!ok) continue;
for (int i=0; i < 12; i++)
_st_liq[i] = FALSE;
}
(*_cur) = 0L;
const long item = _cur->items();
@ -2467,13 +2478,13 @@ else //non ci sono movimenti da stampare nel periodo richiesto!
else a = _fino_a_mese;
if (! printer().isopen())
printer().open();
for (int m = da; m > 0 && m <= a; m++)
for (int m = da; m <= a; m++)
{
if (stampo_liquidazione(m))
{
_datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header
TFilename t;
t.temp();
t.temp("rgp");
if (_tipo_stampa == 1)
send_message('L',t, m);
else send_message('l',t, m);
@ -2592,10 +2603,9 @@ else //stampa tutti i registri
{
if (_liquidazione) //per i registri "validi" eseguo il controllo liquidazione
{
clear_stliq();
ok = controlla_liquidazione();
if (!ok) continue;
for (int i=0; i < 12; i++)
_st_liq[i] = FALSE;
}
TFilename t;
t.temp();
@ -2627,7 +2637,7 @@ else //stampa tutti i registri
if (!printer().isopen())
printer().open();
for (int m = da; m > 0 && m <= a; m++)
for (int m = da; m <= a; m++)
{
if (stampo_liquidazione(m))
{
@ -2635,7 +2645,7 @@ else //stampa tutti i registri
//if (!ok) break;
_datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header
TFilename t;
t.temp();
t.temp("rgi");
TString80 nomef; nomef = t.path(); nomef << "\\" << t.name();
if (_tipo_stampa == 1)
send_message('L',t, m);
@ -2668,18 +2678,20 @@ TApplication::set_firm(__firm);
return TRUE;
}
void CG4400_application::stampa_liq_mesi_succ()
{
int da = _datareg.month() + 1;
if (!printer().isopen())
printer().open();
for (int m = da; m > 0 && m <= _data_a.month(); m++)
int a = _data_a.month();
for (int m = da; m <= a; m++)
{
if (stampo_liquidazione(m))
{
_datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header (intestazione per la stampa liquidazione)
TFilename t;
t.temp();
t.temp("iva");
if (_tipo_stampa == 1)
send_message('L',t, m);
else send_message('l',t,m);
@ -2693,8 +2705,8 @@ void CG4400_application::stampa_liq_mesi_succ()
}
}
}
printer().close();
}
printer().close();
}
void CG4400_application::send_message(char tipo, const TFilename& nome, int mese)
{

View File

@ -13,7 +13,11 @@
#include <sheet.h>
#include <config.h>
#include <prefix.h>
<<<<<<< cg4400.h
#include "conto.h"
=======
#include "conto.h" // CI VOGLIONO LE VIRGOLETTE! CAPITELA!
>>>>>>> 1.23
#include <nditte.h>
#include <anagr.h>
#include <comuni.h>
@ -37,10 +41,10 @@ class CG4400_application : public TPrintapp
TRigaiva_array _iva_array, _riga_rmi;
TTipodoc_array _doc_array;
TRiga_array _tot_iva_array;
bool _st_liq[12];
TBit_array _selected;
TArray_sheet *_ditte;
TArray _nomiditte;
bool _st_liq[12];
TRecnotype _nrec;
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf, _stampa;
bool _corrispettivi, _liquidazione, _riep_liq, _stampa_ind_comp, _esiste_riga_iva, _stampa_cred_pre;
@ -53,9 +57,9 @@ class CG4400_application : public TPrintapp
int _fino_a_mese, _tipo_reg, _tipo_stampa, _cod_un_loc;
int _annoes, _r, _stampa_width, _mese_ultima_liq, _mese_credito;
int _stampa_len, _stampa_mese;
real _totale_doc, _credito;
real _totale_doc;
TString _codreg, _desc_lib, _codatt, _attivita, _tipoatt;
TString _tipodoc, _descr_doc, _codlib, _codice_vidi;
TString _tipodoc, _descr_doc, _codlib, _codice_vidi, _credito;
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
protected:
@ -91,7 +95,7 @@ protected:
void send_message(char, const TFilename&,int);
void aggiorna_reg();
void aggiorna_lib();
void calcola_progressivi();
void calcola_progressivi();
void stampa_liq_mesi_succ();
bool user_create();
bool user_destroy();
@ -110,6 +114,7 @@ protected:
void preprocess_header();
void build_nomiditte();
void set_year(int y) { _annoes = y; }
void clear_stliq();
static bool filter_func (const TRelation * r);