Consuntivazione ore
git-svn-id: svn://10.65.10.50/branches/R_10_00@22902 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									6c28b4a0ab
								
							
						
					
					
						commit
						ef83caf3bc
					
				@ -81,17 +81,16 @@ void TRiepiloghi_mask::create_sheet()
 | 
				
			|||||||
      else
 | 
					      else
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        const bool cdc_req = ini.get_bool("CdcRequired");
 | 
					        const bool cdc_req = ini.get_bool("CdcRequired");
 | 
				
			||||||
        create_sheet_fields(LF_CDC, y, dlg);
 | 
					        create_sheet_fields(LF_CDC, y, dlg, cdc_req);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } else
 | 
					    } else
 | 
				
			||||||
    if (level == "CMS")                                   // Crea commessa
 | 
					    if (level == "CMS")                                   // Crea commessa
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					      const bool cms_req = ini.get_bool("CmsRequired");
 | 
				
			||||||
      if (fasinfo.parent() == LF_COMMESSE)
 | 
					      if (fasinfo.parent() == LF_COMMESSE)
 | 
				
			||||||
        create_sheet_fields(LF_FASI, y, dlg);
 | 
					        create_sheet_fields(LF_FASI, y, dlg, cms_req);
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
      {
 | 
					        create_sheet_fields(LF_COMMESSE, y, dlg, cms_req);
 | 
				
			||||||
        create_sheet_fields(LF_COMMESSE, y, dlg);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -244,16 +243,19 @@ bool TRiepiloghi_recordset::rdoc_filter(const TRelation* rel)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool TRiepiloghi_recordset::has_doc_reference(const char* str) const
 | 
					bool TRiepiloghi_recordset::has_doc_reference(const char* str) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TString expr(str); expr.upper();
 | 
					/*  TString expr(str); expr.upper();
 | 
				
			||||||
  return expr.find("DOC.") >= 0 || expr.find("DOC->") >= 0 || 
 | 
					  return expr.find("DOC.") >= 0 || expr.find("DOC->") >= 0 || 
 | 
				
			||||||
         expr.find("33.") >= 0 || expr.find("33->") >=0;
 | 
					         expr.find("33.") >= 0 || expr.find("33->") >=0;
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					  const TFixed_string expr(str);
 | 
				
			||||||
 | 
					  return expr.find('.') > 0 || expr.find("->") > 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TRiepiloghi_recordset::set_custom_filter(TCursor& cur) const
 | 
					void TRiepiloghi_recordset::set_custom_filter(TCursor& cur) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  // Quanto segue potrebbe essere una magia degli TISAM_recordset
 | 
					  // Quanto segue potrebbe essere una magia degli TISAM_recordset
 | 
				
			||||||
  // o quanto meno dei TDocument_recordset
 | 
					  // o quanto meno dei TDocument_recordset
 | 
				
			||||||
  TString filter = cur.filter();
 | 
					  const TString filter = cur.filter();
 | 
				
			||||||
  bool has_doc = false;
 | 
					  bool has_doc = false;
 | 
				
			||||||
  if (has_doc_reference(filter))
 | 
					  if (has_doc_reference(filter))
 | 
				
			||||||
    has_doc = true; else
 | 
					    has_doc = true; else
 | 
				
			||||||
@ -262,7 +264,12 @@ void TRiepiloghi_recordset::set_custom_filter(TCursor& cur) const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  myself = this;
 | 
					  myself = this;
 | 
				
			||||||
  cur.set_filterfunction(rdoc_filter, true); // Acc. il true e' obbligatorio :-(
 | 
					  cur.set_filterfunction(rdoc_filter, true); // Acc. il true e' obbligatorio :-(
 | 
				
			||||||
  cur.setfilter(filter, has_doc, 1);
 | 
					
 | 
				
			||||||
 | 
					  // Se non ho riferimenti ai file collegti pongo a 0 il limite di profondità per la relazione
 | 
				
			||||||
 | 
					  if (has_doc)
 | 
				
			||||||
 | 
					    cur.setfilter(filter, has_doc, cur.relation()->items());
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    cur.setfilter(filter, has_doc, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int nkey = 6;
 | 
					  int nkey = 6;
 | 
				
			||||||
  const TMultilevel_code_info* mci = ca_multilevel_code_info_by_index(0);
 | 
					  const TMultilevel_code_info* mci = ca_multilevel_code_info_by_index(0);
 | 
				
			||||||
@ -429,9 +436,12 @@ void TRiepiloghi_app::main_loop()
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			FOR_EACH_SHEET_ROW(sheet, r, row)	//per ogni cdc/cms che appare nello sheet di pag.1 della msk..
 | 
								FOR_EACH_SHEET_ROW(sheet, r, row)	//per ogni cdc/cms che appare nello sheet di pag.1 della msk..
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				rep.set_filter(mask, r);	//..chiama il metodone globale che crea e compila il file.. 
 | 
					        if (!row->empty_items())
 | 
				
			||||||
  																	//..temporaneo i cui dati riempiranno il report
 | 
					        {
 | 
				
			||||||
				book.add(rep);	//aggiunge il report relativo alla cdc/cms corrente al book
 | 
									  rep.set_filter(mask, r);	//..chiama il metodone globale che crea e compila il file.. 
 | 
				
			||||||
 | 
					  																  //..temporaneo i cui dati riempiranno il report
 | 
				
			||||||
 | 
									  book.add(rep);	//aggiunge il report relativo alla cdc/cms corrente al book
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										135
									
								
								ci/ci2400.cpp
									
									
									
									
									
								
							
							
						
						
									
										135
									
								
								ci/ci2400.cpp
									
									
									
									
									
								
							@ -1,5 +1,6 @@
 | 
				
			|||||||
#include <applicat.h>
 | 
					#include <applicat.h>
 | 
				
			||||||
#include <colors.h>
 | 
					#include <colors.h>
 | 
				
			||||||
 | 
					#include <controls.h>
 | 
				
			||||||
#include <modaut.h>
 | 
					#include <modaut.h>
 | 
				
			||||||
#include <progind.h>
 | 
					#include <progind.h>
 | 
				
			||||||
#include <reputils.h>
 | 
					#include <reputils.h>
 | 
				
			||||||
@ -47,7 +48,7 @@ static void advanced_draw_justified_text_line(WINDOW w, const char* text, short
 | 
				
			|||||||
        const bool last_word = txt[i+1] == '\0';
 | 
					        const bool last_word = txt[i+1] == '\0';
 | 
				
			||||||
        const TString& parola = txt.sub(start, i + (last_word ? 0 : 1));
 | 
					        const TString& parola = txt.sub(start, i + (last_word ? 0 : 1));
 | 
				
			||||||
        const int lw = xvt_dwin_get_text_width(w, parola, -1);
 | 
					        const int lw = xvt_dwin_get_text_width(w, parola, -1);
 | 
				
			||||||
        if (last_word) // ultima parola
 | 
					        if (last_word) // ultima parola ("vedova")
 | 
				
			||||||
          kx = x+dx-lw;
 | 
					          kx = x+dx-lw;
 | 
				
			||||||
        xvt_dwin_draw_text(w, int(kx+0.5), y, parola, -1);
 | 
					        xvt_dwin_draw_text(w, int(kx+0.5), y, parola, -1);
 | 
				
			||||||
        kx += lw + kspc;
 | 
					        kx += lw + kspc;
 | 
				
			||||||
@ -131,6 +132,7 @@ protected:
 | 
				
			|||||||
  void cell2rct(int c, RCT& rct) const;
 | 
					  void cell2rct(int c, RCT& rct) const;
 | 
				
			||||||
  void query(TString& month) const;
 | 
					  void query(TString& month) const;
 | 
				
			||||||
  void set_font(int nHeight);
 | 
					  void set_font(int nHeight);
 | 
				
			||||||
 | 
					  COLOR day2color(const TDate& d) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  void set_date(const TDate& d);
 | 
					  void set_date(const TDate& d);
 | 
				
			||||||
@ -190,6 +192,29 @@ void TConsuntivazione_window::set_font(int nHeight)
 | 
				
			|||||||
  xvt_font_destroy(fontid);
 | 
					  xvt_font_destroy(fontid);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					inline bool is_red_day(const TDate& d)
 | 
				
			||||||
 | 
					{ return d.wday() >= 6 || d.is_holiday(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COLOR TConsuntivazione_window::day2color(const TDate& d) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  const COLOR festivo = COLOR_RED;
 | 
				
			||||||
 | 
					  const COLOR feriale = COLOR_BLUE;
 | 
				
			||||||
 | 
					  const COLOR ponte   = blend_colors(festivo, feriale);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (is_red_day(d)) 
 | 
				
			||||||
 | 
					    return festivo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (d.month() == 12 && (d.day() == 24 || d.day() == 31))
 | 
				
			||||||
 | 
					    return ponte;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  TDate yesterday = d; --yesterday;
 | 
				
			||||||
 | 
					  TDate tomorrow = d; ++tomorrow;
 | 
				
			||||||
 | 
					  if (is_red_day(yesterday) && is_red_day(tomorrow))
 | 
				
			||||||
 | 
					    return ponte;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  return feriale;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TConsuntivazione_window::update()
 | 
					void TConsuntivazione_window::update()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  WINDOW dc = win();
 | 
					  WINDOW dc = win();
 | 
				
			||||||
@ -217,7 +242,7 @@ void TConsuntivazione_window::update()
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    RCT r; cell2rct(i, r);
 | 
					    RCT r; cell2rct(i, r);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (i<dend.day() && busy[i] > ' ')
 | 
					    if (busy[i] > ' ' && i < dend.day())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      cbrush.pat = PAT_SOLID;
 | 
					      cbrush.pat = PAT_SOLID;
 | 
				
			||||||
      cbrush.color = FOCUS_BACK_COLOR; 
 | 
					      cbrush.color = FOCUS_BACK_COLOR; 
 | 
				
			||||||
@ -251,7 +276,7 @@ void TConsuntivazione_window::update()
 | 
				
			|||||||
      set_font(h/6);
 | 
					      set_font(h/6);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cbrush.pat = PAT_SOLID;
 | 
					    cbrush.pat = PAT_SOLID;
 | 
				
			||||||
    cbrush.color = (d.wday() >= 6 || d.is_holiday()) ? COLOR_RED : COLOR_BLUE; 
 | 
					    cbrush.color = day2color(d); 
 | 
				
			||||||
    xvt_dwin_set_cbrush(dc, &cbrush);
 | 
					    xvt_dwin_set_cbrush(dc, &cbrush);
 | 
				
			||||||
    const int r = h/16;
 | 
					    const int r = h/16;
 | 
				
			||||||
    xvt_dwin_draw_roundrect(dc, &rc, r, r);
 | 
					    xvt_dwin_draw_roundrect(dc, &rc, r, r);
 | 
				
			||||||
@ -363,13 +388,14 @@ class TConsuntivazione_msk : public TAutomask
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  short _cdc_sid, _cdc_lid, _cms_sid, _cms_lid,	_fase_sid, _fase_lid;
 | 
					  short _cdc_sid, _cdc_lid, _cms_sid, _cms_lid,	_fase_sid, _fase_lid;
 | 
				
			||||||
	short _scdc_sid, _scdc_lid,	_scms_sid, _scms_lid, _sfase_sid, _sfase_lid;
 | 
						short _scdc_sid, _scdc_lid,	_scms_sid, _scms_lid, _sfase_sid, _sfase_lid;
 | 
				
			||||||
  bool _sheet_dirty, _recontabilize;
 | 
					  bool _sheet_dirty, _recontabilize, _locked;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  virtual TMask_field* parse_field(TScanner& scanner);
 | 
					  virtual TMask_field* parse_field(TScanner& scanner);
 | 
				
			||||||
  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
					  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
 | 
					  bool cerca_disponibilita(int riga) const;
 | 
				
			||||||
  real proponi_costo(TMask& msk) const;
 | 
					  real proponi_costo(TMask& msk) const;
 | 
				
			||||||
  void riempi_nuova_riga(int r);
 | 
					  void riempi_nuova_riga(int r);
 | 
				
			||||||
  bool add_ril_to_doc(TRectype& rilore, TDocumento& doc, TLog_report& log) const;
 | 
					  bool add_ril_to_doc(TRectype& rilore, TDocumento& doc, TLog_report& log) const;
 | 
				
			||||||
@ -391,9 +417,11 @@ public:
 | 
				
			|||||||
TMask_field* TConsuntivazione_msk::parse_field(TScanner& scanner)
 | 
					TMask_field* TConsuntivazione_msk::parse_field(TScanner& scanner)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (scanner.key() == "CA")
 | 
					  if (scanner.key() == "CA")
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    set_full_screen_interface(page_win(0), true);
 | 
				
			||||||
    return new TConsuntivazione_field(this);
 | 
					    return new TConsuntivazione_field(this);
 | 
				
			||||||
  else
 | 
					  }
 | 
				
			||||||
    return TAutomask::parse_field(scanner);
 | 
					  return TAutomask::parse_field(scanner);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TConsuntivazione_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase) const
 | 
					void TConsuntivazione_msk::get_anal_fields(TString & cdc, TString & cms, TString & fase) const
 | 
				
			||||||
@ -609,6 +637,7 @@ bool TConsuntivazione_msk::load_sheet()
 | 
				
			|||||||
  TDate last_date = da_data;
 | 
					  TDate last_date = da_data;
 | 
				
			||||||
  TSheet_field& sheet = sfield(F_SHEET);
 | 
					  TSheet_field& sheet = sfield(F_SHEET);
 | 
				
			||||||
  sheet.destroy();
 | 
					  sheet.destroy();
 | 
				
			||||||
 | 
					  _locked = true;
 | 
				
			||||||
  int r = 0;
 | 
					  int r = 0;
 | 
				
			||||||
  for (bool ok = def.move_first(); ok; ok = def.move_next())
 | 
					  for (bool ok = def.move_first(); ok; ok = def.move_next())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -627,7 +656,7 @@ bool TConsuntivazione_msk::load_sheet()
 | 
				
			|||||||
  set(F_CALENDAR, last_date.string());
 | 
					  set(F_CALENDAR, last_date.string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  enable(DLG_SAVEREC, _sheet_dirty = false);
 | 
					  enable(DLG_SAVEREC, _sheet_dirty = false);
 | 
				
			||||||
 | 
					  _locked = false;
 | 
				
			||||||
  return !sheet.empty();
 | 
					  return !sheet.empty();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -678,9 +707,14 @@ real TConsuntivazione_msk::proponi_costo(TMask& msk) const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const TRectype& roa = cache().get(tipo == 'A' ? "ATR" : "RSS", codice);
 | 
					  const TRectype& roa = cache().get(tipo == 'A' ? "ATR" : "RSS", codice);
 | 
				
			||||||
  if (costo.is_zero())
 | 
					  if (costo.is_zero())
 | 
				
			||||||
    costo = roa.get_real("R10");
 | 
					  {
 | 
				
			||||||
 | 
					    const char* fld_price = "R10"; // Costo standard risorsa o attrezzatura
 | 
				
			||||||
 | 
					    if (tipo =='A' && tpora == roa.get("S9") && !roa.get_real("R11").is_zero()) 
 | 
				
			||||||
 | 
					      fld_price = "R11";           // costo disponibilità attrezzatura
 | 
				
			||||||
 | 
					    costo = roa.get_real(fld_price);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (costo > ZERO && costo < 1000)
 | 
					  if (costo > ZERO && costo < 10000)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    msk.set(S_COSTO, costo);
 | 
					    msk.set(S_COSTO, costo);
 | 
				
			||||||
    msk.set(S_CODIVA, roa.get("S3").left(4));
 | 
					    msk.set(S_CODIVA, roa.get("S3").left(4));
 | 
				
			||||||
@ -720,10 +754,22 @@ bool TConsuntivazione_msk::add_ril_to_doc(TRectype& rilore, TDocumento& doc, TLo
 | 
				
			|||||||
  const char tipo_roa = rilore.get_char(RILORE_TIPORA); // 'R'isorsa o 'A'ttrezzatura
 | 
					  const char tipo_roa = rilore.get_char(RILORE_TIPORA); // 'R'isorsa o 'A'ttrezzatura
 | 
				
			||||||
  const TString& codice_roa = rilore.get(RILORE_CODICE);
 | 
					  const TString& codice_roa = rilore.get(RILORE_CODICE);
 | 
				
			||||||
  const TRectype& roa = cache().get(tipo_roa == 'A' ? "ATR" : "RSS", codice_roa);
 | 
					  const TRectype& roa = cache().get(tipo_roa == 'A' ? "ATR" : "RSS", codice_roa);
 | 
				
			||||||
  TString80 codart = roa.get("S2").left(20); codart.trim();
 | 
					
 | 
				
			||||||
 | 
					  const TString& tipo_ora = rilore.get(RILORE_TPORA);
 | 
				
			||||||
 | 
					  const bool disponibilita = tipo_ora == roa.get("S9");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  TString80 codart = roa.get("S2");
 | 
				
			||||||
 | 
					  if (disponibilita)
 | 
				
			||||||
 | 
					    codart.ltrim(20);
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    codart.cut(20); 
 | 
				
			||||||
 | 
					  codart.trim();
 | 
				
			||||||
  if (codart.blank())
 | 
					  if (codart.blank())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TString msg; msg << TR("Impossibile associare un articolo a ") << codice_roa;
 | 
					    TString msg;
 | 
				
			||||||
 | 
					    msg << (tipo_roa == 'R' ? TR("Impossibile associare un articolo alla risorsa ") 
 | 
				
			||||||
 | 
					                            : TR("Impossibile associare un articolo all'attrezzatura "));
 | 
				
			||||||
 | 
					    msg << codice_roa;
 | 
				
			||||||
    log.log(2, msg);
 | 
					    log.log(2, msg);
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -755,6 +801,7 @@ bool TConsuntivazione_msk::add_ril_to_doc(TRectype& rilore, TDocumento& doc, TLo
 | 
				
			|||||||
      riga.put(RDOC_CHECKED, "X");
 | 
					      riga.put(RDOC_CHECKED, "X");
 | 
				
			||||||
      riga.put(RDOC_DESCR, anamag.get(ANAMAG_DESCR));
 | 
					      riga.put(RDOC_DESCR, anamag.get(ANAMAG_DESCR));
 | 
				
			||||||
      riga.put(RDOC_PREZZO, prezzo);
 | 
					      riga.put(RDOC_PREZZO, prezzo);
 | 
				
			||||||
 | 
					      riga.put(RDOC_DATACONS, doc.get(DOC_DATADOC));
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
      TString4 codiva = roa.get("S3").left(4);
 | 
					      TString4 codiva = roa.get("S3").left(4);
 | 
				
			||||||
      if (codiva.blank())
 | 
					      if (codiva.blank())
 | 
				
			||||||
@ -906,7 +953,7 @@ bool TConsuntivazione_msk::contabilizza()
 | 
				
			|||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const int anno = get_int(F_ANNO);
 | 
					  const int anno = get_int(F_ANNO);
 | 
				
			||||||
  if (anno < 2000)
 | 
					  if (anno < 2010)
 | 
				
			||||||
    return field(F_ANNO).on_hit();
 | 
					    return field(F_ANNO).on_hit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const TString4 numcn  = ini_get_string(CONFIG_DITTA, "ci", "CODNUMCN");
 | 
					  const TString4 numcn  = ini_get_string(CONFIG_DITTA, "ci", "CODNUMCN");
 | 
				
			||||||
@ -967,7 +1014,6 @@ bool TConsuntivazione_msk::contabilizza()
 | 
				
			|||||||
  if (!yesno_box(msg))
 | 
					  if (!yesno_box(msg))
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  TLog_report log;
 | 
					  TLog_report log;
 | 
				
			||||||
  msg = TR("Caricamento contabilità industriale");
 | 
					  msg = TR("Caricamento contabilità industriale");
 | 
				
			||||||
  log.log(0, msg);
 | 
					  log.log(0, msg);
 | 
				
			||||||
@ -1121,6 +1167,32 @@ bool TConsuntivazione_msk::contabilizza()
 | 
				
			|||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TConsuntivazione_msk::cerca_disponibilita(int riga) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TSheet_field& s = sfield(F_SHEET);
 | 
				
			||||||
 | 
					  const int col_att = s.cid2index(S_CODATT);
 | 
				
			||||||
 | 
					  const int col_ora = s.cid2index(S_TPORA);
 | 
				
			||||||
 | 
					  const int col_cms = s.cid2index(S_CDC1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const TToken_string& r = s.row(riga);
 | 
				
			||||||
 | 
					  TString80 cod_att; r.get(col_att, cod_att); cod_att.trim();
 | 
				
			||||||
 | 
					  TString4 tipo_ora; r.get(col_ora, tipo_ora); tipo_ora.trim();
 | 
				
			||||||
 | 
					  TString80 cod_cms; r.get(col_cms, cod_att); cod_cms.trim();
 | 
				
			||||||
 | 
					  for (int i = riga-1; i <= riga+1; i+=2)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    if (i >= 0 && i < s.items())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      const TToken_string& ri = s.row(i);
 | 
				
			||||||
 | 
					      TString80 ca; ri.get(col_att, ca); ca.trim();
 | 
				
			||||||
 | 
					      TString4 to;  ri.get(col_ora, to); to.trim();
 | 
				
			||||||
 | 
					      TString80 cc; ri.get(col_cms, cc); cc.trim();
 | 
				
			||||||
 | 
					      if (ca == cod_att && cc == cod_cms && to != tipo_ora)
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TConsuntivazione_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
					bool TConsuntivazione_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  switch (o.dlg())
 | 
					  switch (o.dlg())
 | 
				
			||||||
@ -1242,15 +1314,16 @@ bool TConsuntivazione_msk::on_field_event(TOperable_field& o, TField_event e, lo
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        TToken_string& row = sheet.row(jolly);
 | 
					        TToken_string& row = sheet.row(jolly);
 | 
				
			||||||
        const char tipo = row.get_char(1);
 | 
					        const char tipo = row.get_char(1);
 | 
				
			||||||
        const TString16 cod = row.get(2);
 | 
					        const TString80 cod = row.get(2);
 | 
				
			||||||
        const TString4  ora = row.get(4);
 | 
					        const TString4  ora = row.get(4);
 | 
				
			||||||
        if (tipo == 'A' && cod.full() && ora.full())
 | 
					        if (tipo == 'A' && cod.full() && ora.full())
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          const TRectype& atr = cache().get("ATR", cod);
 | 
					          const TRectype& atr = cache().get("ATR", cod);
 | 
				
			||||||
          TString4 orad = atr.get("S9");
 | 
					          const TString& codartdisp = atr.get("S2").mid(20);   // Previsto articolo per disponibilità?
 | 
				
			||||||
          if (orad.full() && ora != orad) // Attrezzatura con ora normale
 | 
					          const TString4 orad = atr.get("S9");                 // Previsto tipo ora per disponibilità?
 | 
				
			||||||
 | 
					          if (codartdisp.full() && orad.full() && ora != orad) // Attrezzatura con ora normale
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            if (jolly == sheet.items()-1 || orad != sheet.row(jolly+1).get(4))
 | 
					            if (!cerca_disponibilita(jolly))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
              const int nr = sheet.insert(jolly+1);
 | 
					              const int nr = sheet.insert(jolly+1);
 | 
				
			||||||
              TToken_string& rowd = sheet.row(nr);
 | 
					              TToken_string& rowd = sheet.row(nr);
 | 
				
			||||||
@ -1279,7 +1352,7 @@ bool TConsuntivazione_msk::on_field_event(TOperable_field& o, TField_event e, lo
 | 
				
			|||||||
  case S_CODRIS:
 | 
					  case S_CODRIS:
 | 
				
			||||||
  case S_CODATT:
 | 
					  case S_CODATT:
 | 
				
			||||||
  case S_TPORA:
 | 
					  case S_TPORA:
 | 
				
			||||||
    if (e == fe_modify && !o.empty())
 | 
					    if (e == fe_modify && !o.empty() && !_locked)
 | 
				
			||||||
      proponi_costo(o.mask());
 | 
					      proponi_costo(o.mask());
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  default:
 | 
					  default:
 | 
				
			||||||
@ -1324,7 +1397,7 @@ bool TConsuntivazione_msk::on_field_event(TOperable_field& o, TField_event e, lo
 | 
				
			|||||||
  return true;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TConsuntivazione_msk::TConsuntivazione_msk()
 | 
					TConsuntivazione_msk::TConsuntivazione_msk() : _locked(false)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  read_mask("ci2400a", 0, 1);
 | 
					  read_mask("ci2400a", 0, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1422,19 +1495,6 @@ TConsuntivazione_msk::TConsuntivazione_msk()
 | 
				
			|||||||
		sdlg += h;
 | 
							sdlg += h;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
  for (int i = 0; i < 12; i++)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
		const short id = F_ANAL + i;
 | 
					 | 
				
			||||||
    const int pos = id2pos(id);
 | 
					 | 
				
			||||||
    if (pos >= 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
			set_universal_handler(id);
 | 
					 | 
				
			||||||
			set_universal_handler(id + 100);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
  */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  for (short id = S_CDC12 + 100; id >= S_CDC1 + 100; id--)
 | 
					  for (short id = S_CDC12 + 100; id >= S_CDC1 + 100; id--)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const int pos = sm.id2pos(id);
 | 
					    const int pos = sm.id2pos(id);
 | 
				
			||||||
@ -1442,20 +1502,23 @@ TConsuntivazione_msk::TConsuntivazione_msk()
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      TMask_field& f = sm.fld(pos);
 | 
					      TMask_field& f = sm.fld(pos);
 | 
				
			||||||
      const int size = f.size();
 | 
					      const int size = f.size();
 | 
				
			||||||
      const TString prompt = ((TEditable_field &)f).get_warning();
 | 
					      TString80 prompt = f.prompt(); prompt.trim();
 | 
				
			||||||
 | 
					      if (prompt.blank()) 
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        TToken_string ts(((TEditable_field &)f).get_warning(), ' ');
 | 
				
			||||||
 | 
					        prompt = ts.get(0);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      s.set_column_header(id, prompt);
 | 
					      s.set_column_header(id, prompt);
 | 
				
			||||||
      s.set_column_justify(id, f.is_kind_of(CLASS_REAL_FIELD));
 | 
					      s.set_column_justify(id, f.is_kind_of(CLASS_REAL_FIELD));
 | 
				
			||||||
      s.set_column_width(id, (max(3+size, prompt.len()+1)) * CHARX);
 | 
					      s.set_column_width(id, (max(3+size, prompt.len()+1)) * CHARX);
 | 
				
			||||||
			s.update_column_width(id);
 | 
								s.update_column_width(id);
 | 
				
			||||||
			s.enable_column(id);
 | 
								s.enable_column(id);
 | 
				
			||||||
// 			set_insheet_universal_handler(F_SHEET, id);
 | 
					 | 
				
			||||||
//			set_insheet_universal_handler(F_SHEET, id + 50);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      s.delete_column(id);
 | 
					      s.delete_column(id);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_handlers();
 | 
					  set_handlers(); // Fondamentale dopo una read_mask e la generazione dinamica di campi
 | 
				
			||||||
  enable(DLG_SAVEREC, _sheet_dirty = false);
 | 
					  enable(DLG_SAVEREC, _sheet_dirty = false);
 | 
				
			||||||
  _recontabilize = false;
 | 
					  _recontabilize = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -32,6 +32,11 @@ ENDPAGE
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
PAGE "Consuntivazione ore" 0 2 0 0
 | 
					PAGE "Consuntivazione ore" 0 2 0 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CALENDAR F_CALENDAR -1 7
 | 
				
			||||||
 | 
					BEGIN
 | 
				
			||||||
 | 
					  PROMPT 80 0 ""
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GROUPBOX DLG_NULL 78 8
 | 
					GROUPBOX DLG_NULL 78 8
 | 
				
			||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 1 0 "@bSelezione"
 | 
					  PROMPT 1 0 "@bSelezione"
 | 
				
			||||||
@ -159,11 +164,6 @@ BEGIN
 | 
				
			|||||||
  GROUP 3
 | 
					  GROUP 3
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CALENDAR F_CALENDAR -1 7
 | 
					 | 
				
			||||||
BEGIN
 | 
					 | 
				
			||||||
  PROMPT 80 0 ""
 | 
					 | 
				
			||||||
END
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
SPREADSHEET F_SHEET
 | 
					SPREADSHEET F_SHEET
 | 
				
			||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 0 8 ""
 | 
					  PROMPT 0 8 ""
 | 
				
			||||||
@ -173,7 +173,7 @@ BEGIN
 | 
				
			|||||||
  ITEM "Descrizione@20"
 | 
					  ITEM "Descrizione@20"
 | 
				
			||||||
  ITEM "Tipo@5"
 | 
					  ITEM "Tipo@5"
 | 
				
			||||||
  ITEM "Ore@7"
 | 
					  ITEM "Ore@7"
 | 
				
			||||||
  ITEM "Prezzo@6"
 | 
					  ITEM "Prezzo@7"
 | 
				
			||||||
  ITEM "CDC1"
 | 
					  ITEM "CDC1"
 | 
				
			||||||
  ITEM "CDC2"
 | 
					  ITEM "CDC2"
 | 
				
			||||||
  ITEM "CDC3"
 | 
					  ITEM "CDC3"
 | 
				
			||||||
@ -305,7 +305,7 @@ BEGIN
 | 
				
			|||||||
  CHECKTYPE REQUIRED
 | 
					  CHECKTYPE REQUIRED
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NUMBER S_COSTO 6 2
 | 
					NUMBER S_COSTO 7 2
 | 
				
			||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 34 2 "Prezzo "
 | 
					  PROMPT 34 2 "Prezzo "
 | 
				
			||||||
  FIELD COSTO
 | 
					  FIELD COSTO
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user