Milgiorata stampa scadenzario in presenza di "false" partite aperte
git-svn-id: svn://10.65.10.50/branches/R_10_00@22842 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
658ee8ae80
commit
ec2edfbaaa
@ -4,7 +4,7 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int n = (argc > 1) ? (atoi(&argv[1][1])) : 0;
|
||||
const int n = (argc > 1) ? (argv[1][1]-'0') : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1: sc0200(argc,argv); break; // Gestione partite
|
||||
|
@ -26,7 +26,7 @@ END
|
||||
|
||||
NUMBER F_GRUPPO 3
|
||||
BEGIN
|
||||
PROMPT 26 1 "Gruppo "
|
||||
PROMPT 27 1 "Gruppo "
|
||||
USE LF_PCON SELECT CONTO==""
|
||||
INPUT GRUPPO F_GRUPPO
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
@ -38,7 +38,7 @@ END
|
||||
|
||||
NUMBER F_CONTO 3
|
||||
BEGIN
|
||||
PROMPT 40 1 "Conto "
|
||||
PROMPT 41 1 "Conto "
|
||||
USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO=="")
|
||||
INPUT GRUPPO F_GRUPPO
|
||||
INPUT CONTO F_CONTO
|
||||
@ -55,7 +55,7 @@ END
|
||||
|
||||
NUMBER F_SOTTOCONTO 6
|
||||
BEGIN
|
||||
PROMPT 54 1 "Sottoconto "
|
||||
PROMPT 55 1 "Sottoc. "
|
||||
USE LF_PCON SELECT SOTTOCONTO!=""
|
||||
COPY INPUT F_CONTO
|
||||
INPUT SOTTOCONTO F_SOTTOCONTO
|
||||
@ -74,7 +74,7 @@ END
|
||||
|
||||
NUMBER F_CLIENTE 6
|
||||
BEGIN
|
||||
PROMPT 54 1 "Cliente "
|
||||
PROMPT 55 1 "Cliente "
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CLIENTE
|
||||
@ -92,7 +92,7 @@ END
|
||||
|
||||
NUMBER F_FORNITORE 6
|
||||
BEGIN
|
||||
PROMPT 54 1 "Fornitore "
|
||||
PROMPT 55 1 "Fornitore "
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "F"
|
||||
INPUT CODCF F_FORNITORE
|
||||
|
@ -155,7 +155,7 @@ BEGIN
|
||||
DISPLAY "Diff. Cambio@15R" DIFFCAM
|
||||
DISPLAY "Ritenute fiscali@15R" RITENUTE
|
||||
DISPLAY "Ritenute sociali@15R" RITSOC
|
||||
DISPLAY "P.N." NREG
|
||||
DISPLAY "P.N.@7R" NREG
|
||||
END
|
||||
|
||||
ENDMASK
|
||||
|
@ -288,6 +288,9 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
const TDate datacomp = msk.get(F_DATACOMP);
|
||||
const TValuta valuta(msk, F_CODVAL, F_DATACAMBIO, F_CAMBIO);
|
||||
|
||||
TEsercizi_contabili esc;
|
||||
const int annoes = esc.date2esc(datacomp);
|
||||
|
||||
const TCausale caus(msk.get(F_CAUSALE), datareg.year());
|
||||
const int riga_abb = tipo_cf == 'C' ? RIGA_ABBUONI_PASSIVI : RIGA_ABBUONI_ATTIVI;
|
||||
TBill conto_abbuoni; caus.bill(riga_abb, conto_abbuoni);
|
||||
@ -301,6 +304,8 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
head.put(MOV_CODCAUS, msk.get(F_CAUSALE));
|
||||
head.put(MOV_DATAREG, datareg);
|
||||
head.put(MOV_DATACOMP, datacomp);
|
||||
head.put(MOV_ANNOIVA, datareg.year());
|
||||
head.put(MOV_ANNOES, annoes);
|
||||
head.put(MOV_DESCR, TR("Abbuoni automatici"));
|
||||
if (valuta.in_valuta())
|
||||
valuta.put(head);
|
||||
@ -365,6 +370,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
TRectype& rmov = mov.cg(i);
|
||||
rmov.put(RMV_SEZIONE, imp.sezione());
|
||||
rmov.put(RMV_IMPORTO, imp.valore());
|
||||
rmov.put(RMV_ANNOES, annoes);
|
||||
}
|
||||
if (abbuoni.is_zero())
|
||||
{
|
||||
@ -379,6 +385,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
rmov.put(RMV_ROWTYPE, tipo_cf == 'F' ? 'A' : 'P'); // Abbuoni attivi o passivi?
|
||||
rmov.put(RMV_SEZIONE, abbuoni.sezione());
|
||||
rmov.put(RMV_IMPORTO, abbuoni.valore());
|
||||
rmov.put(RMV_ANNOES, annoes);
|
||||
conto_abbuoni.put(rmov);
|
||||
}
|
||||
|
||||
@ -390,6 +397,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
rmov.put(RMV_ROWTYPE, 'C'); // Differenze cambio
|
||||
rmov.put(RMV_SEZIONE, diffcam.sezione());
|
||||
rmov.put(RMV_IMPORTO, diffcam.valore());
|
||||
rmov.put(RMV_ANNOES, annoes);
|
||||
conto_diffcam.put(rmov);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ struct _LinearTotal : public TObject // Oggetto base per gli elementi di tlg, t
|
||||
_bo, // Bonifici
|
||||
_al; // Altri
|
||||
virtual TObject* dup() const { return new _LinearTotal(*this); }
|
||||
_LinearTotal() {_is = 0.0; _ip = 0.0; _rd = 0.0; _ri = 0.0; _bo = 0.0; _al = 0.0; }
|
||||
_LinearTotal() { _is = _ip = _rd = _ri = _bo = _al = ZERO; }
|
||||
};
|
||||
|
||||
enum tipo_st {nessuno=0, tutti=1, clienti=2, fornitori=3, altri=4};
|
||||
@ -70,7 +70,7 @@ class TStampaScadenzario : public TPrintapp
|
||||
// Se _tipost=altri scorre il piano dei conti.
|
||||
// Se _tipost=clienti || fornitori scorre clifo.
|
||||
int _striepilogo; // 0 = non stampa 1 = stampa il riepilogo giornaliero per pagamento 2 = stampa il riepilogo mensile per pagamento
|
||||
TString16 _codag; // codice agente selezionato
|
||||
TString8 _codag; // codice agente selezionato
|
||||
int _tipopag; // tipo pagamento selezionato
|
||||
TRecnotype _last_bank_rec; // ultimo record con banca stampato
|
||||
real _w_imp_pag, _w_imp_res; // Qui dentro memorizza i valori calcolati in calcola_pagamenti,
|
||||
@ -135,7 +135,7 @@ public:
|
||||
void look_in_cache(real& a, real& b, real& c, TAssoc_array& uns, TAssoc_array& unsnc, TAssoc_array& unsins, TString& k);
|
||||
void calcola_unassigned(const TString& k);
|
||||
void calcola_pagamenti(real& imp_scad, int riga, int rata, TBill& bill); // calcola i pagamenti effettuati per questa rata e il residuo eventuale
|
||||
const char * tipi_tab(int tipo);
|
||||
const char * tipi_tab(int tipo) const;
|
||||
|
||||
TLocalisamfile& pagamenti() const { return *_pagsca; }
|
||||
|
||||
@ -245,10 +245,10 @@ bool TStampaScadenzario::filter_func(const TRelation *r)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (app()._codag.not_empty())
|
||||
if (app()._codag.full())
|
||||
{
|
||||
const TRectype& rec = r->curr();
|
||||
const TString16 codag = rec.get(SCAD_CODAG);
|
||||
const TString& codag = rec.get(SCAD_CODAG);
|
||||
if (app()._codag != codag)
|
||||
return false;
|
||||
}
|
||||
@ -431,32 +431,42 @@ void TStampaScadenzario::look_in_cache(real& a, real& b, real& c,
|
||||
k << rp.get(PART_NUMPART);
|
||||
|
||||
a = b = c = ZERO;
|
||||
if (uns.is_key(k)) a = (real&)uns[k];
|
||||
if (unsnc.is_key(k)) b = (real&)unsnc[k];
|
||||
if (uns.is_key(k)) a = (real&)uns[k];
|
||||
if (unsnc.is_key(k)) b = (real&)unsnc[k];
|
||||
if (unsins.is_key(k)) c = (real&)unsins[k];
|
||||
}
|
||||
|
||||
void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, TBill& bill)
|
||||
{
|
||||
TAssoc_array& uns = (TAssoc_array&) _uns_cache[0];
|
||||
TAssoc_array& unsnc = (TAssoc_array&) _uns_cache[1];
|
||||
TAssoc_array& unsins = (TAssoc_array&) _uns_cache[2];
|
||||
|
||||
if (!_p->esiste(riga, rata))
|
||||
{
|
||||
imp_scad = _w_imp_pag = _w_imp_res = ZERO;
|
||||
error_box("Nella partita %c %ld %d %s la rata %d non corrisponde ad una riga di fattura (%d)",
|
||||
bill.tipo(), bill.codclifo(), _p->anno(), (const char*)_p->numero(), rata, riga);
|
||||
return;
|
||||
}
|
||||
|
||||
const TRiga_scadenze& rs = _p->rata(riga, rata);
|
||||
|
||||
// Non perder tempo con partite chiuse!
|
||||
if (!_ratesald && (rs.chiusa() || _p->chiusa(true)))
|
||||
{
|
||||
imp_scad = rs.importo(_stvaluta).valore();
|
||||
_w_imp_pag = imp_scad;
|
||||
_w_imp_res = ZERO;
|
||||
return;
|
||||
}
|
||||
|
||||
TAssoc_array& uns = (TAssoc_array&)_uns_cache[0];
|
||||
TAssoc_array& unsnc = (TAssoc_array&)_uns_cache[1];
|
||||
TAssoc_array& unsins = (TAssoc_array&)_uns_cache[2];
|
||||
|
||||
const char ssez = _p->riga(riga).sezione();
|
||||
const char* field = (_stvaluta && rs.in_valuta()) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
|
||||
const char* sfield = (_stvaluta && rs.in_valuta()) ? SCAD_IMPORTOVAL : SCAD_IMPORTO;
|
||||
TImporto totalep, // Totale dei pagamenti
|
||||
scdz; // Importo in scadenza
|
||||
scdz += TImporto(ssez,rs.get_real(sfield));
|
||||
totalep += rs.importo_pagato(_stvaluta); // Quanto e' stato pagato per questa scadenza?
|
||||
totalep += rs.importo_pagato(_stvaluta); // Quanto e' stato pagato per questa scadenza?
|
||||
for (int p = rs.last(); p > 0; p = rs.pred(p)) // Calcola il totale pagamenti e discrimina
|
||||
{ // Il TIPOMOV: 1,5 : fattura insoluto
|
||||
const TRectype pag = rs.row(p); // 2 : nota di credito
|
||||
@ -522,7 +532,7 @@ void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata, T
|
||||
_w_imp_res = imp_scad - _w_imp_pag;
|
||||
}
|
||||
|
||||
const char * TStampaScadenzario::tipi_tab(int tipo)
|
||||
const char * TStampaScadenzario::tipi_tab(int tipo) const
|
||||
{
|
||||
switch (tipo)
|
||||
{
|
||||
@ -638,7 +648,7 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
// Se la rata e' stata saldata e non e' abilitato il flag di stampa
|
||||
// oppure l'importo in scadenza e' 0 allora salta alla prossima scadenza
|
||||
|
||||
if (!_ratesald && _w_imp_res == 0.0)
|
||||
if (!_ratesald && _w_imp_res.is_zero())
|
||||
return false;
|
||||
|
||||
_annopart.format("%d",annop);
|
||||
@ -653,26 +663,28 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
|
||||
print_real(_imp_scad, imp_scad, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
|
||||
if (_w_imp_pag != ZERO)
|
||||
if (!_w_imp_pag.is_zero())
|
||||
print_real(_imp_pag, _w_imp_pag, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
|
||||
if (_w_imp_res != ZERO)
|
||||
if (!_w_imp_res.is_zero())
|
||||
{
|
||||
switch (tipo_pag)
|
||||
{
|
||||
case 1: // Rimesse dirette
|
||||
print_real(_rimdir, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
case 2: // ri.ba / Tratte
|
||||
case 3:
|
||||
print_real(_riba, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
case 9: // Bonifici
|
||||
print_real(_bonifico, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
default: // Altri
|
||||
print_real(_altri, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
case 1: // Rimesse dirette
|
||||
print_real(_rimdir, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
case 2: // ri.ba / Tratte
|
||||
case 3:
|
||||
print_real(_riba, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
case 9: // Bonifici
|
||||
print_real(_bonifico, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
default: // Altri
|
||||
print_real(_altri, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} //if (file == LF_SCADENZE && !_end_printed)...
|
||||
|
||||
if (file == LF_CLIFO)
|
||||
@ -860,7 +872,6 @@ print_action TStampaScadenzario::postprocess_page(int file, int counter)
|
||||
{
|
||||
if (_modified)
|
||||
reset_print();
|
||||
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
@ -904,9 +915,10 @@ bool TStampaScadenzario::user_create()
|
||||
_uns_cache.add(new TAssoc_array); // Note di credito
|
||||
_uns_cache.add(new TAssoc_array); // Insoluti
|
||||
|
||||
TConfig conf (CONFIG_DITTA,"cg");
|
||||
_m = new TSelection_ext_mask("sc2200a");
|
||||
_m->enable(F_VALUTA,conf.get_bool("GesVal"));
|
||||
|
||||
const bool gv = ini_get_bool(CONFIG_DITTA, "cg", "GesVal");
|
||||
_m->enable(F_VALUTA, gv);
|
||||
|
||||
enable_print_menu();
|
||||
return true;
|
||||
@ -1145,10 +1157,10 @@ bool TStampaScadenzario::set_print(int)
|
||||
|
||||
if (sel_datafatt)
|
||||
{
|
||||
TString filter("(BETWEEN(");
|
||||
|
||||
TString80 filter("(BETWEEN(");
|
||||
filter << LF_PARTITE << "->" << PART_DATADOC << ",\"" << _datai.string() << "\",\"" << _dataf.string() << "\"))";
|
||||
add_filter_fatt(get_cursor(_cur1), filter);
|
||||
|
||||
add_filter_fatt(get_cursor(_cur1), filter);
|
||||
add_filter_fatt(get_cursor(_cur11), filter);
|
||||
add_filter_fatt(get_cursor(_cur2), filter);
|
||||
add_filter_fatt(get_cursor(_cur3), filter);
|
||||
|
@ -108,7 +108,7 @@ END
|
||||
|
||||
LISTBOX F_RIEPILOGO 1 12
|
||||
BEGIN
|
||||
PROMPT 33 7 "Prospetto per pagamento"
|
||||
PROMPT 33 7 "Prospetto per pagamento "
|
||||
ITEM "0|Nessuno"
|
||||
ITEM "1|Giornaliero"
|
||||
ITEM "2|Mensile"
|
||||
|
Loading…
x
Reference in New Issue
Block a user