From 542d857cdd7e3a7352937c43db7df225f9580ff7 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 5 Dec 2011 16:12:28 +0000 Subject: [PATCH] Patch level : 10.0 1178 Files correlati : ve2.exe Ricompilazione Demo : [ ] Commento : Potenziato collegamento esterno a contratti (Hardy) git-svn-id: svn://10.65.10.50/branches/R_10_00@22516 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ve/ve2400.cpp | 1 + ve/ve2500.cpp | 79 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/ve/ve2400.cpp b/ve/ve2400.cpp index c772bfd18..11a23ceae 100755 --- a/ve/ve2400.cpp +++ b/ve/ve2400.cpp @@ -6,6 +6,7 @@ #include #include +#include //--------------------------------------------------- // MASCHERA ANAGRAFICA MAGAZZINO diff --git a/ve/ve2500.cpp b/ve/ve2500.cpp index b64195356..a13a7b326 100755 --- a/ve/ve2500.cpp +++ b/ve/ve2500.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -15,7 +14,6 @@ #include "ve2500a.h" #include "ve2500b.h" - const TString& build_query(const char tipo) { TString& query = get_tmp_string(); @@ -43,12 +41,13 @@ const TString& build_query(const char tipo) } return query; } + //////////////////////////////////////////////////////////////////// // MASCHERA SECONDARIA DI GENERAZIONE LISTINO //////////////////////////////////////////////////////////////////// + class TGestione_listini_semplice_mask_genera: public TAutomask { - TMask* _main_mask; //puntatore maschera principale protected: @@ -62,11 +61,8 @@ public: TGestione_listini_semplice_mask_genera(TMask* main_mask, const TString& mask_name); }; - bool TGestione_listini_semplice_mask_genera::on_field_event(TOperable_field& o, TField_event e, long jolly) -{ - return true; -} +{ return true; } TGestione_listini_semplice_mask_genera::TGestione_listini_semplice_mask_genera(TMask* main_mask, const TString& mask_name) : TAutomask(mask_name), _main_mask(main_mask) @@ -393,7 +389,6 @@ public: }; - TGestione_listini_semplice_mask::TGestione_listini_semplice_mask(const TString& mask_name) : TAutomask(mask_name) { //assegna le posizioni delle colonne dello sheet @@ -536,7 +531,6 @@ bool TGestione_listini_semplice_mask::on_field_event(TOperable_field &o, TField_ TSheet_field& sf_righe = sfield(FA_RIGHE); const bool gest_um = o.get().full(); sf_righe.enable_column(S_UM, gest_um); - sf_righe.force_update(); } break; @@ -592,21 +586,15 @@ bool TGestione_listini_semplice_mask::on_field_event(TOperable_field &o, TField_ break; case 'G': if (art.full() && get(FA_CODRIGA_G) != art) - { set(FA_CODRIGA_G, art, 0x2); - } break; case 'S': if (art.full() && get(FA_CODRIGA_S) != art) - { set(FA_CODRIGA_S, art, 0x2); - } break; case 'R': if (art.full() && get(FA_CODRIGA_R) != art) - { set(FA_CODRIGA_R, art, 0x2); - } break; default: break; @@ -629,7 +617,7 @@ bool TGestione_listini_semplice_mask::on_field_event(TOperable_field &o, TField_ if (err == NOERR) { TToken_string& row = cs.row(cs.selected()); - const TString& grmerc = row.get(0); + const char* grmerc = row.get(0); anamag.put(ANAMAG_GRMERC, grmerc); anamag.rewrite(); @@ -693,13 +681,15 @@ bool TGestione_listini_semplice_mask::on_field_event(TOperable_field &o, TField_ } /////////////////////////////////////////////////////////////// -// APPLICAZIONE +// APPLICAZIONE /////////////////////////////////////////////////////////////// -class TGestione_listini_semplice : public TRelation_application + +class TGestione_listini_semplice : public TRelation_application { - TGestione_listini_semplice_mask *_mask; + TGestione_listini_semplice_mask* _mask; TRelation* _rel; char _tipo; + long _codice; private: void save_rows(); @@ -731,9 +721,6 @@ public: virtual ~TGestione_listini_semplice() {} }; - - - void TGestione_listini_semplice::save_rows() { TWait_cursor hourglass; @@ -1077,12 +1064,36 @@ void TGestione_listini_semplice::mask2ini(const TMask& m, TConfig& ini) ini.set(field_name, rec.get(field_name)); } } - } void TGestione_listini_semplice::init_query_mode(TMask& m) { m.disable(DLG_CREA); + + // Simple transaction like behaviour with command line arguments only + if (_tipo == 'C' && _codice > 0L) + { + m.set(FA_C_CODCF, _codice); + + TEdit_field& contr = m.efield(FA_COD); + TBrowse& browse = *contr.browse(); + browse.do_input(true); + TCursor& cur = *browse.cursor(); + const TRecnotype nrecs = cur.items(); + if (nrecs > 0) + { + const TDate oggi(TODAY); + const TRectype& curr = cur.curr(); + for (cur = 0L; cur.pos() < nrecs-1; ++cur) + { + const TDate fine = curr.get(CONDV_VALFIN); + if (!fine.ok() || fine >= oggi) + break; + } + browse.do_output(); + m.send_key(K_AUTO_ENTER, 0); + } + } } void TGestione_listini_semplice::init_insert_mode(TMask& m) @@ -1108,18 +1119,28 @@ bool TGestione_listini_semplice::user_create() //decide il tipo di condizione di vendita: 'L'istino, 'C'ontratto 'O'fferta _tipo = 'L'; + _codice = 0L; if (argc() > 2) //se la chiamata ha un parametro ulteriore ('ve2 -4 c', ad esempio).. { TFilename trans = argv(2); //..prende il parametro ulteriore if (trans.len() == 1) //se è lungo 1 -> chiamata da menu... + { _tipo = trans[0]; + if (argc() > 3) // Es. Hardy: ve2 -4 c 210100 + _codice = max(0, atol(argv(3))); + } else { - trans.ltrim(2); //..sennò chiamata interattiva con file .ini - if (trans.exist()) + if (trans.starts_with("-i", true) || trans.starts_with("/i", true)) { - TConfig ini(trans, "52"); - _tipo = ini.get_char("TIPO"); + trans.ltrim(2); //..sennò chiamata interattiva con file .ini + if (trans.exist()) + { + TConfig ini(trans, "52"); + _tipo = ini.get_char("TIPO"); + if (_tipo == 'C') + _codice = ini.get_char(CONDV_CODCF); + } } } _tipo = toupper(_tipo); @@ -1133,7 +1154,7 @@ bool TGestione_listini_semplice::user_create() //super-attenzione! la maschera da caricare viene decisa in base al tipo di condizione di vendita TString16 mask_name; mask_name << "ve2500a" << _tipo; - _mask = new TGestione_listini_semplice_mask(mask_name); + _mask = new TGestione_listini_semplice_mask(mask_name); return true; } @@ -1147,6 +1168,6 @@ bool TGestione_listini_semplice::user_destroy() int ve2500(int argc, char* argv[]) { TGestione_listini_semplice a; - a.run(argc, argv, "Gestione listini"); + a.run(argc, argv, TR("Gestione listini")); return 0; } \ No newline at end of file