Patch level : 10.0
Files correlati : lv?.exe Ricompilazione Demo : [ ] Commento : Aggiunta classe per gestire effcientemente i contratti delle lavanderie git-svn-id: svn://10.65.10.50/trunk@17667 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cee0637ed0
commit
effec481fb
81
lv/lvlib.cpp
81
lv/lvlib.cpp
@ -1,11 +1,16 @@
|
|||||||
#include "lvlib.h"
|
#include "lvlib.h"
|
||||||
#include "..\mg\clifogiac.h"
|
#include "lvrcondv.h"
|
||||||
|
|
||||||
|
#include "../cg/cglib01.h"
|
||||||
|
#include "../mg/clifogiac.h"
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <date.h>
|
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include "../cg/cglib01.h"
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Utilities
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void lv_set_creation_info(TRectype& rec)
|
void lv_set_creation_info(TRectype& rec)
|
||||||
{
|
{
|
||||||
@ -20,19 +25,77 @@ void lv_set_update_info(TRectype& rec)
|
|||||||
long lv_find_contract(const long codcf, const long indsped, const TDate& data)
|
long lv_find_contract(const long codcf, const long indsped, const TDate& data)
|
||||||
{
|
{
|
||||||
TString query;
|
TString query;
|
||||||
query << "USE LVCONDV SELECT BETWEEN(#DATA,DATAIN,DATASC) && BETWEEN(CODINDSP,#INDSPED,#INDSPED)\n"
|
query << "USE LVCONDV\n"
|
||||||
|
<< "SELECT BETWEEN(#DATA,DATAIN,DATASC)&&BETWEEN(CODINDSP,#INDSPED,#INDSPED)\n"
|
||||||
<< "FROM CODCF=#CODCF\nTO CODCF=#CODCF";
|
<< "FROM CODCF=#CODCF\nTO CODCF=#CODCF";
|
||||||
TISAM_recordset contr(query);
|
TISAM_recordset contr(query);
|
||||||
contr.set_var("#DATA",data);
|
contr.set_var("#DATA",data);
|
||||||
contr.set_var("#INDSPED",indsped);
|
contr.set_var("#INDSPED",indsped);
|
||||||
contr.set_var("#CODCF",codcf);
|
contr.set_var("#CODCF",codcf);
|
||||||
|
|
||||||
|
long cod = 0L;
|
||||||
if (contr.move_first())
|
if (contr.move_first())
|
||||||
return contr.get("CODCONT").as_int();
|
cod = contr.get("CODCONT").as_int();
|
||||||
|
|
||||||
return 0;
|
return cod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TLaundry_contract
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Ritorna la riga di contratto corrispondente a codart
|
||||||
|
const TRectype& TLaundry_contract::row(const char* codart) const
|
||||||
|
{
|
||||||
|
TToken_string key;
|
||||||
|
key.add(get(LVRCONDV_CODCF));
|
||||||
|
key.add(get(LVRCONDV_CODCONT));
|
||||||
|
key.add(codart);
|
||||||
|
return cache().get(LF_LVRCONDV, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Controlla se il contratto esiste veramente
|
||||||
|
bool TLaundry_contract::ok() const
|
||||||
|
{ return !empty(); }
|
||||||
|
|
||||||
|
// Legge un contratto tramite la chiave primaria cliente+codice
|
||||||
|
bool TLaundry_contract::read(const long codcf, const long codcont)
|
||||||
|
{
|
||||||
|
if (codcf > 0 && codcont > 0) // Campi obbligatori!
|
||||||
|
{
|
||||||
|
TString16 key; key.format("%ld|%ld", codcf, codcont);
|
||||||
|
*((TRectype*)this) = cache().get(LF_LVCONDV, key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
zero();
|
||||||
|
return ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cerca il contratto in essere alla data di un certo cliente+indirizzo
|
||||||
|
bool TLaundry_contract::read(const long codcf, const long indsped, const TDate& data)
|
||||||
|
{
|
||||||
|
const long codcont = lv_find_contract(codcf, indsped, data);
|
||||||
|
return read(codcf, codcont);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inizializza un contratto vuoto: servira' una read successiva
|
||||||
|
TLaundry_contract::TLaundry_contract() : TRectype(LF_LVCONDV)
|
||||||
|
{ zero(); }
|
||||||
|
|
||||||
|
// Inizializza un contratto in base alla chiave primaria
|
||||||
|
TLaundry_contract::TLaundry_contract(const long codcf, const long codcont)
|
||||||
|
: TRectype(LF_LVCONDV)
|
||||||
|
{ read(codcf, codcont); }
|
||||||
|
|
||||||
|
// Tenta di inizilizzare il contratto corrente di un cliente
|
||||||
|
TLaundry_contract::TLaundry_contract(const long codcf, const long indsped, const TDate& data)
|
||||||
|
: TRectype(LF_LVCONDV)
|
||||||
|
{ read(codcf, indsped, data); }
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TRecmag_lavanderie
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void TRecmag_lavanderie::update()
|
void TRecmag_lavanderie::update()
|
||||||
{
|
{
|
||||||
if (_update_time > 0L)
|
if (_update_time > 0L)
|
||||||
@ -194,6 +257,9 @@ TObject* TRecmag_lavanderie::dup() const
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TArticolo_lavanderie
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
const TString & TArticolo_lavanderie::get_str(const char* fieldname) const
|
const TString & TArticolo_lavanderie::get_str(const char* fieldname) const
|
||||||
{
|
{
|
||||||
@ -337,8 +403,9 @@ TArticolo_lavanderie::TArticolo_lavanderie(const TRectype & rec, const char tipo
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TArticolo_lavanderie_cache
|
// TCache_articoli_lavanderie
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TCache_articoli_lavanderie : public TRecord_cache
|
class TCache_articoli_lavanderie : public TRecord_cache
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
35
lv/lvlib.h
35
lv/lvlib.h
@ -1,26 +1,33 @@
|
|||||||
#ifndef __LVLIB_H
|
#ifndef __LVLIB_H
|
||||||
#define __LVLIB_H
|
#define __LVLIB_H
|
||||||
|
|
||||||
#ifndef __ISAM_H
|
|
||||||
#include <isam.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __RECSET_H
|
#ifndef __RECSET_H
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __VARREC_H
|
#ifndef __MGLIB_H
|
||||||
#include <varrec.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../mg/mglib.h"
|
#include "../mg/mglib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void lv_set_creation_info(TRectype& rec);
|
void lv_set_creation_info(TRectype& rec);
|
||||||
void lv_set_update_info(TRectype& rec);
|
void lv_set_update_info(TRectype& rec);
|
||||||
long lv_find_contract(const long codcf, const long indsped, const TDate& data);
|
long lv_find_contract(const long codcf, const long indsped, const TDate& data);
|
||||||
|
|
||||||
class TRecmag_lavanderie : public TVariable_rectype
|
class TLaundry_contract : public TRectype
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
const TRectype& row(const char* codart) const;
|
||||||
|
virtual bool ok() const;
|
||||||
|
|
||||||
|
bool read(const long codcf, const long codcont);
|
||||||
|
bool read(const long codcf, const long indsped, const TDate& data);
|
||||||
|
|
||||||
|
TLaundry_contract();
|
||||||
|
TLaundry_contract(const long codcf, const long codcont);
|
||||||
|
TLaundry_contract(const long codcf, const long indsped, const TDate& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
class TRecmag_lavanderie : public TVariable_rectype
|
||||||
{
|
{
|
||||||
TVariant _dotin;
|
TVariant _dotin;
|
||||||
TVariant _dotod;
|
TVariant _dotod;
|
||||||
@ -48,10 +55,10 @@ public:
|
|||||||
|
|
||||||
class TArticolo_lavanderie : public TArticolo_giacenza_data
|
class TArticolo_lavanderie : public TArticolo_giacenza_data
|
||||||
{
|
{
|
||||||
int _anno_lav;
|
int _anno_lav;
|
||||||
char _tipocf;
|
char _tipocf;
|
||||||
long _codcf;
|
long _codcf;
|
||||||
int _indsped;
|
int _indsped;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// la get_str supporta anche la sintassi:
|
// la get_str supporta anche la sintassi:
|
||||||
@ -89,7 +96,7 @@ public:
|
|||||||
virtual ~TArticolo_lavanderie() {}
|
virtual ~TArticolo_lavanderie() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
TArticolo_lavanderie & cached_article_laundry(const char * codart, const char tipocf, const long codcf, const int indsped);
|
TArticolo_lavanderie& cached_article_laundry(const char * codart, const char tipocf, const long codcf, const int indsped);
|
||||||
|
|
||||||
class TLavanderie_calendar : public TObject
|
class TLavanderie_calendar : public TObject
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user