Velocizzata e corretta stampa delloo scadenzario e dei solleciti
git-svn-id: svn://10.65.10.50/trunk@3741 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
51236253f8
commit
0c33db8d25
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#include "sc2102.h"
|
#include "sc2102.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -129,7 +129,7 @@ class TStampaScadenzario : public TPrintapp
|
|||||||
// chiave per tali TAssoc_array e': TIPO+GRUPPO+CONTO+SOTTOCONTO+ANNO+NUMPART.
|
// chiave per tali TAssoc_array e': TIPO+GRUPPO+CONTO+SOTTOCONTO+ANNO+NUMPART.
|
||||||
// prima di ricalcolare i non assegnati e' necessario guardare in questa cache, se esiste la
|
// prima di ricalcolare i non assegnati e' necessario guardare in questa cache, se esiste la
|
||||||
// chiave relativa alla partita, ed eventualmente utilizzare tale valore in memoria.
|
// chiave relativa alla partita, ed eventualmente utilizzare tale valore in memoria.
|
||||||
friend bool filter_func(const TRelation *); // Funzione di filtro [_datai.._dataf]
|
static bool filter_func(const TRelation *); // Funzione di filtro [_datai.._dataf]
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// print functions
|
// print functions
|
||||||
@ -169,17 +169,23 @@ public:
|
|||||||
|
|
||||||
inline TStampaScadenzario& app() {return (TStampaScadenzario&)main_app();}
|
inline TStampaScadenzario& app() {return (TStampaScadenzario&)main_app();}
|
||||||
|
|
||||||
bool filter_func(const TRelation *r)
|
bool TStampaScadenzario::filter_func(const TRelation *r)
|
||||||
{ // Filtro per rate saldate: se e' saldata e' ok solo quando
|
|
||||||
bool rt = FALSE; // e' abilitato il flag; se non e' saldata va sempre bene.
|
|
||||||
TLocalisamfile* scad = &(r->lfile(LF_SCADENZE));
|
|
||||||
bool saldata = scad->get_bool(SCAD_PAGATA);
|
|
||||||
|
|
||||||
if (!saldata || (saldata && app()._ratesald))
|
|
||||||
{
|
{
|
||||||
rt=TRUE;
|
// Filtro per rate saldate: se e' saldata e' ok solo quando
|
||||||
|
// e' abilitato il flag; se non e' saldata va sempre bene.
|
||||||
|
/*
|
||||||
|
const TRectype& scad = r->curr(LF_SCADENZE);
|
||||||
|
const bool saldata = scad.get_bool(SCAD_PAGATA);
|
||||||
|
const bool ok = !saldata || (saldata && app()._ratesald);
|
||||||
|
*/
|
||||||
|
bool ok = app()._ratesald;
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
const TRectype& scad = r->curr();
|
||||||
|
ok = !scad.get_bool(SCAD_PAGATA);
|
||||||
}
|
}
|
||||||
return rt;
|
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampaScadenzario::check_add_key_to_tl(tipo_pe p, int t)
|
void TStampaScadenzario::check_add_key_to_tl(tipo_pe p, int t)
|
||||||
@ -379,7 +385,7 @@ void TStampaScadenzario::calcola_pagamenti(real& imp_scad, int riga, int rata)
|
|||||||
bool TStampaScadenzario::preprocess_page(int file, int counter)
|
bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||||
// Se ritorna FALSE salta questa scadenza e va alla prossima.
|
// Se ritorna FALSE salta questa scadenza e va alla prossima.
|
||||||
{
|
{
|
||||||
TRectype &rc = current_cursor()->curr(LF_SCADENZE);
|
const TRectype &rc = current_cursor()->curr(LF_SCADENZE);
|
||||||
char tipoc = rc.get_char(SCAD_TIPOCF); // Tipo
|
char tipoc = rc.get_char(SCAD_TIPOCF); // Tipo
|
||||||
int gruppo = rc.get_int(SCAD_GRUPPO); // Gruppo
|
int gruppo = rc.get_int(SCAD_GRUPPO); // Gruppo
|
||||||
int conto = rc.get_int(SCAD_CONTO); // Conto
|
int conto = rc.get_int(SCAD_CONTO); // Conto
|
||||||
@ -407,6 +413,7 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
|||||||
}
|
}
|
||||||
if (file == LF_SCADENZE && !_end_printed)
|
if (file == LF_SCADENZE && !_end_printed)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
TCursor_sheet& cs = _m->cur_sheet(); // Sheet di selezione (CLI/FO/PCON)
|
TCursor_sheet& cs = _m->cur_sheet(); // Sheet di selezione (CLI/FO/PCON)
|
||||||
TCursor* c = cs.cursor();
|
TCursor* c = cs.cursor();
|
||||||
TRectype& rec = c->curr();
|
TRectype& rec = c->curr();
|
||||||
@ -415,8 +422,14 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
|||||||
else
|
else
|
||||||
if (_tipost == altri)
|
if (_tipost == altri)
|
||||||
rec = current_cursor()->curr(LF_PCON);
|
rec = current_cursor()->curr(LF_PCON);
|
||||||
|
|
||||||
if (!cs.checked(c->read(_isequal))) // Se non e' stato selezionato salta alla prossima scdz
|
if (!cs.checked(c->read(_isequal))) // Se non e' stato selezionato salta alla prossima scdz
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
*/
|
||||||
|
const TBill bill(rc);
|
||||||
|
if (!_m->selected(bill))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
_descrizione->restart();
|
_descrizione->restart();
|
||||||
if (scad_changed(tipoc,gruppo,conto,codcf,annop,nump))
|
if (scad_changed(tipoc,gruppo,conto,codcf,annop,nump))
|
||||||
{
|
{
|
||||||
@ -744,23 +757,8 @@ bool TStampaScadenzario::user_destroy()
|
|||||||
|
|
||||||
bool TStampaScadenzario::set_print(int)
|
bool TStampaScadenzario::set_print(int)
|
||||||
{
|
{
|
||||||
bool rt=FALSE,ok=FALSE;
|
const bool ok = _m->run() == K_ENTER;
|
||||||
KEY t;
|
if (ok)
|
||||||
while (!ok)
|
|
||||||
{
|
|
||||||
if ((t=_m->run())==K_ENTER)
|
|
||||||
{
|
|
||||||
if ( !_m->cur_sheet().checked())
|
|
||||||
error_box("Non e' stata effettuata alcuna selezione.");
|
|
||||||
else
|
|
||||||
ok=TRUE;
|
|
||||||
}
|
|
||||||
else ok=TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (t)
|
|
||||||
{
|
|
||||||
case K_ENTER:
|
|
||||||
{
|
{
|
||||||
_end_printed = FALSE;
|
_end_printed = FALSE;
|
||||||
reset_files();
|
reset_files();
|
||||||
@ -817,8 +815,7 @@ bool TStampaScadenzario::set_print(int)
|
|||||||
// Setta l'intervallo di data. Si puo' fare per tutti i cursori, poiche'
|
// Setta l'intervallo di data. Si puo' fare per tutti i cursori, poiche'
|
||||||
// il file principale e' sempre LF_SCADENZE.
|
// il file principale e' sempre LF_SCADENZE.
|
||||||
TRectype da_data(LF_SCADENZE), a_data(LF_SCADENZE);
|
TRectype da_data(LF_SCADENZE), a_data(LF_SCADENZE);
|
||||||
da_data.zero();
|
|
||||||
a_data.zero();
|
|
||||||
da_data.put(SCAD_DATASCAD,_datai);
|
da_data.put(SCAD_DATASCAD,_datai);
|
||||||
a_data.put(SCAD_DATASCAD,_dataf);
|
a_data.put(SCAD_DATASCAD,_dataf);
|
||||||
get_cursor(_cur1)->setregion(da_data,a_data);
|
get_cursor(_cur1)->setregion(da_data,a_data);
|
||||||
@ -912,18 +909,16 @@ bool TStampaScadenzario::set_print(int)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rt=TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_p) delete _p; // Questo deve essere cancellato, altrimenti rimane in memoria,
|
if (_p) delete _p; // Questo deve essere cancellato, altrimenti rimane in memoria,
|
||||||
_p = NULL; // provocando casini al prossimo "giro"
|
_p = NULL; // provocando casini al prossimo "giro"
|
||||||
|
|
||||||
TAssoc_array& a =(TAssoc_array&) _uns_cache[0];
|
TAssoc_array& a =(TAssoc_array&) _uns_cache[0];
|
||||||
TAssoc_array& b =(TAssoc_array&) _uns_cache[1];
|
TAssoc_array& b =(TAssoc_array&) _uns_cache[1];
|
||||||
a.destroy(); b.destroy(); // Libera i TAssoc_array impiegati.
|
a.destroy(); b.destroy(); // Libera i TAssoc_array impiegati.
|
||||||
return rt;
|
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TStampaScadenzario::print_header()
|
void TStampaScadenzario::print_header()
|
||||||
|
169
sc/sc2300.cpp
169
sc/sc2300.cpp
@ -1,53 +1,27 @@
|
|||||||
#ifndef __PRINTAPP_H
|
|
||||||
#include <printapp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#include <printapp.h>
|
||||||
|
|
||||||
#ifndef __ASSOC_H
|
|
||||||
#include <assoc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __SALDACON_H
|
|
||||||
#include "../cg/saldacon.h"
|
#include "../cg/saldacon.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __DITTE_H
|
|
||||||
#include <nditte.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CLIFO_H
|
|
||||||
#include <clifo.h>
|
#include <clifo.h>
|
||||||
#endif
|
#include <nditte.h>
|
||||||
|
|
||||||
#ifndef __PCONTI_H
|
|
||||||
#include <pconti.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __PARTITE_H
|
|
||||||
#include <partite.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __SCADENZE_H
|
|
||||||
#include <scadenze.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <pagsca.h>
|
#include <pagsca.h>
|
||||||
|
#include <pconti.h>
|
||||||
|
#include <scadenze.h>
|
||||||
|
|
||||||
#include "sc2.h"
|
#include "sc2.h"
|
||||||
#include "sc2201.h"
|
#include "sc2201.h"
|
||||||
#include "sc2300.h"
|
#include "sc2300.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Stampa scaduto
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
enum tipo_st {nessuno=0, tutti=1, clienti=2, fornitori=3, altri=4};
|
enum tipo_st {nessuno=0, tutti=1, clienti=2, fornitori=3, altri=4};
|
||||||
|
|
||||||
const char * scaglioni[9] =
|
const char * scaglioni[9] =
|
||||||
{"0 gg","+15 gg","+30 gg","+45 gg","+60 gg","+30 gg","+60 gg","+90 gg","+120 gg"};
|
{"0 gg","+15 gg","+30 gg","+45 gg","+60 gg","+30 gg","+60 gg","+90 gg","+120 gg"};
|
||||||
|
|
||||||
bool fil_function(const TRelation *);
|
|
||||||
|
|
||||||
struct _LineTotal : public TObject //Oggetto di base per i TAssoc_array dei totali
|
struct _LineTotal : public TObject //Oggetto di base per i TAssoc_array dei totali
|
||||||
{
|
{
|
||||||
real _rd, // Residuo documento
|
real _rd, // Residuo documento
|
||||||
@ -71,6 +45,7 @@ class TStampaScaduto : public TPrintapp
|
|||||||
_cur3, _cur4;
|
_cur3, _cur4;
|
||||||
|
|
||||||
TSelection_ext_mask *_m;
|
TSelection_ext_mask *_m;
|
||||||
|
|
||||||
TLocalisamfile *_scad,*_pagsca;
|
TLocalisamfile *_scad,*_pagsca;
|
||||||
tipo_st _tipost; // Tipo di stampa impostato
|
tipo_st _tipost; // Tipo di stampa impostato
|
||||||
bool _end_printed,
|
bool _end_printed,
|
||||||
@ -86,7 +61,8 @@ class TStampaScaduto : public TPrintapp
|
|||||||
TArray _t, // Array per i totali
|
TArray _t, // Array per i totali
|
||||||
_s_date; // Date per lo scaduto
|
_s_date; // Date per lo scaduto
|
||||||
|
|
||||||
friend bool fil_function(const TRelation *);
|
static TString _last_game;
|
||||||
|
static bool fil_function(const TRelation *);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool preprocess_page(int file, int counter);
|
virtual bool preprocess_page(int file, int counter);
|
||||||
@ -110,16 +86,23 @@ public:
|
|||||||
TStampaScaduto();
|
TStampaScaduto();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TString TStampaScaduto::_last_game;
|
||||||
|
|
||||||
inline TStampaScaduto& app() {return (TStampaScaduto&)main_app();}
|
inline TStampaScaduto& app() {return (TStampaScaduto&)main_app();}
|
||||||
|
|
||||||
bool fil_function(const TRelation *r)
|
bool TStampaScaduto::fil_function(const TRelation *r)
|
||||||
{
|
{
|
||||||
TLocalisamfile* part = &(r->lfile(LF_PARTITE));
|
TRectype& part = r->curr(LF_PARTITE);
|
||||||
int nriga = part->get_int(PART_NRIGA);
|
|
||||||
bool rt = FALSE;
|
|
||||||
|
|
||||||
if (nriga == 1)
|
TString80 key;
|
||||||
rt=TRUE;
|
key.format("%03d%03d%06ld%4d",
|
||||||
|
part.get_int(PART_GRUPPO), part.get_int(PART_CONTO),
|
||||||
|
part.get_long(PART_SOTTOCONTO), part.get_int(PART_ANNO));
|
||||||
|
key << part.get(PART_NUMPART);
|
||||||
|
|
||||||
|
const bool rt = key != _last_game;
|
||||||
|
if (rt)
|
||||||
|
_last_game = key;
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,36 +327,30 @@ void TStampaScaduto::compute_all(TPartita& p)
|
|||||||
|
|
||||||
bool TStampaScaduto::preprocess_page(int file, int counter)
|
bool TStampaScaduto::preprocess_page(int file, int counter)
|
||||||
{
|
{
|
||||||
TRectype rc(current_cursor()->curr(file));
|
|
||||||
|
|
||||||
if (file == LF_PARTITE)
|
if (file == LF_PARTITE)
|
||||||
{
|
{
|
||||||
TCursor_sheet& cs = _m->cur_sheet(); // Sheet di selezione (CLI/FO/PCON)
|
const TRectype& curr = current_cursor()->curr(file);
|
||||||
TCursor* c = cs.cursor();
|
|
||||||
TRectype& rec = c->curr();
|
|
||||||
if (_tipost == clienti || _tipost == fornitori)
|
|
||||||
rec = current_cursor()->curr(LF_CLIFO);
|
|
||||||
else
|
|
||||||
if (_tipost == altri)
|
|
||||||
rec = current_cursor()->curr(LF_PCON);
|
|
||||||
|
|
||||||
int nriga = 1;
|
const TBill bill(curr);
|
||||||
bool checked = cs.checked(c->read(_isequal));
|
const bool checked = _m->selected(bill);
|
||||||
|
|
||||||
if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record
|
if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
int nriga = 1;
|
||||||
if (_tipost == clienti || _tipost == fornitori)
|
if (_tipost == clienti || _tipost == fornitori)
|
||||||
{
|
{
|
||||||
_des = current_cursor()->curr(LF_CLIFO).get(CLI_RAGSOC);
|
const TRectype& clifo = current_cursor()->curr(LF_CLIFO);
|
||||||
_cod = current_cursor()->curr(LF_CLIFO).get(CLI_CODCF);
|
_des = clifo.get(CLI_RAGSOC);
|
||||||
|
_cod = clifo.get(CLI_CODCF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_des = current_cursor()->curr(LF_PCON).get(PCN_DESCR);
|
const TRectype& pcon = current_cursor()->curr(LF_PCON);
|
||||||
_cod = current_cursor()->curr(LF_PCON).get(PCN_GRUPPO);
|
_des = pcon.get(PCN_DESCR);
|
||||||
_cod << " " << current_cursor()->curr(LF_PCON).get(PCN_CONTO);
|
_cod = pcon.get(PCN_GRUPPO);
|
||||||
_cod << " " << current_cursor()->curr(LF_PCON).get(PCN_SOTTOCONTO);
|
_cod << " " << pcon.get(PCN_CONTO);
|
||||||
|
_cod << " " << pcon.get(PCN_SOTTOCONTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cod != _cod_pre || _end_printed) // Controlla se e' cambiato il codice cli/fo/conto
|
if (_cod != _cod_pre || _end_printed) // Controlla se e' cambiato il codice cli/fo/conto
|
||||||
@ -400,12 +377,14 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
|
|||||||
_pending_clifo = TRUE;
|
_pending_clifo = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPartita p(rc);
|
if (curr.empty()) // Attenzione: Possono succedere anche queste cose!
|
||||||
|
return FALSE;
|
||||||
|
TPartita p(curr);
|
||||||
|
|
||||||
//Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1
|
//Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1
|
||||||
int r = p.prima_fattura();
|
const int r = p.prima_fattura();
|
||||||
|
if (r <= 0)
|
||||||
if (r < 1) return TRUE; // se non ci sono fatture ... salta al prossimo
|
return TRUE; // se non ci sono fatture ... salta al prossimo
|
||||||
|
|
||||||
_residuo = "";
|
_residuo = "";
|
||||||
_nonscad = "";
|
_nonscad = "";
|
||||||
@ -438,7 +417,7 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
|
|||||||
!_sc_3.empty() || !_sc_4.empty() || !_sc_5.empty() || !_sc_6.empty() || (_tipost == clienti && !_buonfin.empty());
|
!_sc_3.empty() || !_sc_4.empty() || !_sc_5.empty() || !_sc_6.empty() || (_tipost == clienti && !_buonfin.empty());
|
||||||
if (to_print)
|
if (to_print)
|
||||||
{
|
{
|
||||||
if (rc.get_int(PART_NRIGA) == 1)
|
if (curr.get_int(PART_NRIGA) == 1)
|
||||||
{
|
{
|
||||||
if (_pending_clifo)
|
if (_pending_clifo)
|
||||||
{
|
{
|
||||||
@ -480,12 +459,14 @@ bool TStampaScaduto::user_create()
|
|||||||
{
|
{
|
||||||
_rel1 = new TRelation(LF_PARTITE);
|
_rel1 = new TRelation(LF_PARTITE);
|
||||||
_rel1->add(LF_CLIFO,"TIPOCF=TIPOC|CODCF=SOTTOCONTO",1);
|
_rel1->add(LF_CLIFO,"TIPOCF=TIPOC|CODCF=SOTTOCONTO",1);
|
||||||
_cur1 = add_cursor(new TSorted_cursor(_rel1,"SOTTOCONTO|ANNO|NUMPART","",1));
|
// _cur1 = add_cursor(new TSorted_cursor(_rel1,"SOTTOCONTO|ANNO|NUMPART","",1));
|
||||||
|
_cur1 = add_cursor(new TCursor(_rel1));
|
||||||
_cur2 = add_cursor(new TSorted_cursor(_rel1,"UPPER(20->RAGSOC)|ANNO|NUMPART","",1));
|
_cur2 = add_cursor(new TSorted_cursor(_rel1,"UPPER(20->RAGSOC)|ANNO|NUMPART","",1));
|
||||||
|
|
||||||
_rel2 = new TRelation(LF_PARTITE);
|
_rel2 = new TRelation(LF_PARTITE);
|
||||||
_rel2->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO|SOTTOCONTO=SOTTOCONTO",1);
|
_rel2->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO|SOTTOCONTO=SOTTOCONTO",1);
|
||||||
_cur3 = add_cursor(new TSorted_cursor(_rel2,"GRUPPO|CONTO|SOTTOCONTO|ANNO|NUMPART","",1));
|
// _cur3 = add_cursor(new TSorted_cursor(_rel2,"GRUPPO|CONTO|SOTTOCONTO|ANNO|NUMPART","",1));
|
||||||
|
_cur3 = add_cursor(new TCursor(_rel2));
|
||||||
_cur4 = add_cursor(new TSorted_cursor(_rel2,"UPPER(19->DESCR)|ANNO|NUMPART","",1));
|
_cur4 = add_cursor(new TSorted_cursor(_rel2,"UPPER(19->DESCR)|ANNO|NUMPART","",1));
|
||||||
|
|
||||||
_scad = new TLocalisamfile(LF_SCADENZE);
|
_scad = new TLocalisamfile(LF_SCADENZE);
|
||||||
@ -493,9 +474,11 @@ bool TStampaScaduto::user_create()
|
|||||||
_t.add(new TAssoc_array);_t.add(new TAssoc_array);
|
_t.add(new TAssoc_array);_t.add(new TAssoc_array);
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
_s_date.add(new TDate);
|
_s_date.add(new TDate);
|
||||||
|
|
||||||
TConfig conf (CONFIG_DITTA,"cg");
|
TConfig conf (CONFIG_DITTA,"cg");
|
||||||
_m = new TSelection_ext_mask("sc2300a");
|
_m = new TSelection_ext_mask("sc2300a");
|
||||||
_m->enable(F_VALUTA,conf.get_bool("GesVal"));
|
_m->enable(F_VALUTA,conf.get_bool("GesVal"));
|
||||||
|
|
||||||
enable_print_menu();
|
enable_print_menu();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -514,30 +497,21 @@ bool TStampaScaduto::user_destroy()
|
|||||||
|
|
||||||
bool TStampaScaduto::set_print(int)
|
bool TStampaScaduto::set_print(int)
|
||||||
{
|
{
|
||||||
bool rt=FALSE,ok=FALSE;
|
const bool rt = _m->run() == K_ENTER;
|
||||||
KEY t;
|
if (rt)
|
||||||
while (!ok)
|
|
||||||
{
|
|
||||||
if ((t=_m->run())==K_ENTER)
|
|
||||||
{
|
|
||||||
if ( !_m->cur_sheet().checked())
|
|
||||||
error_box("Non e' stato effettuata alcuna selezione.");
|
|
||||||
else
|
|
||||||
ok=TRUE;
|
|
||||||
}
|
|
||||||
else ok=TRUE;
|
|
||||||
}
|
|
||||||
// Here set some filters...
|
|
||||||
switch (t)
|
|
||||||
{
|
|
||||||
case K_ENTER:
|
|
||||||
{
|
{
|
||||||
reset_files();
|
reset_files();
|
||||||
reset_print();
|
reset_print();
|
||||||
if (_m->get_who() == 'P') _tipost = altri;
|
|
||||||
|
if (_m->get_who() == 'P')
|
||||||
|
{
|
||||||
|
_tipost = altri;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
if (_m->get_who() == 'C') _tipost = clienti;
|
if (_m->get_who() == 'C') _tipost = clienti;
|
||||||
else _tipost = fornitori;
|
else _tipost = fornitori;
|
||||||
|
}
|
||||||
if (_m->get_key() == 1) _ordcod = TRUE;
|
if (_m->get_key() == 1) _ordcod = TRUE;
|
||||||
else _ordcod = FALSE;
|
else _ordcod = FALSE;
|
||||||
_end_printed = _pending_clifo = FALSE;
|
_end_printed = _pending_clifo = FALSE;
|
||||||
@ -556,43 +530,45 @@ bool TStampaScaduto::set_print(int)
|
|||||||
TAssoc_array& aa = (TAssoc_array&) _t[it];
|
TAssoc_array& aa = (TAssoc_array&) _t[it];
|
||||||
aa.destroy(); // Totali lineari (singolo e generale)
|
aa.destroy(); // Totali lineari (singolo e generale)
|
||||||
}
|
}
|
||||||
|
|
||||||
get_cursor(_cur1)->set_filterfunction(fil_function,TRUE);
|
get_cursor(_cur1)->set_filterfunction(fil_function,TRUE);
|
||||||
get_cursor(_cur2)->set_filterfunction(fil_function,TRUE);
|
get_cursor(_cur2)->set_filterfunction(fil_function,TRUE);
|
||||||
get_cursor(_cur3)->set_filterfunction(fil_function,TRUE);
|
get_cursor(_cur3)->set_filterfunction(fil_function,TRUE);
|
||||||
get_cursor(_cur4)->set_filterfunction(fil_function,TRUE);
|
get_cursor(_cur4)->set_filterfunction(fil_function,TRUE);
|
||||||
|
_last_game.cut(0);
|
||||||
|
|
||||||
|
TRectype filter_from(LF_PARTITE), filter_to(LF_PARTITE);
|
||||||
|
|
||||||
switch (_tipost)
|
switch (_tipost)
|
||||||
{
|
{
|
||||||
case clienti:
|
case clienti:
|
||||||
case fornitori:
|
case fornitori:
|
||||||
|
filter_from.put("TIPOC", _tipost == clienti ? "C" : "F");
|
||||||
|
filter_to = filter_from;
|
||||||
if (_ordcod) // Per codice...
|
if (_ordcod) // Per codice...
|
||||||
{
|
{
|
||||||
select_cursor(_cur1);
|
select_cursor(_cur1);
|
||||||
if (_tipost==clienti)
|
get_cursor(_cur1)->setregion(filter_from, filter_to);
|
||||||
get_cursor(_cur1)->setfilter("(TIPOC=\"C\")");
|
|
||||||
else
|
|
||||||
get_cursor(_cur1)->setfilter("(TIPOC=\"F\")");
|
|
||||||
}
|
}
|
||||||
else // ... e ragione sociale
|
else // ... e ragione sociale
|
||||||
{
|
{
|
||||||
select_cursor(_cur2);
|
select_cursor(_cur2);
|
||||||
if (_tipost==clienti)
|
get_cursor(_cur2)->setregion(filter_from, filter_to);
|
||||||
get_cursor(_cur2)->setfilter("(TIPOC=\"C\")");
|
|
||||||
else
|
|
||||||
get_cursor(_cur2)->setfilter("(TIPOC=\"F\")");
|
|
||||||
}
|
}
|
||||||
add_file(LF_PARTITE);
|
add_file(LF_PARTITE);
|
||||||
add_file(LF_CLIFO,LF_PARTITE);
|
add_file(LF_CLIFO,LF_PARTITE);
|
||||||
break;
|
break;
|
||||||
case altri:
|
case altri:
|
||||||
|
filter_to.put("TIPOC", "A"); // Sporco trucco per selezionare solo i conti
|
||||||
if (_ordcod) // Per codice...
|
if (_ordcod) // Per codice...
|
||||||
{
|
{
|
||||||
select_cursor(_cur3);
|
select_cursor(_cur3);
|
||||||
get_cursor(_cur3)->setfilter("(TIPOC=\"\")"); // Filtro per i conti normali!
|
get_cursor(_cur3)->setregion(filter_from, filter_to); // Filtro per i conti normali!
|
||||||
}
|
}
|
||||||
else // ... e descrizione
|
else // ... e descrizione
|
||||||
{
|
{
|
||||||
select_cursor(_cur4);
|
select_cursor(_cur4);
|
||||||
get_cursor(_cur4)->setfilter("(TIPOC=\"\")"); // Filtro per i conti normali!
|
get_cursor(_cur4)->setregion(filter_from, filter_to); // Filtro per i conti normali!
|
||||||
}
|
}
|
||||||
add_file(LF_PARTITE);
|
add_file(LF_PARTITE);
|
||||||
add_file(LF_PCON,LF_PARTITE);
|
add_file(LF_PCON,LF_PARTITE);
|
||||||
@ -612,12 +588,7 @@ bool TStampaScaduto::set_print(int)
|
|||||||
*d = _limscad - nday;
|
*d = _limscad - nday;
|
||||||
nday += inc;
|
nday += inc;
|
||||||
}
|
}
|
||||||
rt = TRUE;
|
} // End if
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
} // End of outer switch
|
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
#include "../cg/conto.h"
|
||||||
|
|
||||||
#include "scselect.h"
|
#include "scselect.h"
|
||||||
|
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
|
|
||||||
TSelection_mask::TSelection_mask(const char* name)
|
TSelection_mask::TSelection_mask(const char* name)
|
||||||
@ -65,6 +67,14 @@ TSelection_mask::~TSelection_mask()
|
|||||||
delete _clifo_rel;
|
delete _clifo_rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TSelection_mask::stop_run(KEY k)
|
||||||
|
{
|
||||||
|
const bool ok = TMask::stop_run(k);
|
||||||
|
if (ok && k == K_ENTER)
|
||||||
|
update_assoc();
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
void TSelection_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
|
void TSelection_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
|
||||||
{
|
{
|
||||||
const int pos = id2pos(fld_id);
|
const int pos = id2pos(fld_id);
|
||||||
@ -465,3 +475,60 @@ bool TSelection_mask::rsortcf_handler(TMask_field& f, KEY k)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TSelection_mask::update_assoc()
|
||||||
|
{
|
||||||
|
_assoc.destroy();
|
||||||
|
_all_selected = FALSE;
|
||||||
|
|
||||||
|
TCursor_sheet& cs = cur_sheet(); // Sheet di selezione (CLI/FO/PCON)
|
||||||
|
const long checked = cs.checked();
|
||||||
|
if (checked == 0L || checked == cs.items())
|
||||||
|
_all_selected =TRUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const int first = get_key();
|
||||||
|
const char who = get_who();
|
||||||
|
TString16 key;
|
||||||
|
|
||||||
|
for (long i = cs.items()-1; i >= 0; i--) if (cs.checked(i))
|
||||||
|
{
|
||||||
|
TToken_string& row = cs.row(i);
|
||||||
|
if (who == 'C' || who == 'F')
|
||||||
|
{
|
||||||
|
key.format("000000%06ld", row.get_long(first));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const TBill b(row, first, 0x0);
|
||||||
|
key.format("%03d%03d%06ld",
|
||||||
|
b.gruppo(), b.conto(), b.sottoconto());
|
||||||
|
}
|
||||||
|
_assoc.add(key, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TSelection_mask::selected(const TBill& b) const
|
||||||
|
{
|
||||||
|
bool ok = _all_selected;
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
TString16 key;
|
||||||
|
key.format("%03d%03d%06ld",
|
||||||
|
b.gruppo(), b.conto(), b.sottoconto());
|
||||||
|
ok = _assoc.is_key(key);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TSelection_mask::selected(int g, int c, long s) const
|
||||||
|
{
|
||||||
|
bool ok = _all_selected;
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
TString16 key;
|
||||||
|
key.format("%03d%03d%06ld", g, c, s);
|
||||||
|
ok = _assoc.is_key(key);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
#ifndef __SCSELECT_H
|
#ifndef __SCSELECT_H
|
||||||
#define __SCSELECT_H
|
#define __SCSELECT_H
|
||||||
|
|
||||||
|
#ifndef __ASSOC_H
|
||||||
|
#include <assoc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __CONTO_H
|
||||||
|
class TBill;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __MASK_H
|
#ifndef __MASK_H
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#endif
|
#endif
|
||||||
@ -34,11 +42,15 @@ class TSelection_mask : public TMask
|
|||||||
TCursor_sheet* _for_sh_k1;
|
TCursor_sheet* _for_sh_k1;
|
||||||
TCursor_sheet* _for_sh_k2;
|
TCursor_sheet* _for_sh_k2;
|
||||||
|
|
||||||
char _who;
|
char _who; // Clienti, fornitori, conti
|
||||||
int _key;
|
int _key; // 1 = per codice, 2 = per descrizione
|
||||||
|
|
||||||
|
TAssoc_array _assoc;
|
||||||
|
bool _all_selected;
|
||||||
|
|
||||||
protected: // TMask
|
protected: // TMask
|
||||||
virtual void set_handler(short fld_id, CONTROL_HANDLER handler);
|
virtual void set_handler(short fld_id, CONTROL_HANDLER handler);
|
||||||
|
virtual bool stop_run(KEY k);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void select_clifo_range(long from, long to);
|
void select_clifo_range(long from, long to);
|
||||||
@ -50,6 +62,7 @@ protected:
|
|||||||
void set_key (int k) { _key = k; }
|
void set_key (int k) { _key = k; }
|
||||||
|
|
||||||
void reset_sheets();
|
void reset_sheets();
|
||||||
|
void update_assoc();
|
||||||
|
|
||||||
// handlers
|
// handlers
|
||||||
static bool bfrom_handler(TMask_field& f, KEY k);
|
static bool bfrom_handler(TMask_field& f, KEY k);
|
||||||
@ -71,6 +84,9 @@ public:
|
|||||||
char get_who() const { return _who; }
|
char get_who() const { return _who; }
|
||||||
int get_key() const { return _key; }
|
int get_key() const { return _key; }
|
||||||
|
|
||||||
|
bool selected(const TBill& c) const;
|
||||||
|
bool selected(int g, int c, long s) const;
|
||||||
|
|
||||||
TSelection_mask(const char* name);
|
TSelection_mask(const char* name);
|
||||||
virtual ~TSelection_mask();
|
virtual ~TSelection_mask();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user