Patch level : 2.0 444
Files correlati : cg0.exe Ricompilazione Demo : [ ] Commento : CM600167 Richiedo la stampa dei progressivi Iva. Deve calcolare la liquidazione se nei lim manca il flag CM600189 Se scarico i file di Marker e Trasfer su disco fisso non mi permette di utilizzare direttori con nomi più lunghi di 8 caratteri. CM600270 Inserimento pagamento Se cancello la "X" di rata bloccata sulla riga della scadenza da pagare, mi lascia pagare la rata in questione però non capisco per quale motivo poi la rimette. CM800865 Se non uso il "topo" e voglio creare la 1° riga, il comando "ALT+" non funziona. git-svn-id: svn://10.65.10.50/trunk@10985 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
34026337ab
commit
d1d0fdcebe
120
cg/cg0400.cpp
120
cg/cg0400.cpp
@ -1,12 +1,13 @@
|
||||
//********************************
|
||||
//* Riepilogo Progressivi IVA *
|
||||
//********************************
|
||||
#include <currency.h>
|
||||
|
||||
#include <execp.h>
|
||||
#include <mailbox.h>
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <recarray.h>
|
||||
#include <tabutil.h>
|
||||
#include <prefix.h>
|
||||
|
||||
#include "cg0.h"
|
||||
#include "cg0400.h"
|
||||
@ -20,8 +21,8 @@
|
||||
|
||||
|
||||
enum liste {
|
||||
visualizza=1,
|
||||
stampa=2,
|
||||
ListaPerAliquota=1,
|
||||
ListaPerPeriodo=2,
|
||||
};
|
||||
|
||||
enum tipo_sospensione { nessuna, normale, vol_affari, liquidazione };
|
||||
@ -158,8 +159,9 @@ public:
|
||||
int stampa_intestazione_ditta();
|
||||
const char* desc_attivita(const char*);
|
||||
const char* desc_iva(const TString&);
|
||||
char look_lia(long ditta = 0l);
|
||||
char frequenza_versamenti(long ditta, int anno);
|
||||
void look_pim();
|
||||
void ricalcola_liquidazione_se_necessario();
|
||||
|
||||
TProgressivi_iva(){};
|
||||
};
|
||||
@ -236,14 +238,16 @@ const char* TProgressivi_iva::desc_iva(const TString& cod)
|
||||
return "";
|
||||
}
|
||||
|
||||
char TProgressivi_iva::look_lia(long ditta)
|
||||
char TProgressivi_iva::frequenza_versamenti(long ditta, int anno)
|
||||
{
|
||||
if (ditta <= 0L) ditta = get_firm();
|
||||
if (ditta <= 0L)
|
||||
ditta = get_firm();
|
||||
if (anno <= 0L)
|
||||
anno = _anno;
|
||||
|
||||
TString16 key; key.format("%05ld%04d", ditta, _anno);
|
||||
const TRectype & lia = cache().get("%LIA", key);
|
||||
|
||||
return lia.get_char("S7");
|
||||
TString16 key; key.format("%05ld%04d", ditta, anno);
|
||||
const TRectype& lia = cache().get("%LIA", key);
|
||||
return lia.empty() ? 'M' : lia.get_char("S7");
|
||||
}
|
||||
|
||||
bool TProgressivi_iva::user_create()
|
||||
@ -282,7 +286,7 @@ void TProgressivi_iva::look_pim()
|
||||
real imponibile, imposta,afi,afv,va7i,va7v;
|
||||
real corr_item,*cp,aliquota;
|
||||
bool is_key;
|
||||
const char freq = look_lia(_codditta);
|
||||
const char freq = frequenza_versamenti(_codditta, _anno);
|
||||
|
||||
_corr_array.destroy();
|
||||
|
||||
@ -441,6 +445,62 @@ void TProgressivi_iva::look_pim()
|
||||
_gen1_array.sort(compare_rows); // ordinamento per codice iva
|
||||
}
|
||||
|
||||
void TProgressivi_iva::ricalcola_liquidazione_se_necessario()
|
||||
{
|
||||
TRelation rel("LIM");
|
||||
TRectype& rec = rel.curr();
|
||||
|
||||
TString8 anno; anno.format("%04d", _annoiva);
|
||||
rec.put("CODTAB", anno);
|
||||
|
||||
TCursor cur(&rel, "", 1, &rec, &rec);
|
||||
const TRecnotype items = cur.items();
|
||||
cur.freeze();
|
||||
|
||||
// Scandisce i mesi alla ricerca "spuntando" quelli gia' calcolati
|
||||
TBit_array computed;
|
||||
for (cur = 0l; cur.pos() < items; ++cur)
|
||||
{
|
||||
const int mese = atoi(rec.get("CODTAB").mid(4, 2));
|
||||
if (mese >= 1 && mese <= 12)
|
||||
{
|
||||
if (rec.get_bool("B0"))
|
||||
computed.set(mese); // Mese calcolato!
|
||||
else
|
||||
break; // Considera non calcolati anche i successivi
|
||||
}
|
||||
}
|
||||
|
||||
const char freq = frequenza_versamenti(0, _annoiva);
|
||||
const int periods = freq == 'M' ? 12 : 4;
|
||||
const bool ok = computed.ones() == periods;
|
||||
|
||||
if (!ok && yesno_box(FR("Alcuni mesi precedenti non risultano ricalcolati:\n"
|
||||
"è consigliabile il ricalcolo. Si desidera eseguirlo?")))
|
||||
{
|
||||
for (int mese = (freq == 'M') ? 1 : 3; mese <= 12; mese += (freq == 'M') ? 1 : 3)
|
||||
{
|
||||
if (!computed[mese])
|
||||
{
|
||||
TToken_string body(36);
|
||||
body.add(_annoiva);
|
||||
body.add(mese);
|
||||
body.add(get_firm());
|
||||
body.add("V"); // visualizzazione: no ff alla fine, zeri stampati
|
||||
body.add("");
|
||||
body.add("");
|
||||
body.add('X');
|
||||
|
||||
TMessage msg("cg4 -2 -S", "RCL", body);
|
||||
msg.send();
|
||||
|
||||
TExternal_app liq("cg4 -2");
|
||||
liq.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TProgressivi_iva::cerca_i_pim()
|
||||
{
|
||||
TTable pim("PIM");
|
||||
@ -679,7 +739,7 @@ bool TProgressivi_iva::tipo_handler(TMask_field& f, KEY k)
|
||||
void TProgressivi_iva::check_period(TMask& m)
|
||||
{
|
||||
app()._anno = m.get_int(F_ANNO);
|
||||
const char f = app().look_lia(m.get_long(F_CODDITTA));
|
||||
const char f = app().frequenza_versamenti(m.get_long(F_CODDITTA), app()._anno);
|
||||
m.show(-2);
|
||||
m.show(F_MESE, f == 'M');
|
||||
m.show(F_TRIMESTRE, f == 'T');
|
||||
@ -713,7 +773,7 @@ bool TProgressivi_iva::selection_handler(TMask_field& f, KEY k)
|
||||
bool TProgressivi_iva::period_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
if (m.get_int(F_SELECTION) == 2)
|
||||
check_period(m);
|
||||
@ -730,13 +790,13 @@ bool TProgressivi_iva::set_print(int m)
|
||||
msk.set_handler(F_TIPO, tipo_handler);
|
||||
msk.set_handler(F_SELECTION, selection_handler);
|
||||
|
||||
if (msk.run() != K_ENTER) return FALSE;
|
||||
if (msk.run() != K_ENTER)
|
||||
return FALSE;
|
||||
|
||||
_tipo_lista = msk.get_int(F_SELECTION) == 1 ? visualizza : stampa;
|
||||
|
||||
_tipo_lista = msk.get_int(F_SELECTION) == 1 ? ListaPerAliquota : ListaPerPeriodo;
|
||||
switch (_tipo_lista)
|
||||
{
|
||||
case visualizza:
|
||||
case ListaPerAliquota:
|
||||
{
|
||||
_sospmsk = _tipo_aliq = _tipo_attiv = 0;
|
||||
_codditta = msk.get_long(F_CODDITTA);
|
||||
@ -753,17 +813,18 @@ bool TProgressivi_iva::set_print(int m)
|
||||
if (_tipoprog == 1 && _livelloprog == 1)
|
||||
_sospmsk = msk.get_int(F_TIPOTAB); //vendite in genere; vendite in sospensione d'imposta
|
||||
|
||||
ricalcola_liquidazione_se_necessario();
|
||||
setta_intestazione();
|
||||
azzera_mesi();
|
||||
cerca_i_pim();
|
||||
}
|
||||
break;
|
||||
case stampa:
|
||||
case ListaPerPeriodo:
|
||||
{
|
||||
_codditta = msk.get_long(F_CODDITTA);
|
||||
_anno = msk.get_int(F_ANNO);
|
||||
_datast = msk.get(F_DATASTAMPA);
|
||||
_mese = msk.get_int(look_lia(_codditta) == 'M' ? F_MESE : F_TRIMESTRE);
|
||||
_mese = msk.get_int(frequenza_versamenti(_codditta, _anno) == 'M' ? F_MESE : F_TRIMESTRE);
|
||||
_st_inizio_anno = msk.get_bool(F_STAMPA);
|
||||
_tipo_prog_reg = *msk.get(F_TIPOPROGREG); // L <=> Solo liquidazione, V <=> Solo volume d'affari
|
||||
prefix().set_codditta(_codditta);
|
||||
@ -836,7 +897,7 @@ bool TProgressivi_iva::preprocess_page(int file, int counter)
|
||||
|
||||
switch (_tipo_lista)
|
||||
{
|
||||
case stampa:
|
||||
case ListaPerPeriodo:
|
||||
{
|
||||
if (!_st_inizio_anno)
|
||||
prospetto_pagina(_gen_array,_iva_array);
|
||||
@ -852,7 +913,7 @@ bool TProgressivi_iva::preprocess_page(int file, int counter)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case visualizza:
|
||||
case ListaPerAliquota:
|
||||
{
|
||||
if (counter)
|
||||
_i++;
|
||||
@ -1174,11 +1235,11 @@ void TProgressivi_iva::setta_intestazione()
|
||||
|
||||
void TProgressivi_iva::preprocess_header()
|
||||
{
|
||||
if (_tipo_lista == stampa)
|
||||
if (_tipo_lista == ListaPerPeriodo)
|
||||
{
|
||||
int soh = 1;
|
||||
TString sep(132);
|
||||
TString ragsoc(50);
|
||||
TString ragsoc;
|
||||
TString16 descf;
|
||||
TString16 key; key << _codditta;
|
||||
|
||||
@ -1190,14 +1251,15 @@ void TProgressivi_iva::preprocess_header()
|
||||
|
||||
reset_header();
|
||||
|
||||
char f = look_lia(_codditta);
|
||||
const char f = frequenza_versamenti(_codditta, _anno);
|
||||
if (f == 'T')
|
||||
descf = TR(" TRIMESTRALE");
|
||||
else if (f == 'M')
|
||||
descf = TR(" MENSILE");
|
||||
else descf = "";
|
||||
else
|
||||
descf = "";
|
||||
|
||||
sep << TR("Ditta ") << _codditta;
|
||||
sep << TR("Ditta") << " " << _codditta;
|
||||
sep << " " << ragsoc;
|
||||
sep << " " << descf;
|
||||
|
||||
@ -1244,7 +1306,7 @@ print_action TProgressivi_iva::postprocess_page(int file, int counter)
|
||||
{
|
||||
switch (_tipo_lista)
|
||||
{
|
||||
case stampa:
|
||||
case ListaPerPeriodo:
|
||||
{
|
||||
if (_st_inizio_anno && _mese != 13)
|
||||
if (_prima_pagina)
|
||||
@ -1255,7 +1317,7 @@ print_action TProgressivi_iva::postprocess_page(int file, int counter)
|
||||
else return NEXT_PAGE;
|
||||
}
|
||||
break;
|
||||
case visualizza:
|
||||
case ListaPerAliquota:
|
||||
{
|
||||
if (_i < 12) return REPEAT_PAGE;
|
||||
else return NEXT_PAGE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user