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

This commit is contained in:
guy 2015-12-21 11:22:59 +00:00
parent 0de08dbe78
commit fe73df2a38
4 changed files with 55 additions and 57 deletions

View File

@ -220,20 +220,14 @@ bool TRilprod_mask::on_field_event(TOperable_field& o, TField_event e, long joll
if (m.run() == K_ENTER) if (m.run() == K_ENTER)
{ {
short dlg = F_PERC1;
for (int i = 0; i < 4; i++)
{ {
short dlg = F_PERC1; const real perc(m.get(dlg++));
warn_perc.add(perc);
for (int i = 0; i < 4; i++) const TString & s = m.get(dlg++);
{ warning.add(s);
const real perc(m.get(dlg++)); }
warn_perc.add(perc);
const TString & s = m.get(dlg++);
warning.add(s);
}
}
load_prod_file(m.get(F_FILE), m.get_bool(F_SAVE), m.get_bool(F_ONLY_ERRORS), warn_perc, warning); load_prod_file(m.get(F_FILE), m.get_bool(F_SAVE), m.get_bool(F_ONLY_ERRORS), warn_perc, warning);
} }
} }
@ -279,23 +273,18 @@ void TRilprod_mask::print_record(TViswin & v, TTipo_rec t , TProduzione & r)
v.add_line(""); v.add_line("");
if (t == _start) if (t == _start)
v.add_line(TR("Record elaborato - inizio produzione")); v.add_line(TR("Record elaborato - inizio produzione")); else
else if (t == _end)
if (t == _end) v.add_line(TR("Record elaborato - fine produzione")); else
v.add_line(TR("Record elaborato - fine produzione")); if (t == _rett)
else v.add_line(TR("Record elaborato - rettifica"));
if (t == _rett)
v.add_line(TR("Record elaborato - rettifica"));
TString l; TString l;
for (int i = 0; i < nfields; i++) for (int i = 0; i < nfields; i++)
{ {
const TString & name = r.fieldname(i); const TString & name = r.fieldname(i);
const TString & val = r.get(name); const TString & val = r.get(name);
TString s; TString s;
s.format(" %s = %s", (const char*)name, (const char*)val);
s.format(" %s = %s", (const char *) name, (const char *) val);
if (l.len() + s.len() > 80) if (l.len() + s.len() > 80)
{ {
v.add_line(l); v.add_line(l);
@ -303,11 +292,11 @@ void TRilprod_mask::print_record(TViswin & v, TTipo_rec t , TProduzione & r)
} }
l << s; l << s;
} }
if (l.not_empty()) if (l.full())
v.add_line(l); v.add_line(l);
} }
void TRilprod_mask::load_prod_file(const char * nomefile, bool savefile, bool only_errors, TArray & warn_perc, TString_array & warning) void TRilprod_mask::load_prod_file(const char* nomefile, bool savefile, bool only_errors, TArray & warn_perc, TString_array & warning)
{ {
TViswin vwin(NULL, TR("Importazione produzione"), FALSE, TRUE, TRUE); TViswin vwin(NULL, TR("Importazione produzione"), FALSE, TRUE, TRUE);
TFile_text prod(nomefile,"mr0500a.ini"); //crea un oggetto articoli di tipo TFile_text TFile_text prod(nomefile,"mr0500a.ini"); //crea un oggetto articoli di tipo TFile_text
@ -628,14 +617,12 @@ void TRilprod_mask::load_prod_file(const char * nomefile, bool savefile, bool on
if (tot > ZERO) if (tot > ZERO)
{ {
real perc = prd.get_real("SCARTO") * CENTO / tot; real perc = prd.get_real("SCARTO") * CENTO / tot;
perc.round(2); perc.round(2);
for (int j = 3; j >= 0; j--) for (int j = 3; j >= 0; j--)
{ {
if ((const real&)warn_perc[j] > ZERO && perc > (const real&)warn_perc[j]) if ((const real&)warn_perc[j] > ZERO && perc > (const real&)warn_perc[j])
{ {
TString warn; TString warn;
warn.format("@b%s - percentuale %s", (const char *) warning.row(j), perc.string()); warn.format("@b%s - percentuale %s", (const char *) warning.row(j), perc.string());
display_error(vwin, warn, trec, rec); display_error(vwin, warn, trec, rec);
break; break;

View File

@ -947,11 +947,10 @@ class TMatResMask : public TCalendar_mask
void select_orders(char type, const char * dacatmer, const char * acatmer); void select_orders(char type, const char * dacatmer, const char * acatmer);
public: public:
int round_date(TDate& date, bool up = false) const;
int round_date(TDate& date, bool up = FALSE) const;
int add_order_line(long forn, const TMRP_line& l, int bucket); int add_order_line(long forn, const TMRP_line& l, int bucket);
TSelect_color_mask & sel() { return _sel_color; } TSelect_color_mask& sel() { return _sel_color; }
TMatResMask(); TMatResMask();
virtual ~TMatResMask() { } virtual ~TMatResMask() { }
}; };
@ -3473,7 +3472,7 @@ bool TMatResPlanning::emit_orders()
if (ok) if (ok)
{ {
const int numriga = riga.get_int(sf.cid2index(F_DOCNRIGA)); const int numriga = riga.get_int(sf.cid2index(F_DOCNRIGA));
TRiga_documento& rdoc = numdoc ? (*doc)[numriga] : doc->new_row(m.get(prod ? F_RIGA_PROD : F_RIGA_FORN)); TRiga_documento& rdoc = (numdoc && numriga>0 && numriga<=doc->physical_rows()) ? (*doc)[numriga] : doc->new_row(m.get(prod ? F_RIGA_PROD : F_RIGA_FORN));
if (numdoc) if (numdoc)
qta += rdoc.get_real(RDOC_QTA); qta += rdoc.get_real(RDOC_QTA);
rdoc.put(RDOC_CODART, riga.get(sf.cid2index(F_ARTICOLO))); rdoc.put(RDOC_CODART, riga.get(sf.cid2index(F_ARTICOLO)));

View File

@ -1,21 +1,23 @@
#define XI_INTERNAL
#include <xinclude.h>
#include "mrplib.h" #include "mrplib.h"
#include <colors.h> #include <colors.h>
#include <defmask.h> #include <defmask.h>
#include <diction.h> #include <diction.h>
#include <image.h>
#include <progind.h> #include <progind.h>
#include <tabutil.h> #include <tabutil.h>
#include <reprint.h> // Advanced draw text
//*********************************** //***********************************
// Utility // Utility
//*********************************** //***********************************
TMRP_config & mrp_config() TMRP_config& mrp_config()
{ {
static TMRP_config *_confditta=NULL; static TMRP_config *_confditta = new TMRP_config();
if (_confditta==NULL)
_confditta= new TMRP_config();
return *_confditta; return *_confditta;
} }
@ -824,6 +826,22 @@ long TCalendar_win::handler(WINDOW win, EVENT* ep)
return TField_window::handler(win, ep); return TField_window::handler(win, ep);
} }
static void get_rect(const RCT& client, int row, int col, RCT& rect)
{
rect.left = client.right * (col ? col+1 : 0) / 33;
rect.right = client.right * (col ? col+2 : 2) / 33;
rect.top = client.bottom * row / 13;
rect.bottom = client.bottom * (row+1) / 13;
}
static void draw_btn(WINDOW win, int row, int col, const char* txt)
{
RCT client; xvt_vobj_get_client_rect(win, &client);
RCT rect; get_rect(client, row, col, rect);
xi_draw_3d_rect((XinWindow)win, (XinRect*)&rect, false, 1, 0, 0, 0);
advanced_draw_text_line(win, txt, rect, 'C', 'C');
}
void TCalendar_win::update() void TCalendar_win::update()
{ {
const TDate today(TODAY); const TDate today(TODAY);
@ -880,13 +898,12 @@ void TCalendar_win::update()
set_brush(NORMAL_BACK_COLOR); set_brush(NORMAL_BACK_COLOR);
} }
TString16 str; TString16 str; str << _anno;
str << _anno;
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR); set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
if (_anno == this_year) if (_anno == this_year)
set_font(NULL, XVT_FS_BOLD); set_font(NULL, XVT_FS_BOLD);
stringat(1, 1, str); draw_btn(win(), 0, 0, str);
if (_anno == this_year) if (_anno == this_year)
set_font(); set_font();
@ -900,7 +917,7 @@ void TCalendar_win::update()
if (i == this_day) if (i == this_day)
set_font(NULL, XVT_FS_BOLD); set_font(NULL, XVT_FS_BOLD);
stringat(x+2, 0, str); draw_btn(win(), 0, i, str);
if (i == this_day) if (i == this_day)
set_font(); set_font();
} }
@ -910,10 +927,9 @@ void TCalendar_win::update()
const int y = rct.bottom * j / 13; const int y = rct.bottom * j / 13;
line(0, y, rct.right, y); line(0, y, rct.right, y);
str = itom(j); str.cut(3); str = itom(j); str.cut(3);
if (j == this_month) if (j == this_month)
set_font(NULL, XVT_FS_BOLD); set_font(NULL, XVT_FS_BOLD);
stringat(1, y, str); draw_btn(win(), j, 0, str);
if (j == this_month) if (j == this_month)
set_font(); set_font();
} }
@ -951,11 +967,13 @@ void TCalendar_win::update()
set_color(colore, COLOR_WHITE); set_color(colore, COLOR_WHITE);
if (j == this_month && i == this_day) if (j == this_month && i == this_day)
set_font(NULL, XVT_FS_BOLD); set_font(NULL, XVT_FS_BOLD);
str.format("%d", tmin); RCT rect; get_rect(rct, j, i, rect);
stringat(x+2, y, str); xvt_rect_inflate(&rect, -6, -6);
str.format(" %d", tmax); str.format("%d", tmin);
stringat(x+2, y + CHARY, str); advanced_draw_text_line(win(), str, rect, 'L', 'T');
str.format("%d", tmax);
advanced_draw_text_line(win(), str, rect, 'R', 'B');
if (j == this_month && i == this_day) if (j == this_month && i == this_day)
set_font(); // Rimette a posto il font set_font(); // Rimette a posto il font
@ -965,7 +983,7 @@ void TCalendar_win::update()
if (defcal != NULL) if (defcal != NULL)
delete defcal; delete defcal;
_pixmap = FALSE; _pixmap = false;
} }
void TCalendar_win::set_calendar(TMRP_calendar* cal, int year) void TCalendar_win::set_calendar(TMRP_calendar* cal, int year)
@ -992,10 +1010,8 @@ TCalendar_win::TCalendar_win(int x, int y, int dx, int dy,
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
void TCalendar_field::set_immediate_write(bool on) void TCalendar_field::set_immediate_write(bool on)
{ {
TCalendar_win& cw = (TCalendar_win&)win(); TCalendar_win& cw = (TCalendar_win&)win();
cw.set_immediate_write(on); cw.set_immediate_write(on);
} }

View File

@ -5,10 +5,6 @@
#include <automask.h> #include <automask.h>
#endif #endif
#ifndef __ASSOC_H
#include <assoc.h>
#endif
#ifndef __DBLIB_H #ifndef __DBLIB_H
#include "../db/dblib.h" #include "../db/dblib.h"
#endif #endif
@ -121,8 +117,8 @@ public:
class TCalendar_field : public TWindowed_field class TCalendar_field : public TWindowed_field
{ {
protected: // TWindowed_field protected: // TWindowed_field
virtual TField_window* create_window(int x, int y, int dx, int dy, virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
WINDOW parent);
public: public:
void set_calendar(TMRP_calendar* cal, int year = 0); void set_calendar(TMRP_calendar* cal, int year = 0);
void set_immediate_write(bool on = true); void set_immediate_write(bool on = true);