From f2de80a268c678f10cce57dc10c522a454ce6b9a Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 17 Dec 2010 10:19:06 +0000 Subject: [PATCH] Patch level : Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21325 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ha/hacnv100.cpp | 92 ++++++++++++++++++++++++++++++++++++++++++++++++ ha/hacnv100a.h | 3 +- ha/hacnv100a.ini | 52 +++++++++++++++++++++++++++ ha/hacnv100a.uml | 6 ++++ ha/hacnv200.cpp | 10 ++++-- ha/hacnv200a.h | 2 ++ ha/hacnv200a.uml | 12 ++++++- 7 files changed, 171 insertions(+), 6 deletions(-) diff --git a/ha/hacnv100.cpp b/ha/hacnv100.cpp index d591c9a95..fbc216ffe 100755 --- a/ha/hacnv100.cpp +++ b/ha/hacnv100.cpp @@ -129,6 +129,14 @@ public: virtual bool trasferisci(); }; +class THardy_listinicli : public THardy_transfer +{ +protected: + int get_next_key_cli(const char tipocf, const long codcf) const; +public: + virtual bool trasferisci(); +}; + /////////////////////////////////////////////////////////// // THardy_pag /////////////////////////////////////////////////////////// @@ -1059,6 +1067,82 @@ bool THardy_contratti::trasferisci() return write_enabled(); } +// restituisce il codice contratto da usare per l'inserimento in condv +int THardy_listinicli::get_next_key_cli(const char tipocf, const long codcf) const +{ + TISAM_recordset condv("USE CONDV\nFROM TIPO=#TIPO CATVEN=#CATVEN TIPOCF=#TIPOCF CODCF=#CODCF\nTO TIPO=#TIPO CATVEN=#CATVEN TIPOCF=#TIPOCF CODCF=#CODCF"); + TString4 str; + str = "C"; + condv.set_var("#TIPO", TVariant(str)); + str = " "; + condv.set_var("#CATVEN", TVariant(str)); + str = "C"; + condv.set_var("#TIPOCF", TVariant(str)); + condv.set_var("#CODCF", TVariant(codcf)); + int cod = 1; + if (condv.items() > 0) // La move_last da errore fatale su recordset vuoti! + { + condv.move_last(); + cod += condv.get("COD").as_int(); + } + return cod; +} + +bool THardy_listinicli::trasferisci() +{ + TString query = + "SELECT * " + "FROM dbo.ListiniCF " + "ORDER BY dbo.ListiniCF.IdConto, dbo.ListiniCF.IdProdotto "; + + TRecordset& recset = create_recordset(query); + TConfig& ini = config(); + TString_array lista_campi, lista_campi_rcondv; + ini.list_variables(lista_campi, true, "LISTINICF", true); + ini.list_variables(lista_campi_rcondv, true, "LISTINICF_RIGHE", true); + TSystemisamfile condv(LF_CONDV); + condv.open(_lock); + TRectype& rec = condv.curr(); + TSystemisamfile rcondv(LF_RCONDV); + rcondv.open(_lock); + TRectype& rec_rcondv = rcondv.curr(); + + THardy_iterator hi(this); + + long curr_cliente = 0; + int curr_contratto = 0; + + const TDate oggi(TODAY); + + while (++hi) + { + const TDate datafine = TDate(get_str("DataFine")); + if (datafine >= oggi) + { + const TString& key = get_str("IdConto"); + const long codcf = hd_key2cli(key); + // scrivo la testata del listino cliente (CONDV C) + if (curr_cliente != codcf) + { + curr_cliente = codcf; + const int cod = get_next_key_cli('C', codcf); + rec.put(CONDV_CODCF, codcf); + rec.put(CONDV_COD, cod); + aggiorna_record(rec, lista_campi); + test_write(condv); + } + rec_rcondv.put(RCONDV_COD, rec.get(CONDV_COD)); + rec_rcondv.put(RCONDV_CODCF, rec.get(CONDV_CODCF)); + aggiorna_record(rec_rcondv, lista_campi_rcondv); + test_write(rcondv); + } + } + condv.close(); + rcondv.close(); + return write_enabled(); +} + + /////////////////////////////////////////////////////////// // TImportazioneHardy_mask /////////////////////////////////////////////////////////// @@ -1228,6 +1312,14 @@ void TImportazioneHardy_mask::trasferisci() book.add(log); rep_to_print = true; } + if (go_on && get_bool(F_LISTINICLI)) + { + THardy_listinicli pc; + pc.init(TR("Listini clienti"), query_header, log); + go_on = pc.trasferisci(); + book.add(log); + rep_to_print = true; + } if (rep_to_print && book.pages() > 0) book.preview(); diff --git a/ha/hacnv100a.h b/ha/hacnv100a.h index 247a1715b..7d889923e 100755 --- a/ha/hacnv100a.h +++ b/ha/hacnv100a.h @@ -20,8 +20,7 @@ #define F_LISTINI 155 #define F_CONTRATTI 156 #define F_AGENTI 157 -#define F_MOVCONT 158 -#define F_MOVIVA 160 +#define F_LISTINICLI 158 #define F_DSN 201 #define F_USR 202 diff --git a/ha/hacnv100a.ini b/ha/hacnv100a.ini index 1b09cdb68..b2e37efd5 100755 --- a/ha/hacnv100a.ini +++ b/ha/hacnv100a.ini @@ -420,6 +420,58 @@ DATAULTAUM = PRZSTO = DATAPRZSTO = +[LISTINICF] +TIPO = _FISSO,C +CATVEN = +TIPOCF = _FISSO,C +CODCF = +COD = +DESCR = _FISSO,Listino cliente +CODVAL = _TRADUCI,IdDivisa +CAMBIO = +CONTROEURO = +DATACAM = +VALIN = +VALFIN = +IMPLORDI = +GESTUM = +GESTSCAGL = +GESTSCO = +OBBLIG = +CODLISSUCC = +SEQRIC = _FISSO,A--- +DECIMALI = +FATHCATVEN = +FATHCOD = +ARROTONDA = + +[LISTINICF_RIGHE] +TIPO = _FISSO,C +CATVEN = +TIPOCF = _FISSO,C +CODCF = +COD = +TIPORIGA = _FISSO,A +CODRIGA = IdProdotto +UM = +NSCAGL = +QLIM = +PREZZO = Prezzo +SCONTO = Sconto1 +ADDIVA = +CODIVA = +PERCPROVV = +QOM = +QBASE = +CODARTOM = +PROMAGGIO = +UMOM = +CODLOTTO = +ARTES = +DATAULTAUM = +PRZSTO = +DATAPRZSTO = + [MOV] ANNOES = Esercizio NUMREG = diff --git a/ha/hacnv100a.uml b/ha/hacnv100a.uml index d1a288671..a13b717c9 100755 --- a/ha/hacnv100a.uml +++ b/ha/hacnv100a.uml @@ -119,6 +119,12 @@ BEGIN PROMPT 32 14 "Agenti" END +BOOLEAN F_LISTINICLI +BEGIN + PROMPT 32 15 "Listini clienti" +END + + ENDPAGE PAGE "Configurazione" -1 -1 78 18 diff --git a/ha/hacnv200.cpp b/ha/hacnv200.cpp index 3ea3fa4ce..0cb31d088 100755 --- a/ha/hacnv200.cpp +++ b/ha/hacnv200.cpp @@ -25,6 +25,7 @@ const char* const APPNAME = TR("Conversione movimenti"); class THardy_movimenti : public THardy_transfer { int _anno; + TDate _dadata, _adata; TConfig* _conf; long _kmovcont; protected: @@ -32,7 +33,7 @@ protected: bool is_mov_iva(); public: virtual bool trasferisci(); - THardy_movimenti(int anno); + THardy_movimenti(const int anno, const TDate dadata, const TDate adata); }; bool THardy_movimenti::is_mov_iva() @@ -127,6 +128,7 @@ bool THardy_movimenti::trasferisci() "FROM dbo.MovContabiliT " "WHERE Esercizio="; query << _anno; + query << " ORDER BY DataMovimento "; TRecordset& recset = create_recordset(query); TConfig& ini = config(); @@ -193,7 +195,7 @@ bool THardy_movimenti::trasferisci() return true; } -THardy_movimenti::THardy_movimenti(int anno) : _anno(anno) +THardy_movimenti::THardy_movimenti(const int anno, const TDate dadata, const TDate adata) : _anno(anno), _dadata(dadata), _adata(adata) { } @@ -247,9 +249,11 @@ void TConvMovimentiHardy_mask::trasferisci() bool go_on = true; const int anno = get_int(F_ANNO); + const TDate dadata = get_date(F_DADATA); + const TDate adata = get_date(F_ADATA); if (go_on && (anno!=0)) { - THardy_movimenti pc(anno); + THardy_movimenti pc(anno, dadata, adata); pc.init(TR("Movimenti contabili"), query_header, log); go_on = pc.trasferisci(); book.add(log); diff --git a/ha/hacnv200a.h b/ha/hacnv200a.h index d38fa064f..041364a65 100755 --- a/ha/hacnv200a.h +++ b/ha/hacnv200a.h @@ -5,6 +5,8 @@ #define F_RAGSOC 102 #define F_ANNO 111 +#define F_DADATA 112 +#define F_ADATA 113 #define F_DSN 201 #define F_USR 202 diff --git a/ha/hacnv200a.uml b/ha/hacnv200a.uml index 6de8f7231..e6921c2a2 100755 --- a/ha/hacnv200a.uml +++ b/ha/hacnv200a.uml @@ -29,7 +29,7 @@ BEGIN FLAGS "D" END -GROUPBOX DLG_NULL 78 3 +GROUPBOX DLG_NULL 78 4 BEGIN PROMPT 1 4 "@bSelezioni" END @@ -39,6 +39,16 @@ BEGIN PROMPT 2 5 "Esercizio " END +DATE F_DADATA +BEGIN + PROMPT 2 6 "Dal " +END + +DATE F_ADATA +BEGIN + PROMPT 35 6 "Al " +END + ENDPAGE PAGE "Configurazione" -1 -1 78 18