Patch level :2.0 nopatch
Files correlati :cm1.exe cm1100a.frm Ricompilazione Demo : [ ] Commento :aggiunti totali di commessa a stampa pagato per commessa git-svn-id: svn://10.65.10.50/trunk@11760 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1ef32ea135
commit
7d41eba786
107
cm/cm1100.cpp
107
cm/cm1100.cpp
@ -56,6 +56,8 @@ public:
|
||||
|
||||
TString _commessa;
|
||||
TCurrency _importocommessa;
|
||||
|
||||
TPag_per_cms_struct() : _tipo(0), _codforn(0), _nreg(0) { }
|
||||
};
|
||||
|
||||
int TPag_per_cms_struct::compare(const TSortable& s) const
|
||||
@ -81,21 +83,33 @@ int TPag_per_cms_struct::compare(const TSortable& s) const
|
||||
return cmp;
|
||||
}
|
||||
|
||||
//===============================================================================================
|
||||
// struct del residuo
|
||||
struct TPag_per_cms_residual : public TObject
|
||||
{
|
||||
TCurrency _fatt, _pag;
|
||||
};
|
||||
|
||||
//===============================================================================================
|
||||
//form
|
||||
class TPag_per_cms_form : public TForm
|
||||
{
|
||||
TArray& _righe; //puntatore all'arrayone dei pagamenti
|
||||
int _curr_pag; //pagamento corrente
|
||||
TAssoc_array _tot_fatt; //assoc_array contenente i movimenti che generano i pagamenti
|
||||
TCurrency _totpagcms; //totale pagamenti sulla commessa
|
||||
|
||||
protected:
|
||||
virtual long records() const {return _righe.items();}
|
||||
bool validate(TForm_item &cf, TToken_string &s);
|
||||
virtual bool validate(TForm_item &cf, TToken_string &s);
|
||||
|
||||
const TString& prev_cms() const;
|
||||
const TString& next_cms() const;
|
||||
int prev_type () const;
|
||||
const TPag_per_cms_struct& curr() const { return(TPag_per_cms_struct&)_righe[_curr_pag]; }
|
||||
void print_title (const char * title);
|
||||
void stampa_totali();
|
||||
void azzera_totali();
|
||||
|
||||
public:
|
||||
void print(const TMask& m);
|
||||
@ -111,6 +125,14 @@ const TString& TPag_per_cms_form::prev_cms() const
|
||||
return prev._commessa;
|
||||
}
|
||||
|
||||
const TString& TPag_per_cms_form::next_cms() const
|
||||
{
|
||||
if (_curr_pag >= _righe.last())
|
||||
return EMPTY_STRING;
|
||||
const TPag_per_cms_struct& next = (const TPag_per_cms_struct&)_righe[_curr_pag+1];
|
||||
return next._commessa;
|
||||
}
|
||||
|
||||
int TPag_per_cms_form::prev_type() const
|
||||
{
|
||||
if (_curr_pag <= 0)
|
||||
@ -128,6 +150,43 @@ void TPag_per_cms_form::print_title (const char * title)
|
||||
printer().print(last_head.row(i));
|
||||
}
|
||||
|
||||
void TPag_per_cms_form::azzera_totali()
|
||||
{
|
||||
_tot_fatt.destroy();
|
||||
_totpagcms = ZERO;
|
||||
}
|
||||
|
||||
void TPag_per_cms_form::stampa_totali()
|
||||
{
|
||||
TPrintrow pr;
|
||||
pr.put("@bTotali per commessa", 21);
|
||||
|
||||
TCurrency tot;
|
||||
FOR_EACH_ASSOC_OBJECT(_tot_fatt, h, k, obj)
|
||||
{
|
||||
const TPag_per_cms_residual* imp = (const TPag_per_cms_residual*)obj;
|
||||
tot += imp->_fatt;
|
||||
}
|
||||
TString80 str;
|
||||
str = tot.string(true);
|
||||
str.right_just(15);
|
||||
pr.put(str, 76);
|
||||
str = _totpagcms.string(true);
|
||||
str.right_just(15);
|
||||
pr.put(str, 93);
|
||||
|
||||
const TCurrency residuo = tot - _totpagcms;
|
||||
if (!residuo.is_zero())
|
||||
{
|
||||
str = residuo.string(true);
|
||||
str.right_just(15);
|
||||
pr.put(str, 109);
|
||||
}
|
||||
|
||||
printer().print(pr);
|
||||
azzera_totali();
|
||||
}
|
||||
|
||||
bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
|
||||
{
|
||||
if (s == "_NEXTPAG")
|
||||
@ -150,8 +209,13 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
|
||||
if (cms != prev_cms())
|
||||
{
|
||||
if (_curr_pag > 0)
|
||||
printer().formfeed();
|
||||
print_title(cms);
|
||||
{
|
||||
stampa_totali();
|
||||
if (_curr_pag < _righe.last()) //se sei all'ultimo movimento non aggiungere pagine vuote
|
||||
printer().formfeed();
|
||||
}
|
||||
if (cms.not_empty())
|
||||
print_title(cms);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -167,6 +231,14 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
|
||||
TString8 str;
|
||||
str << curr()._nreg;
|
||||
cf.set(str);
|
||||
|
||||
TPag_per_cms_residual* mov = (TPag_per_cms_residual*) _tot_fatt.objptr(str);
|
||||
if (mov == NULL)
|
||||
{
|
||||
mov = new TPag_per_cms_residual;
|
||||
mov->_fatt = curr()._importocommessa;
|
||||
_tot_fatt.add(str, mov); //agginge nreg ed importo all'array dei totali
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -223,9 +295,31 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
|
||||
if (s == "_TOTPAG")
|
||||
{
|
||||
cf.set(curr()._importopagato.get_num().string());
|
||||
_totpagcms += curr()._importopagato;
|
||||
|
||||
TString8 str;
|
||||
str << curr()._nreg;
|
||||
|
||||
TPag_per_cms_residual* mov = (TPag_per_cms_residual*) _tot_fatt.objptr(str);
|
||||
if (mov != NULL)
|
||||
mov->_pag += curr()._importopagato;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (s == "_TOTRES")
|
||||
{
|
||||
TString8 str;
|
||||
str << curr()._nreg;
|
||||
|
||||
TCurrency residuo;
|
||||
TPag_per_cms_residual* mov = (TPag_per_cms_residual*) _tot_fatt.objptr(str);
|
||||
if (mov != NULL)
|
||||
residuo = mov->_fatt - mov->_pag; //residuo = totale movimento - quanto e' stato finora pagato del movimento
|
||||
|
||||
cf.set(residuo.get_num().string());
|
||||
return true;
|
||||
}
|
||||
|
||||
return TForm::validate(cf,s);
|
||||
}
|
||||
|
||||
@ -237,7 +331,12 @@ void TPag_per_cms_form::print(const TMask& m)
|
||||
header.find_field(FR_DACDC).set(m.get(F_DACDC));
|
||||
header.find_field(FR_ACDC).set(m.get(F_ACDC));
|
||||
_curr_pag = 0;
|
||||
TForm::print(); //chiama la vera print dopo aver azzerato il contatore
|
||||
azzera_totali();
|
||||
//aggiunge una riga vuota (ppcs vuoto) per forzare il totale dell'ultima commessa
|
||||
TPag_per_cms_struct* ppcs = new TPag_per_cms_struct;
|
||||
_righe.add(ppcs);
|
||||
//chiama la vera print dopo aver azzerato il contatore ed i totali
|
||||
TForm::print();
|
||||
}
|
||||
|
||||
TPag_per_cms_form::TPag_per_cms_form(TArray& pag) :TForm ("cm1100a"), _righe(pag)
|
||||
|
@ -6,5 +6,6 @@
|
||||
#define FR_ACDC 14
|
||||
#define FR_CODCMS 15
|
||||
#define FR_TIPORIGA 16
|
||||
#define FR_DESC 17
|
||||
|
||||
|
||||
|
@ -88,13 +88,19 @@ END
|
||||
STRINGA -1
|
||||
BEGIN
|
||||
KEY "totale fattura"
|
||||
PROMPT 77 6 " Totale fattura"
|
||||
PROMPT 78 6 "@bTotale fattura"
|
||||
END
|
||||
|
||||
STRINGA -1
|
||||
BEGIN
|
||||
KEY "totale pagamento"
|
||||
PROMPT 94 6 "Totale pagamento"
|
||||
PROMPT 94 6 "@bTotale pagamento"
|
||||
END
|
||||
|
||||
STRINGA -1
|
||||
BEGIN
|
||||
KEY "totale residuo"
|
||||
PROMPT 111 6 "@bTotale residuo"
|
||||
END
|
||||
|
||||
END // section header odd
|
||||
@ -179,7 +185,7 @@ BEGIN
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRINGA -1 45
|
||||
STRINGA FR_DESC 45
|
||||
BEGIN
|
||||
KEY "descrizione pagamento"
|
||||
PROMPT 22 1 ""
|
||||
@ -209,6 +215,13 @@ BEGIN
|
||||
MESSAGE _TOTPAG
|
||||
END
|
||||
|
||||
VALUTA -1 15
|
||||
BEGIN
|
||||
KEY "totale residuo"
|
||||
PROMPT 110 1 ""
|
||||
MESSAGE _TOTRES
|
||||
END
|
||||
|
||||
STRINGA -1
|
||||
BEGIN
|
||||
KEY "avanza 1 pagamento"
|
||||
|
Loading…
x
Reference in New Issue
Block a user