Patch level : 10.0
Files correlati : lvlib Ricompilazione Demo : [ ] Commento : Aggiunti i metodi per modificare una riga contratto tra i membri dei TLaundry_contract git-svn-id: svn://10.65.10.50/trunk@19297 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3c365ba637
commit
5da5f59d21
153
lv/lvlib.cpp
153
lv/lvlib.cpp
@ -73,6 +73,22 @@ long lv_find_contract(const long codcf, const long indsped, const TDate& data)
|
||||
// TLaundry_contract
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TRectype& TLaundry_contract::modify_row(const char* codart)
|
||||
{
|
||||
const long codcf = get_int(LVRCONDV_CODCF);
|
||||
const long codcont = get_int(LVRCONDV_CODCONT);
|
||||
|
||||
TLocalisamfile rcondv(LF_LVRCONDV);
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
|
||||
int err = rcondv.read();
|
||||
|
||||
TRectype& riga = rcondv.curr();
|
||||
return riga;
|
||||
}
|
||||
|
||||
// Ritorna la riga di contratto corrispondente a codart
|
||||
const TRectype& TLaundry_contract::row(const char* codart) const
|
||||
{
|
||||
@ -109,7 +125,7 @@ int TLaundry_contract::add_row(const char* codart)
|
||||
{
|
||||
const long codcf = get_int(LVRCONDV_CODCF);
|
||||
const long codcont = get_int(LVRCONDV_CODCONT);
|
||||
|
||||
|
||||
TLocalisamfile rcondv(LF_LVRCONDV);
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
@ -118,6 +134,141 @@ int TLaundry_contract::add_row(const char* codart)
|
||||
return rcondv.rewrite_write();
|
||||
}
|
||||
|
||||
//fa l'update di una riga del contratto
|
||||
int TLaundry_contract::update_row(const char* codart, const char* fieldname, const bool bol)
|
||||
{
|
||||
const long codcf = get_int(LVRCONDV_CODCF);
|
||||
const long codcont = get_int(LVRCONDV_CODCONT);
|
||||
|
||||
TLocalisamfile rcondv(LF_LVRCONDV);
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
|
||||
int err = rcondv.read();
|
||||
|
||||
//se il record esiste
|
||||
if (err == NOERR)
|
||||
{
|
||||
rcondv.curr().zero();
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
rcondv.put(fieldname, bol);
|
||||
err = rcondv.rewrite();
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//fa l'update di una riga del contratto
|
||||
int TLaundry_contract::update_row(const char* codart, const char* fieldname, const char* str)
|
||||
{
|
||||
const long codcf = get_int(LVRCONDV_CODCF);
|
||||
const long codcont = get_int(LVRCONDV_CODCONT);
|
||||
|
||||
TLocalisamfile rcondv(LF_LVRCONDV);
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
|
||||
int err = rcondv.read();
|
||||
|
||||
//se il record esiste
|
||||
if (err == NOERR)
|
||||
{
|
||||
rcondv.curr().zero();
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
rcondv.put(fieldname, str);
|
||||
err = rcondv.rewrite();
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//fa l'update di una riga del contratto
|
||||
int TLaundry_contract::update_row(const char* codart, const char* fieldname, const long nmr)
|
||||
{
|
||||
const long codcf = get_int(LVRCONDV_CODCF);
|
||||
const long codcont = get_int(LVRCONDV_CODCONT);
|
||||
|
||||
TLocalisamfile rcondv(LF_LVRCONDV);
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
|
||||
int err = rcondv.read();
|
||||
|
||||
//se il record esiste
|
||||
if (err == NOERR)
|
||||
{
|
||||
rcondv.curr().zero();
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
rcondv.put(fieldname, nmr);
|
||||
err = rcondv.rewrite();
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//fa l'update di una riga del contratto
|
||||
int TLaundry_contract::update_row(const char* codart, const char* fieldname, const real nmr)
|
||||
{
|
||||
const long codcf = get_int(LVRCONDV_CODCF);
|
||||
const long codcont = get_int(LVRCONDV_CODCONT);
|
||||
|
||||
TLocalisamfile rcondv(LF_LVRCONDV);
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
|
||||
int err = rcondv.read();
|
||||
|
||||
//se il record esiste
|
||||
if (err == NOERR)
|
||||
{
|
||||
rcondv.curr().zero();
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
rcondv.put(fieldname, nmr);
|
||||
err = rcondv.rewrite();
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
//fa l'update di una riga del contratto
|
||||
int TLaundry_contract::update_row(const char* codart, const char* fieldname, const TDate& data)
|
||||
{
|
||||
const long codcf = get_int(LVRCONDV_CODCF);
|
||||
const long codcont = get_int(LVRCONDV_CODCONT);
|
||||
|
||||
TLocalisamfile rcondv(LF_LVRCONDV);
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
|
||||
int err = rcondv.read();
|
||||
|
||||
//se il record esiste
|
||||
if (err == NOERR)
|
||||
{
|
||||
rcondv.curr().zero();
|
||||
rcondv.put(LVRCONDV_CODCF, codcf);
|
||||
rcondv.put(LVRCONDV_CODCONT, codcont);
|
||||
rcondv.put(LVRCONDV_CODART, codart);
|
||||
rcondv.put(fieldname, data);
|
||||
err = rcondv.rewrite();
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
// Legge un contratto tramite la chiave primaria cliente+codice
|
||||
bool TLaundry_contract::read(const long codcf, const long codcont)
|
||||
{
|
||||
|
13
lv/lvlib.h
13
lv/lvlib.h
@ -20,15 +20,26 @@ bool lv_is_holiday(const TDate& data);
|
||||
|
||||
class TLaundry_contract : public TRectype
|
||||
{
|
||||
protected:
|
||||
TRectype& modify_row(const char* codart); //restituisce una riga modificabile
|
||||
|
||||
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);
|
||||
bool can_be_deleted() const;
|
||||
|
||||
//metodi per la gestione delle righe
|
||||
const TRectype& row(const char* codart) const;
|
||||
|
||||
int add_row(const char* codart);
|
||||
int update_row(const char* codart, const char* fieldname, const bool bol);
|
||||
int update_row(const char* codart, const char* fieldname, const char* str);
|
||||
int update_row(const char* codart, const char* fieldname, const long nmr);
|
||||
int update_row(const char* codart, const char* fieldname, const real nmr);
|
||||
int update_row(const char* codart, const char* fieldname, const TDate& data);
|
||||
|
||||
TLaundry_contract();
|
||||
TLaundry_contract(const TRectype & rec);
|
||||
|
Loading…
x
Reference in New Issue
Block a user