Patch level : 10.0 patch ???
Files correlati : ps0713 Ricompilazione Demo : [ ] Commento : Spostate alcune classi comuni a tutti i programmi in questa piccola libreria git-svn-id: svn://10.65.10.50/trunk@20467 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2b6d1599f8
commit
82a27843a6
143
ps/ps0713lib.cpp
Executable file
143
ps/ps0713lib.cpp
Executable file
@ -0,0 +1,143 @@
|
||||
#include "ps0713lib.h"
|
||||
|
||||
////////////////////////////////
|
||||
//// TCOMMESSA_STRING ////
|
||||
////////////////////////////////
|
||||
|
||||
//IDLAVORO: metodo che restituisce l'Idlavoro
|
||||
const long TCommessa_string::idlavoro()
|
||||
{
|
||||
return get_long(0);
|
||||
}
|
||||
|
||||
//GRUPPO: metodo che restituisce il gruppo
|
||||
const int TCommessa_string::gruppo()
|
||||
{
|
||||
return get_int(1);
|
||||
}
|
||||
|
||||
//CONTO: metodo che restituisce il conto
|
||||
const int TCommessa_string::conto()
|
||||
{
|
||||
return get_int(2);
|
||||
}
|
||||
|
||||
//SOTCO: metodo che restituisce il sottoconto
|
||||
const long TCommessa_string::sotco()
|
||||
{
|
||||
return get_long(3);
|
||||
}
|
||||
|
||||
//metodo costruttore
|
||||
TCommessa_string::TCommessa_string(const long idlavoro, const int gruppo, const int conto, const long sotco)
|
||||
{
|
||||
add(idlavoro);
|
||||
add(gruppo);
|
||||
add(conto);
|
||||
add(sotco);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////
|
||||
//// TCOMMESSA ////
|
||||
/////////////////////////
|
||||
|
||||
//CODICE: metodo che restituisce il codice di ripartizione
|
||||
const TString8 TCommessa::codice() const
|
||||
{
|
||||
return _codice;
|
||||
}
|
||||
|
||||
//CMSSTR: metodo che restituisce la TToken_string contenente le informazioni di codcms e del conto
|
||||
const TCommessa_string TCommessa::cmsstr() const
|
||||
{
|
||||
return _commessa;
|
||||
}
|
||||
|
||||
//metodo costruttore
|
||||
TCommessa::TCommessa(const char* codcms)
|
||||
{
|
||||
TString query;
|
||||
query << "USE RIP KEY 4\n"
|
||||
<< "FROM TIPO=\"B\" CODCOSTO=\"\" CODCMS=\"" << codcms << "\"\n"
|
||||
<< "TO TIPO=\"B\" CODCOSTO=\"\" CODCMS=\"" << codcms << "\"\n";
|
||||
|
||||
TISAM_recordset rip(query);
|
||||
rip.move_first();
|
||||
|
||||
if(!rip.empty())
|
||||
{
|
||||
_codice = rip.get("CODICE").as_string();
|
||||
|
||||
const long codcms = rip.get("CODCMS").as_int();
|
||||
|
||||
query.cut(0);
|
||||
query << "USE RRIP\n"
|
||||
<< "FROM TIPO=\"B\" CODICE=" << _codice << " NRIGA=1\n"
|
||||
<< "TO TIPO=\"B\" CODICE=" << _codice << " NRIGA=1\n";
|
||||
|
||||
TISAM_recordset rrip(query);
|
||||
rrip.move_first();
|
||||
|
||||
TString80 str = rrip.get("CODCONTO").as_string();
|
||||
const int gruppo = atoi(str.left(3));
|
||||
const int conto = atoi(str.mid(3,3));
|
||||
const long sotco = atol(str.right(6));
|
||||
|
||||
TCommessa_string cms(codcms, gruppo, conto, sotco);
|
||||
|
||||
_commessa = cms;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
//// TVB_RECSET ////
|
||||
//////////////////////////
|
||||
|
||||
TRecnotype TVB_recset::new_rec(const char* buf)
|
||||
{
|
||||
TToken_string str(256,'\t'); //nuovo record tab separator
|
||||
|
||||
if(buf && *buf)
|
||||
{
|
||||
bool apici=false;
|
||||
|
||||
for (const char* c = buf; *c ; c++)
|
||||
{
|
||||
if (*c == '"')
|
||||
{
|
||||
apici = !apici;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*c == separator())
|
||||
{
|
||||
if (!apici)
|
||||
str << str.separator();
|
||||
else
|
||||
str << *c;
|
||||
}
|
||||
else
|
||||
str << *c;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TRecnotype n = TText_recordset::new_rec(str);
|
||||
|
||||
if (n >= 0)
|
||||
row(n).separator(str.separator());
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
TVB_recset::TVB_recset(const char * fileName, const char s)
|
||||
: TCSV_recordset("CSV(,)")
|
||||
{
|
||||
set_separator(s);
|
||||
load_file(fileName);
|
||||
}
|
64
ps/ps0713lib.h
Executable file
64
ps/ps0713lib.h
Executable file
@ -0,0 +1,64 @@
|
||||
#ifndef __PS0713LIB_H
|
||||
#define __PS0713LIB_H
|
||||
|
||||
#ifndef __RECSET_H
|
||||
#include <recset.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TEXTSET_H
|
||||
#include <textset.h>
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//// TCOMMESSA_STRING ////
|
||||
////////////////////////////////
|
||||
|
||||
//classe TCommessa_string
|
||||
class TCommessa_string: public TToken_string
|
||||
{
|
||||
public:
|
||||
const long idlavoro();
|
||||
const int gruppo();
|
||||
const int conto();
|
||||
const long sotco();
|
||||
|
||||
TCommessa_string& operator= (const char* key){ set(key); return *this; }
|
||||
|
||||
TCommessa_string(const long idlavoro, const int gruppo, const int conto, const long sotco);
|
||||
TCommessa_string(const char* key):TToken_string(key){}
|
||||
TCommessa_string(const TToken_string& key):TToken_string(key){}
|
||||
TCommessa_string(const TCommessa_string& key):TToken_string(key){}
|
||||
TCommessa_string():TToken_string(){}
|
||||
};
|
||||
|
||||
/////////////////////////
|
||||
//// TCOMMESSA ////
|
||||
/////////////////////////
|
||||
|
||||
//Classe TCommessa
|
||||
class TCommessa : public TObject
|
||||
{
|
||||
TString8 _codice;
|
||||
TCommessa_string _commessa;
|
||||
|
||||
public:
|
||||
const TString8 codice() const;
|
||||
const TCommessa_string cmsstr() const;
|
||||
TCommessa(const char* codcms);
|
||||
};
|
||||
|
||||
//////////////////////////
|
||||
//// TVB_RECSET ////
|
||||
//////////////////////////
|
||||
|
||||
//Classe TVB_recset
|
||||
class TVB_recset : public TCSV_recordset
|
||||
{
|
||||
protected:
|
||||
virtual TRecnotype new_rec(const char* buf = NULL);
|
||||
|
||||
public:
|
||||
TVB_recset(const char* fileName, const char s);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user