5ddf528044
Files correlati : Ricompilazione Demo : [ ] Commento : riporto hardy da 11.0 git-svn-id: svn://10.65.10.50/branches/R_10_00@21075 c028cbd2-c16b-5b4b-a496-9718f37d4682
394 lines
13 KiB
C++
Executable File
394 lines
13 KiB
C++
Executable File
|
|
#include "halib.h"
|
|
|
|
TString4 TContratto_premi::_tipo_ant;
|
|
TString4 TContratto_premi::_tipo_post;
|
|
TString4 TContratto_premi::_tipo_rifa;
|
|
|
|
//metodi della TContratto_premi
|
|
char TContratto_premi::tipo_contratto() const
|
|
{
|
|
//i tipi contratto vengono caricati solo al primo accesso, in modo da non dover rileggere tutte le volte..
|
|
//..il file di configurazione
|
|
if (_tipo_ant.blank())
|
|
{
|
|
TConfig config(CONFIG_DITTA, "ha");
|
|
_tipo_ant = config.get("CoAntTip");
|
|
_tipo_post = config.get("CoPostTip");
|
|
_tipo_rifa = config.get("CoRifaTip");
|
|
}
|
|
|
|
//ritorna il tipo contratto come carattere; se non lo trova -> tipo 'P'osticipo perchè..
|
|
//..è il tipo meno pericoloso (comunque non dovrebbe mai accadere in quanto il tipo è..
|
|
//..obbligatorio sia in immissione contratto che in configurazione modulo)
|
|
const TString& tipo_doc = get(DOC_TIPODOC);
|
|
if (tipo_doc == _tipo_ant)
|
|
return 'A';
|
|
else
|
|
{
|
|
if (tipo_doc == _tipo_rifa)
|
|
return 'R';
|
|
}
|
|
return 'P';
|
|
}
|
|
|
|
|
|
TContratto_premi::TContratto_premi(char provv, int anno, const char* codnum, long ndoc)
|
|
: TDocumento(provv, anno, codnum, ndoc)
|
|
{}
|
|
|
|
TContratto_premi::TContratto_premi(const TRectype& rec_doc)
|
|
: TDocumento(rec_doc)
|
|
{}
|
|
|
|
|
|
/////////////////////////////////////////////////////////////
|
|
// Recordset specifici per i dati da trasferire OUTPUT
|
|
/////////////////////////////////////////////////////////////
|
|
//questo è il metodo magico che vale per tutti
|
|
void THardy_recordset::add_field(const char* name, const char* tipo, int pos, int len)
|
|
{
|
|
const TFixed_string str_tipo(tipo);
|
|
if (str_tipo.ends_with("N"))
|
|
{
|
|
create_field(name, pos-1, len, _intzerofld);
|
|
return;
|
|
}
|
|
create_field(name, pos-1, len, _alfafld);
|
|
}
|
|
|
|
void THardy_recordset::add_trc_field(const char* tr, const char* name, const char* tipo, int pos, int len)
|
|
{
|
|
CHECK(tr && strlen(tr) == 2, "Lunghezza tipo record errata!!");
|
|
TString80 trc_name;
|
|
trc_name << tr << '.' << name;
|
|
add_field(trc_name, tipo, pos, len);
|
|
}
|
|
|
|
|
|
|
|
void THardy_recordset::insert_field(const char* name, const char* tipo, int pos, int len)
|
|
{
|
|
if (pos >= 1)
|
|
{
|
|
TArray& trc = (TArray&)*_trc.first_item();
|
|
FOR_EACH_ARRAY_ITEM(trc, r, itm)
|
|
{
|
|
TAS400_column_info& fld = (TAS400_column_info&)*itm;
|
|
if (fld._pos+1 >= pos)
|
|
{
|
|
fld._pos += len;
|
|
}
|
|
}
|
|
}
|
|
add_field(name, tipo, pos, len);
|
|
}
|
|
|
|
//al costruttore viene passato come parametro la lunghezza del tracciato
|
|
THardy_recordset::THardy_recordset(const int rec_lenght) : TAS400_recordset("AS400()")
|
|
{
|
|
TString16 query;
|
|
query << "AS400(" << rec_lenght << ")";
|
|
TFilename cazzone;
|
|
parse_query(query, cazzone);
|
|
}
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------
|
|
//Clienti
|
|
//-------
|
|
TEsporta_clienti_recordset::TEsporta_clienti_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodiceTerminale", T_N, 1, 3); //x
|
|
add_field(CLI_CODCF, T_X, 4, 6); //x
|
|
add_field(CLI_RAGSOC, T_X, 10, 34); //x
|
|
add_field(CLI_INDCF, T_X, 44, 34); //x
|
|
add_field("Localita", T_X, 78, 20); //x
|
|
add_field(CLI_CAPCF, T_X, 98, 5); //x
|
|
add_field("Provincia", T_X, 103, 2); //x
|
|
add_field(CLI_PAIV, T_X, 105, 11); //x
|
|
add_field(CLI_CODPAG, T_X, 116, 2); //x
|
|
add_field("CodiceListino", T_X, 118, 3); //x
|
|
add_field("CodicePromozione", T_X, 121, 3);
|
|
add_field("ScontoFineFattura", T_2Nv2N,124, 4); //x
|
|
add_field("Giro01", T_N, 128, 3);
|
|
add_field("Giro02", T_N, 131, 3);
|
|
add_field("Giro03", T_N, 134, 3);
|
|
add_field("Giro04", T_N, 137, 3);
|
|
add_field("Giro05", T_N, 140, 3);
|
|
add_field("Giro06", T_N, 143, 3);
|
|
add_field("TipoControllo", T_X, 146, 1);
|
|
add_field("FlDecodArt", T_X, 147, 1);
|
|
add_field("DecodeCodCli", T_X, 148, 6);
|
|
add_field(CLI_TEL, T_X, 154, 10); //x
|
|
add_field(CFV_ASSFIS, T_X, 164, 2); //x
|
|
add_field(CLI_CODCFFATT, T_X, 166, 6); //x
|
|
add_field("TipoDoc", T_X, 172, 1);
|
|
add_field("NoConsegna", T_X, 173, 1); //x
|
|
add_field("ScontoA", T_2N, 174, 2);
|
|
add_field("ScontoB", T_2N, 176, 2);
|
|
add_field("ScontoC", T_2N, 178, 2);
|
|
add_field("ScontoD", T_2N, 180, 2);
|
|
add_field("ScontoE", T_2N, 182, 2);
|
|
add_field("ScontoF", T_2N, 184, 2);
|
|
add_field("ScontoG", T_2N, 186, 2);
|
|
add_field("ScontoH", T_2N, 188, 2);
|
|
add_field("ScontoI", T_2N, 190, 2);
|
|
add_field("ScontoJ", T_2N, 192, 2);
|
|
add_field("ScontoK", T_2N, 194, 2);
|
|
add_field("ScontoL", T_2N, 196, 2);
|
|
add_field("ScontoM", T_2N, 198, 2);
|
|
add_field("ScontoN", T_2N, 200, 2);
|
|
add_field("ScontoO", T_2N, 202, 2);
|
|
add_field("ScontoP", T_2N, 204, 2);
|
|
add_field("ScontoQ", T_2N, 206, 2);
|
|
add_field("ScontoR", T_2N, 208, 2);
|
|
add_field("ScontoS", T_2N, 210, 2);
|
|
add_field("ScontoT", T_2N, 212, 2);
|
|
add_field(CLI_FIDO, T_Nv2N, 214, 8); //x
|
|
add_field("CodcliGiro3", T_X, 222, 6);
|
|
add_field(CLI_COFI, T_X, 228, 16); //x
|
|
add_field("Giro4", T_N, 244, 6);
|
|
add_field("FlPrezzoLibero", T_N, 250, 1);
|
|
}
|
|
//..e variazioni clienti
|
|
TEsporta_clientiVAR_recordset::TEsporta_clientiVAR_recordset()
|
|
: TEsporta_clienti_recordset(251)
|
|
{
|
|
insert_field("Segno", T_X, 4, 1); //x
|
|
}
|
|
|
|
|
|
//Sospesi
|
|
//-------
|
|
TEsporta_sospesi_recordset::TEsporta_sospesi_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodiceTerminale", T_N, 1, 3); //x
|
|
add_field("CodiceCliente", T_X, 4, 6); //x
|
|
add_field("NumeroFattura", T_X, 10, 12); //x
|
|
add_field("DataFattura", T_X, 22, 6); //x
|
|
add_field("ImportoResiduo", T_Nv2N, 28, 9); //x
|
|
add_field("ImpOriginalDoc", T_N, 37, 9); //x
|
|
add_field("DataScadenza", T_X, 46, 6); //x
|
|
add_field("Partita", T_X, 52, 15); //x
|
|
add_field("TipoDocumento", T_X, 67, 1); //x
|
|
}
|
|
//..e variazioni sospesi
|
|
TEsporta_sospesiVAR_recordset::TEsporta_sospesiVAR_recordset()
|
|
: TEsporta_sospesi_recordset(68)
|
|
{
|
|
insert_field("Segno", T_X, 4, 1); //x
|
|
}
|
|
|
|
|
|
//Righe Listini
|
|
//-------------
|
|
TEsporta_listini_recordset::TEsporta_listini_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodiceTerminale", T_N, 1, 3); //x
|
|
add_field(RCONDV_COD, T_X, 4, 3); //x
|
|
add_field(RCONDV_CODRIGA, T_X, 7, 5); //x
|
|
add_field(RCONDV_PREZZO, T_Nv3N, 12, 7); //x
|
|
add_field(RCONDV_SCONTO, T_2Nv2N,19, 4); //x
|
|
add_field("Sconto2", T_2Nv2N,23, 4);
|
|
add_field("Sconto3", T_2Nv2N,27, 4);
|
|
add_field("CasaMandante", T_NS, 31, 6);
|
|
}
|
|
//..e variazioni listini
|
|
TEsporta_listiniVAR_recordset::TEsporta_listiniVAR_recordset()
|
|
: TEsporta_listini_recordset(37)
|
|
{
|
|
insert_field("Segno", T_X, 4, 1); //x
|
|
}
|
|
|
|
//Righe Contratti
|
|
//---------------
|
|
TEsporta_contratti_recordset::TEsporta_contratti_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodiceTerminale", T_N, 1, 3); //x
|
|
add_field(CONDV_CODCF, T_X, 4, 6); //x
|
|
add_field(RCONDV_CODRIGA, T_X, 10, 5); //x
|
|
add_field(RCONDV_PREZZO, T_Nv3N, 15, 7); //x
|
|
add_field(RCONDV_SCONTO, T_2Nv2N,22, 4); //x
|
|
add_field("Sconto2", T_2Nv2N,26, 4);
|
|
add_field("Sconto3", T_2Nv2N,30, 4);
|
|
add_field(CONDV_VALIN, T_X, 34, 8); //x
|
|
add_field(CONDV_VALFIN, T_X, 42, 8); //x
|
|
}
|
|
|
|
//Offerte
|
|
//-------
|
|
TEsporta_offerte_recordset::TEsporta_offerte_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field(CONDV_COD, T_X, 1, 3);
|
|
add_field(CONDV_COD, T_X, 4, 3);
|
|
add_field(CONDV_VALIN, T_X, 7, 8);
|
|
add_field(CONDV_VALFIN, T_X, 15, 8);
|
|
}
|
|
|
|
//Prodotti
|
|
//--------
|
|
TEsporta_prodotti_recordset::TEsporta_prodotti_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field(ANAMAG_CODART, T_X, 1, 5); //x
|
|
add_field(ANAMAG_DESCR, T_X, 6, 30); //x
|
|
add_field(UMART_PREZZO, T_Nv3N, 36, 7); //x
|
|
add_field(ANAMAG_CODIVA, T_N, 43, 2); //x
|
|
add_field(UMART_UM, T_X, 45, 2); //x
|
|
add_field("NONusato", T_X, 47, 1);
|
|
add_field(ANAMAG_SCONTO, T_2Nv2N,48, 4); //x
|
|
add_field("ScontoArt2", T_2Nv2N,52, 4);
|
|
add_field("Fascia", T_X, 56, 1);
|
|
add_field("PrezzoMinimo", T_Nv3N, 57, 7);
|
|
}
|
|
//..e variazioni prodottii
|
|
TEsporta_prodottiVAR_recordset::TEsporta_prodottiVAR_recordset()
|
|
: TEsporta_prodotti_recordset(64)
|
|
{
|
|
insert_field("Segno", T_X, 1, 1); //x
|
|
}
|
|
|
|
|
|
//Agenti
|
|
//-------
|
|
TEsporta_agenti_recordset::TEsporta_agenti_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodiceTerminale", T_N, 1, 3); //x
|
|
add_field(AGE_CODAGE, T_N, 4, 3); //x
|
|
add_field("Data", T_X, 7, 6);
|
|
add_field("Targa", T_X, 13, 8);
|
|
add_field("nDDT", T_N, 21, 5);
|
|
add_field("nFATT", T_N, 26, 5);
|
|
add_field("nBOLLA", T_N, 31, 5);
|
|
add_field(AGE_RAGSOC, T_X, 36, 30); //x
|
|
add_field("nORD", T_N, 66, 5);
|
|
add_field("nSAGIT", T_N, 71, 5);
|
|
}
|
|
|
|
|
|
//Linee
|
|
//-----
|
|
TEsporta_linee_recordset::TEsporta_linee_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("Fascia", T_X, 1, 1);
|
|
add_field("Descrizione", T_X, 2, 50);
|
|
}
|
|
|
|
//Rdoc (Carico) è una riga di un documento
|
|
//----------------
|
|
TEsporta_carico_recordset::TEsporta_carico_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodiceTerminale", T_N, 1, 3); //x
|
|
add_field(RDOC_CODART, T_X, 4, 5); //x
|
|
add_field(RDOC_QTA, T_Nv2N,9, 7); //x
|
|
add_field(RDOC_LIVELLO, T_X, 16, 10);
|
|
}
|
|
|
|
|
|
//Decodart ()
|
|
//---------------
|
|
TEsporta_decodart_recordset::TEsporta_decodart_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field(CODCORR_CODART, T_X, 1, 5); //x
|
|
add_field(CODCORR_CODCF, T_NS, 6, 6); //x
|
|
add_field(CODCORR_CODARTALT, T_X, 12, 6); //x
|
|
}
|
|
|
|
|
|
//Barcode
|
|
//---------------
|
|
TEsporta_barcode_recordset::TEsporta_barcode_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field(CODCORR_CODARTALT, T_X, 1, 20); //x
|
|
add_field(CODCORR_CODART, T_X, 21, 5); //x
|
|
}
|
|
|
|
|
|
//Attrezzature
|
|
//---------------
|
|
TEsporta_attrezzature_recordset::TEsporta_attrezzature_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodiceTerminale", T_N, 1, 3);
|
|
add_field("CodiceCliente", T_X, 4, 6);
|
|
add_field("CodiceArticolo", T_X, 10, 5);
|
|
add_field("MatricolaAttrezz", T_X, 15, 12);
|
|
add_field("DescrAttrezz", T_X, 27, 30);
|
|
add_field("DataConsegna", T_X, 57, 6);
|
|
add_field("Quantita", T_N, 63, 7);
|
|
}
|
|
|
|
|
|
//Pagamenti
|
|
//---------------
|
|
TEsporta_pagamenti_recordset::TEsporta_pagamenti_recordset(int rec_length)
|
|
: THardy_recordset(rec_length)
|
|
{
|
|
add_field("CodicePagamento", T_X, 1, 2); //x
|
|
add_field("DescrPagamento", T_X, 3, 20); //x
|
|
add_field("GiorniScadenza", T_N, 23, 3); //x
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////
|
|
// Metodi di utility
|
|
/////////////////////////////////////////////////////////////
|
|
real find_sconto(const TString& str_sconto)
|
|
{
|
|
TString goodexp;
|
|
real val_perc;
|
|
if (scontoexpr2perc(str_sconto, false, goodexp, val_perc))
|
|
{
|
|
val_perc = CENTO - (val_perc * CENTO);
|
|
val_perc *= CENTO;
|
|
val_perc.round();
|
|
}
|
|
return val_perc;
|
|
}
|
|
|
|
|
|
const TString& find_codag(const long codcf)
|
|
{
|
|
TToken_string key_cfven;
|
|
key_cfven.add("C");
|
|
key_cfven.add(codcf);
|
|
const TRectype& rec_cfven = cache().get(LF_CFVEN, key_cfven);
|
|
TString8 codag = rec_cfven.get(CFV_CODAG);
|
|
return codag.right(3); //il loro codagente è lungo 3!!!
|
|
}
|
|
|
|
//il dio dei programmatori ci perdoni!
|
|
const TString& format_data_8(const TDate& data)
|
|
{
|
|
const int day = data.day();
|
|
const int month = data.month();
|
|
const int year = data.year();
|
|
TString& str_data = get_tmp_string();
|
|
str_data.format("%02d%02d%04d", day, month, year);
|
|
return str_data;
|
|
}
|
|
|
|
const TString& format_data_6(const TDate& data)
|
|
{
|
|
const int day = data.day();
|
|
const int month = data.month();
|
|
const int year = data.year();
|
|
TString& str_data = get_tmp_string();
|
|
str_data.format("%02d%02d%02d", day, month, year%100);
|
|
return str_data;
|
|
}
|