From e2c7783386eb73d1e4457858509e367198f8c640 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 3 Mar 2013 21:43:48 +0000 Subject: [PATCH] Correzioni DNINST via MySql git-svn-id: svn://10.65.10.50/branches/R_10_00@22808 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0102.cpp | 20 +++++++++++++++ ba/ba0102.h | 3 ++- ba/ba0103.cpp | 10 ++++---- ba/ba2800.cpp | 67 ++++++++++++++++++++++++++++++++++----------------- 4 files changed, 72 insertions(+), 28 deletions(-) diff --git a/ba/ba0102.cpp b/ba/ba0102.cpp index c0caadc43..45d92501c 100755 --- a/ba/ba0102.cpp +++ b/ba/ba0102.cpp @@ -35,6 +35,26 @@ bool TMenu_tree::enabled() const return curr_item().enabled(); } +bool TMenu_tree::marked() const +{ + bool yes = false; + /* Non cambia nulla! + const TMenuitem& mi = curr_item(); + if (mi.is_program() && mi.enabled()) + { + TFilename n = mi.action().before(' '); + n.ext("exe"); + if (n.custom_path()) + { + n.lower(); + yes = n.find("custom") > 0; + } + } + */ + return yes; +} + + struct TFind_node_data { TString _id; diff --git a/ba/ba0102.h b/ba/ba0102.h index d55dec4b2..c9acea5ee 100755 --- a/ba/ba0102.h +++ b/ba/ba0102.h @@ -47,7 +47,8 @@ public: // TTree virtual bool get_description(TString& desc) const; virtual TImage* image(bool selected) const; virtual bool enabled() const; - + virtual bool marked() const; + public: const TSubmenu& curr_submenu() const; const TMenuitem& curr_item() const; diff --git a/ba/ba0103.cpp b/ba/ba0103.cpp index 1f921e786..2bb1809c0 100755 --- a/ba/ba0103.cpp +++ b/ba/ba0103.cpp @@ -124,14 +124,17 @@ void TBook_window::update() RCT rctw; xvt_vobj_get_client_rect(w, &rctw); if (rctw.right >= 64 && rctw.bottom >= 64) { + if (_back.ok()) + _back.draw(w, rctw, 'L', 'T', '*'); // Disegna sfondo in alto if (_logo.ok()) { const RCT& r = _logo.draw(w, rctw, 'R', 'B', '-'); // Disegna logo in basso - if (_back.ok() && r.top >= 64) +/* if (_back.ok() && r.top >= 64) { rctw.bottom = r.top; _back.draw(w, rctw, 'R', 'T', '*'); // Disegna sfondo in alto } + */ } const PNT pnt = { 0, 0 }; @@ -449,7 +452,7 @@ void TBook_window::set_back(const TString& back) if (!ok) { str.ext("gif"); - str.custom_path(); + ok = str.custom_path(); } if (ok && _back.load(back)) { @@ -463,9 +466,6 @@ void TBook_window::set_back(const TString& back) const COLOR rgb = _back.get_pixel(x, y); if (rgb != NORMAL_BACK_COLOR) { - const unsigned char r = XVT_COLOR_GET_RED(rgb); - const unsigned char g = XVT_COLOR_GET_GREEN(rgb); - const unsigned char b = XVT_COLOR_GET_BLUE(rgb); const COLOR col = blend_colors(NORMAL_BACK_COLOR, rgb, 0.9); if (col != rgb) _back.set_pixel(x, y, col); diff --git a/ba/ba2800.cpp b/ba/ba2800.cpp index e3b44984d..b1ae2179e 100644 --- a/ba/ba2800.cpp +++ b/ba/ba2800.cpp @@ -418,25 +418,47 @@ bool Tdninst_mask::load_odbc(TString_array& a) const r.add(_oem.Agente2OEM(agente), _c_dboem); r.add(smart_trim(att.get("RagioneSociale").as_string(), 50), _c_dbowner); - const TString& stato = att.get("Stato").as_string(); + if (atoi(r) == 5160) + int cazzone = 1; + + TString16 kill; + TString16 stato = att.get("Stato").as_string(); if (stato[0] > 'A') // Non Attivo + kill = att.get("DataDisattivazione").as_string(); + if (kill.blank()) { - const TString& kill = att.get("DataDisattivazione").as_string(); - if (kill.full() && kill.len() == 10) + query.cut(0); + query << "ODBC(" << dsn << ")\n" + << "SELECT Chiave,DataAttivazione,DataScadenza\n" + << "FROM attivazioni WHERE Modulo IS NULL AND Chiave=" << r.get(0); + TODBC_recordset ad(query); + for (bool ok = ad.move_first(); ok; ok = ad.move_next()) { - TDate d; - if (kill[2] == '-') - d = TDate(kill); else - if (kill[4] == '-') - d = TDate(atoi(kill.mid(8,2)), atoi(kill.mid(5,2)), atoi(kill.left(4))); - if (d.year() >= 1990) + const TString& attivaz = ad.get("DataAttivazione").as_string(); + const TString& disatt = ad.get("DataScadenza").as_string(); + if (disatt > kill) + kill = disatt; else + if (attivaz > kill) + kill.cut(0); + } + if (kill.full()) + stato = "Disdetto"; + } + + if (kill.full() && kill.len() == 10) + { + TDate d; + if (kill[2] == '-') + d = TDate(kill); else + if (kill[4] == '-') + d = TDate(atol(kill.strip("-"))); + if (d.year() >= 1990) + { + switch (stato[0]) { - switch (stato[0]) - { - case 'D': r.add(d.string(), _c_dbkilled); break; // Disdetto - case 'S': r.add(d.string(), _c_dbsuspend); break; // Sospeso - default: break; // Attivo - } + case 'D': r.add(d.string(), _c_dbkilled); break; // Disdetto + case 'S': r.add(d.string(), _c_dbsuspend); break; // Sospeso + default: break; // Attivo } } } @@ -534,7 +556,7 @@ bool Tdninst_mask::load_xml(TString_array& a) const bool Tdninst_mask::get_remote_dninst() { - const TString& n = remote_dninst(10); + const TString& n = remote_dninst(11); if (n.full()) { const int minsize = 46*1024; @@ -622,7 +644,7 @@ bool Tdninst_mask::fill_sheet() TDate ds = row->get(_c_suspend); TDate dk = row->get(_c_killed); - if (ds > ds) ds = dk; + if (dk > ds) ds = dk; TDate dbs = row->get(_c_dbsuspend); TDate dbk = row->get(_c_dbkilled); @@ -631,15 +653,16 @@ bool Tdninst_mask::fill_sheet() if (ds != dbs) { if (dbs.ok()) - { s.set_back_and_fore_color(FOCUS_BACK_COLOR, FOCUS_COLOR, r, _c_suspend); - s.set_back_and_fore_color(FOCUS_BACK_COLOR, FOCUS_COLOR, r, _c_killed); - } else - { s.set_back_and_fore_color(FOCUS_BACK_COLOR, FOCUS_COLOR, r, _c_dbsuspend); + } + if (dk != dbk) + { + if (dbk.ok()) + s.set_back_and_fore_color(FOCUS_BACK_COLOR, FOCUS_COLOR, r, _c_killed); + else s.set_back_and_fore_color(FOCUS_BACK_COLOR, FOCUS_COLOR, r, _c_dbkilled); - } } }