This commit was manufactured by cvs2svn to create branch 'R_10_00'.
git-svn-id: svn://10.65.10.50/branches/R_10_00@20970 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
065d6506ac
commit
cb07a3a233
25
ha/ha1.cpp
Executable file
25
ha/ha1.cpp
Executable file
@ -0,0 +1,25 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#include "ha1.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1}"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
int rt = -1 ;
|
||||
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0:
|
||||
rt = ha1100(argc, argv) ; break; //generazione .txt da files .ini del postino (file tipo XXXvar.txt)
|
||||
break;
|
||||
case 1:
|
||||
rt = ha1200(argc, argv) ; break; //generazione .txt da anagrafica campo (file tipo XXX.txt)
|
||||
break;
|
||||
default:
|
||||
error_box(usage, argv[0]) ; break;
|
||||
}
|
||||
return rt;
|
||||
}
|
2
ha/ha1.h
Executable file
2
ha/ha1.h
Executable file
@ -0,0 +1,2 @@
|
||||
int ha1100(int argc, char* argv[]);
|
||||
int ha1200(int argc, char* argv[]);
|
375
ha/ha1200.cpp
Executable file
375
ha/ha1200.cpp
Executable file
@ -0,0 +1,375 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
|
||||
#include <comuni.h>
|
||||
|
||||
#include "../ve/condv.h"
|
||||
|
||||
#include "halib.h"
|
||||
|
||||
#include "ha1200a.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAutomask
|
||||
///////////////////////////////////////////////////////////
|
||||
class TFile2Txt_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TFile2Txt_mask();
|
||||
};
|
||||
|
||||
|
||||
bool TFile2Txt_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TFile2Txt_mask::TFile2Txt_mask() : TAutomask ("ha1200a")
|
||||
{
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
const TString& path = config.get("OutputPath");
|
||||
set(F_PATH, path);
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
// TSkeleton_application
|
||||
///////////////////////////////////////
|
||||
class TFile2Txt : public TSkeleton_application
|
||||
{
|
||||
TFilename _output_dir;
|
||||
|
||||
protected:
|
||||
void elabora(const TMask& mask);
|
||||
|
||||
void genera_agenti_txt();
|
||||
void genera_clienti_txt();
|
||||
void genera_sospesi_txt();
|
||||
void genera_righelistini_txt();
|
||||
void genera_contratti_txt();
|
||||
void genera_promozioni_txt();
|
||||
void genera_prodotti_txt();
|
||||
void genera_barcode_txt();
|
||||
|
||||
TFilename genera_path(const TString& prefisso);
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
};
|
||||
|
||||
|
||||
TFilename TFile2Txt::genera_path(const TString& prefisso)
|
||||
{
|
||||
TFilename output_path;
|
||||
output_path = _output_dir;
|
||||
output_path.add(prefisso);
|
||||
output_path.ext(".txt");
|
||||
return output_path;
|
||||
}
|
||||
|
||||
void TFile2Txt::genera_agenti_txt()
|
||||
{
|
||||
//AS400 recordset da riempire (da lui nascerà il .txt)
|
||||
TEsporta_agenti_recordset agenti;
|
||||
|
||||
//ISAM recordset con tutti i dati degli archivi Campo (servirà per riempire l'AS400 recset)
|
||||
TISAM_recordset archivio_agenti("USE AGENTI");
|
||||
const long archivio_agenti_items = archivio_agenti.items();
|
||||
//scansione ISAM
|
||||
TProgind progind(archivio_agenti_items, "Agenti...", false, true);
|
||||
for (bool ok = archivio_agenti.move_first(); ok; ok = archivio_agenti.move_next())
|
||||
{
|
||||
progind.addstatus(1);
|
||||
|
||||
//riga dell'AS400 recset da riempire
|
||||
agenti.new_rec("");
|
||||
|
||||
agenti.set("CodiceTerminale", 0L);
|
||||
TString8 codage = archivio_agenti.get(AGE_CODAGE).as_string();
|
||||
codage = codage.right(3);
|
||||
agenti.set(AGE_CODAGE, codage);
|
||||
agenti.set(AGE_RAGSOC, archivio_agenti.get(AGE_RAGSOC));
|
||||
}
|
||||
|
||||
//prepara il nome corretto del file .txt e lo genera
|
||||
TFilename output_path = genera_path("agenti");
|
||||
//..e alla fine della fiera salva il file di testo nell directory selezionata
|
||||
agenti.save_as(output_path, fmt_text);
|
||||
}
|
||||
|
||||
|
||||
//clienti: i commenti del metodo sono nella genera_cliente_txt() della ha1100 (che è la mamma di questo)
|
||||
void TFile2Txt::genera_clienti_txt()
|
||||
{
|
||||
TEsporta_clienti_recordset clienti;
|
||||
|
||||
TString query;
|
||||
query << "USE CLIFO";
|
||||
query << "\nJOIN CFVEN INTO TIPOCF=TIPOCF CODCF=CODCF";
|
||||
query << "\nFROM TIPOCF=C";
|
||||
query << "\nTO TIPOCF=C";
|
||||
|
||||
TISAM_recordset archivio_clienti(query);
|
||||
const long archivio_clienti_items = archivio_clienti.items();
|
||||
|
||||
TProgind progind(archivio_clienti_items, "Clienti...", false, true);
|
||||
for (bool ok = archivio_clienti.move_first(); ok; ok = archivio_clienti.move_next())
|
||||
{
|
||||
progind.addstatus(1);
|
||||
|
||||
clienti.new_rec("");
|
||||
|
||||
//il codice terminale è il codagente legato al cliente
|
||||
TString8 codage = archivio_clienti.get(CFV_CODAG).as_string();
|
||||
codage = codage.right(3);
|
||||
clienti.set("CodiceTerminale", codage);
|
||||
|
||||
clienti.set(CLI_CODCF, archivio_clienti.get(CLI_CODCF));
|
||||
clienti.set(CLI_RAGSOC, archivio_clienti.get(CLI_RAGSOC));
|
||||
|
||||
TString80 indcf = archivio_clienti.get(CLI_INDCF).as_string();
|
||||
indcf << " " << archivio_clienti.get(CLI_CIVCF).as_string();
|
||||
clienti.set(CLI_INDCF, indcf);
|
||||
|
||||
const TString& statocf = archivio_clienti.get(CLI_STATOCF).as_string();
|
||||
if (statocf.blank())
|
||||
{
|
||||
const TString& comcf = archivio_clienti.get(CLI_COMCF).as_string();
|
||||
TToken_string key;
|
||||
key.add(statocf);
|
||||
key.add(comcf);
|
||||
const TRectype& rec_comuni = cache().get(LF_COMUNI, key);
|
||||
TString80 dencom = rec_comuni.get(COM_DENCOM);
|
||||
clienti.set("Localita", dencom);
|
||||
const TString& provcf = rec_comuni.get(COM_PROVCOM);
|
||||
clienti.set("Provincia", provcf);
|
||||
}
|
||||
|
||||
clienti.set(CLI_CAPCF, archivio_clienti.get(CLI_CAPCF));
|
||||
|
||||
clienti.set(CLI_PAIV, archivio_clienti.get(CLI_PAIV));
|
||||
|
||||
TString4 codpag = archivio_clienti.get(CLI_CODPAG).as_string();
|
||||
clienti.set(CLI_CODPAG, codpag);
|
||||
|
||||
TString query;
|
||||
query << "USE CONDV";
|
||||
query << "\nFROM TIPO=C TIPOCF=C CODCF=#CODCF";
|
||||
query << "\nTO TIPO=C TIPOCF=C CODCF=#CODCF";
|
||||
|
||||
TISAM_recordset contratti(query);
|
||||
contratti.set_var("#CODCF", archivio_clienti.get(CLI_CODCF).as_int());
|
||||
if (contratti.move_last())
|
||||
{
|
||||
const TString& cod_contr = contratti.get(CONDV_COD).as_string();
|
||||
clienti.set("CodiceListino", cod_contr);
|
||||
}
|
||||
|
||||
TString16 ntel = archivio_clienti.get(CLI_PTEL).as_string();
|
||||
ntel << archivio_clienti.get(CLI_TEL).as_string();
|
||||
clienti.set(CLI_TEL, ntel);
|
||||
|
||||
clienti.set(CLI_CODCFFATT, archivio_clienti.get(CLI_CODCFFATT));
|
||||
|
||||
real fido = archivio_clienti.get(CLI_FIDO).as_real();
|
||||
fido *= CENTO;
|
||||
fido.round();
|
||||
clienti.set(CLI_FIDO, fido);
|
||||
|
||||
const bool sospeso = archivio_clienti.get(CLI_SOSPESO).as_bool();
|
||||
TString4 s;
|
||||
if (sospeso)
|
||||
s='S';
|
||||
clienti.set("NoConsegna", TVariant(s));
|
||||
|
||||
clienti.set(CLI_COFI, archivio_clienti.get(CLI_COFI));
|
||||
|
||||
const TString& str_sconto = archivio_clienti.get(CFV_SCONTO).as_string();
|
||||
clienti.set("ScontoFineFattura", find_sconto(str_sconto));
|
||||
|
||||
clienti.set(CFV_ASSFIS, archivio_clienti.get(CFV_ASSFIS));
|
||||
}
|
||||
|
||||
TFilename output_path = genera_path("clienti");
|
||||
clienti.save_as(output_path, fmt_text);
|
||||
}
|
||||
|
||||
|
||||
void TFile2Txt::genera_sospesi_txt()
|
||||
{
|
||||
}
|
||||
|
||||
//listini: i commenti del metodo sono nella genera_listino_txt() della ha1100
|
||||
void TFile2Txt::genera_righelistini_txt()
|
||||
{
|
||||
TEsporta_listini_recordset righe_listini;
|
||||
|
||||
TString query;
|
||||
query << "USE RCONDV";
|
||||
query << "\nFROM TIPO=L";
|
||||
query << "\nTO TIPO=L";
|
||||
|
||||
TISAM_recordset archivio_rcondv(query);
|
||||
const long archivio_rcondv_items = archivio_rcondv.items();
|
||||
|
||||
TProgind progind(archivio_rcondv_items, "Listini...", false, true);
|
||||
for (bool ok = archivio_rcondv.move_first(); ok; ok = archivio_rcondv.move_next())
|
||||
{
|
||||
progind.addstatus(1);
|
||||
|
||||
righe_listini.new_rec("");
|
||||
|
||||
righe_listini.set("CodiceTerminale", 0L);
|
||||
righe_listini.set(RCONDV_COD, archivio_rcondv.get(RCONDV_COD));
|
||||
TString80 codart = archivio_rcondv.get(RCONDV_CODRIGA).as_string();
|
||||
righe_listini.set(RCONDV_CODRIGA, codart);
|
||||
|
||||
real prezzo = archivio_rcondv.get(RCONDV_PREZZO).as_real();
|
||||
if (prezzo.is_zero())
|
||||
{
|
||||
TToken_string key_umart;
|
||||
key_umart.add(codart);
|
||||
key_umart.add(1);
|
||||
const TRectype& rec_umart = cache().get(LF_UMART, key_umart);
|
||||
prezzo = rec_umart.get_real(UMART_PREZZO);
|
||||
}
|
||||
prezzo *= 1000;
|
||||
prezzo.round();
|
||||
righe_listini.set(RCONDV_PREZZO, prezzo.integer());
|
||||
|
||||
const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
|
||||
righe_listini.set(RCONDV_SCONTO, find_sconto(str_sconto));
|
||||
}
|
||||
|
||||
TFilename output_path = genera_path("listini");
|
||||
righe_listini.save_as(output_path, fmt_text);
|
||||
}
|
||||
|
||||
|
||||
void TFile2Txt::genera_contratti_txt()
|
||||
{
|
||||
TEsporta_contratti_recordset righe_contratti;
|
||||
|
||||
TString query;
|
||||
query << "USE RCONDV";
|
||||
query << "JOIN CONDV INTO TIPO=TIPO TIPOCF=TIPOCF CODCF=CODCF COD=COD";
|
||||
query << "\nFROM TIPO=C";
|
||||
query << "\nTO TIPO=C";
|
||||
|
||||
TISAM_recordset archivio_rcondv(query);
|
||||
const long archivio_rcondv_items = archivio_rcondv.items();
|
||||
|
||||
TProgind progind(archivio_rcondv_items, "Contratti...", false, true);
|
||||
for (bool ok = archivio_rcondv.move_first(); ok; ok = archivio_rcondv.move_next())
|
||||
{
|
||||
progind.addstatus(1);
|
||||
|
||||
righe_contratti.new_rec("");
|
||||
|
||||
const long codcf = archivio_rcondv.get(CONDV_CODCF).as_int();
|
||||
righe_contratti.set("CodiceTerminale", find_codag(codcf));
|
||||
righe_contratti.set(RCONDV_CODRIGA, archivio_rcondv.get(RCONDV_CODRIGA));
|
||||
righe_contratti.set(RCONDV_PREZZO, archivio_rcondv.get(RCONDV_PREZZO));
|
||||
const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
|
||||
righe_contratti.set(RCONDV_SCONTO, find_sconto(str_sconto));
|
||||
}
|
||||
|
||||
TFilename output_path = genera_path("particolari");
|
||||
righe_contratti.save_as(output_path, fmt_text);
|
||||
}
|
||||
|
||||
void TFile2Txt::genera_promozioni_txt()
|
||||
{
|
||||
TEsporta_contratti_recordset righe_offerte;
|
||||
|
||||
TString query;
|
||||
query << "USE RCONDV";
|
||||
query << "JOIN CONDV INTO TIPO=TIPO TIPOCF=TIPOCF CODCF=CODCF COD=COD";
|
||||
query << "\nFROM TIPO=O";
|
||||
query << "\nTO TIPO=O";
|
||||
|
||||
TISAM_recordset archivio_rcondv(query);
|
||||
const long archivio_rcondv_items = archivio_rcondv.items();
|
||||
|
||||
TProgind progind(archivio_rcondv_items, "Promozioni...", false, true);
|
||||
for (bool ok = archivio_rcondv.move_first(); ok; ok = archivio_rcondv.move_next())
|
||||
{
|
||||
progind.addstatus(1);
|
||||
|
||||
righe_offerte.new_rec("");
|
||||
|
||||
}
|
||||
|
||||
TFilename output_path = genera_path("particolari");
|
||||
righe_offerte.save_as(output_path, fmt_text);
|
||||
}
|
||||
|
||||
//prodotti: i commenti del metodo sono nella genera_prodotto_txt() della ha1100
|
||||
void TFile2Txt::genera_prodotti_txt()
|
||||
{
|
||||
}
|
||||
|
||||
void TFile2Txt::genera_barcode_txt()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//metodo di alto livello per la gestione delle chiamate
|
||||
void TFile2Txt::elabora(const TMask& mask)
|
||||
{
|
||||
if (mask.get_bool(F_AGENTI))
|
||||
genera_agenti_txt();
|
||||
|
||||
if (mask.get_bool(F_CLIENTI))
|
||||
genera_clienti_txt();
|
||||
|
||||
if (mask.get_bool(F_SOSPESI))
|
||||
genera_sospesi_txt();
|
||||
|
||||
if (mask.get_bool(F_LISTINI))
|
||||
genera_righelistini_txt();
|
||||
|
||||
if (mask.get_bool(F_CONTRATTI))
|
||||
genera_contratti_txt();
|
||||
|
||||
if (mask.get_bool(F_PROMOZIONI))
|
||||
genera_promozioni_txt();
|
||||
|
||||
if (mask.get_bool(F_PRODOTTI))
|
||||
genera_prodotti_txt();
|
||||
|
||||
if (mask.get_bool(F_BARCODE))
|
||||
genera_barcode_txt();
|
||||
}
|
||||
|
||||
|
||||
void TFile2Txt::main_loop()
|
||||
{
|
||||
TFile2Txt_mask mask;
|
||||
_output_dir = mask.get(F_PATH);
|
||||
while (mask.run() == K_ENTER)
|
||||
{
|
||||
elabora(mask);
|
||||
}
|
||||
}
|
||||
|
||||
bool TFile2Txt::create()
|
||||
{
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
int ha1200(int argc, char* argv[])
|
||||
{
|
||||
TFile2Txt a;
|
||||
a.run(argc, argv, "Generazione .txt da archivi");
|
||||
return 0;
|
||||
}
|
14
ha/ha1200a.h
Executable file
14
ha/ha1200a.h
Executable file
@ -0,0 +1,14 @@
|
||||
#define F_PATH 200
|
||||
#define F_AGENTI 201
|
||||
#define F_CLIENTI 202
|
||||
#define F_SOSPESI 203
|
||||
#define F_LISTINI 204
|
||||
#define F_CONTRATTI 205
|
||||
#define F_PROMOZIONI 206
|
||||
#define F_PRODOTTI 207
|
||||
#define F_LINEE 208
|
||||
#define F_BARCODE 209
|
||||
#define F_DECODART 210
|
||||
#define F_ATTREZZA 211
|
||||
#define F_TABPAG 212
|
||||
#define F_CARICO 213
|
108
ha/ha1200a.uml
Executable file
108
ha/ha1200a.uml
Executable file
@ -0,0 +1,108 @@
|
||||
#include "ha1200a.h"
|
||||
|
||||
PAGE "Esportazione archivi in formato .txt" -1 -1 78 12
|
||||
|
||||
STRING F_PATH 256 50
|
||||
BEGIN
|
||||
PROMPT 1 1 "Cartella creazione files "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 8
|
||||
BEGIN
|
||||
PROMPT 1 2 "@bArchivi da trasferire"
|
||||
END
|
||||
|
||||
BOOLEAN F_AGENTI
|
||||
BEGIN
|
||||
PROMPT 2 3 "Agenti"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_CLIENTI
|
||||
BEGIN
|
||||
PROMPT 2 4 "Clienti"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_SOSPESI
|
||||
BEGIN
|
||||
PROMPT 2 5 "Sospesi"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_LISTINI
|
||||
BEGIN
|
||||
PROMPT 2 6 "Listini"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_CONTRATTI
|
||||
BEGIN
|
||||
PROMPT 2 7 "Contratti"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_PROMOZIONI
|
||||
BEGIN
|
||||
PROMPT 2 8 "Promozioni"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_PRODOTTI
|
||||
BEGIN
|
||||
PROMPT 20 3 "Prodotti"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_LINEE
|
||||
BEGIN
|
||||
PROMPT 20 4 "Linee"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_BARCODE
|
||||
BEGIN
|
||||
PROMPT 20 5 "Barcode"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_DECODART
|
||||
BEGIN
|
||||
PROMPT 20 6 "Codici articolo alternativi"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_ATTREZZA
|
||||
BEGIN
|
||||
PROMPT 45 3 "Attrezzature"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_TABPAG
|
||||
BEGIN
|
||||
PROMPT 45 4 "Condizioni pagamento"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BOOLEAN F_CARICO
|
||||
BEGIN
|
||||
PROMPT 45 5 "Documenti di carico"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING DLG_PROFILE 50
|
||||
BEGIN
|
||||
PROMPT 1 -1 "Profilo "
|
||||
PSELECT
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
#include <elabar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user