Patch level : 10.0
Files correlati : or1.exe Ricompilazione Demo : [ ] Commento : Corretto filtro per articolo nella stampa ordini (Cliente Frasson) git-svn-id: svn://10.65.10.50/trunk@19653 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6bd9bb36d5
commit
69427f6b17
@ -8,9 +8,6 @@
|
|||||||
|
|
||||||
#include "../ve/velib.h"
|
#include "../ve/velib.h"
|
||||||
|
|
||||||
#include "doc.h"
|
|
||||||
#include "rdoc.h"
|
|
||||||
|
|
||||||
// Tipi di stampa per selezionare il form
|
// Tipi di stampa per selezionare il form
|
||||||
enum tipo_stampa {
|
enum tipo_stampa {
|
||||||
numero, // or1100a.frm
|
numero, // or1100a.frm
|
||||||
@ -100,7 +97,7 @@ bool TStampa_ordini::stato_handler(TMask_field& f, KEY k)
|
|||||||
if (b) // Qualsiasi altro tipo di stampa dettaglio righe puo' essere selezionata
|
if (b) // Qualsiasi altro tipo di stampa dettaglio righe puo' essere selezionata
|
||||||
m.enable(F_STATORORD);
|
m.enable(F_STATORORD);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TStampa_ordini::detail_handler(TMask_field& f, KEY k)
|
bool TStampa_ordini::detail_handler(TMask_field& f, KEY k)
|
||||||
@ -137,7 +134,7 @@ bool TStampa_ordini::detail_handler(TMask_field& f, KEY k)
|
|||||||
m.disable(F_FORCE_EVASE);
|
m.disable(F_FORCE_EVASE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TStampa_ordini::create()
|
bool TStampa_ordini::create()
|
||||||
@ -218,29 +215,29 @@ bool TStampa_ordini::document_row_filter(const TRectype& row) const
|
|||||||
if (_TEA_rord == 'E')
|
if (_TEA_rord == 'E')
|
||||||
{
|
{
|
||||||
if (!evasa)
|
if (!evasa)
|
||||||
return FALSE;
|
return false;
|
||||||
if (_force_evase) // Controlla se evasa con residuo
|
if (_force_evase) // Controlla se evasa con residuo
|
||||||
{
|
{
|
||||||
const real qta = row.get(RDOC_QTA);
|
const real qta = row.get(RDOC_QTA);
|
||||||
const real qta_evasa = row.get(RDOC_QTAEVASA);
|
const real qta_evasa = row.get(RDOC_QTAEVASA);
|
||||||
if (qta_evasa >= qta)
|
if (qta_evasa >= qta)
|
||||||
return FALSE; // Non c'e' residuo
|
return false; // Non c'e' residuo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_TEA_rord == 'A' && evasa)
|
if (_TEA_rord == 'A' && evasa)
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_from_art.not_empty() || _to_art.not_empty())
|
if (_from_art.full() || _to_art.full())
|
||||||
{
|
{
|
||||||
const TString& codart = row.get(RDOC_CODART);
|
const TString& codart = row.get(RDOC_CODART);
|
||||||
if (_from_art.not_empty() && codart < _from_art)
|
if (_from_art.full() && codart < _from_art)
|
||||||
return FALSE;
|
return false;
|
||||||
if (_to_art.not_empty() && codart > _to_art)
|
if (_to_art.full() && codart > _to_art)
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TStampa_ordini::document_filter(const TRelation* rel)
|
bool TStampa_ordini::document_filter(const TRelation* rel)
|
||||||
@ -256,9 +253,9 @@ bool TStampa_ordini::document_filter(const TRelation* rel)
|
|||||||
for (int r = righe.rows(); r > 0; r--)
|
for (int r = righe.rows(); r > 0; r--)
|
||||||
{
|
{
|
||||||
if (app().document_row_filter(righe.row(r)))
|
if (app().document_row_filter(righe.row(r)))
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -719,13 +716,13 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
if (_detail_rows)
|
if (_detail_rows)
|
||||||
{
|
{
|
||||||
// Setta i range per il codice articolo
|
// Setta i range per il codice articolo
|
||||||
if (_from_art.not_empty())
|
if (_from_art.full())
|
||||||
{
|
{
|
||||||
s.format("&&(%d->CODART>=\"%s\")",
|
s.format("&&(%d->CODART>=\"%s\")",
|
||||||
LF_RIGHEDOC, (const char*)_from_art);
|
LF_RIGHEDOC, (const char*)_from_art);
|
||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
}
|
}
|
||||||
if (_to_art.not_empty())
|
if (_to_art.full())
|
||||||
{
|
{
|
||||||
filter_expr << "&&";
|
filter_expr << "&&";
|
||||||
s.format("(%d->CODART<=\"%s\")",
|
s.format("(%d->CODART<=\"%s\")",
|
||||||
@ -795,7 +792,7 @@ void TStampa_ordini::filter_for_clifo_agent()
|
|||||||
if (s.not_empty())
|
if (s.not_empty())
|
||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
|
|
||||||
cur->setfilter(filter_expr,TRUE,2);
|
cur->setfilter(filter_expr,true,2);
|
||||||
|
|
||||||
// Alla fine setta i campi da vedere
|
// Alla fine setta i campi da vedere
|
||||||
if (!is_for_cli && _detail_cli)
|
if (!is_for_cli && _detail_cli)
|
||||||
@ -987,8 +984,13 @@ void TStampa_ordini::filter_for_articolo()
|
|||||||
|
|
||||||
t = f;
|
t = f;
|
||||||
t.put(RDOC_CODART, _to_art);
|
t.put(RDOC_CODART, _to_art);
|
||||||
|
|
||||||
|
int tilde = 0x2;
|
||||||
|
if (_to_art.empty() || cache().get(LF_ANAMAG, _to_art).empty())
|
||||||
|
tilde = 0x0; // Se scrivo un articolo parziale non mettere ~ alla fine della chiave
|
||||||
|
|
||||||
cur->setkey(2); // Questa chiave rende piu' veloce la costruzione se indicato un range di articoli
|
cur->setkey(2); // Questa chiave rende piu' veloce la costruzione se indicato un range di articoli
|
||||||
cur->setregion(f,t,0x2); // This is the region...
|
cur->setregion(f,t,tilde); // This is the region...
|
||||||
|
|
||||||
s.format("(%d->TIPOCF==\"",LF_DOC);
|
s.format("(%d->TIPOCF==\"",LF_DOC);
|
||||||
filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C"
|
filter_expr << s << _tipocf << "\")"; // Nel caso di stampa per agenti e' sempre "C"
|
||||||
@ -1089,7 +1091,7 @@ void TStampa_ordini::filter_for_articolo()
|
|||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur->setfilter(filter_expr,TRUE,2); // Setta il filtro e serra i ranghi
|
cur->setfilter(filter_expr,true,2); // Setta il filtro e serra i ranghi
|
||||||
|
|
||||||
// Setta la condizione di raggruppamento principale per articoli
|
// Setta la condizione di raggruppamento principale per articoli
|
||||||
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTMAIN");
|
TForm_subsection& ssec = (TForm_subsection&) _frm->find_field('B', odd_page, "ARTMAIN");
|
||||||
@ -1153,8 +1155,6 @@ void TStampa_ordini::show_giac_levels()
|
|||||||
|
|
||||||
void TStampa_ordini::main_loop()
|
void TStampa_ordini::main_loop()
|
||||||
{
|
{
|
||||||
TString form_name;
|
|
||||||
|
|
||||||
while (_m->run()!=K_QUIT)
|
while (_m->run()!=K_QUIT)
|
||||||
{
|
{
|
||||||
// selezione tipo di stampa per il form appropriato
|
// selezione tipo di stampa per il form appropriato
|
||||||
@ -1230,6 +1230,7 @@ void TStampa_ordini::main_loop()
|
|||||||
_TEA_ord = _m->get(F_STATOORD)[0];
|
_TEA_ord = _m->get(F_STATOORD)[0];
|
||||||
_TEA_rord = _m->get(F_STATORORD)[0];
|
_TEA_rord = _m->get(F_STATORORD)[0];
|
||||||
|
|
||||||
|
const char* form_name = NULL;
|
||||||
switch (_tipo)
|
switch (_tipo)
|
||||||
{
|
{
|
||||||
case clifo: form_name = "or1100b"; break;
|
case clifo: form_name = "or1100b"; break;
|
||||||
@ -1243,16 +1244,10 @@ void TStampa_ordini::main_loop()
|
|||||||
// Selezione cursore & filtro
|
// Selezione cursore & filtro
|
||||||
switch (_tipo)
|
switch (_tipo)
|
||||||
{
|
{
|
||||||
case clifo:
|
case clifo :
|
||||||
case agente:
|
case agente : filter_for_clifo_agent(); break;
|
||||||
filter_for_clifo_agent();
|
case articolo: filter_for_articolo(); break;
|
||||||
break;
|
default : filter_for_number(); break;
|
||||||
case articolo:
|
|
||||||
filter_for_articolo();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
filter_for_number();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const int hh = 6;
|
const int hh = 6;
|
||||||
|
@ -24,7 +24,7 @@ class TStampa_dettaglio_articoli : public TSkeleton_application
|
|||||||
TString _fromcodnum, _tocodnum; // Range calcolati automaticamente all'inizio del prg
|
TString _fromcodnum, _tocodnum; // Range calcolati automaticamente all'inizio del prg
|
||||||
int _anno;
|
int _anno;
|
||||||
char _provv;
|
char _provv;
|
||||||
bool _da_ordinare, // Se TRUE solo gli articoli da ordinare, FALSE tutti.
|
bool _da_ordinare, // Se true solo gli articoli da ordinare, false tutti.
|
||||||
_detail_mag, _detail_dep,
|
_detail_mag, _detail_dep,
|
||||||
_giac_eff, _val_comp;
|
_giac_eff, _val_comp;
|
||||||
TDate _data_oss; // Data di osservazione
|
TDate _data_oss; // Data di osservazione
|
||||||
@ -229,7 +229,7 @@ void TStampa_dettaglio_articoli::set_form()
|
|||||||
filter_expr << s;
|
filter_expr << s;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur->setfilter(filter_expr,TRUE); // Cursor filter expression
|
cur->setfilter(filter_expr,true); // Cursor filter expression
|
||||||
|
|
||||||
// Una volta settato il cursore del form, pensiamo ai campi del form
|
// Una volta settato il cursore del form, pensiamo ai campi del form
|
||||||
// ed alle espressioni delle sottosezioni, le colonne da abilitare etc. etc...
|
// ed alle espressioni delle sottosezioni, le colonne da abilitare etc. etc...
|
||||||
|
@ -27,7 +27,7 @@ class TOrdine_form : public TForm
|
|||||||
TString16 _codmag, _livello;
|
TString16 _codmag, _livello;
|
||||||
bool _detail_mag, _detail_dep,
|
bool _detail_mag, _detail_dep,
|
||||||
_giac_eff, _val_comp,
|
_giac_eff, _val_comp,
|
||||||
_normale; // Se TRUE e' una stampa normale, ovvero stampa ordini per cli/fo/agente etc.
|
_normale; // Se true e' una stampa normale, ovvero stampa ordini per cli/fo/agente etc.
|
||||||
// Se FALE e' una stampa disponibilita' articoli
|
// Se FALE e' una stampa disponibilita' articoli
|
||||||
TArray* _date_array; // Do not delete: e' passato dall'applicazione
|
TArray* _date_array; // Do not delete: e' passato dall'applicazione
|
||||||
TArray _totdisp; // Array di elementi per la stampa disponibilita'
|
TArray _totdisp; // Array di elementi per la stampa disponibilita'
|
||||||
@ -41,7 +41,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
bool genera_intestazione_supplementare(pagetype p, short y);
|
bool genera_intestazione_supplementare(pagetype p, short y);
|
||||||
void set_options(int lev, bool mag, bool dep, bool giac_eff = FALSE, bool val_comp = FALSE, TArray* da = NULL)
|
void set_options(int lev, bool mag, bool dep, bool giac_eff = false, bool val_comp = false, TArray* da = NULL)
|
||||||
{ _level = lev; _detail_mag = mag; _detail_dep = dep; _giac_eff = giac_eff; _val_comp = val_comp; _date_array = da; _normale = da == NULL;}
|
{ _level = lev; _detail_mag = mag; _detail_dep = dep; _giac_eff = giac_eff; _val_comp = val_comp; _date_array = da; _normale = da == NULL;}
|
||||||
|
|
||||||
TOrdine_form(const char* name);
|
TOrdine_form(const char* name);
|
||||||
|
@ -44,11 +44,11 @@ bool TOrdine_form::genera_intestazione_supplementare(pagetype p, short y)
|
|||||||
CHECK(_date_array, "L'array delle date non e' impostato.");
|
CHECK(_date_array, "L'array delle date non e' impostato.");
|
||||||
TPrint_section* body = exist('B', p);
|
TPrint_section* body = exist('B', p);
|
||||||
if (body == NULL || !body->columnwise())
|
if (body == NULL || !body->columnwise())
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
TPrint_section* header = exist('H', p);
|
TPrint_section* header = exist('H', p);
|
||||||
if (header == NULL)
|
if (header == NULL)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
const int items = _date_array->items();//body->fields();
|
const int items = _date_array->items();//body->fields();
|
||||||
TForm_string* s;
|
TForm_string* s;
|
||||||
@ -64,11 +64,11 @@ bool TOrdine_form::genera_intestazione_supplementare(pagetype p, short y)
|
|||||||
s->set_x(fi.x());
|
s->set_x(fi.x());
|
||||||
s->y() = y;
|
s->y() = y;
|
||||||
s->set_prompt(des);
|
s->set_prompt(des);
|
||||||
s->temp() = TRUE;
|
s->temp() = true;
|
||||||
header->add_field(s);
|
header->add_field(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
||||||
@ -144,9 +144,9 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|||||||
real qtare(qr.get());
|
real qtare(qr.get());
|
||||||
|
|
||||||
// Converte i totali q.ta evasa e ordinata nella unita' di misura principale
|
// Converte i totali q.ta evasa e ordinata nella unita' di misura principale
|
||||||
qtaor = _art_giac->convert_to_um(qtaor, "", cur_um, TRUE);
|
qtaor = _art_giac->convert_to_um(qtaor, "", cur_um, true);
|
||||||
qtaev = _art_giac->convert_to_um(qtaev, "", cur_um, TRUE);
|
qtaev = _art_giac->convert_to_um(qtaev, "", cur_um, true);
|
||||||
qtare = _art_giac->convert_to_um(qtare, "", cur_um, TRUE);
|
qtare = _art_giac->convert_to_um(qtare, "", cur_um, true);
|
||||||
|
|
||||||
qo.set(qtaor.string());
|
qo.set(qtaor.string());
|
||||||
qe.set(qtaev.string());
|
qe.set(qtaev.string());
|
||||||
@ -169,7 +169,7 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|||||||
if (_art_giac->read(rdoc.get(RDOC_CODART)) == NOERR) // Perche' non RDOC_CODARTMAG ???
|
if (_art_giac->read(rdoc.get(RDOC_CODART)) == NOERR) // Perche' non RDOC_CODARTMAG ???
|
||||||
{
|
{
|
||||||
real qt(cf.get());
|
real qt(cf.get());
|
||||||
qt = _art_giac->convert_to_um(qt, cur_um, um, TRUE);
|
qt = _art_giac->convert_to_um(qt, cur_um, um, true);
|
||||||
|
|
||||||
cf.set(qt.string());
|
cf.set(qt.string());
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|||||||
// Reperisce fattore di conversione per UM principale,
|
// Reperisce fattore di conversione per UM principale,
|
||||||
// la quantita residua
|
// la quantita residua
|
||||||
real qtares = rdoc.qtaresidua(); // ZIO PERA! ag völ la riga dal document
|
real qtares = rdoc.qtaresidua(); // ZIO PERA! ag völ la riga dal document
|
||||||
qtares = _art_giac->convert_to_um(qtares, "", um, TRUE);
|
qtares = _art_giac->convert_to_um(qtares, "", um, true);
|
||||||
qtares *= segno; // mette a posto il segno...
|
qtares *= segno; // mette a posto il segno...
|
||||||
// Trova il periodo giusto
|
// Trova il periodo giusto
|
||||||
const int index = find_period(datacons);
|
const int index = find_period(datacons);
|
||||||
@ -358,7 +358,7 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|||||||
else
|
else
|
||||||
if (action == "PREZZONS")
|
if (action == "PREZZONS")
|
||||||
{
|
{
|
||||||
real pns = rdoc.prezzo(TRUE,FALSE); // Prezzo netto scontato
|
real pns = rdoc.prezzo(true,false); // Prezzo netto scontato
|
||||||
cf.set(pns.string());
|
cf.set(pns.string());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -415,12 +415,12 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|||||||
TString16 annoes; annoes.format("%04d", esc.date2esc(oggi));
|
TString16 annoes; annoes.format("%04d", esc.date2esc(oggi));
|
||||||
const TString16 codmag(rdoc.get("CODMAG")); // Riferito al magazzino indicato sulla riga...
|
const TString16 codmag(rdoc.get("CODMAG")); // Riferito al magazzino indicato sulla riga...
|
||||||
const TString16 livello(_level > 0 ? rdoc.get(RDOC_LIVELLO) : "");
|
const TString16 livello(_level > 0 ? rdoc.get(RDOC_LIVELLO) : "");
|
||||||
g = _art_giac->disponibilita(annoes, codmag, livello, TRUE); // Giacenza attuale
|
g = _art_giac->disponibilita(annoes, codmag, livello, true); // Giacenza attuale
|
||||||
}
|
}
|
||||||
cf.set(g.string());
|
cf.set(g.string());
|
||||||
}
|
}
|
||||||
//Ignore any other command
|
//Ignore any other command
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return TForm::validate(cf, s);
|
return TForm::validate(cf, s);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user