Abilitata stampa estratto conto di conti normali (non solo clifo)
git-svn-id: svn://10.65.10.50/branches/R_10_00@22944 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a2491d98ed
commit
d19f6148e1
@ -366,7 +366,8 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
// La validità di tutti questi campi è già garantita dai controlli di msk
|
||||
const char tipo_cf = msk.get(F_TIPOCF)[0];
|
||||
const TDate datareg = msk.get(F_DATAREG);
|
||||
const TDate datacomp = msk.get(F_DATACOMP);
|
||||
TDate datacomp = msk.get(F_DATACOMP);
|
||||
if (!datacomp.ok()) datacomp = datareg;
|
||||
const TValuta valuta(msk, F_CODVAL, F_DATACAMBIO, F_CAMBIO);
|
||||
|
||||
TEsercizi_contabili esc;
|
||||
@ -384,6 +385,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
TMovimentoPN mov;
|
||||
TRectype& head = mov.curr();
|
||||
head.put(MOV_CODCAUS, msk.get(F_CAUSALE));
|
||||
head.put(MOV_TIPOMOV, tm_pagamento);
|
||||
head.put(MOV_DATAREG, datareg);
|
||||
head.put(MOV_DATACOMP, datacomp);
|
||||
head.put(MOV_ANNOIVA, datareg.year());
|
||||
@ -424,6 +426,13 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
TRectype& new_rmov = mov.cg(-1);
|
||||
bill.put(new_rmov);
|
||||
new_rmov.put(RMV_ROWTYPE, 'K');
|
||||
new_rmov.put(RMV_ANNOES, annoes);
|
||||
new_rmov.put(RMV_DATAREG, datareg);
|
||||
|
||||
msg = TR("Saldo partita ");
|
||||
msg << game.anno() << '/' << game.numero();
|
||||
new_rmov.put(RMV_DESCR, msg);
|
||||
|
||||
last_clifo = bill;
|
||||
}
|
||||
if (!genera_abbuono(game, nriga, nrata, mov, log))
|
||||
@ -453,6 +462,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
rmov.put(RMV_SEZIONE, imp.sezione());
|
||||
rmov.put(RMV_IMPORTO, imp.valore());
|
||||
rmov.put(RMV_ANNOES, annoes);
|
||||
rmov.put(RMV_DATAREG, datareg);
|
||||
}
|
||||
if (!banca.is_zero())
|
||||
{
|
||||
@ -463,6 +473,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
rmov.put(RMV_SEZIONE, banca.sezione());
|
||||
rmov.put(RMV_IMPORTO, banca.valore());
|
||||
rmov.put(RMV_ANNOES, annoes);
|
||||
rmov.put(RMV_DATAREG, datareg);
|
||||
conto_abbuoni.put(rmov);
|
||||
|
||||
mov.curr().add(MOV_TOTDOC, -banca.valore());
|
||||
@ -476,6 +487,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
rmov.put(RMV_SEZIONE, abbuoni.sezione());
|
||||
rmov.put(RMV_IMPORTO, abbuoni.valore());
|
||||
rmov.put(RMV_ANNOES, annoes);
|
||||
rmov.put(RMV_DATAREG, datareg);
|
||||
conto_abbuoni.put(rmov);
|
||||
}
|
||||
if (!diffcam.is_zero())
|
||||
@ -487,6 +499,7 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
rmov.put(RMV_SEZIONE, diffcam.sezione());
|
||||
rmov.put(RMV_IMPORTO, diffcam.valore());
|
||||
rmov.put(RMV_ANNOES, annoes);
|
||||
rmov.put(RMV_DATAREG, datareg);
|
||||
conto_diffcam.put(rmov);
|
||||
}
|
||||
|
||||
@ -494,11 +507,18 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
{
|
||||
if (mov.rewrite() == NOERR)
|
||||
{
|
||||
partite.write(true);
|
||||
|
||||
log.log(0, msg.cut(0));
|
||||
msg << TR("Aggiornato saldaconto legato al movimento n.") << numreg;
|
||||
log.log(1, msg);
|
||||
if (partite.write(true))
|
||||
{
|
||||
msg << TR("Aggiornato saldaconto legato al movimento n.") << numreg;
|
||||
log.log(1, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg << TR("Errore in aggiornamento saldaconto legato al movimento n.") << numreg;
|
||||
log.log(2, msg);
|
||||
can_write = false;
|
||||
}
|
||||
|
||||
TSaldo_agg sa;
|
||||
for (int i = 0; i < mov.cg_items(); i++)
|
||||
@ -506,13 +526,11 @@ bool TAbbuona_partite::elabora(const TMask& msk, TAbbuona_sheet& scad_sheet) con
|
||||
const TRectype& rmov = mov.cg(i);
|
||||
sa.aggiorna(rmov);
|
||||
}
|
||||
sa.set_num_ulmov(mov.curr().get_long(MOV_NUMREG));
|
||||
sa.set_data_ulmov(mov.curr().get_date(MOV_DATAREG));
|
||||
sa.registra();
|
||||
}
|
||||
else
|
||||
{
|
||||
log.log(2, "Impossibile aggiornare il saldaconto");
|
||||
log.log(2, "Impossibile aggiornare il movimento");
|
||||
can_write = false;
|
||||
}
|
||||
}
|
||||
|
150
sc/sc2100.cpp
150
sc/sc2100.cpp
@ -20,17 +20,32 @@
|
||||
#include <cfven.h>
|
||||
#include <causali.h>
|
||||
#include <mov.h>
|
||||
#include <pconti.h>
|
||||
|
||||
class TEC_recordset : public TAS400_recordset
|
||||
{
|
||||
char _who;
|
||||
|
||||
public:
|
||||
TEC_recordset();
|
||||
char get_who() const { return _who; }
|
||||
TEC_recordset(const char who);
|
||||
};
|
||||
|
||||
TEC_recordset::TEC_recordset() : TAS400_recordset("AS400(255,0,0)")
|
||||
TEC_recordset::TEC_recordset(char who) : TAS400_recordset("AS400(255,0,0)"), _who(who)
|
||||
{
|
||||
create_field("Cliente", 0, 6, _longfld);
|
||||
create_field("RagioneSociale", -1, 50);
|
||||
if (who >= 'C')
|
||||
{
|
||||
if (who == 'F')
|
||||
create_field("Fornitore", 0, 6, _longfld);
|
||||
else
|
||||
create_field("Cliente", 0, 6, _longfld);
|
||||
create_field("RagioneSociale", -1, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
create_field("Conto", 0, 12, _alfafld);
|
||||
create_field("Denominazione", -1, 50);
|
||||
}
|
||||
create_field("Telefono", -1, 20);
|
||||
create_field("Valuta", -1, 3);
|
||||
create_field("Causale", -1, 3);
|
||||
@ -91,7 +106,10 @@ protected:
|
||||
static void ec_footer_handler(TPrinter& p);
|
||||
|
||||
public:
|
||||
TTotalizer& totali() { return _totali; }
|
||||
TTotalizer& totali() { return _totali; }
|
||||
|
||||
virtual TRelation* relation() const { return _cursore->relation(); }
|
||||
virtual TCursor* cursor() { return _cursore; }
|
||||
|
||||
const TDate& data_limite_operazione() const { return _dlo; }
|
||||
const TDate& data_limite_scaduto() const { return _dls; }
|
||||
@ -115,7 +133,7 @@ public:
|
||||
bool exporting() const { return _recordset != NULL; }
|
||||
void export_total();
|
||||
|
||||
TEC_recordset& recordset() const { CHECK(exporting(),"Not exporting"); return *_recordset; }
|
||||
TEC_recordset& recordset() const { CHECK(exporting(), "Not exporting"); return *_recordset; }
|
||||
|
||||
TEC_form(const TEC_mask& m, bool gesval, bool excel);
|
||||
virtual ~TEC_form();
|
||||
@ -130,6 +148,7 @@ TEC_form* TEC_form::_form = NULL;
|
||||
|
||||
static char __ltipocf;
|
||||
static long __lcodcf;
|
||||
static int __lgruppo, __lconto;
|
||||
|
||||
class TEC_row : public TSortable
|
||||
{
|
||||
@ -142,6 +161,7 @@ class TEC_row : public TSortable
|
||||
|
||||
char _tipocf;
|
||||
long _codcf;
|
||||
int _gruppo, _conto; // Solo per conti ver, altrimenti 0
|
||||
|
||||
TDate _data_doc; // Data del documento
|
||||
TString _num_doc; // Numero documento
|
||||
@ -221,6 +241,16 @@ TEC_row::TEC_row(const TRiga_partite& row, const TDate& data, const TImporto& im
|
||||
_totale = row.get_real(field);
|
||||
__ltipocf = _tipocf = row.get_char(PART_TIPOCF);
|
||||
__lcodcf = _codcf = row.get_long(PART_SOTTOCONTO);
|
||||
if (_tipocf < 'C')
|
||||
{
|
||||
__lgruppo = _gruppo = row.get_int(PART_GRUPPO);
|
||||
__lconto = _conto = row.get_int(PART_CONTO);
|
||||
}
|
||||
else
|
||||
{
|
||||
__lgruppo = _gruppo = 0;
|
||||
__lconto = _conto = 0;
|
||||
}
|
||||
}
|
||||
|
||||
TEC_row::TEC_row(const char* desc, const TImporto& imp, const TValuta& val)
|
||||
@ -232,6 +262,8 @@ TEC_row::TEC_row(const char* desc, const TImporto& imp, const TValuta& val)
|
||||
_valuta = val;
|
||||
_tipocf = __ltipocf;
|
||||
_codcf = __lcodcf;
|
||||
_gruppo = __lgruppo;
|
||||
_conto = __lconto;
|
||||
}
|
||||
|
||||
// Le righe dell'estratto conto sono ordinate per data, riga partita, numero rata o
|
||||
@ -374,24 +406,33 @@ void TEC_row::print_on(TPrint_section& body)
|
||||
void TEC_row::export_to(TEC_recordset& r)
|
||||
{
|
||||
r.new_rec();
|
||||
r.set("Cliente", TVariant(_codcf));
|
||||
|
||||
TString key; key.format("%c|%ld", _tipocf, _codcf);
|
||||
const TString & ragsoc = cache().get(LF_CLIFO, key, CLI_RAGSOC);
|
||||
if (_tipocf >= 'C')
|
||||
{
|
||||
r.set(0u, _codcf);
|
||||
TString8 key; key.format("%c|%ld", _tipocf, _codcf);
|
||||
const TString& ragsoc = cache().get(LF_CLIFO, key, CLI_RAGSOC);
|
||||
r.set("RagioneSociale", TVariant(ragsoc));
|
||||
|
||||
r.set("RagioneSociale", TVariant(ragsoc));
|
||||
TString80 telefono = cache().get(LF_CLIFO, key, CLI_PTEL);
|
||||
telefono << " " << cache().get(LF_CLIFO, key, CLI_TEL);
|
||||
r.set("Telefono", TVariant(telefono));
|
||||
}
|
||||
else
|
||||
{
|
||||
TString16 key; key.format("%03d%03d%06ld", _gruppo, _conto, _codcf);
|
||||
r.set(0u, key);
|
||||
const TString& descr = cache().get(LF_PCON, key, PCN_DESCR);
|
||||
r.set(1u, descr);
|
||||
}
|
||||
|
||||
TString80 telefono = cache().get(LF_CLIFO, key, CLI_PTEL);
|
||||
|
||||
telefono << " " << cache().get(LF_CLIFO, key, CLI_TEL);
|
||||
r.set("Telefono", TVariant(telefono));
|
||||
r.set("Valuta", TVariant(_valuta.codice()));
|
||||
r.set("Causale", TVariant(_causale));
|
||||
r.set("Descrizione", TVariant(_descrizione));
|
||||
r.set("DataDoc", TVariant(_data_doc));
|
||||
r.set("NumDoc", TVariant(_num_doc));
|
||||
r.set("ProtIVA", TVariant(_num_prot));
|
||||
r.set("DataPag", TVariant(_data));
|
||||
r.set("DataScad", TVariant(_data));
|
||||
r.set("DataPag", TVariant(_data));
|
||||
r.set(_importo.sezione() == 'D' ? "Dare" : "Avere", _importo.valore());
|
||||
r.set("Scaduto", TVariant(_scaduto));
|
||||
r.set("Esposto", TVariant(_esposto));
|
||||
@ -1321,7 +1362,16 @@ TEC_form::TEC_form(const TEC_mask& m, bool gesval, bool excel)
|
||||
_form = this;
|
||||
|
||||
TCursor_sheet& cs = m.cur_sheet();
|
||||
_cursore = cs.cursor();
|
||||
_cursore = cs.cursor();
|
||||
|
||||
if (relation()->log2ind(LF_COMUNI) < 0)
|
||||
{
|
||||
if (relation()->file().num() == LF_CLIFO)
|
||||
relation()->add(LF_COMUNI, "STATO==STATOCF|COM==COMCF");
|
||||
else
|
||||
relation()->add(LF_COMUNI, "COM=\"\"");
|
||||
}
|
||||
|
||||
|
||||
_lingua = m.get_prof_lang(); // Lingua profilo
|
||||
_dlo = m.get(F_DATALIMOP);
|
||||
@ -1397,7 +1447,7 @@ TEC_form::TEC_form(const TEC_mask& m, bool gesval, bool excel)
|
||||
_maxtot = max;
|
||||
}
|
||||
else
|
||||
_recordset = new TEC_recordset;
|
||||
_recordset = new TEC_recordset(m.get_who());
|
||||
}
|
||||
|
||||
TEC_form::~TEC_form()
|
||||
@ -1511,20 +1561,27 @@ public:
|
||||
|
||||
bool TStampaEC_application::print_selected()
|
||||
{
|
||||
TCursor_sheet& s = sheet();
|
||||
TCursor& c = *s.cursor();
|
||||
|
||||
const char who = mask().get_who();
|
||||
|
||||
TCursor_sheet& s = sheet();
|
||||
TCursor& c = *s.cursor(); // Il cursore del form coincide con quello dello sheet
|
||||
|
||||
/*
|
||||
const int key = mask().get_key();
|
||||
|
||||
// Filtra il cursore del form in modo che diventi uguale al cursor_sheet corrente
|
||||
// Qui sarebbe bello copiarsi l'indice dell'altro cursore
|
||||
TCursor& fc = *form().cursor();
|
||||
fc.setkey(key);
|
||||
TRectype filter(LF_CLIFO);
|
||||
filter.put(CLI_TIPOCF, who);
|
||||
fc.setregion(filter, filter);
|
||||
|
||||
if (who >= 'C')
|
||||
{
|
||||
TRectype filter = fc.curr(); filter.zero();
|
||||
filter.put(CLI_TIPOCF, who);
|
||||
fc.setregion(filter, filter);
|
||||
}
|
||||
*/
|
||||
|
||||
form().set_agente(EMPTY_STRING); // Nascondi agente
|
||||
|
||||
const long print_all = !s.one_checked(); // Se non ho selezionato nulla allora li stampo tutti
|
||||
@ -1532,17 +1589,17 @@ bool TStampaEC_application::print_selected()
|
||||
const bool printing = form().printing();
|
||||
const long items = c.items();
|
||||
|
||||
TProgind* pi = NULL;
|
||||
TProgress_monitor* pi = NULL;
|
||||
if (printing)
|
||||
printer().open();
|
||||
else
|
||||
pi = new TProgind(items, TR("Calcolo estratto conto"), true, true);
|
||||
pi = new TProgress_monitor(items, TR("Calcolo estratto conto"));
|
||||
|
||||
for (long i = 0; i < items; i++)
|
||||
{
|
||||
if (print_all || s.checked(i))
|
||||
{
|
||||
fc = i; // Muove il cursore alla posizione corrente
|
||||
c = i; // Muove il cursore alla posizione corrente
|
||||
const int ret = print_ec();
|
||||
if (ret < 0)
|
||||
analfabeti++;
|
||||
@ -1638,14 +1695,19 @@ void TStampaEC_application::find_agents_scads(TAssoc_array& agents)
|
||||
|
||||
void TStampaEC_application::find_agents_unassigned_pags(TAssoc_array& agents)
|
||||
{
|
||||
const TString& fromage = mask().get(F_FROM_AGENT);
|
||||
const TString& toage = mask().get(F_TO_AGENT);
|
||||
const long fromcli = mask().get_long(SC_CFCODFR);
|
||||
const long tocli = mask().get_long(SC_CFCODTO);
|
||||
TEC_mask& m = mask();
|
||||
const char tipocf = m.get(SC_CLIFO)[0];
|
||||
if (tipocf < 'C')
|
||||
return;
|
||||
|
||||
const TString& fromage = m.get(F_FROM_AGENT);
|
||||
const TString& toage = m.get(F_TO_AGENT);
|
||||
const long fromcli = m.get_long(SC_CFCODFR);
|
||||
const long tocli = m.get_long(SC_CFCODTO);
|
||||
|
||||
TRelation rel(LF_PAGSCA);
|
||||
TRectype& curr = rel.curr();
|
||||
curr.put(PAGSCA_TIPOC, mask().get(SC_CLIFO)); // Imposta C o F
|
||||
curr.put(PAGSCA_TIPOC, tipocf); // Imposta C o F
|
||||
|
||||
TRectype recfr(curr), recto(curr);
|
||||
if (fromcli > 0)
|
||||
@ -1771,8 +1833,8 @@ bool TStampaEC_application::print_agents()
|
||||
if (analfabeti > 0)
|
||||
{
|
||||
const char* anag = who == 'C' ? TR("clienti") : TR("fornitori");
|
||||
warning_box(FR("%ld %s non sono stati stampati in quanto "
|
||||
"il codice lingua non corrispondeva al profilo di stampa"),
|
||||
warning_box(FR("%ld %s non sono stati stampati, avendo "
|
||||
"il codice lingua non corrispondente al profilo di stampa"),
|
||||
analfabeti, anag);
|
||||
}
|
||||
}
|
||||
@ -1834,7 +1896,7 @@ void TStampaEC_application::save_numec()
|
||||
|
||||
void TStampaEC_application::update_numec(const TRectype& clf, int sign)
|
||||
{
|
||||
const char tipocf = clf.get_char(CLI_TIPOCF);
|
||||
const char tipocf = clf.exist(CLI_TIPOCF) ? clf.get_char(CLI_TIPOCF) : ' ';
|
||||
if (_tiponumec > ' ' && tipocf == 'C' && form().printing())
|
||||
{
|
||||
TForm_item& nec = form().find_field('H', odd_page, PEC_NUMPROG);
|
||||
@ -1887,7 +1949,7 @@ int TStampaEC_application::print_ec(TEC_Game_list* games)
|
||||
|
||||
const TRectype& clf = f.cursor()->curr();
|
||||
|
||||
if (printing)
|
||||
if (printing && clf.num() == LF_CLIFO)
|
||||
{
|
||||
// make controllations per lingua profilo/CF
|
||||
const TString& lincf = clf.get(CLI_CODLIN);
|
||||
@ -1904,8 +1966,18 @@ int TStampaEC_application::print_ec(TEC_Game_list* games)
|
||||
// Filtra solo le partite del cliente selezionato
|
||||
TRelation rel(LF_PARTITE);
|
||||
TRectype& curr = rel.curr();
|
||||
curr.put(PART_TIPOCF, clf.get(CLI_TIPOCF));
|
||||
curr.put(PART_SOTTOCONTO, clf.get(CLI_CODCF));
|
||||
if (clf.num() == LF_CLIFO)
|
||||
{
|
||||
curr.put(PART_TIPOCF, clf.get(CLI_TIPOCF));
|
||||
curr.put(PART_SOTTOCONTO, clf.get(CLI_CODCF));
|
||||
}
|
||||
else
|
||||
{
|
||||
curr.zero(PART_TIPOCF);
|
||||
curr.put(PART_GRUPPO, clf.get(PCN_GRUPPO));
|
||||
curr.put(PART_CONTO, clf.get(PCN_CONTO));
|
||||
curr.put(PART_SOTTOCONTO, clf.get(PCN_SOTTOCONTO));
|
||||
}
|
||||
TCursor cur(&rel, "", 1, &curr, &curr);
|
||||
|
||||
const long items = cur.items();
|
||||
@ -1918,7 +1990,7 @@ int TStampaEC_application::print_ec(TEC_Game_list* games)
|
||||
|
||||
int printed = 0; // Non ho stampato ancora nulla
|
||||
|
||||
if (printing)
|
||||
if (printing && clf.num() == LF_CLIFO)
|
||||
update_numec(clf, +1); // Incrementa contatore
|
||||
|
||||
TString8 last_game;
|
||||
|
@ -138,15 +138,16 @@ END
|
||||
RADIOBUTTON SC_CLIFO 20
|
||||
BEGIN
|
||||
PROMPT 1 10 "@bSelezione"
|
||||
ITEM "C|Clienti" MESSAGE ENABLE,1@
|
||||
ITEM "F|Fornitori" MESSAGE CLEAR,1@
|
||||
ITEM "C|Clienti" MESSAGE ENABLE,1@|ENABLE,3@
|
||||
ITEM "F|Fornitori" MESSAGE CLEAR,1@|ENABLE,3@
|
||||
ITEM " |Conti" MESSAGE CLEAR,1@|DISABLE,3@
|
||||
END
|
||||
|
||||
RADIOBUTTON SC_SORTCF 25
|
||||
BEGIN
|
||||
PROMPT 25 10 "@bOrdinamento"
|
||||
ITEM "1|Per codice" MESSAGE HIDE,2@|SHOW,3@
|
||||
ITEM "2|Per ragione sociale" MESSAGE HIDE,3@|SHOW,2@
|
||||
ITEM "2|Per denominazione" MESSAGE HIDE,3@|SHOW,2@
|
||||
END
|
||||
|
||||
BUTTON SC_SELECT 10 1
|
||||
@ -168,42 +169,42 @@ END
|
||||
|
||||
NUMBER SC_CFCODFR 6
|
||||
BEGIN
|
||||
PROMPT 2 14 "Da codice "
|
||||
PROMPT 2 15 "Da codice "
|
||||
GROUP 3
|
||||
FLAGS "B"
|
||||
END
|
||||
|
||||
NUMBER SC_CFCODTO 6
|
||||
BEGIN
|
||||
PROMPT 37 14 "a codice "
|
||||
PROMPT 37 15 "a codice "
|
||||
GROUP 3
|
||||
FLAGS "B"
|
||||
END
|
||||
|
||||
STRING SC_CFDESFR 50
|
||||
BEGIN
|
||||
PROMPT 2 14 "Da ragione sociale "
|
||||
PROMPT 2 15 "Da denominazione "
|
||||
GROUP 2
|
||||
FLAGS "HB"
|
||||
END
|
||||
|
||||
STRING SC_CFDESTO 50
|
||||
BEGIN
|
||||
PROMPT 2 15 "A ragione sociale "
|
||||
PROMPT 2 16 "A denominazione "
|
||||
GROUP 2
|
||||
FLAGS "HB"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUPAGENT
|
||||
BEGIN
|
||||
PROMPT 2 16 "Raggruppamento per agente"
|
||||
PROMPT 2 17 "Raggruppamento per agente"
|
||||
MESSAGE FALSE HIDE,5@
|
||||
MESSAGE TRUE SHOW,5@
|
||||
END
|
||||
|
||||
STRING F_FROM_AGENT 5
|
||||
BEGIN
|
||||
PROMPT 2 17 "Dall'agente "
|
||||
PROMPT 2 18 "Dall'agente "
|
||||
FLAGS "HZU"
|
||||
USE LF_AGENTI
|
||||
INPUT CODAGE F_FROM_AGENT
|
||||
@ -217,7 +218,7 @@ END
|
||||
|
||||
STRING F_FROM_AGENT_D 50
|
||||
BEGIN
|
||||
PROMPT 22 17 ""
|
||||
PROMPT 22 18 ""
|
||||
FLAGS "H"
|
||||
USE LF_AGENTI KEY 2
|
||||
INPUT RAGSOC F_FROM_AGENT_D
|
||||
@ -230,7 +231,7 @@ END
|
||||
|
||||
STRING F_TO_AGENT 5
|
||||
BEGIN
|
||||
PROMPT 2 18 "All'agente "
|
||||
PROMPT 2 19 "All'agente "
|
||||
FLAGS "HZU"
|
||||
COPY USE F_FROM_AGENT
|
||||
INPUT CODAGE F_TO_AGENT
|
||||
@ -243,7 +244,7 @@ END
|
||||
|
||||
STRING F_TO_AGENT_D 50
|
||||
BEGIN
|
||||
PROMPT 22 18 ""
|
||||
PROMPT 22 19 ""
|
||||
FLAGS "H"
|
||||
COPY USE F_FROM_AGENT_D
|
||||
INPUT RAGSOC F_TO_AGENT_D
|
||||
|
@ -180,9 +180,14 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
BUTTON 100 10 2
|
||||
BEGIN
|
||||
PROMPT -14 -1 "Dettaglio"
|
||||
PICTURE TOOL_EDIT
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
|
100
sc/scselect.cpp
100
sc/scselect.cpp
@ -1,12 +1,13 @@
|
||||
#include <defmask.h>
|
||||
|
||||
#include "../cg/cglib01.h"
|
||||
#include "scselect.h"
|
||||
|
||||
#include "scselect.h"
|
||||
#include <pconti.h>
|
||||
|
||||
TSelection_mask::TSelection_mask(const char* name)
|
||||
: TMask(name), _who('C'), _key(1), _clifo_rel(NULL),
|
||||
_cli_cur_k1(NULL), _cli_cur_k2(NULL), _for_cur_k1(NULL), _for_cur_k2(NULL)
|
||||
: TMask(name), _who('C'), _key(1), _clifo_rel(NULL), _pdc_rel(NULL),
|
||||
_cli_cur_k1(NULL), _cli_cur_k2(NULL), _for_cur_k1(NULL), _for_cur_k2(NULL),
|
||||
_pdc_cur_k1(NULL), _pdc_cur_k2(NULL)
|
||||
{
|
||||
// crea relazioni, cursori e cursor_sheets
|
||||
_clifo_rel = new TRelation(LF_CLIFO);
|
||||
@ -37,7 +38,27 @@ TSelection_mask::TSelection_mask(const char* name)
|
||||
_for_cur_k2 = NULL;
|
||||
_for_sh_k1 = NULL;
|
||||
_for_sh_k2 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (id2pos(SC_CLIFO) >= 0 && TToken_string(lfield(SC_CLIFO).get_codes()).items()>2)
|
||||
{
|
||||
_pdc_rel = new TRelation(LF_PCON);
|
||||
TRectype& filter = _pdc_rel->curr();
|
||||
_pdc_cur_k1 = new TCursor(_pdc_rel, "", 1, &filter, &filter);
|
||||
_pdc_cur_k2 = new TCursor(_pdc_rel, "", 2, &filter, &filter);
|
||||
_pdc_sh_k1 = new TCursor_sheet(_pdc_cur_k1, " |GRUPPO|CONTO|SOTTOCONTO|DESCR", "Selezione conti per codice",
|
||||
"@1|Gruppo|Conto|Sottoconto|Descrizione@50",0,1);
|
||||
_pdc_sh_k2 = new TCursor_sheet(_pdc_cur_k2, " |DESCR|GRUPPO|CONTO|SOTTOCONTO", "Selezione conti per descrizione",
|
||||
"@1|Descrizione@50|Gruppo|Conto|Sottoconto",0,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pdc_rel = NULL;
|
||||
_pdc_cur_k1 = NULL;
|
||||
_pdc_cur_k2 = NULL;
|
||||
_pdc_sh_k1 = NULL;
|
||||
_pdc_sh_k2 = NULL;
|
||||
}
|
||||
|
||||
set_handler(SC_CLIFO, rclifo_handler);
|
||||
set_handler(SC_SORTCF, rsortcf_handler);
|
||||
@ -51,6 +72,15 @@ TSelection_mask::TSelection_mask(const char* name)
|
||||
|
||||
TSelection_mask::~TSelection_mask()
|
||||
{
|
||||
if (_pdc_sh_k1 != NULL)
|
||||
{
|
||||
delete _pdc_sh_k2;
|
||||
delete _pdc_sh_k1;
|
||||
delete _pdc_cur_k2;
|
||||
delete _pdc_cur_k1;
|
||||
delete _pdc_rel;
|
||||
}
|
||||
|
||||
if (_for_sh_k1 != NULL)
|
||||
{
|
||||
delete _for_sh_k2;
|
||||
@ -83,11 +113,14 @@ void TSelection_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
|
||||
}
|
||||
|
||||
TCursor_sheet& TSelection_mask::cur_sheet() const
|
||||
{
|
||||
TCursor_sheet* cs;
|
||||
if (get_key() == 1) cs = get_who() == 'C' ? _cli_sh_k1 : _for_sh_k1;
|
||||
else cs = get_who() == 'C' ? _cli_sh_k2 : _for_sh_k2;
|
||||
|
||||
{
|
||||
TCursor_sheet* cs = NULL;
|
||||
switch (get_who())
|
||||
{
|
||||
case 'C': cs = get_key() == 1 ? _cli_sh_k1 : _cli_sh_k2; break;
|
||||
case 'F': cs = get_key() == 1 ? _for_sh_k1 : _for_sh_k2; break;
|
||||
default : cs = get_key() == 1 ? _pdc_sh_k1 : _pdc_sh_k2; break;
|
||||
}
|
||||
CHECK(cs, "Can't use a NULL TCursor_sheet");
|
||||
return *cs;
|
||||
}
|
||||
@ -101,6 +134,11 @@ void TSelection_mask::reset_sheets()
|
||||
_for_sh_k1->uncheck(-1);
|
||||
_for_sh_k2->uncheck(-1);
|
||||
}
|
||||
if (_pdc_sh_k1)
|
||||
{
|
||||
_pdc_sh_k1->uncheck(-1);
|
||||
_pdc_sh_k2->uncheck(-1);
|
||||
}
|
||||
reset(SC_CFCODFR);
|
||||
reset(SC_CFCODTO);
|
||||
reset(SC_CFDESFR);
|
||||
@ -179,25 +217,38 @@ void TSelection_mask::select_des_clifo_range(const TString& from, const TString
|
||||
s_from = to;// ripristina i valori originali (!upper)
|
||||
set(SC_CFDESFR, to);
|
||||
set(SC_CFDESTO, from);
|
||||
} else
|
||||
{
|
||||
if (to.not_empty()) s_to = to;
|
||||
s_from = from; // ripristina i valori originali (!upper)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (to.not_empty()) s_to = to;
|
||||
s_from = from; // ripristina i valori originali (!upper)
|
||||
}
|
||||
|
||||
TString last;
|
||||
TString firs;
|
||||
|
||||
|
||||
const char who = get_who();
|
||||
TCursor* crs = c.cursor();
|
||||
TRectype& rec = crs->file().curr();
|
||||
rec.zero();
|
||||
rec.put(CLI_TIPOCF,get_who());
|
||||
rec.put(CLI_RAGSOC,s_from);
|
||||
if (who >= 'C')
|
||||
{
|
||||
rec.put(CLI_TIPOCF, who);
|
||||
rec.put(CLI_RAGSOC, s_from);
|
||||
}
|
||||
else
|
||||
rec.put(PCN_DESCR, s_from);
|
||||
const TRecnotype start = crs->read(_isgteq);
|
||||
firs = rec.get(CLI_RAGSOC);
|
||||
firs = rec.get(who >= 'C' ? CLI_RAGSOC : PCN_DESCR);
|
||||
rec.zero();
|
||||
rec.put(CLI_TIPOCF,get_who());
|
||||
rec.put(CLI_RAGSOC,s_to);
|
||||
if (who >= 'C')
|
||||
{
|
||||
rec.put(CLI_TIPOCF, who);
|
||||
rec.put(CLI_RAGSOC, s_to);
|
||||
}
|
||||
else
|
||||
rec.put(PCN_DESCR, s_to);
|
||||
|
||||
TRectype recx(rec);
|
||||
TRecnotype end = crs->read(_isgteq);
|
||||
if (rec > recx)
|
||||
@ -205,7 +256,7 @@ void TSelection_mask::select_des_clifo_range(const TString& from, const TString
|
||||
end--;
|
||||
(*crs)-=1;
|
||||
}
|
||||
last = rec.get(CLI_RAGSOC);
|
||||
last = rec.get(who >= 'C' ? CLI_RAGSOC : PCN_DESCR);
|
||||
c.uncheck(-1);
|
||||
for (long i = start; i <= end; i++)
|
||||
c.check(i);
|
||||
@ -385,7 +436,8 @@ bool TSelection_mask::fdfrom_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TSelection_mask& m = (TSelection_mask&)f.mask();
|
||||
TCursor_sheet& c = m.cur_sheet();
|
||||
c.cursor()->curr().put(CLI_RAGSOC, f.get());
|
||||
const char* fld = m.get_who() >= 'C' ? CLI_RAGSOC : PCN_DESCR;
|
||||
c.cursor()->curr().put(fld, f.get());
|
||||
c.cursor()->read();
|
||||
c.disable_check();
|
||||
c.disable(DLG_USER);
|
||||
@ -419,7 +471,7 @@ bool TSelection_mask::fdto_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TSelection_mask& m = (TSelection_mask&)f.mask();
|
||||
TCursor_sheet& c = m.cur_sheet();
|
||||
c.cursor()->curr().put(CLI_RAGSOC, f.get());
|
||||
c.cursor()->curr().put(m.get_who() >= 'C' ? CLI_RAGSOC : PCN_DESCR, f.get());
|
||||
c.cursor()->read();
|
||||
c.disable_check();
|
||||
c.disable(DLG_USER);
|
||||
|
@ -35,6 +35,8 @@ class TSelection_mask : public TMask
|
||||
TCursor_sheet* _cli_sh_k2;
|
||||
TCursor_sheet* _for_sh_k1;
|
||||
TCursor_sheet* _for_sh_k2;
|
||||
TCursor_sheet* _pdc_sh_k1;
|
||||
TCursor_sheet* _pdc_sh_k2;
|
||||
|
||||
char _who; // Clienti, fornitori, conti
|
||||
int _key; // 1 = per codice, 2 = per descrizione
|
||||
@ -43,6 +45,9 @@ class TSelection_mask : public TMask
|
||||
TCursor* _cli_cur_k2;
|
||||
TCursor* _for_cur_k1;
|
||||
TCursor* _for_cur_k2;
|
||||
TRelation* _pdc_rel;
|
||||
TCursor* _pdc_cur_k1;
|
||||
TCursor* _pdc_cur_k2;
|
||||
|
||||
TAssoc_array _assoc;
|
||||
bool _all_selected;
|
||||
|
Loading…
x
Reference in New Issue
Block a user