Patch level : 10.0 366
Files correlati : sc2.exe Ricompilazione Demo : [ ] Commento Bug 0001334 La stampa deve prevedere l'ordinamento per valuta ed un totale a rottura di valuta. git-svn-id: svn://10.65.10.50/trunk@19104 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6579bdfc1a
commit
a08bb6b87f
288
sc/sc2600.cpp
288
sc/sc2600.cpp
@ -1,5 +1,6 @@
|
||||
#include <printapp.h>
|
||||
#include <utility.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "../cg/cgsaldac.h"
|
||||
#include "../cg/cglib02.h"
|
||||
@ -50,8 +51,9 @@ public:
|
||||
|
||||
virtual TObject* dup() const { return new TLineTotal(*this); }
|
||||
virtual TLineTotal & copy(const TLineTotal & l);
|
||||
virtual void zero();
|
||||
TLineTotal(const TLineTotal* l) { copy(*l); }
|
||||
TLineTotal();
|
||||
TLineTotal() { zero();}
|
||||
};
|
||||
|
||||
TLineTotal & TLineTotal::copy(const TLineTotal & l)
|
||||
@ -66,7 +68,7 @@ TLineTotal & TLineTotal::copy(const TLineTotal & l)
|
||||
return *this;
|
||||
}
|
||||
|
||||
TLineTotal::TLineTotal()
|
||||
void TLineTotal::zero()
|
||||
{
|
||||
for (int i = 0; i < NUMERO_FASCE; i++)
|
||||
{
|
||||
@ -84,12 +86,15 @@ class TProspettoScadenze : public TPrintapp
|
||||
_cur3, _cur4;
|
||||
TSelection_ext_mask *_m;
|
||||
TLocalisamfile *_scad,*_pagsca;
|
||||
TTable *_val;
|
||||
tipo_st _tipost; // Tipo di stampa impostato
|
||||
bool _end_printed,
|
||||
_start,
|
||||
_stvaluta,
|
||||
_ordcod, // VERO=ordine per codice, FALSO=ordine per ragione sociale
|
||||
_sinfasce,
|
||||
_nsinfasce;
|
||||
TString _anno,_numdoc,_protiva,_datadoc,_codval,
|
||||
TString _anno,_numdoc,_protiva,_datadoc,_codval, _codvalsel,
|
||||
_cod, _cod_pre, _des, _des_pre;
|
||||
TDate _limop, _limscad, _datas, _limbf; // Data limite operazione, data limite scaduto e data di stampa
|
||||
int _gcr, // Giorni per Calcolo Rischio (valido solo per stampa clienti)
|
||||
@ -109,10 +114,11 @@ class TProspettoScadenze : public TPrintapp
|
||||
|
||||
public:
|
||||
virtual bool preprocess_page(int file, int counter);
|
||||
virtual bool preprocess_print(int file, int counter);
|
||||
virtual bool open_print();
|
||||
virtual void postclose_print();
|
||||
virtual print_action postprocess_print(int file, int counter);
|
||||
virtual print_action postprocess_page(int file, int counter);
|
||||
virtual void close_print();
|
||||
virtual void preprocess_header() {};
|
||||
virtual void preprocess_footer() ;
|
||||
virtual bool user_create();
|
||||
@ -123,6 +129,7 @@ public:
|
||||
void export_totali_rows();
|
||||
void print_totali(int nriga);
|
||||
void print_header();
|
||||
|
||||
int calc_last_column();
|
||||
void update_totals(bool what, real& esp, real s[NUMERO_FASCE], real ns[NUMERO_FASCE]);
|
||||
void compute_unassigned(TPartita& p, const TDate & datalim);
|
||||
@ -139,7 +146,9 @@ inline TProspettoScadenze& app() {return (TProspettoScadenze&)main_app();}
|
||||
|
||||
void TProspettoScadenze::print_real(TString& dest, const real& num)
|
||||
{
|
||||
const TCurrency cur(num, EMPTY_STRING);
|
||||
const bool stampa_in_valuta = _stvaluta && !_codval.blank();
|
||||
const TString& val = stampa_in_valuta ? _codval : EMPTY_STRING;
|
||||
const TCurrency cur(num, val);
|
||||
dest = cur.string(true);
|
||||
dest.right_just(10);
|
||||
}
|
||||
@ -187,7 +196,7 @@ void TProspettoScadenze::compute_unassigned(TPartita& p, const TDate & datalim)
|
||||
{
|
||||
const TRectype& rec = ra.row(r);
|
||||
const TRiga_partite& sum = p.riga(rec.get_int(PAGSCA_NRIGP));
|
||||
const char * field = PAGSCA_IMPORTO;
|
||||
const char * field = (_stvaluta && sum.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO);
|
||||
const TDate & datascad = sum.get_date(PART_DATAPAG);
|
||||
|
||||
if ((datascad <= datalim))
|
||||
@ -229,11 +238,11 @@ void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
|
||||
{
|
||||
const TRiga_scadenze& rs = rp.rata(n);
|
||||
const TDate d(rs.get_date(SCAD_DATASCAD));
|
||||
const char* field = PAGSCA_IMPORTO;
|
||||
const char* sfield = SCAD_IMPORTO;
|
||||
const char* field = (_stvaluta && rs.in_valuta()) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
|
||||
const char* sfield = (_stvaluta && rs.in_valuta()) ? SCAD_IMPORTOVAL : SCAD_IMPORTO;
|
||||
const char ssez = rp.sezione();
|
||||
TImporto scd(ssez,rs.get_real(sfield)); // Importo in scadenza...
|
||||
TImporto pag(rs.importo_pagato(false)); // Quanto e' stato pagato per questa scadenza?
|
||||
TImporto pag(rs.importo_pagato(_stvaluta)); // Quanto e' stato pagato per questa scadenza?
|
||||
TImporto bf;
|
||||
TImporto work_imp;
|
||||
|
||||
@ -355,7 +364,7 @@ void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
|
||||
}
|
||||
residuo += res;
|
||||
bool sbf;
|
||||
TImporto esp = rs.esposto(false, _limscad, _limbf, sbf);
|
||||
TImporto esp = rs.esposto(_stvaluta, _limscad, _limbf, sbf);
|
||||
esposto += esp.valore();
|
||||
}
|
||||
}
|
||||
@ -456,7 +465,8 @@ bool TProspettoScadenze::preprocess_page(int file, int counter)
|
||||
_numdoc = rp.get(PART_NUMDOC);
|
||||
_protiva = rp.get(PART_PROTIVA);
|
||||
_datadoc = (const char*) rp.get_date(PART_DATADOC);
|
||||
_codval = " ";
|
||||
_codval = (_stvaluta ? rp.get(PART_CODVAL): "");
|
||||
if (_codval.empty()) _codval = " ";
|
||||
// Now performing fulkrum...
|
||||
compute_all(p, bill);
|
||||
}
|
||||
@ -466,113 +476,15 @@ bool TProspettoScadenze::preprocess_page(int file, int counter)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TProspettoScadenze::preprocess_print(int file, int counter)
|
||||
bool TProspettoScadenze::open_print()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
print_action TProspettoScadenze::postprocess_print(int file, int counter)
|
||||
{
|
||||
print_action rt = NEXT_PAGE;
|
||||
if (!_end_printed)
|
||||
if (_stvaluta)
|
||||
{
|
||||
if ((file == LF_PARTITE))
|
||||
{
|
||||
rt = REPEAT_PAGE;
|
||||
_end_printed = true;
|
||||
const int err = _start ? _val->first() : _val->next();
|
||||
if (err != NOERR)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((TAssoc_array&) _t[0]).items() > 0)
|
||||
{
|
||||
print_totali(1);
|
||||
print_one(0);
|
||||
}
|
||||
if (((TAssoc_array&) _t[1]).items() > 0)
|
||||
{
|
||||
print_totali_rows(1,1);
|
||||
print_one(0);
|
||||
}
|
||||
}
|
||||
return rt;
|
||||
}
|
||||
|
||||
void TProspettoScadenze::postclose_print()
|
||||
{
|
||||
if (_excel)
|
||||
{
|
||||
TFilename slk; slk.tempdir(); slk.add("prosscad.slk");
|
||||
_recset->save_as(slk, fmt_silk);
|
||||
xvt_sys_goto_url(slk, "open");
|
||||
delete _recset;
|
||||
_recset = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
print_action TProspettoScadenze::postprocess_page(int file, int counter)
|
||||
{
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
bool TProspettoScadenze::user_create()
|
||||
{
|
||||
_rel1 = new TRelation(LF_PARTITE);
|
||||
_rel1->add(LF_CLIFO,"TIPOCF=TIPOC|CODCF=SOTTOCONTO",1);
|
||||
_cur1 = add_cursor(new TCursor(_rel1));
|
||||
_cur2 = add_cursor(new TSorted_cursor(_rel1,"UPPER(20->RAGSOC)||NUMPART","",1));
|
||||
|
||||
_rel2 = new TRelation(LF_PARTITE);
|
||||
_rel2->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO|SOTTOCONTO=SOTTOCONTO",1);
|
||||
_cur3 = add_cursor(new TCursor(_rel2));
|
||||
_cur4 = add_cursor(new TSorted_cursor(_rel2,"UPPER(19->DESCR)|ANNO|NUMPART","",1));
|
||||
|
||||
_scad = new TLocalisamfile(LF_SCADENZE);
|
||||
_pagsca = new TLocalisamfile(LF_PAGSCA);
|
||||
_t.add(new TAssoc_array);_t.add(new TAssoc_array);
|
||||
|
||||
TConfig conf (CONFIG_DITTA,"cg");
|
||||
_m = new TSelection_ext_mask("sc2600a");
|
||||
|
||||
enable_print_menu();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TProspettoScadenze::user_destroy()
|
||||
{
|
||||
if (_rel1) delete _rel1;
|
||||
if (_rel2) delete _rel2;
|
||||
if (_scad) delete _scad;
|
||||
if (_pagsca) delete _pagsca;
|
||||
if (_m) delete _m;
|
||||
_t.destroy();
|
||||
return true;
|
||||
}
|
||||
|
||||
void TProspettoScadenze::riempi_conti_mastro(const char cf)
|
||||
{
|
||||
_conti_cf.destroy();
|
||||
TRelation rel = TRelation(LF_PCON);
|
||||
TString80 filtro;
|
||||
filtro.format("TMCF==\'%c\'", cf);
|
||||
TCursor cur(&rel, filtro);
|
||||
TToken_string gc(10);
|
||||
for (cur=0; cur.pos() < cur.items(); ++cur)
|
||||
{
|
||||
const int g = cur.curr().get_int(PCN_GRUPPO);
|
||||
const int c = cur.curr().get_int(PCN_CONTO);
|
||||
gc.add(g,0);
|
||||
gc.add(c,1);
|
||||
_conti_cf.add(gc);
|
||||
}
|
||||
}
|
||||
|
||||
bool TProspettoScadenze::set_print(int)
|
||||
{
|
||||
KEY k = _m->run();
|
||||
_excel = k != K_ENTER;
|
||||
if (k != K_QUIT)
|
||||
{
|
||||
_codvalsel = _val->get("CODTAB");
|
||||
reset_files();
|
||||
reset_print();
|
||||
printer().footerlen(5);
|
||||
@ -627,20 +539,32 @@ bool TProspettoScadenze::set_print(int)
|
||||
{
|
||||
case clienti:
|
||||
case fornitori:
|
||||
{
|
||||
TString filter;
|
||||
|
||||
filter_from.put("TIPOC", _tipost == clienti ? "C" : "F");
|
||||
filter_to = filter_from;
|
||||
if (_stvaluta)
|
||||
{
|
||||
if (is_firm_value(_codvalsel))
|
||||
filter << "(CODVAL==\"\")||";
|
||||
filter << "(CODVAL==\"" << _codvalsel << "\")";
|
||||
}
|
||||
if (_ordcod) // Per codice...
|
||||
{
|
||||
select_cursor(_cur1);
|
||||
get_cursor(_cur1)->setregion(filter_from, filter_to);
|
||||
get_cursor(_cur1)->setfilter(filter);
|
||||
}
|
||||
else // ... e ragione sociale
|
||||
{
|
||||
select_cursor(_cur2);
|
||||
get_cursor(_cur2)->setregion(filter_from, filter_to);
|
||||
get_cursor(_cur2)->setfilter(filter);
|
||||
}
|
||||
add_file(LF_PARTITE);
|
||||
add_file(LF_CLIFO,LF_PARTITE);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
} // End of inner switch
|
||||
@ -665,9 +589,131 @@ bool TProspettoScadenze::set_print(int)
|
||||
_colnames.add("A Scadere");
|
||||
_recset = new TPRSC_recordset(_colnames);
|
||||
}
|
||||
_start = false ;
|
||||
return true;
|
||||
} // End if
|
||||
return false;
|
||||
}
|
||||
|
||||
print_action TProspettoScadenze::postprocess_print(int file, int counter)
|
||||
{
|
||||
print_action rt = NEXT_PAGE;
|
||||
if (!_end_printed)
|
||||
{
|
||||
if ((file == LF_PARTITE))
|
||||
{
|
||||
rt = REPEAT_PAGE;
|
||||
_end_printed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((TAssoc_array&) _t[0]).items() > 0)
|
||||
{
|
||||
print_totali(1);
|
||||
print_one(0);
|
||||
}
|
||||
if (((TAssoc_array&) _t[1]).items() > 0)
|
||||
{
|
||||
print_totali_rows(1,1);
|
||||
print_one(0);
|
||||
}
|
||||
}
|
||||
return rt;
|
||||
}
|
||||
|
||||
void TProspettoScadenze::postclose_print()
|
||||
{
|
||||
if (_excel)
|
||||
{
|
||||
TFilename slk; slk.tempdir(); slk.add("prosscad.slk");
|
||||
_recset->save_as(slk, fmt_silk);
|
||||
xvt_sys_goto_url(slk, "open");
|
||||
delete _recset;
|
||||
_recset = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void TProspettoScadenze::close_print()
|
||||
{
|
||||
if (_stvaluta)
|
||||
repeat_print();
|
||||
}
|
||||
|
||||
print_action TProspettoScadenze::postprocess_page(int file, int counter)
|
||||
{
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
bool TProspettoScadenze::user_create()
|
||||
{
|
||||
_rel1 = new TRelation(LF_PARTITE);
|
||||
_rel1->add(LF_CLIFO,"TIPOCF=TIPOC|CODCF=SOTTOCONTO",1);
|
||||
_cur1 = add_cursor(new TCursor(_rel1));
|
||||
_cur2 = add_cursor(new TSorted_cursor(_rel1,"UPPER(20->RAGSOC)||NUMPART","",1));
|
||||
|
||||
_rel2 = new TRelation(LF_PARTITE);
|
||||
_rel2->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO|SOTTOCONTO=SOTTOCONTO",1);
|
||||
_cur3 = add_cursor(new TCursor(_rel2));
|
||||
_cur4 = add_cursor(new TSorted_cursor(_rel2,"UPPER(19->DESCR)|ANNO|NUMPART","",1));
|
||||
|
||||
_scad = new TLocalisamfile(LF_SCADENZE);
|
||||
_pagsca = new TLocalisamfile(LF_PAGSCA);
|
||||
_val = new TTable("%VAL");
|
||||
_t.add(new TAssoc_array);_t.add(new TAssoc_array);
|
||||
|
||||
TConfig conf (CONFIG_DITTA,"cg");
|
||||
_m = new TSelection_ext_mask("sc2600a");
|
||||
_m->enable(F_VALUTA,conf.get_bool("GesVal"));
|
||||
_stvaluta = false;
|
||||
_start = true;
|
||||
|
||||
enable_print_menu();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TProspettoScadenze::user_destroy()
|
||||
{
|
||||
if (_rel1) delete _rel1;
|
||||
if (_rel2) delete _rel2;
|
||||
if (_scad) delete _scad;
|
||||
if (_pagsca) delete _pagsca;
|
||||
if (_val) delete _val;
|
||||
if (_m) delete _m;
|
||||
_t.destroy();
|
||||
return true;
|
||||
}
|
||||
|
||||
void TProspettoScadenze::riempi_conti_mastro(const char cf)
|
||||
{
|
||||
_conti_cf.destroy();
|
||||
TRelation rel = TRelation(LF_PCON);
|
||||
TString80 filtro;
|
||||
filtro.format("TMCF==\'%c\'", cf);
|
||||
TCursor cur(&rel, filtro);
|
||||
TToken_string gc(10);
|
||||
for (cur=0; cur.pos() < cur.items(); ++cur)
|
||||
{
|
||||
const int g = cur.curr().get_int(PCN_GRUPPO);
|
||||
const int c = cur.curr().get_int(PCN_CONTO);
|
||||
gc.add(g,0);
|
||||
gc.add(c,1);
|
||||
_conti_cf.add(gc);
|
||||
}
|
||||
}
|
||||
|
||||
bool TProspettoScadenze::set_print(int)
|
||||
{
|
||||
const bool repeat = _stvaluta && need_to_repeat_print();
|
||||
bool print = repeat;
|
||||
|
||||
if (!repeat)
|
||||
{
|
||||
KEY k = _m->run();
|
||||
_excel = k != K_ENTER;
|
||||
print = k != K_QUIT;
|
||||
_start = true;
|
||||
}
|
||||
_stvaluta = _m->get_bool(F_VALUTA);
|
||||
return print;
|
||||
}
|
||||
|
||||
void TProspettoScadenze::print_totali_rows(int nriga, bool what)
|
||||
@ -897,9 +943,13 @@ void TProspettoScadenze::print_header()
|
||||
TString datas = _datas.string();
|
||||
TString limop = _limop.string();
|
||||
TString limscad = _limscad.string();
|
||||
TString s1;
|
||||
|
||||
set_header (soh++, "Ditta : %ld %s@%ldgData %s @%ldgPag. @#",
|
||||
firm, (const char *)s, last_column - 30, (const char *)datas, last_column - 10);
|
||||
if (_stvaluta)
|
||||
s1 << "Valuta : " << _codvalsel << " " << _val->get("S0");
|
||||
|
||||
set_header (soh++, "Ditta : %ld %s@%ldg%s@%ldgData %s @%ldgPag. @#",
|
||||
firm, (const char *)s, (last_column - s1.len()) / 2, (const char *)s1,last_column - 30, (const char *)datas, last_column - 10);
|
||||
|
||||
switch (_tipost)
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define F_DATAOPERAZIONE 104
|
||||
#define F_DATASCADUTO 105
|
||||
#define F_GIORNI 106
|
||||
#define F_VALUTA 107
|
||||
#define F_SCADINFASCE 201
|
||||
#define F_SCADFASCE 202
|
||||
#define F_ASCADINFASCE 203
|
||||
|
@ -67,6 +67,12 @@ BEGIN
|
||||
HELP "Inserire il numero di giorni per il calcolo del rischio"
|
||||
END
|
||||
|
||||
BOOLEAN F_VALUTA
|
||||
BEGIN
|
||||
PROMPT 2 7 "Stampa in valuta"
|
||||
HELP "Selezionare se si vuole la stampa in valuta"
|
||||
END
|
||||
|
||||
RADIOBUTTON SC_CLIFO 20
|
||||
BEGIN
|
||||
PROMPT 1 9 "Selezione"
|
||||
|
Loading…
x
Reference in New Issue
Block a user