Patch level : 10.0
Files correlati : cg3.exe Ricompilazione Demo : [ ] Commento : 0000994: selezione per causale Nella lista fatture per cliente e fornitore, seleziono per una causale mai utilizzata e mi vengono stampate tutte le fatture di vendita dell'esercizio. git-svn-id: svn://10.65.10.50/trunk@17699 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
faa338a83a
commit
ba3945ad5e
102
cg/cg3100.cpp
102
cg/cg3100.cpp
@ -44,7 +44,7 @@ class TListaMov_application : public TPrintapp
|
|||||||
TString4 _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
|
TString4 _causale_ini, _causale_fin, _registro,_registro_ini, _registro_fin;
|
||||||
TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_tipoelsucc;
|
TString _tipoatt, _tipo_elenco,_tipo_clifo_prec,_tipoelsucc;
|
||||||
char _appoggio;
|
char _appoggio;
|
||||||
TString16 _tipodoc, _tipodocumento;
|
TString4 _tipodoc, _tipodocumento;
|
||||||
TString _ragsoc, _indcf, _civcf, _paiv, _codcaus, _dencom, _provcom, _cofi;
|
TString _ragsoc, _indcf, _civcf, _paiv, _codcaus, _dencom, _provcom, _cofi;
|
||||||
TString _capcf, _codval, _simbolo, _statocf, _comcf, _tipo_fin, _reg_causale;
|
TString _capcf, _codval, _simbolo, _statocf, _comcf, _tipo_fin, _reg_causale;
|
||||||
long _documenti, _codice_ini, _codice_fin, _numero_reg, _codcf;
|
long _documenti, _codice_ini, _codice_fin, _numero_reg, _codcf;
|
||||||
@ -409,14 +409,10 @@ bool CausAlleg (const char * cod)
|
|||||||
return allegb;
|
return allegb;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * TipoAttivita (const char * attreg, long codice_ditta)
|
const char* TipoAttivita (const char* attreg, long codice_ditta)
|
||||||
{
|
{
|
||||||
TToken_string key;
|
TString16 key; key.format("%ld|%s", codice_ditta, attreg);
|
||||||
key.add(codice_ditta);
|
return cache().get(LF_ATTIV, key, ATT_TIPOATT);
|
||||||
key.add(attreg);
|
|
||||||
const TRectype & attiv = cache().get(LF_ATTIV, key);
|
|
||||||
|
|
||||||
return attiv.get(ATT_TIPOATT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString& TListaMov_application::SimboloValuta(const char* cod) const
|
const TString& TListaMov_application::SimboloValuta(const char* cod) const
|
||||||
@ -425,10 +421,9 @@ const TString& TListaMov_application::SimboloValuta(const char* cod) const
|
|||||||
const TString& TListaMov_application::DescrDoc(const char* tipo) const
|
const TString& TListaMov_application::DescrDoc(const char* tipo) const
|
||||||
{ return cache().get(TAB_TPD, tipo, "S0"); }
|
{ return cache().get(TAB_TPD, tipo, "S0"); }
|
||||||
|
|
||||||
const TString& TListaMov_application::AttivitaRegistro(const char * cod, int anno) const
|
const TString& TListaMov_application::AttivitaRegistro(const char* cod, int anno) const
|
||||||
{
|
{
|
||||||
TString8 key;
|
TString8 key; key.format("%04d%-3s", anno, cod);
|
||||||
key.format("%04d%-3s", anno, cod);
|
|
||||||
return cache().get("REG", key, "S8");
|
return cache().get("REG", key, "S8");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,19 +431,40 @@ HIDDEN int tipo_registro(const char* cod, int anno)
|
|||||||
{
|
{
|
||||||
TString8 codtab; codtab.format("%4d%-3s", anno, cod);
|
TString8 codtab; codtab.format("%4d%-3s", anno, cod);
|
||||||
const TString& tipo_reg = cache().get("REG", codtab, "I0");
|
const TString& tipo_reg = cache().get("REG", codtab, "I0");
|
||||||
|
|
||||||
return atoi(tipo_reg);
|
return atoi(tipo_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool between(const TString& code, const TString& mini, const TString& maxi)
|
||||||
|
{
|
||||||
|
if (mini.full() && code < mini)
|
||||||
|
return false;
|
||||||
|
if (maxi.full() && code > maxi)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool between(const TDate& code, const TDate& mini, const TDate& maxi)
|
||||||
|
{
|
||||||
|
if (mini.ok() && code < mini)
|
||||||
|
return false;
|
||||||
|
if (maxi.ok() && code > maxi)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool between(long code, long mini, long maxi)
|
||||||
|
{
|
||||||
|
if (mini > 0 && code < mini)
|
||||||
|
return false;
|
||||||
|
if (maxi > 0 && code > maxi)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool TListaMov_application::rmoviva_filter(const TRectype& rmoviva) const
|
bool TListaMov_application::rmoviva_filter(const TRectype& rmoviva) const
|
||||||
{
|
{
|
||||||
const TString& codiva = rmoviva.get(RMI_CODIVA);
|
const TString& codiva = rmoviva.get(RMI_CODIVA);
|
||||||
if (_dacodiva.not_empty() && codiva < _dacodiva)
|
return between(codiva, _dacodiva, _acodiva);
|
||||||
return false;
|
|
||||||
if (_acodiva.not_empty() && codiva > _acodiva)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TListaMov_application::codiva_filter(const TRelation* rel) const
|
bool TListaMov_application::codiva_filter(const TRelation* rel) const
|
||||||
@ -471,41 +487,39 @@ bool TListaMov_application::filter_func_fatture (const TRelation* rel)
|
|||||||
const TRectype& mov = rel->curr(LF_MOV);
|
const TRectype& mov = rel->curr(LF_MOV);
|
||||||
|
|
||||||
// Altrimenti stampa anche i corrispettivi! Pseudo errore MI2396
|
// Altrimenti stampa anche i corrispettivi! Pseudo errore MI2396
|
||||||
long codcf = mov.get_long(MOV_CODCF);
|
const long codcf = mov.get_long(MOV_CODCF);
|
||||||
if (codcf <= 0)
|
if (codcf <= 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
const int ann_reg = mov.get_int(MOV_ANNOIVA);
|
const TString& causale = mov.get(MOV_CODCAUS);
|
||||||
const TString16 cod_reg = mov.get(MOV_REG);
|
if (!between(causale, app()._causale_ini, app()._causale_fin))
|
||||||
const int tipo_reg = tipo_registro (cod_reg, ann_reg);
|
return false;
|
||||||
|
|
||||||
|
const int ann_reg = mov.get_int(MOV_ANNOIVA);
|
||||||
|
const TString4 cod_reg = mov.get(MOV_REG);
|
||||||
|
const int tipo_reg = tipo_registro(cod_reg, ann_reg);
|
||||||
|
|
||||||
// Considera solo iva acquisti o vendite
|
// Considera solo iva acquisti o vendite
|
||||||
if (tipo_reg != 1 && tipo_reg != 2)
|
if (tipo_reg != 1 && tipo_reg != 2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
TRectype from (LF_MOV), to (LF_MOV);
|
if (app()._annoes > 0) //anno esercizio specificato nella maschera
|
||||||
if (app()._annoes != 0) //anno esercizio specificato nella maschera
|
|
||||||
{
|
{
|
||||||
from.put(MOV_ANNOES, app()._annoes);
|
const int annoes = mov.get_int(MOV_ANNOES);
|
||||||
to.put(MOV_ANNOES, app()._annoes);
|
if (annoes != app()._annoes)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (app()._data_ini.ok())
|
|
||||||
from.put(MOV_DATAREG, app()._data_ini);
|
|
||||||
from.put(MOV_TIPO, app()._tipo_ini);
|
|
||||||
if (app()._codice_ini != 0)
|
|
||||||
from.put(MOV_CODCF, app()._codice_ini);
|
|
||||||
if (app()._data_fin.ok())
|
|
||||||
to.put(MOV_DATAREG, app()._data_fin);
|
|
||||||
to.put(MOV_TIPO, app()._tipo_fin);
|
|
||||||
if (app()._codice_fin != 0)
|
|
||||||
to.put(MOV_CODCF, app()._codice_fin);
|
|
||||||
|
|
||||||
bool ok = mov >= from && mov <= to;
|
if (!between(mov.get_date(MOV_DATAREG), app()._data_ini, app()._data_fin))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (ok)
|
if (!between(mov.get(MOV_TIPO), app()._tipo_ini, app()._tipo_fin))
|
||||||
ok = app().codiva_filter(rel);
|
return false;
|
||||||
|
|
||||||
return ok;
|
if (!between(mov.get_long(MOV_CODCF), app()._codice_ini, app()._codice_fin))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return app().codiva_filter(rel);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TListaMov_application::filter_func (const TRelation * rel)
|
bool TListaMov_application::filter_func (const TRelation * rel)
|
||||||
@ -520,17 +534,13 @@ bool TListaMov_application::filter_func (const TRelation * rel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TString& causale = mov.get(MOV_CODCAUS);
|
const TString& causale = mov.get(MOV_CODCAUS);
|
||||||
if (app()._causale_ini.not_empty() && causale < app()._causale_ini)
|
if (!between(causale, app()._causale_ini, app()._causale_fin))
|
||||||
return false;
|
|
||||||
if (app()._causale_fin.not_empty() && causale > app()._causale_fin)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (app()._scelta_stampa == 0) // Lista movimenti
|
if (app()._scelta_stampa == 0) // Lista movimenti
|
||||||
{
|
{
|
||||||
const TString& codreg = mov.get(MOV_REG);
|
const TString& codreg = mov.get(MOV_REG);
|
||||||
if (app()._registro_ini.not_empty() && codreg < app()._registro_ini)
|
if (!between(codreg, app()._registro_ini, app()._registro_fin))
|
||||||
return false;
|
|
||||||
if (app()._registro_fin.not_empty() && codreg > app()._registro_fin)
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else // Lista movimenti sola prima nota
|
else // Lista movimenti sola prima nota
|
||||||
|
Loading…
x
Reference in New Issue
Block a user