Aggiunta la stampa dei solleciti. Estratti alcuni oggetti dalla stampa
dell'estratto conto. Creata la relativa maschera. git-svn-id: svn://10.65.10.50/trunk@2242 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5287fdfa37
commit
a4271cdf75
@ -4,7 +4,7 @@
|
||||
|
||||
#include "sc2.h"
|
||||
|
||||
#define usage "Errore - uso : sc2 -{0|1|2}"
|
||||
#define usage "Errore - uso : sc2 -{0|1|2|3}"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
@ -18,6 +18,8 @@ int main(int argc,char** argv)
|
||||
sc2200(argc,argv); break;
|
||||
case 2:
|
||||
sc2300(argc,argv); break;
|
||||
case 3:
|
||||
sc2400(argc,argv); break;
|
||||
default:
|
||||
error_box(usage);
|
||||
}
|
||||
|
1
sc/sc2.h
1
sc/sc2.h
@ -2,5 +2,6 @@
|
||||
int sc2100(int argc, char** argv);
|
||||
int sc2200(int argc, char** argv);
|
||||
int sc2300(int argc, char** argv);
|
||||
int sc2400(int argc, char** argv);
|
||||
|
||||
|
||||
|
10
sc/sc2.url
10
sc/sc2.url
@ -13,4 +13,14 @@ MENUBAR MENU_BAR(2)
|
||||
MENU MENU_BAR(2)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
MENUBAR MENU_BAR(3)
|
||||
|
||||
MENU MENU_BAR(3)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
MENUBAR MENU_BAR(4)
|
||||
|
||||
MENU MENU_BAR(4)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "../cg/saldacon.h"
|
||||
#include "sc2.h"
|
||||
#include "sc2101.h"
|
||||
#include "sc2102.h"
|
||||
|
||||
#include "sc2100a.h"
|
||||
#include "sc21pec.h"
|
||||
@ -17,36 +18,6 @@
|
||||
#include <pagsca.h>
|
||||
#include <scadenze.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Totalizzatore
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TTotalizer : public TAssoc_array
|
||||
{
|
||||
public:
|
||||
void add(const TImporto& imp, const TString& val);
|
||||
|
||||
TTotalizer() { }
|
||||
virtual ~TTotalizer() { }
|
||||
};
|
||||
|
||||
void TTotalizer::add(const TImporto& imp, const TString& val)
|
||||
{
|
||||
TString16 codice(val);
|
||||
if (codice == "LIT")
|
||||
codice.cut(0);
|
||||
|
||||
TObject* obj = objptr(codice);
|
||||
if (obj != NULL)
|
||||
{
|
||||
TImporto& tot = (TImporto&)*obj;
|
||||
tot += imp;
|
||||
}
|
||||
else
|
||||
{
|
||||
TAssoc_array::add(codice, new TImporto(imp));
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TEC_form
|
||||
@ -468,36 +439,6 @@ TEC_form::~TEC_form()
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFilearray
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TFile_array
|
||||
{
|
||||
TArray _file;
|
||||
|
||||
public:
|
||||
void open(int num, ...);
|
||||
TLocalisamfile& file(int num) const { return (TLocalisamfile&)_file[num]; }
|
||||
TLocalisamfile& operator[](int num) const { return file(num); }
|
||||
|
||||
TFile_array() {}
|
||||
virtual ~TFile_array() {}
|
||||
};
|
||||
|
||||
void TFile_array::open(int logicnum, ...)
|
||||
{
|
||||
va_list marker;
|
||||
va_start(marker, logicnum);
|
||||
while (logicnum > 0)
|
||||
{
|
||||
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
||||
_file.add(new TLocalisamfile(logicnum), logicnum);
|
||||
logicnum = va_arg(marker, int);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Stampa estratti conto
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -681,6 +622,7 @@ bool TStampaEC_application::create()
|
||||
bool TStampaEC_application::destroy()
|
||||
{
|
||||
delete _msk;
|
||||
_file.close();
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
|
50
sc/sc2101.h
50
sc/sc2101.h
@ -1,25 +1,25 @@
|
||||
#ifndef __SC2101_H
|
||||
#define __SC2101_H
|
||||
|
||||
#ifndef __SCSELECT_H
|
||||
#include "scselect.h"
|
||||
#endif
|
||||
|
||||
class TEC_mask : public TSelection_mask
|
||||
{
|
||||
TRelation _ditta;
|
||||
|
||||
protected: // TMask
|
||||
virtual void on_firm_change();
|
||||
virtual void start_run();
|
||||
|
||||
public:
|
||||
const char* get_prof_base() const;
|
||||
const TString& get_prof_code() const;
|
||||
const TString& get_prof_lang() const;
|
||||
|
||||
TEC_mask(const char* name);
|
||||
virtual ~TEC_mask();
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef __SC2101_H
|
||||
#define __SC2101_H
|
||||
|
||||
#ifndef __SCSELECT_H
|
||||
#include "scselect.h"
|
||||
#endif
|
||||
|
||||
class TEC_mask : public TSelection_mask
|
||||
{
|
||||
TRelation _ditta;
|
||||
|
||||
protected: // TMask
|
||||
virtual void on_firm_change();
|
||||
virtual void start_run();
|
||||
|
||||
public:
|
||||
const char* get_prof_base() const;
|
||||
const TString& get_prof_code() const;
|
||||
const TString& get_prof_lang() const;
|
||||
|
||||
TEC_mask(const char* name);
|
||||
virtual ~TEC_mask();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
46
sc/sc2102.cpp
Executable file
46
sc/sc2102.cpp
Executable file
@ -0,0 +1,46 @@
|
||||
|
||||
#include "sc2102.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Totalizzatore
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TTotalizer::add(const TImporto& imp, const TString& val)
|
||||
{
|
||||
TString16 codice(val);
|
||||
if (codice == "LIT")
|
||||
codice.cut(0);
|
||||
|
||||
TObject* obj = objptr(codice);
|
||||
if (obj != NULL)
|
||||
{
|
||||
TImporto& tot = (TImporto&)*obj;
|
||||
tot += imp;
|
||||
}
|
||||
else
|
||||
{
|
||||
TAssoc_array::add(codice, new TImporto(imp));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFilearray
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TFile_array::open(int logicnum, ...)
|
||||
{
|
||||
va_list marker;
|
||||
va_start(marker, logicnum);
|
||||
while (logicnum > 0)
|
||||
{
|
||||
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
||||
_file.add(new TLocalisamfile(logicnum), logicnum);
|
||||
logicnum = va_arg(marker, int);
|
||||
}
|
||||
}
|
||||
|
||||
void TFile_array::close()
|
||||
{
|
||||
_file.destroy();
|
||||
}
|
46
sc/sc2102.h
Executable file
46
sc/sc2102.h
Executable file
@ -0,0 +1,46 @@
|
||||
|
||||
#ifndef __SC2102_H
|
||||
#define __SC2102_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <utility.h>
|
||||
#include <array.h>
|
||||
#include <strings.h>
|
||||
#include <real.h>
|
||||
#include <isam.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Totalizzatore
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TTotalizer : public TAssoc_array
|
||||
{
|
||||
public:
|
||||
void add(const TImporto& imp, const TString& val);
|
||||
|
||||
TTotalizer() { }
|
||||
virtual ~TTotalizer() { }
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TFilearray
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TFile_array
|
||||
{
|
||||
TArray _file;
|
||||
|
||||
public:
|
||||
void open(int num, ...);
|
||||
void close();
|
||||
TLocalisamfile& file(int num) const { return (TLocalisamfile&)_file[num]; }
|
||||
TLocalisamfile& operator[](int num) const { return file(num); }
|
||||
|
||||
TFile_array() {}
|
||||
virtual ~TFile_array() {}
|
||||
};
|
||||
|
||||
#endif // __SC2102_H
|
165
sc/sc2400.cpp
Executable file
165
sc/sc2400.cpp
Executable file
@ -0,0 +1,165 @@
|
||||
|
||||
#include <applicat.h>
|
||||
#include <config.h>
|
||||
#include <form.h>
|
||||
#include <printer.h>
|
||||
#include <tabutil.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include "sc2.h"
|
||||
#include "sc2401.h"
|
||||
#include "sc2402.h"
|
||||
#include "sc2102.h"
|
||||
#include "sc2400a.h"
|
||||
|
||||
#include <clifo.h>
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Stampa solleciti
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TStampaSol_application: public TApplication {
|
||||
TSol_mask *_msk;
|
||||
TSol_form *_form;
|
||||
TString _lingua_ditta;
|
||||
bool _gesval;
|
||||
TFile_array _file;
|
||||
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
virtual void on_firm_change();
|
||||
|
||||
public:
|
||||
TSol_mask &mask() { return *_msk; }
|
||||
TSol_form &form() { return *_form; }
|
||||
TCursor_sheet &sheet() { return _msk->cur_sheet(); }
|
||||
|
||||
bool select_sol(); // metodo per la selezione, punto d'inizio
|
||||
bool print_selected(); // cicla la stampa sugli elementi selezionati
|
||||
bool print_sol(); // stampa l'elemento corrente
|
||||
|
||||
TStampaSol_application();
|
||||
virtual ~TStampaSol_application() {}
|
||||
};
|
||||
|
||||
bool TStampaSol_application::select_sol() {
|
||||
TSol_mask &m= mask();
|
||||
while (m.run() != K_ESC) {
|
||||
_form= new TSol_form(m, F_DATALIMSOL);
|
||||
// !! manca la preparazione della stampa
|
||||
print_selected();
|
||||
delete _form;
|
||||
_form= NULL;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TStampaSol_application::print_selected() {
|
||||
TCursor_sheet &s = sheet();
|
||||
TCursor &c = *s.cursor();
|
||||
|
||||
const char who = mask().get_who();
|
||||
const int key = mask().get_key();
|
||||
|
||||
// filtra il cursore del form in mode che diventi uguale al cursor_sheet corrente
|
||||
TCursor &fc = *form().cursor();
|
||||
fc.setkey(key);
|
||||
TRectype filter(LF_CLIFO);
|
||||
filter.put(CLI_TIPOCF, who);
|
||||
fc.setregion(filter, filter);
|
||||
|
||||
const long print_all = !s.one_checked(); // se non ho selezionato nulla allora li stampo tutti
|
||||
long analfabeti = 0; // persone non stampate in quanto aventi lingua errata
|
||||
|
||||
printer().open();
|
||||
|
||||
const long items = c.items();
|
||||
for (long i=0; i < items; i++) if (print_all || s.checked(i)) {
|
||||
fc= i; // muove il cursore alla posizione corrente
|
||||
const bool ok = print_sol();
|
||||
if (!ok) analfabeti++;
|
||||
}
|
||||
printer().formfeed();
|
||||
printer().close();
|
||||
|
||||
if (analfabeti > 0) {
|
||||
warning_box("%ld clienti non sono stati stampati in quanto "
|
||||
"il codice lingua non corrispondeva al profilo di stampa", analfabeti);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TStampaSol_application::print_sol() {
|
||||
TSol_form &f= form();
|
||||
|
||||
// preparazione variabili per controllo lingua
|
||||
const TRectype &clf= f.cursor()->file().curr();
|
||||
const TString lincf(clf.get(CLI_CODLIN));
|
||||
bool ok= TRUE;
|
||||
|
||||
// controllo lingua ditta corrente
|
||||
if ((f.lingua() == _lingua_ditta && !lincf.empty()) || f.lingua() != _lingua_ditta) ok= (lincf == f.lingua());
|
||||
if (!ok) return FALSE; // cliente analfabeta
|
||||
|
||||
// filtra solo le partite del cliente selezionato
|
||||
TLocalisamfile& partite = _file[LF_PARTITE];
|
||||
partite.zero();
|
||||
partite.put(PART_TIPOCF, clf.get(CLI_TIPOCF));
|
||||
partite.put(PART_SOTTOCONTO, clf.get(CLI_CODCF));
|
||||
const TRectype filter(partite.curr());
|
||||
|
||||
bool one_printed = FALSE; // booleano di controllo di riuscita della stampa
|
||||
|
||||
// !! manca tutta la stampa
|
||||
|
||||
if (one_printed) printer().formfeed();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TStampaSol_application::create() {
|
||||
TApplication::create();
|
||||
|
||||
_file.open(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_MOV, LF_RMOV, 0);
|
||||
_file.open(LF_NDITTE, LF_ANAG, LF_COMUNI, 0);
|
||||
_file.open(LF_CLIFO, LF_PARTITE, LF_SCADENZE, LF_PAGSCA ,0);
|
||||
|
||||
_msk= new TSol_mask("sc2400a");
|
||||
|
||||
dispatch_e_menu(MENU_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TStampaSol_application::destroy() {
|
||||
delete _msk;
|
||||
_file.close();
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
void TStampaSol_application::on_firm_change() {
|
||||
TApplication::on_firm_change();
|
||||
TConfig c(CONFIG_DITTA, "cg");
|
||||
_lingua_ditta= c.get("CodLin");
|
||||
_gesval= c.get_bool("GesVal");
|
||||
}
|
||||
|
||||
bool TStampaSol_application::menu(MENU_TAG m) {
|
||||
select_sol();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TStampaSol_application::TStampaSol_application(): _lingua_ditta(1), _msk(NULL), _form(NULL) {}
|
||||
|
||||
|
||||
|
||||
int sc2400(int argc, char** argv) {
|
||||
TStampaSol_application app;
|
||||
|
||||
app.run(argc, argv, "Stampa solleciti");
|
||||
return 0;
|
||||
}
|
19
sc/sc2400a.h
Executable file
19
sc/sc2400a.h
Executable file
@ -0,0 +1,19 @@
|
||||
#ifndef __SC2400A_H
|
||||
#define __SC2400A_H
|
||||
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_CODPROF 103
|
||||
#define F_LINPROF 104
|
||||
#define F_DESPROF 105
|
||||
#define F_DATALIMSOL 106
|
||||
#define F_STAMPESP 107
|
||||
#define F_IMPORMIN 108
|
||||
#define F_RIFIMPMIN 109
|
||||
#define F_LUOGOSEND 110
|
||||
#define F_DATASEND 111
|
||||
|
||||
// basename of profile
|
||||
#define BASE_EC_PROFILE "PEC"
|
||||
|
||||
#endif
|
154
sc/sc2400a.uml
Executable file
154
sc/sc2400a.uml
Executable file
@ -0,0 +1,154 @@
|
||||
#include "scselmsk.h"
|
||||
#include "sc2400a.h"
|
||||
|
||||
PAGE "Stampa solleciti" -1 -1 68 16
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 1 1 "Cod. "
|
||||
FLAGS "DFR"
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50 46
|
||||
BEGIN
|
||||
PROMPT 15 1 "R.S. "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 68 7
|
||||
BEGIN
|
||||
PROMPT 0 7 ""
|
||||
END
|
||||
|
||||
NUMBER F_CODPROF 4
|
||||
BEGIN
|
||||
PROMPT 1 8 "Profilo "
|
||||
FLAGS "Z"
|
||||
USE LF_FORM
|
||||
INPUT TIPOPROF BASE_EC_PROFILE
|
||||
INPUT CODPROF[1,4] F_CODPROF
|
||||
INPUT CODPROF[5,5] F_LINPROF
|
||||
DISPLAY "Codice" CODPROF
|
||||
DISPLAY "Descrizione@50" DESC
|
||||
OUTPUT F_CODPROF CODPROF[1,4]
|
||||
OUTPUT F_LINPROF CODPROF[5,5]
|
||||
OUTPUT F_DESPROF DESC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_LINPROF 1
|
||||
BEGIN
|
||||
PROMPT 18 8 ""
|
||||
USE %LNG
|
||||
INPUT CODTAB F_LINPROF
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_LINPROF CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESPROF 50 40
|
||||
BEGIN
|
||||
PROMPT 25 8 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE F_DATALIMSOL
|
||||
BEGIN
|
||||
PROMPT 1 9 "Data limite sollecito "
|
||||
FLAGS "A"
|
||||
VALIDATE DATE_CMP_FUNC <= F_DATASEND
|
||||
WARNING "La data limite sollecito non può essere superiore alla data di invio"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_IMPORMIN 18
|
||||
BEGIN
|
||||
PROMPT 1 10 "Importo minimo "
|
||||
END
|
||||
|
||||
RADIOBUTTON F_RIFIMPMIN 10
|
||||
BEGIN
|
||||
PROMPT 45 9 ""
|
||||
ITEM "P|Partita"
|
||||
ITEM "C|Cliente"
|
||||
END
|
||||
|
||||
BOOLEAN F_STAMPESP
|
||||
BEGIN
|
||||
PROMPT 1 11 "Stampa esposizione"
|
||||
END
|
||||
|
||||
STRING F_LUOGOSEND 50 32
|
||||
BEGIN
|
||||
PROMPT 1 12 "Luogo d'invio "
|
||||
END
|
||||
|
||||
DATE F_DATASEND
|
||||
BEGIN
|
||||
PROMPT 50 12 "data "
|
||||
FLAGS "A"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
RADIOBUTTON SC_SORTCF 40
|
||||
BEGIN
|
||||
PROMPT 1 2 "Ordinamento"
|
||||
ITEM "1|Per codice"
|
||||
ITEM "2|Per ragione sociale"
|
||||
END
|
||||
|
||||
BUTTON SC_SELECT 10 1
|
||||
BEGIN
|
||||
PROMPT 50 3 "~Selezione"
|
||||
END
|
||||
|
||||
BUTTON SC_RESET 10 1
|
||||
BEGIN
|
||||
PROMPT 50 4 "~Azzera"
|
||||
END
|
||||
|
||||
NUMBER SC_CFCODFR 5
|
||||
BEGIN
|
||||
PROMPT 1 6 "Da codice "
|
||||
END
|
||||
|
||||
NUMBER SC_CFCODTO 5
|
||||
BEGIN
|
||||
PROMPT 36 6 "a codice "
|
||||
END
|
||||
|
||||
NUMBER SC_NSEL 3
|
||||
BEGIN
|
||||
PROMPT 59 6 "N. "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BUTTON SC_CFBUTFR 2 1
|
||||
BEGIN
|
||||
PROMPT 31 6 ""
|
||||
PICTURE 109
|
||||
END
|
||||
|
||||
BUTTON SC_CFBUTTO 2 1
|
||||
BEGIN
|
||||
PROMPT 51 6 ""
|
||||
PICTURE 109
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
40
sc/sc2401.cpp
Executable file
40
sc/sc2401.cpp
Executable file
@ -0,0 +1,40 @@
|
||||
#include <prefix.h>
|
||||
|
||||
#include "sc2401.h"
|
||||
#include "sc2400a.h"
|
||||
|
||||
#include <comuni.h>
|
||||
|
||||
TSol_mask::TSol_mask(const char *name) : TSelection_mask(name), _ditta(LF_NDITTE) {
|
||||
_ditta.add(LF_ANAG, "TIPOA==TIPOA|CODANAGR==CODANAGR");
|
||||
_ditta.add(LF_COMUNI, "COM==COMRF(COMRES)", 1, LF_ANAG, 101);
|
||||
_ditta.add(LF_COMUNI, "COM==COMRES", 1, LF_ANAG, 102);
|
||||
}
|
||||
|
||||
TSol_mask::~TSol_mask() {}
|
||||
|
||||
void TSol_mask::on_firm_change() {
|
||||
TMask::on_firm_change();
|
||||
|
||||
_ditta[0].put("CODDITTA", prefix().get_codditta());
|
||||
if (_ditta.read() == NOERR) {
|
||||
const int alias = _ditta[LF_ANAG].get_char("TIPOA") == 'F' ? -101 : -102;
|
||||
set(F_LUOGOSEND, _ditta.lfile(alias).get("DENCOM"));
|
||||
}
|
||||
}
|
||||
|
||||
void TSol_mask::start_run() {
|
||||
on_firm_change();
|
||||
}
|
||||
|
||||
const char *TSol_mask::get_prof_base() const {
|
||||
return BASE_EC_PROFILE;
|
||||
}
|
||||
|
||||
const TString &TSol_mask::get_prof_code() const {
|
||||
return get(F_CODPROF);
|
||||
}
|
||||
|
||||
const TString &TSol_mask::get_prof_lang() const {
|
||||
return get(F_LINPROF);
|
||||
}
|
24
sc/sc2401.h
Executable file
24
sc/sc2401.h
Executable file
@ -0,0 +1,24 @@
|
||||
#ifndef __SC2401_H
|
||||
#define __SC2401_H
|
||||
|
||||
#ifndef __SCSELECT_H
|
||||
#include "scselect.h"
|
||||
#endif
|
||||
|
||||
class TSol_mask: public TSelection_mask {
|
||||
TRelation _ditta;
|
||||
|
||||
protected:
|
||||
virtual void on_firm_change();
|
||||
virtual void start_run();
|
||||
|
||||
public:
|
||||
const char *get_prof_base() const;
|
||||
const TString &get_prof_code() const;
|
||||
const TString &get_prof_lang() const;
|
||||
|
||||
TSol_mask(const char *name);
|
||||
virtual ~TSol_mask();
|
||||
};
|
||||
|
||||
#endif // __SC2401_H
|
293
sc/sc2402.cpp
Executable file
293
sc/sc2402.cpp
Executable file
@ -0,0 +1,293 @@
|
||||
|
||||
#include "../cg/saldacon.h"
|
||||
#include <pagsca.h>
|
||||
#include <scadenze.h>
|
||||
#include <partite.h>
|
||||
|
||||
#include "sc21pec.h"
|
||||
#include "sc2102.h"
|
||||
#include "sc2402.h"
|
||||
|
||||
#include <causali.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSol_row
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TSol_row::TSol_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata): _num_prot(0) {
|
||||
_riga = row.get_int(PART_NRIGA);
|
||||
_rata = rata;
|
||||
|
||||
_data = data;
|
||||
_causale = row.get(PART_CODCAUS);
|
||||
_data_doc = row.get(PART_DATADOC);
|
||||
_num_prot = row.get_long(PART_PROTIVA);
|
||||
_importo = imp; _importo.normalize();
|
||||
_totale = row.get_real(PART_IMPTOTPAG);
|
||||
|
||||
_valuta.get(row);
|
||||
}
|
||||
|
||||
TSol_row::TSol_row(const char* desc, const TImporto& imp): _num_prot(0) {
|
||||
_descrizione = desc;
|
||||
_importo = imp; _importo.normalize();
|
||||
}
|
||||
|
||||
// le righe dell'estratto conto sono ordinate per data, riga partita, numero rata,
|
||||
// posizione iniziale nell'array (in caso di uguaglianza di tutto il resto)
|
||||
int TSol_row::compare(const TSortable& s) const {
|
||||
const TSol_row& r = (const TSol_row&)s;
|
||||
int c = 0;
|
||||
if (_data == r._data) {
|
||||
c = r._riga - _riga;
|
||||
if (c == 0) c = r._rata - _rata;
|
||||
} else c = _data < r._data ? +1 : -1;
|
||||
return c;
|
||||
}
|
||||
|
||||
void TSol_row::print_on(TPrint_section& body) {
|
||||
TSol_form& form = (TSol_form&)body.form();
|
||||
|
||||
TForm_item& causale = body.find_field(PEC_CODCAUS);
|
||||
causale.set(_causale);
|
||||
if (_causale.not_empty() && _descrizione.empty()) {
|
||||
TDecoder& causali = form.causali();
|
||||
_descrizione = causali.decode(_causale);
|
||||
}
|
||||
|
||||
TForm_item& descr = body.find_field(PEC_DESCR1);
|
||||
descr.set(_descrizione);
|
||||
|
||||
TForm_item& datadoc = body.find_field(PEC_DATADOC);
|
||||
datadoc.set(_data_doc.string());
|
||||
|
||||
TForm_item& numdoc = body.find_field(PEC_NUMDOC);
|
||||
numdoc.set(_num_doc);
|
||||
|
||||
TForm_item& numprot = body.find_field(PEC_PROTIVA);
|
||||
TString16 protiva; protiva << _num_prot;
|
||||
numprot.set(protiva);
|
||||
|
||||
TForm_item& datapag = body.find_field(PEC_DATAPAG);
|
||||
datapag.set(_data.string());
|
||||
|
||||
const real& imp = _importo.valore();
|
||||
TForm_item& dare = body.find_field(PEC_DARE);
|
||||
TForm_item& avere = body.find_field(PEC_AVERE);
|
||||
|
||||
if (_importo.sezione() == 'D') {
|
||||
dare.set(imp.string());
|
||||
avere.set("");
|
||||
} else {
|
||||
avere.set(imp.string());
|
||||
dare.set("");
|
||||
}
|
||||
|
||||
TForm_item& scaduto = body.find_field(PEC_SCADUTO);
|
||||
scaduto.set(_scaduto.string());
|
||||
|
||||
TForm_item& cambio = body.find_field(PEC_CAMBIO);
|
||||
cambio.set(_valuta.cambio().string());
|
||||
|
||||
TForm_item& datacambio = body.find_field(PEC_DATACAM);
|
||||
datacambio.set(_valuta.data().string());
|
||||
|
||||
body.update();
|
||||
}
|
||||
|
||||
static int val_compare(const void* o1, const void* o2) {
|
||||
const THash_object* h1 = (const THash_object*)o1;
|
||||
const THash_object* h2 = (const THash_object*)o2;
|
||||
const TString& s1 = (const TString&)h1->obj();
|
||||
const TString& s2 = (const TString&)h2->obj();
|
||||
return s2.compare(s1, -1, TRUE); // same as stricmp(s1, s2) in reverse order
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSol_array
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TSol_array::calcola_scaduto(const TRiga_scadenze& rata, real& scaduto) const {
|
||||
const TPartita& game = rata.partita();
|
||||
TImporto imp_scaduto = rata.importo(TRUE);
|
||||
|
||||
const char* const field = rata.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
|
||||
TImporto imp;
|
||||
|
||||
for (int p = rata.last(); p > 0; p = rata.pred(p)) {
|
||||
const TRectype& pag = rata.row(p);
|
||||
const TRiga_partite& sum = game.riga(pag.get_int(PAGSCA_NRIGP));
|
||||
const tipo_movimento tm = sum.tipo();
|
||||
if (tm != tm_insoluto && tm != tm_pagamento_insoluto) {
|
||||
imp.set(sum.sezione(), pag.get_real(field));
|
||||
imp_scaduto += imp;
|
||||
}
|
||||
}
|
||||
const char sezione = game.conto().tipo() == 'C' ? 'D' : 'A';
|
||||
imp_scaduto.normalize(sezione);
|
||||
scaduto = imp_scaduto.valore();
|
||||
}
|
||||
|
||||
TSol_row& TSol_array::new_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int n) {
|
||||
if (n == 0) n = items();
|
||||
TSol_row* riga = new TSol_row(row, data, imp, n);
|
||||
add(riga, n);
|
||||
return *riga;
|
||||
}
|
||||
|
||||
void TSol_array::add_row(const TRiga_partite& row) {
|
||||
if (row.is_fattura()) {
|
||||
for (int r = 1; r <= row.rate(); r++) {
|
||||
const TRiga_scadenze& rata = row.rata(r);
|
||||
const TDate data(rata.get(SCAD_DATASCAD));
|
||||
if (data <= form().data_limite_operazione()) {
|
||||
TSol_row& rec = new_row(row, data, rata.importo(TRUE), r);
|
||||
if (data <= form().data_limite_scaduto()) {
|
||||
real s;
|
||||
calcola_scaduto(rata, s);
|
||||
rec.scaduto(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const TDate data(row.get(PART_DATAPAG));
|
||||
if (data <= form().data_limite_operazione()) {
|
||||
const TImporto imp(row.importo(FALSE, 0x1));
|
||||
new_row(row, data, imp);
|
||||
|
||||
const TImporto abbuoni(row.importo(FALSE, 0x2));
|
||||
if (!abbuoni.is_zero()) {
|
||||
TSol_row& r = new_row(row, data, abbuoni);
|
||||
const TForm_item& desc_abb = form().find_field('B', odd_page, 302);
|
||||
r.descrizione(desc_abb.prompt());
|
||||
}
|
||||
|
||||
const TImporto diffcam(row.importo(FALSE, 0x4));
|
||||
if (!diffcam.is_zero()) {
|
||||
TSol_row& r = new_row(row, data, diffcam);
|
||||
const TForm_item& desc_dif = form().find_field('B', odd_page, 303);
|
||||
r.descrizione(desc_dif.prompt());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TSol_array::TSol_array(const TPartita& game, const TSol_form* f): _form(f) {
|
||||
for (int r = game.last(); r > 0; r = game.pred(r)) add_row(game.riga(r));
|
||||
sort();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSol_form: form speciale per solleciti
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TSol_form* TSol_form::_form = NULL;
|
||||
|
||||
void TSol_form::sol_header_handler(TPrinter& pr) {
|
||||
TPrint_section& head = _form->section('H');
|
||||
head.reset();
|
||||
pr.resetheader();
|
||||
|
||||
head.update();
|
||||
for (word j = 0; j < head.height(); j++) pr.setheaderline(j, head.row(j));
|
||||
}
|
||||
|
||||
void TSol_form::sol_footer_handler(TPrinter& pr) {
|
||||
TPrint_section& foot = _form->section('F');
|
||||
pr.resetfooter();
|
||||
|
||||
const word MAXTOT = 32;
|
||||
THash_object* tot[MAXTOT];
|
||||
|
||||
// i totali sono in un assoc array disordinato per cui li copio in un array e li ordino
|
||||
// alfabeticamente in base al loro codice valuta
|
||||
TTotalizer& totali = _form->totali();
|
||||
totali.restart();
|
||||
|
||||
word numtot = 0;
|
||||
for (THash_object* obj = totali.get_hashobj(); numtot < MAXTOT && obj != NULL; obj = totali.get_hashobj()) tot[numtot++] = obj;
|
||||
qsort(tot, numtot, sizeof(THash_object*), val_compare);
|
||||
|
||||
if (numtot > foot.height()) numtot = foot.height();
|
||||
|
||||
TPrint_section& body = _form->section('B');
|
||||
for (word j = 0; j < numtot; j++) {
|
||||
const TString& key = tot[j]->key();
|
||||
TImporto& imp = (TImporto&)tot[j]->obj();
|
||||
TSol_row r(key, imp.normalize());
|
||||
r.print_on(body);
|
||||
const TPrintrow& ri = body.row(0);
|
||||
pr.setfooterline(j, ri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TSol_form::print_game(const TPartita& game) {
|
||||
bool ok = FALSE;
|
||||
|
||||
TSol_array righe(game, this);
|
||||
|
||||
TPrinter& pr = printer();
|
||||
TPrintrow prow;
|
||||
|
||||
TPrint_section& body = section('B');
|
||||
|
||||
TImporto saldo;
|
||||
|
||||
// stampa le righe di partita
|
||||
for (int r = 0; r < righe.items(); r++) {
|
||||
TSol_row& riga = righe.row(r);
|
||||
|
||||
if (pr.rows_left() < body.height()) pr.formfeed();
|
||||
|
||||
riga.print_on(body);
|
||||
pr.print(body.row(0));
|
||||
|
||||
totali().add(riga.importo(), riga.valuta().codice());
|
||||
|
||||
saldo += riga.importo();
|
||||
ok = TRUE;
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
saldo.normalize();
|
||||
|
||||
const TForm_item& desc_sld = body.find_field(301);
|
||||
TSol_row sld(desc_sld.prompt(), saldo);
|
||||
sld.print_on(body);
|
||||
|
||||
// salta una riga vuota
|
||||
TPrintrow vuota;
|
||||
pr.print(vuota);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
TSol_form::TSol_form(const TSol_mask& m, short datafld): TForm(BASE_EC_PROFILE, m.get_prof_code()), _causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR) {
|
||||
_form = this;
|
||||
|
||||
_lingua = m.get_prof_lang();
|
||||
|
||||
TCursor_sheet& cs = m.cur_sheet();
|
||||
_cursore = cs.cursor();
|
||||
|
||||
_dlo = _dls = m.get(datafld); // prende il campo con la data limite sollecito
|
||||
|
||||
TPrinter& pr = printer();
|
||||
|
||||
pr.setheaderhandler(sol_header_handler);
|
||||
pr.headerlen(section('H').height());
|
||||
|
||||
pr.setfooterhandler(sol_footer_handler);
|
||||
pr.footerlen(section('F').height());
|
||||
}
|
||||
|
||||
TSol_form::~TSol_form() {
|
||||
TPrinter& pr = printer();
|
||||
pr.setheaderhandler(NULL);
|
||||
pr.setfooterhandler(NULL);
|
||||
_form = NULL;
|
||||
}
|
116
sc/sc2402.h
Executable file
116
sc/sc2402.h
Executable file
@ -0,0 +1,116 @@
|
||||
|
||||
#ifndef __SC2402_H
|
||||
#define __SC2402_H
|
||||
|
||||
#include <printer.h>
|
||||
#include <form.h>
|
||||
|
||||
#include "../cg/saldacon.h"
|
||||
#include "sc2102.h"
|
||||
#include "sc2400a.h"
|
||||
#include "sc21pec.h"
|
||||
|
||||
#include "sc2401.h"
|
||||
|
||||
#include <clifo.h>
|
||||
#include <causali.h>
|
||||
#include <pagsca.h>
|
||||
#include <scadenze.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSol_row
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TSol_row : public TSortable {
|
||||
TDate _data;
|
||||
int _riga;
|
||||
int _rata;
|
||||
|
||||
TString _causale;
|
||||
TString _descrizione;
|
||||
|
||||
TDate _data_doc;
|
||||
TString _num_doc;
|
||||
long _num_prot;
|
||||
TImporto _importo;
|
||||
TImporto _importo_lire;
|
||||
real _scaduto;
|
||||
real _totale;
|
||||
TValuta _valuta;
|
||||
|
||||
protected: // TSortable
|
||||
virtual int compare(const TSortable& s) const;
|
||||
|
||||
public:
|
||||
void descrizione(const char* s) { _descrizione = s; }
|
||||
void scaduto(const real& s) { _scaduto = s; }
|
||||
|
||||
const TValuta& valuta() const { return _valuta; }
|
||||
const TImporto& importo() const { return _importo; }
|
||||
const TDate& data() const { return _data; }
|
||||
|
||||
void print_on(TPrint_section& body);
|
||||
|
||||
TSol_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata);
|
||||
TSol_row(const char* desc, const TImporto& imp);
|
||||
virtual ~TSol_row() {}
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSol_form: form speciale per estratti conto
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TSol_form : public TForm {
|
||||
static TSol_form* _form;
|
||||
|
||||
TCursor* _cursore;
|
||||
TTotalizer _totali;
|
||||
TDecoder _causali;
|
||||
|
||||
TString _lingua;
|
||||
TDate _dlo, _dls;
|
||||
|
||||
protected:
|
||||
static void sol_header_handler(TPrinter& p);
|
||||
static void sol_footer_handler(TPrinter& p);
|
||||
|
||||
public:
|
||||
TTotalizer& totali() { return _totali; }
|
||||
TDecoder& causali() { return _causali; }
|
||||
|
||||
const TDate& data_limite_operazione() const { return _dlo; }
|
||||
const TDate& data_limite_scaduto() const { return _dls; }
|
||||
const TString& lingua() const { return _lingua; }
|
||||
|
||||
bool print_game(const TPartita& game);
|
||||
|
||||
TSol_form(const TSol_mask& m, short datafld);
|
||||
virtual ~TSol_form();
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TSol_array
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TSol_array : public TArray {
|
||||
const TSol_form* _form;
|
||||
|
||||
protected:
|
||||
TSol_row& new_row(const TRiga_partite& row, const TDate& data, const TImporto& imp, int rata = 0);
|
||||
void add_row(const TRiga_partite& row);
|
||||
|
||||
const TSol_form& form() const { return *_form; }
|
||||
void calcola_scaduto(const TRiga_scadenze& rata, real& scaduto) const;
|
||||
|
||||
public:
|
||||
TSol_row& row(int r) const { return (TSol_row&)operator[](r); }
|
||||
|
||||
TSol_array(const TPartita& game, const TSol_form* f);
|
||||
virtual ~TSol_array() {}
|
||||
};
|
||||
|
||||
|
||||
#endif // __SC2402_H
|
Loading…
x
Reference in New Issue
Block a user