Patch level : 12.00 1286
Files correlati : ve0.exe ve.exe ca3.exe sc0.exe Commento : Velocizzata la stampa mastrini di analitica Il rendiconto raddoppiava il pagato Lo stesso nel saldaconto extracontabile Aggiunto controllo numeri di documento doppi aalla contabilizzazione
This commit is contained in:
parent
4a4fb1c71d
commit
bf116e66cd
@ -125,6 +125,7 @@ protected:
|
||||
TDate _dadata, _adata;
|
||||
long _danumreg, _anumreg;
|
||||
TString _daconto, _aconto, _codcosto, _codcms, _codfas, _contsep;
|
||||
bool _suddividi;
|
||||
|
||||
protected: //da libreria
|
||||
virtual const TVariant& get(const char* column_name) const;
|
||||
@ -137,7 +138,7 @@ protected:
|
||||
|
||||
public:
|
||||
virtual void set_filter(const TPrint_mastrini_ca_mask& msk, int cms_row);
|
||||
TPrint_mastrini_ca_recordset(const TString& sql) : TISAM_recordset(sql) { }
|
||||
TPrint_mastrini_ca_recordset(const TString& sql, bool suddividi = false) : TISAM_recordset(sql), _suddividi(suddividi) { }
|
||||
};
|
||||
|
||||
static const TPrint_mastrini_ca_recordset* myself = NULL;
|
||||
@ -222,6 +223,51 @@ void TPrint_mastrini_ca_recordset::set_custom_filter(TCursor& cur) const
|
||||
//filtro sui conti selezionati sulla maschera
|
||||
TRectype darec(cur.curr()), arec(cur.curr()); //record corrente (rmovana (solo movimentati))
|
||||
|
||||
if (_suddividi)
|
||||
{
|
||||
if (_codcms.full())
|
||||
{
|
||||
darec.put(RMOVANA_CODCMS, _codcms);
|
||||
arec.put(RMOVANA_CODCMS, _codcms);
|
||||
}
|
||||
else
|
||||
{
|
||||
TString end;
|
||||
|
||||
end << 'z';
|
||||
arec.put(RMOVANA_CODCMS, end);
|
||||
}
|
||||
if (_codcosto.full())
|
||||
{
|
||||
darec.put(RMOVANA_CODCCOSTO, _codcosto);
|
||||
arec.put(RMOVANA_CODCCOSTO, _codcosto);
|
||||
}
|
||||
else
|
||||
{
|
||||
TString end;
|
||||
|
||||
end << 'z';
|
||||
arec.put(RMOVANA_CODCCOSTO, end);
|
||||
}
|
||||
|
||||
TDate d = _dadata;
|
||||
|
||||
if (_codcms.full())
|
||||
d = cache().get_date(LF_COMMESSE, _codcms, COMMESSE_DATAINIZIO);
|
||||
d.addyear(-1);
|
||||
darec.put(RMOVANA_DATACOMP, d);
|
||||
d = _adata;
|
||||
if (_codcms.full())
|
||||
{
|
||||
TDate d1 = cache().get_date(LF_COMMESSE, _codcms, COMMESSE_DATAFINE);
|
||||
if (cache().get_bool(LF_COMMESSE, _codcms, COMMESSE_PROROGA) && cache().get_date(LF_COMMESSE, _codcms, COMMESSE_DATAPROR).ok())
|
||||
d1 = cache().get_date(LF_COMMESSE, _codcms, COMMESSE_DATAPROR);
|
||||
if (d1 > d)
|
||||
d = d1;
|
||||
}
|
||||
d.set_end_year();
|
||||
arec.put(RMOVANA_DATACOMP, d);
|
||||
}
|
||||
if (_daconto.full())
|
||||
darec.put(RMOVANA_CODCONTO, _daconto);
|
||||
|
||||
@ -323,12 +369,12 @@ protected:
|
||||
|
||||
public:
|
||||
virtual void set_filter(const TPrint_mastrini_ca_mask& msk, int cms_row);
|
||||
TPrint_mastrini_ca_alternative_recordset(const TString& sql);
|
||||
TPrint_mastrini_ca_alternative_recordset(const TString& sql, bool suddividi);
|
||||
~TPrint_mastrini_ca_alternative_recordset() { delete _tmp_rmovana; }
|
||||
};
|
||||
|
||||
TPrint_mastrini_ca_alternative_recordset::TPrint_mastrini_ca_alternative_recordset(const TString& sql)
|
||||
: TPrint_mastrini_ca_recordset(sql)
|
||||
TPrint_mastrini_ca_alternative_recordset::TPrint_mastrini_ca_alternative_recordset(const TString& sql, bool suddividi)
|
||||
: TPrint_mastrini_ca_recordset(sql, suddividi)
|
||||
{
|
||||
_tmp_rmovana = NULL;
|
||||
}
|
||||
@ -418,7 +464,7 @@ void TPrint_mastrini_ca_alternative_recordset::set_filter(const TPrint_mastrini_
|
||||
_dadata, _adata, _tipimov, _tipoconti==1, _tipoconti==2);
|
||||
|
||||
const long pconana_items = pconana.items();
|
||||
TProgind pi(pconana_items, TR("Scansione conti..."));
|
||||
TProgress_monitor pi(pconana_items, TR("Scansione conti..."));
|
||||
|
||||
TRelation rel_rmovana(LF_RMOVANA);
|
||||
rel_rmovana.add(LF_MOVANA, "NUMREG==NUMREG"); //aggiunge le testate x avere i tipi mov.
|
||||
@ -506,6 +552,8 @@ void TPrint_mastrini_ca_alternative_recordset::set_filter(const TPrint_mastrini_
|
||||
////////////////////////////////////////////////////////
|
||||
class TPrint_mastrini_ca_rep : public TAnal_report
|
||||
{
|
||||
bool _suddividi;
|
||||
|
||||
protected:
|
||||
virtual bool set_recordset(const TString& sql);
|
||||
virtual const char * get_excel_header_section() { return "H1|H2"; }
|
||||
@ -517,7 +565,9 @@ public:
|
||||
|
||||
bool TPrint_mastrini_ca_rep::set_recordset(const TString& sql)
|
||||
{
|
||||
|
||||
TPrint_mastrini_ca_recordset* rs = new TPrint_mastrini_ca_recordset(sql);
|
||||
|
||||
return TReport::set_recordset(rs);
|
||||
}
|
||||
|
||||
@ -532,20 +582,22 @@ void TPrint_mastrini_ca_rep::set_dbase_fixed_fields(bool on)
|
||||
|
||||
void TPrint_mastrini_ca_rep::set_filter(const TPrint_mastrini_ca_mask& msk, int cms_row)
|
||||
{
|
||||
TReport::set_recordset(NULL); //forza azzeramento file anal.dbf prima di ricostruirlo
|
||||
TReport::set_recordset(nullptr); //forza azzeramento file anal.dbf prima di ricostruirlo
|
||||
|
||||
const int tipoconti = msk.get_int(F_TIPOCONTI);
|
||||
|
||||
_suddividi = !msk.get_bool(F_PERCONTO);
|
||||
|
||||
TPrint_mastrini_ca_recordset* recset = NULL;
|
||||
const char* const query ="USE RMOVANA KEY 2\nJOIN MOVANA INTO NUMREG==NUMREG\nJOIN MOV TO MOVANA INTO NUMREG==NUMREGCG";
|
||||
TString query = rmovana_query(_suddividi);
|
||||
|
||||
switch (tipoconti)
|
||||
{
|
||||
case 1:
|
||||
recset = new TPrint_mastrini_ca_recordset(query);
|
||||
recset = new TPrint_mastrini_ca_recordset(query, _suddividi);
|
||||
break;
|
||||
default:
|
||||
recset = new TPrint_mastrini_ca_alternative_recordset(query);
|
||||
recset = new TPrint_mastrini_ca_alternative_recordset(query, _suddividi);
|
||||
break;
|
||||
}
|
||||
recset->set_filter(msk, cms_row);
|
||||
@ -672,7 +724,7 @@ void TPrint_mastrini_ca::execute_print(TReport_book & book, TAutomask & mask, TR
|
||||
const long items = rmovana.items();
|
||||
if (items > 0)
|
||||
{
|
||||
TProgind po(items, "Analisi righe movimento analitiche...", true, true);
|
||||
TProgress_monitor po(items, "Analisi righe movimento analitiche...", true);
|
||||
|
||||
for (bool ok = rmovana.move_first(); ok; ok = rmovana.move_next())
|
||||
{
|
||||
@ -694,7 +746,9 @@ void TPrint_mastrini_ca::execute_print(TReport_book & book, TAutomask & mask, TR
|
||||
TProgress_monitor pi(set.items(), msg, true);
|
||||
for (bool sok = set.move_first(); pi.add_status() && sok; sok = set.move_next()) //fighissimo metodo per scandire un file in 1 riga!
|
||||
{
|
||||
if (skip_closed && set.get(COMMESSE_CHIUSA).as_bool())
|
||||
if ((skip_closed && set.get(COMMESSE_CHIUSA).as_bool()) ||
|
||||
(set.get_date(COMMESSE_DATAFINE) < _mask->get_date(F_DATAINI) && !set.get_bool(COMMESSE_PROROGA))
|
||||
|| (set.get_bool(COMMESSE_PROROGA) && set.get_date(COMMESSE_DATAPROR) < _mask->get_date(F_DATAINI)))
|
||||
continue;
|
||||
|
||||
row = set.get(0u).as_string(); //prende il valore del primo campo del file (CDC o CMS code)
|
||||
|
@ -860,7 +860,7 @@ void TPrint_rendiconto_ca_recordset::calc_pagato(TRectype& tmprec, const TRectyp
|
||||
|
||||
TRiga_partite * riga_fatt = arr.mov2rig(nregcg, 1);
|
||||
|
||||
if (riga_fatt != NULL)
|
||||
if (riga_fatt != nullptr)
|
||||
{
|
||||
TImporto tot = riga_fatt->calcola_pagato_al(false, _pagato_al, _pagato_al, _pagato_al, 0x5);
|
||||
|
||||
|
@ -1333,6 +1333,23 @@ void ca_put_row_fields(TSheet_field& sheet, const int selected_row,
|
||||
}
|
||||
}
|
||||
|
||||
const char * rmovana_query(bool cos_cms_filter, bool with_movana)
|
||||
{
|
||||
TString & query = get_tmp_string();
|
||||
|
||||
query << "USE " << LF_RMOVANA << " KEY ";
|
||||
if (cos_cms_filter)
|
||||
{
|
||||
TConfig & ca = ca_config();
|
||||
|
||||
query << (ca.get("Level", "ca", 1) ? 6 : 7);
|
||||
}
|
||||
else
|
||||
query << 2;
|
||||
query << "\nJOIN " << LF_MOVANA << " INTO NUMREG==NUMREG\nJOIN MOV TO MOVANA INTO NUMREG==NUMREGCG";
|
||||
return query;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_tree_pos
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -110,6 +110,12 @@ void ca_put_row_fields(TSheet_field& sheet, const int selected_row,
|
||||
const short first_cdc, const short first_cms, const short first_fase, const short first_conto,
|
||||
const char* cdc_fld, const char* cms_fld, const char* fase_fld, const char* conto_fld);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Queries
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
const char * rmovana_query(bool cos_cms_filter = false, bool with_movana = true);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSimple_anal_msk
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -927,14 +927,14 @@ bool TSaldi_cache::int_saldo_movimenti(const TAnal_bill& b, const TString & cont
|
||||
{
|
||||
if (select.full())
|
||||
select << "&&";
|
||||
select << "(CODCCOSTO==\"" << (b.costo() == "~" ? "" : b.costo()) << "\")";
|
||||
select << "(" << RMOVANA_CODCCOSTO << "==\"" << (b.costo() == "~" ? "" : b.costo()) << "\")";
|
||||
}
|
||||
if (b.commessa().full())
|
||||
{
|
||||
if (select.full())
|
||||
select << "&&";
|
||||
select << "(CODCMS==\"" << (b.commessa() == "~" ? "" : b.commessa()) << "\")";
|
||||
}
|
||||
select << "(" << RMOVANA_CODCMS << "==\"" << (b.commessa() == "~" ? "" : b.commessa()) << "\")";
|
||||
}
|
||||
if (b.fase().full())
|
||||
{
|
||||
if (select.full())
|
||||
@ -956,32 +956,32 @@ bool TSaldi_cache::int_saldo_movimenti(const TAnal_bill& b, const TString & cont
|
||||
{
|
||||
if (select.full())
|
||||
select << "&&";
|
||||
select << "("<< FIELD_NAME(LF_MOVANA, MOVANA_CONTSEP) << "=='" << contsep << "')";
|
||||
select << "(" << FIELD_NAME(LF_MOVANA, MOVANA_CONTSEP) << "=='" << contsep << "')";
|
||||
}
|
||||
query << "USE RMOVANA KEY 2\n";
|
||||
if (select.full())
|
||||
query << "SELECT " << select << "\n";
|
||||
query << "USE RMOVANA KEY 2\n";
|
||||
if (select.full())
|
||||
query << "SELECT " << select << "\n";
|
||||
|
||||
// Faccio la join solo se mi serve il tipo movimento in testata
|
||||
const bool filtra_tipo = (tipo & _saldanal_qualsiasi) != 0 &&
|
||||
(tipo & _saldanal_qualsiasi) != _saldanal_qualsiasi;
|
||||
if (filtra_tipo || contsep.full())
|
||||
query << "JOIN MOVANA INTO NUMREG==NUMREG\n";
|
||||
query << "JOIN MOVANA INTO NUMREG==NUMREG\n";
|
||||
//se il conto è buono, anzichè passare per la SELECT usa la chiave 2 con il FROM/TO
|
||||
if (b.conto().full())
|
||||
{
|
||||
query << "FROM CODCONTO=\"" << b.conto() << '"';
|
||||
if (dataini.ok())
|
||||
query << " DATACOMP=" << dataini;
|
||||
query << "\n";
|
||||
|
||||
//se il conto è buono, anzichè passare per la SELECT usa la chiave 2 con il FROM/TO
|
||||
if (b.conto().full())
|
||||
{
|
||||
query << "FROM CODCONTO=\"" << b.conto() << '"';
|
||||
if (dataini.ok())
|
||||
query << " DATACOMP=" << dataini;
|
||||
query << "\n";
|
||||
query << "TO CODCONTO=\"" << b.conto() << '"';
|
||||
if (al.ok())
|
||||
query << " DATACOMP=" << al;
|
||||
query << "\n";
|
||||
}
|
||||
|
||||
query << "TO CODCONTO=\"" << b.conto() << '"';
|
||||
if (al.ok())
|
||||
query << " DATACOMP=" << al;
|
||||
query << "\n";
|
||||
}
|
||||
TISAM_recordset rmovana(query);
|
||||
TISAM_recordset rmovana(query);
|
||||
|
||||
for (TRecnotype i = 0; rmovana.move_to(i); i++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user