git-svn-id: svn://10.65.10.50/branches/R_10_00@22741 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2012-10-26 08:33:06 +00:00
parent 02a750c7b1
commit b7b44916a5
4 changed files with 108 additions and 69 deletions

View File

@ -94,7 +94,7 @@ protected:
bool genera_nomi_output(const char* nome, TFilename& txt, TFilename& tmp) const; bool genera_nomi_output(const char* nome, TFilename& txt, TFilename& tmp) const;
bool salva_recordset(TRecordset& recset, const char* nome) const; bool salva_recordset(TRecordset& recset, const char* nome) const;
bool accoda_recordset(TRecordset& recset, const char* nome) const; bool accoda_recordset(TRecordset& recset, const char* nome) const;
const TString& curr_cod_list(const long codcf) const; bool curr_cod_list(long codcf, TString& list, TString& promo) const;
public: public:
}; };
@ -229,18 +229,19 @@ void TFile2Txt::fill_anagrafica_cliente(const TISAM_recordset& archivio_clienti,
clienti.set_fatt("CodiceFiscale", archivio_clienti.get(CLI_COFI), is_fatt); clienti.set_fatt("CodiceFiscale", archivio_clienti.get(CLI_COFI), is_fatt);
} }
const TString& TFile2Txt::curr_cod_list(const long codcf) const bool TFile2Txt::curr_cod_list(long codcf, TString& codlist, TString& promo) const
{ {
TString16 key; key.format("C|%ld", codcf); TString16 key; key.format("C|%ld", codcf);
TString4 codlist = cache().get(LF_CFVEN, key, CFV_CODLIST); const TString4 original = cache().get(LF_CFVEN, key, CFV_CODLIST);
codlist = original; promo.cut(0);
bool done = codlist.blank(); bool done = codlist.blank();
while (!done) while (!done)
{ {
done = true; done = true;
key.format("L||||%s", (const char*)codlist); key.format("L||||%s", (const char*)codlist);
const TRectype& rec = cache().get(LF_CONDV, key); const TRectype& rec = cache().get(LF_CONDV, key);
const TString4 nxtlist = rec.get(CONDV_CODLISSUCC); promo = rec.get(CONDV_CODLISSUCC);
if (nxtlist.full()) if (promo.full())
{ {
TDate datascad = rec.get(CONDV_VALFIN); TDate datascad = rec.get(CONDV_VALFIN);
if (datascad.ok()) if (datascad.ok())
@ -249,13 +250,27 @@ const TString& TFile2Txt::curr_cod_list(const long codcf) const
--datascad; --datascad;
if (datascad <= TDate(TODAY)) if (datascad <= TDate(TODAY))
{ {
codlist = nxtlist; codlist = promo;
promo.cut(0);
done = false; done = false;
} }
} }
} }
} }
return get_tmp_string() = codlist;
if (codlist.full() && codlist != original)
{
TLocalisamfile clifo(LF_CFVEN);
clifo.put(CFV_TIPOCF, 'C');
clifo.put(CFV_CODCF, codcf);
if (clifo.read(_isequal, _lock) == NOERR)
{
clifo.put(CFV_CODLIST, codlist);
clifo.rewrite();
}
}
return codlist.full();
} }
@ -316,7 +331,9 @@ bool TFile2Txt::genera_clienti_txt(const long da_codcli)
clienti.set("CodicePagamento", codpag.right(2)); clienti.set("CodicePagamento", codpag.right(2));
//Nel campo CodiceListino ci va il codice del Listino Campo associato al cliente in cfven //Nel campo CodiceListino ci va il codice del Listino Campo associato al cliente in cfven
clienti.set("CodiceListino", curr_cod_list(codcf)); TString4 listino, promo; curr_cod_list(codcf, listino, promo);
clienti.set("CodiceListino", listino);
clienti.set("CodicePromozione", promo);
const TString& str_sconto = archivio_clienti.get(CFV_SCONTO).as_string(); const TString& str_sconto = archivio_clienti.get(CFV_SCONTO).as_string();
clienti.set("ScontoFineFattura", hd_find_sconto(str_sconto)); clienti.set("ScontoFineFattura", hd_find_sconto(str_sconto));
@ -446,6 +463,8 @@ bool TFile2Txt::genera_righelistini_txt()
const TDate oggi(TODAY); const TDate oggi(TODAY);
TEsporta_listini_recordset righe_listini; TEsporta_listini_recordset righe_listini;
TAssoc_array promo;
TISAM_recordset agenti("USE AGENTI"); TISAM_recordset agenti("USE AGENTI");
const long agenti_items = agenti.items(); const long agenti_items = agenti.items();
@ -458,15 +477,16 @@ bool TFile2Txt::genera_righelistini_txt()
TISAM_recordset archivio_rcondv(query); TISAM_recordset archivio_rcondv(query);
const long archivio_rcondv_items = archivio_rcondv.items(); const long archivio_rcondv_items = archivio_rcondv.items();
for (bool ok = agenti.move_first(); ok; ok = agenti.move_next()) TProgind progind(agenti_items, "Listini...");
for (bool ak = agenti.move_first(); ak; ak = agenti.move_next())
{ {
if (!progind.addstatus(1))
break;
const TString4 codage = agenti.get(AGE_CODAGE).as_string().right(3); const TString4 codage = agenti.get(AGE_CODAGE).as_string().right(3);
TProgind progind(archivio_rcondv_items, "Listini...", false, true);
for (bool ok = archivio_rcondv.move_first(); ok; ok = archivio_rcondv.move_next()) for (bool ok = archivio_rcondv.move_first(); ok; ok = archivio_rcondv.move_next())
{ {
if (!progind.addstatus(1))
break;
const TDate datascad = archivio_rcondv.get("CONDV.VALFIN").as_date(); const TDate datascad = archivio_rcondv.get("CONDV.VALFIN").as_date();
if (datascad.ok() && datascad < oggi) if (datascad.ok() && datascad < oggi)
continue; continue;
@ -548,27 +568,42 @@ bool TFile2Txt::genera_contratti_txt()
bool TFile2Txt::genera_promozioni_txt() bool TFile2Txt::genera_promozioni_txt()
{ {
TEsporta_contratti_recordset righe_offerte; TEsporta_offerte_recordset promo;
TString query; TAssoc_array promos;
query << "USE RCONDV"; TDate limite(TODAY); limite -= 31;
query << "\nJOIN CONDV INTO TIPO=TIPO TIPOCF=TIPOCF CODCF=CODCF COD=COD";
query << "\nFROM TIPO=O";
query << "\nTO TIPO=O";
TISAM_recordset archivio_rcondv(query); TISAM_recordset listini("USE CONDV\nFROM TIPO=L\nTO TIPO=L");
const long archivio_rcondv_items = archivio_rcondv.items();
TProgind progind(archivio_rcondv_items, "Promozioni...", false, true); TProgind progind(listini.items(), TR("Promozioni"));
for (bool ok = archivio_rcondv.move_first(); ok; ok = archivio_rcondv.move_next()) for (bool ok = listini.move_first(); ok; ok = listini.move_next())
{ {
progind.addstatus(1); const TString& succ = listini.get(CONDV_CODLISSUCC).as_string();
const TDate datascad = listini.get(CONDV_VALFIN).as_date();
righe_offerte.new_rec(""); if (succ.full() && datascad >= limite)
//non si sa quali campi trasferire! promos.add(succ);
}
for (bool ok = listini.move_first(); ok; ok = listini.move_next())
{
const TString& cod = listini.get(CONDV_COD).as_string();
if (promos.is_key(cod))
{
const TDate dataini = listini.get(CONDV_VALIN).as_date();
TDate datafin = listini.get(CONDV_VALFIN).as_date();
if (datafin < dataini)
{
datafin = dataini;
datafin.addmonth(3);
}
promo.new_rec();
promo.set(CONDV_COD, cod);
promo.set(CONDV_CODVAL, cod);
promo.set(CONDV_VALIN, hd_format_date8(dataini));
promo.set(CONDV_VALFIN, hd_format_date8(datafin));
}
} }
return salva_recordset(righe_offerte, "promo"); return salva_recordset(promo, "promo");
} }
//prodotti: i commenti del metodo sono nella genera_prodotto_txt() della ha1100 //prodotti: i commenti del metodo sono nella genera_prodotto_txt() della ha1100

View File

@ -371,7 +371,7 @@ TEsporta_clienti_recordset::TEsporta_clienti_recordset(int recsize) : THardy_rec
} }
//..e variazioni clienti //..e variazioni clienti
TEsporta_clientiVAR_recordset::TEsporta_clientiVAR_recordset() TEsporta_clientiVAR_recordset::TEsporta_clientiVAR_recordset()
: TEsporta_clienti_recordset(308) : TEsporta_clienti_recordset(308)
{ {
insert_field("Segno", T_X, 4, 1); //x insert_field("Segno", T_X, 4, 1); //x
} }
@ -379,7 +379,7 @@ TEsporta_clientiVAR_recordset::TEsporta_clientiVAR_recordset()
//Prodotti //Prodotti
//-------- //--------
TEsporta_prodotti_recordset::TEsporta_prodotti_recordset(int rec_length) TEsporta_prodotti_recordset::TEsporta_prodotti_recordset(int rec_length)
: THardy_recordset(rec_length) : THardy_recordset(rec_length)
{ {
add_field(ANAMAG_CODART, T_X, 1, 5); //x add_field(ANAMAG_CODART, T_X, 1, 5); //x
add_field(ANAMAG_DESCR, T_X, 6, 30); //x add_field(ANAMAG_DESCR, T_X, 6, 30); //x
@ -395,7 +395,7 @@ TEsporta_prodotti_recordset::TEsporta_prodotti_recordset(int rec_length)
} }
//..e variazioni prodotti //..e variazioni prodotti
TEsporta_prodottiVAR_recordset::TEsporta_prodottiVAR_recordset() TEsporta_prodottiVAR_recordset::TEsporta_prodottiVAR_recordset()
: TEsporta_prodotti_recordset(66) : TEsporta_prodotti_recordset(66)
{ {
insert_field("Segno", T_X, 1, 1); //x insert_field("Segno", T_X, 1, 1); //x
} }
@ -403,7 +403,7 @@ TEsporta_prodottiVAR_recordset::TEsporta_prodottiVAR_recordset()
//Linee //Linee
//----- //-----
TEsporta_linee_recordset::TEsporta_linee_recordset(int rec_length) TEsporta_linee_recordset::TEsporta_linee_recordset(int rec_length)
: THardy_recordset(rec_length) : THardy_recordset(rec_length)
{ {
add_field("Fascia", T_X, 1, 1); add_field("Fascia", T_X, 1, 1);
add_field("Descrizione", T_X, 2, 50); add_field("Descrizione", T_X, 2, 50);
@ -414,7 +414,7 @@ TEsporta_linee_recordset::TEsporta_linee_recordset(int rec_length)
//Righe Listini //Righe Listini
//------------- //-------------
TEsporta_listini_recordset::TEsporta_listini_recordset(int rec_length) TEsporta_listini_recordset::TEsporta_listini_recordset(int rec_length)
: THardy_recordset(rec_length) : THardy_recordset(rec_length)
{ {
add_field("CodiceTerminale", T_N, 1, 3); //x add_field("CodiceTerminale", T_N, 1, 3); //x
add_field(RCONDV_COD, T_X, 4, 3); //x add_field(RCONDV_COD, T_X, 4, 3); //x
@ -428,7 +428,7 @@ TEsporta_listini_recordset::TEsporta_listini_recordset(int rec_length)
} }
//..e variazioni listini //..e variazioni listini
TEsporta_listiniVAR_recordset::TEsporta_listiniVAR_recordset() TEsporta_listiniVAR_recordset::TEsporta_listiniVAR_recordset()
: TEsporta_listini_recordset(39) : TEsporta_listini_recordset(39)
{ {
insert_field("Segno", T_X, 4, 1); //x insert_field("Segno", T_X, 4, 1); //x
} }
@ -437,10 +437,10 @@ TEsporta_listiniVAR_recordset::TEsporta_listiniVAR_recordset()
//Offerte //Offerte
//------- //-------
TEsporta_offerte_recordset::TEsporta_offerte_recordset(int rec_length) TEsporta_offerte_recordset::TEsporta_offerte_recordset(int rec_length)
: THardy_recordset(rec_length) : THardy_recordset(rec_length)
{ {
add_field(CONDV_COD, T_X, 1, 3); add_field(CONDV_COD, T_X, 1, 3);
add_field(CONDV_COD, T_X, 4, 3); add_field(CONDV_CODVAL, T_X, 4, 3);
add_field(CONDV_VALIN, T_X, 7, 8); add_field(CONDV_VALIN, T_X, 7, 8);
add_field(CONDV_VALFIN, T_X, 15, 8); add_field(CONDV_VALFIN, T_X, 15, 8);
add_eol_field(); add_eol_field();
@ -504,7 +504,7 @@ TEsporta_sospesiVAR_recordset::TEsporta_sospesiVAR_recordset()
//Decodart () //Decodart ()
//--------------- //---------------
TEsporta_decodart_recordset::TEsporta_decodart_recordset() TEsporta_decodart_recordset::TEsporta_decodart_recordset()
: THardy_recordset(49) : THardy_recordset(49)
{ {
add_field(CODCORR_CODART, T_X, 1, 5); //x add_field(CODCORR_CODART, T_X, 1, 5); //x
add_field(CODCORR_CODCF, T_N, 6, 6); //x add_field(CODCORR_CODCF, T_N, 6, 6); //x
@ -517,10 +517,10 @@ TEsporta_decodart_recordset::TEsporta_decodart_recordset()
//Barcode //Barcode
//--------------- //---------------
TEsporta_barcode_recordset::TEsporta_barcode_recordset(int rec_length) TEsporta_barcode_recordset::TEsporta_barcode_recordset(int rec_length)
: THardy_recordset(rec_length) : THardy_recordset(rec_length)
{ {
add_field(CODCORR_CODARTALT, T_X, 1, 20); //x add_field(CODCORR_CODARTALT, T_X, 1, 20); //x
add_field(CODCORR_CODART, T_X, 21, 5); //x add_field(CODCORR_CODART, T_X, 21, 5); //x
add_eol_field(); add_eol_field();
} }
@ -528,7 +528,7 @@ TEsporta_barcode_recordset::TEsporta_barcode_recordset(int rec_length)
//Attrezzature //Attrezzature
//--------------- //---------------
TEsporta_attrezzature_recordset::TEsporta_attrezzature_recordset(int rec_length) TEsporta_attrezzature_recordset::TEsporta_attrezzature_recordset(int rec_length)
: THardy_recordset(rec_length) : THardy_recordset(rec_length)
{ {
add_field("CodiceTerminale", T_N, 1, 3); add_field("CodiceTerminale", T_N, 1, 3);
add_field("CodiceArticolo", T_X, 4, 5); add_field("CodiceArticolo", T_X, 4, 5);

View File

@ -2,17 +2,16 @@
#include <automask.h> #include <automask.h>
#include <progind.h> #include <progind.h>
#include <recarray.h> #include <recarray.h>
#include <recset.h>
#include <reputils.h> #include <reputils.h>
#include <textset.h> #include <textset.h>
#include <utility.h> //#include <utility.h>
#include <nditte.h> #include <nditte.h>
#include <anagr.h> #include <anagr.h>
#include <comuni.h> #include <comuni.h>
#include <clifo.h> //#include <clifo.h>
#include <doc.h> //#include <doc.h>
#include <rdoc.h> //#include <rdoc.h>
#include "../mg/codcorr.h" #include "../mg/codcorr.h"
#include "../cg/cglib01.h" #include "../cg/cglib01.h"
#include "../ve/velib.h" #include "../ve/velib.h"
@ -87,27 +86,29 @@ bool TFatture_recordset::set(const char* name, const TVariant& value)
{ {
if (value.is_date()) if (value.is_date())
{ {
const TDate date = value.as_date(); TString8 str; str.format("%08ld", value.as_int());
TString8 str; ok = TAS400_recordset::set(name, str);
str.format("%04d%02d%02d", date.year(), date.month(), date.day());
ok = TAS400_recordset::set(name, TVariant(str));
} }
else else
{
if (value.is_real()) if (value.is_real())
{ {
real r = value.as_real()*1000; const real r = value.as_real()*1000;
TString16 str = r.string(16,0,'0'); TString16 str = r.string(16,0,'0');
if (r>ZERO) if (r>ZERO)
str.overwrite("+",0,1); str.overwrite("+",0,1);
else else
if (r<ZERO) {
str.overwrite("-",0,1); if (r<ZERO)
else str.overwrite("-",0,1);
str.overwrite(" ",0,1); else
ok = TAS400_recordset::set(name, TVariant(str)); str.overwrite(" ",0,1);
}
ok = TAS400_recordset::set(name, str);
} }
else else
ok = TAS400_recordset::set(name, value); ok = TAS400_recordset::set(name, value);
}
} }
return ok; return ok;
} }
@ -146,11 +147,12 @@ TFatture_recordset::TFatture_recordset()
// dati di configurazione // dati di configurazione
TConfig config(CONFIG_DITTA, "ha"); TConfig config(CONFIG_DITTA, "ha");
const TString80 piva_hardy = config.get("Esselunga_PIvaHardy"); const TString80 piva_hardy = config.get("Esselunga_PIvaHardy");
const TString80 piva_esselunga = config.get("Esselunga_PIvaEsselunga");
const TString8 tipo_emissione = config.get("Esselunga_TipoEmissione"); const TString8 tipo_emissione = config.get("Esselunga_TipoEmissione");
const long codcli_esselunga = config.get_long("Esselunga_CodEsselunga"); const long codcli_esselunga = config.get_long("Esselunga_CodEsselunga");
const TString80 cod_hardy = config.get("Esselunga_CodHardy"); const TString80 cod_hardy = config.get("Esselunga_CodHardy");
TString16 piva_esselunga = config.get("Esselunga_PIvaEsselunga");
piva_esselunga << "N"; // 27-09-2012
// record cliente Esselunga // record cliente Esselunga
TToken_string key; TToken_string key;
key.add("C"); key.add(codcli_esselunga); key.add("C"); key.add(codcli_esselunga);
@ -274,7 +276,7 @@ TFatture_recordset::TFatture_recordset()
// *** Sezione di dettaglio fattura *** // *** Sezione di dettaglio fattura ***
// Record DET: identificazione, quantita'e prezzi articolo // Record DET: identificazione, quantità e prezzi articolo
add_field("DET.TIPOREC", AN, 3, 1, true, "DET"); add_field("DET.TIPOREC", AN, 3, 1, true, "DET");
add_field("DET.NUMRIGA", NU, 6, 4, true); add_field("DET.NUMRIGA", NU, 6, 4, true);
add_field("DET.IDSOTTOR", AN, 3, 10); add_field("DET.IDSOTTOR", AN, 3, 10);
@ -721,12 +723,12 @@ TString4 THardy_esselunga_fat::check_cliente(const long codcf)
TString8 key; key << codcf; TString8 key; key << codcf;
const TRectype& rec_cliente = cache().get("&CEL", key); const TRectype& rec_cliente = cache().get("&CEL", key);
const bool invio = rec_cliente.get_bool("B0"); const bool invio = rec_cliente.get_bool("B0");
const char dipendenza = rec_cliente.get("S1")[0];
if (invio) if (invio)
{ {
codcf_hardy << dipendenza; const char dipendenza = rec_cliente.get("S1")[0];
codcf_hardy << format("%03d", rec_cliente.get_long("I0")); const long clifo = rec_cliente.get_long("I0");
} codcf_hardy.format("%c%03d", dipendenza, clifo);
}
return codcf_hardy; return codcf_hardy;
} }

View File

@ -245,7 +245,7 @@ void TGestione_attrezzature_mask::fill_sheet_storico(const TString& codattr)
TToken_string& row = sf_righe.row(-1); //riga sheet da riempire TToken_string& row = sf_righe.row(-1); //riga sheet da riempire
const long line_clifo = rec.get_long("I0"); const long line_clifo = rec.get_long("I0");
//se il clifo presente sulla riga e' diverso da quello attuale la riga assumera' un vago colore pervinca //se il clifo presente sulla riga è diverso da quello attuale la riga assumerà un vago colore pervinca
if (line_clifo != present_clifo) if (line_clifo != present_clifo)
sf_righe.set_back_and_fore_color(DISABLED_BACK_COLOR, DISABLED_COLOR, sf_righe.items()-1); sf_righe.set_back_and_fore_color(DISABLED_BACK_COLOR, DISABLED_COLOR, sf_righe.items()-1);
@ -267,6 +267,9 @@ void TGestione_attrezzature_mask::fill_sheet_storico(const TString& codattr)
sf_righe.sort(sort_by_data); sf_righe.sort(sort_by_data);
sf_righe.show(); sf_righe.show();
sf_righe.force_update(); sf_righe.force_update();
//una volta caricato lo sheet deve risultare immacolato!
_sheet_dirty = false;
} }
@ -504,7 +507,7 @@ bool TGestione_attrezzature_mask::on_field_event(TOperable_field& o, TField_even
int can_write = tab_his.write(); int can_write = tab_his.write();
if (can_write != NOERR) if (can_write != NOERR)
return warning_box(TR("Impossibile aggiungere l'attrezzatura! Risulta gia' presente.")); return warning_box(TR("Impossibile aggiungere l'attrezzatura! Risulta già presente."));
set(F_CODCF, codcf, true); set(F_CODCF, codcf, true);
set(F_CODART, full_matricola.left(20), true); set(F_CODART, full_matricola.left(20), true);
@ -517,19 +520,18 @@ bool TGestione_attrezzature_mask::on_field_event(TOperable_field& o, TField_even
break; break;
case DLG_SAVEREC: case DLG_SAVEREC:
if (e == fe_button && check_fields()) if (e == fe_button && check_fields())
{
write(); write();
}
break; break;
case DLG_CANCEL: case DLG_CANCEL:
if (e == fe_button && jolly == 0) //il jolly=0 significa che si riferisce alla maschera principale!.. if (e == fe_button && jolly == 0) //il jolly=0 significa che si riferisce alla maschera principale!..
{ //..se non ci fosse azzererebbe tutto anche quando si fa annulla sulla maschera di riga! { //..se non ci fosse azzererebbe tutto anche quando si fa annulla sulla maschera di riga!
//nel caso l'utonto clicchi su ANNULLA dopo aver fatto modifiche sara' meglio chiedere conferma se le vuole mantenere //nel caso l'utonto clicchi su ANNULLA dopo aver fatto modifiche sara' meglio chiedere conferma se le vuole mantenere
save_if_dirty(); save_if_dirty();
//azzera i campi della maschera //azzera i campi della maschera
reset(); reset();
_sheet_dirty = false;
TTreelist_field& tf = (TTreelist_field&)field(F_ATTREZZATURE); TTreelist_field& tf = (TTreelist_field&)field(F_ATTREZZATURE);
TCoffee_tree* ct = (TCoffee_tree*)tf.tree(); TCoffee_tree* ct = (TCoffee_tree*)tf.tree();
if (ct != NULL) if (ct != NULL)