Patch level : 10.0 no patch
Files correlati : ci0.exe CI2.EXE Ricompilazione Demo : [ ] Commento : Modulo rilevazione ore step 2 git-svn-id: svn://10.65.10.50/branches/R_10_00@21137 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									f7ddf31bce
								
							
						
					
					
						commit
						1da14e1f10
					
				@ -173,12 +173,11 @@ void TDef_risoatt_msk::riempi_sheet()
 | 
			
		||||
  case 'A': codice = get(F_CODATT); break;
 | 
			
		||||
  default: break;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
	get_anal_fields(codcosto, codcms, codfase);
 | 
			
		||||
 | 
			
		||||
	TString query;
 | 
			
		||||
 | 
			
		||||
  query << "USE " << LF_RILORE  << "\n" ;
 | 
			
		||||
  query << "USE " << LF_RILORE  << " KEY 2\n" ;
 | 
			
		||||
 | 
			
		||||
	TString select;
 | 
			
		||||
	if (risoatt.full())
 | 
			
		||||
@ -361,6 +360,7 @@ void TDef_risoatt_msk::registra()
 | 
			
		||||
{
 | 
			
		||||
  TRilevamento_ore rilroa;
 | 
			
		||||
  TSheet_field& sheet = sfield(F_SHEET);
 | 
			
		||||
	int err = NOERR;
 | 
			
		||||
 | 
			
		||||
  FOR_EACH_SHEET_ROW(sheet, r, row)
 | 
			
		||||
  {
 | 
			
		||||
@ -384,9 +384,11 @@ void TDef_risoatt_msk::registra()
 | 
			
		||||
 | 
			
		||||
    rilroa.read('D', id);
 | 
			
		||||
		if (qtaore == 0)
 | 
			
		||||
			rilroa.remove();
 | 
			
		||||
			err = rilroa.remove();
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
			rilroa.put(RILORE_TIPO, "D");
 | 
			
		||||
      rilroa.put(RILORE_ID,  id);
 | 
			
		||||
			rilroa.put(RILORE_ANNO,     anno);
 | 
			
		||||
			rilroa.put(RILORE_MESE,     mese);
 | 
			
		||||
			rilroa.put(RILORE_GIORNO,   giorno);
 | 
			
		||||
@ -398,12 +400,18 @@ void TDef_risoatt_msk::registra()
 | 
			
		||||
			rilroa.put(RILORE_CODFASE,  codfase);
 | 
			
		||||
      rilroa.put(RILORE_QTAORE,  qtaore);
 | 
			
		||||
      rilroa.put(RILORE_COSTO,  costo);
 | 
			
		||||
      rilroa.put(RILORE_ID,  id);
 | 
			
		||||
			rilroa.rewrite_write();
 | 
			
		||||
			err = rilroa.rewrite_write();
 | 
			
		||||
    }
 | 
			
		||||
		if (err != NOERR) 
 | 
			
		||||
			break;
 | 
			
		||||
  }
 | 
			
		||||
	sheet.destroy();
 | 
			
		||||
	riempi_sheet();
 | 
			
		||||
	if (err == NOERR)
 | 
			
		||||
	{
 | 
			
		||||
		sheet.destroy();
 | 
			
		||||
		riempi_sheet();
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		error_box(FR("Errore %d in scrittura"), err);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
 | 
			
		||||
@ -674,7 +682,6 @@ TDef_risoatt_msk::TDef_risoatt_msk()
 | 
			
		||||
	
 | 
			
		||||
	if (_dett == "A")
 | 
			
		||||
	{
 | 
			
		||||
		field(F_ANNO).update_flags("A", true);
 | 
			
		||||
		reset(F_ANNO);
 | 
			
		||||
		disable(F_ANNO);
 | 
			
		||||
		reset(F_MESE);
 | 
			
		||||
@ -683,9 +690,12 @@ TDef_risoatt_msk::TDef_risoatt_msk()
 | 
			
		||||
	else
 | 
			
		||||
		if (_dett == "M")
 | 
			
		||||
		{
 | 
			
		||||
			field(F_ANNO).update_flags("A", true);
 | 
			
		||||
			reset(F_MESE);
 | 
			
		||||
			disable(F_MESE);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			field(F_ANNO).update_flags("A", true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
                                      ////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
@ -40,7 +40,6 @@ END
 | 
			
		||||
NUMBER F_ANNO 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 1 "Anno "
 | 
			
		||||
  FLAGS "A"
 | 
			
		||||
  CHECKTYPE REQUIRED  
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										115
									
								
								ci/ci2100.cpp
									
									
									
									
									
								
							
							
						
						
									
										115
									
								
								ci/ci2100.cpp
									
									
									
									
									
								
							@ -61,11 +61,10 @@ const real TRilevamento_prev_msk::proponi_costo(const TMask& msk)
 | 
			
		||||
  case 'A': codice = msk.get(S_CODATT); break;
 | 
			
		||||
  default : break;
 | 
			
		||||
  }
 | 
			
		||||
  const int anno = msk.get_date(S_DADATA).year();
 | 
			
		||||
  TString4 mese; mese.format("%02d", msk.get_date(S_DADATA).month());
 | 
			
		||||
	const TDate dal = msk.get_date(S_DADATA);
 | 
			
		||||
  const TString4 tpora = msk.get(S_TPORA);
 | 
			
		||||
 | 
			
		||||
  const TRisoatt_key chiave(tipo, codice, anno, mese, tpora);
 | 
			
		||||
  const TRisoatt_key chiave(tipo, codice, dal, tpora);
 | 
			
		||||
  TModule_table roa("&ROA");
 | 
			
		||||
  roa.put("CODTAB", chiave);
 | 
			
		||||
  int err = roa.read();
 | 
			
		||||
@ -74,6 +73,8 @@ const real TRilevamento_prev_msk::proponi_costo(const TMask& msk)
 | 
			
		||||
    costo = roa.get_real("R1");
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
	  const int anno = dal.year();
 | 
			
		||||
	  TString4 mese; mese.format("%02d", dal.month());
 | 
			
		||||
    TString8 tmp; tmp << anno << mese;
 | 
			
		||||
    const long anme = atol(tmp);
 | 
			
		||||
    TString query;
 | 
			
		||||
@ -105,11 +106,9 @@ const real TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
 | 
			
		||||
 | 
			
		||||
  TString cazzone = riga.get(sheet.cid2index(S_DADATA));
 | 
			
		||||
  const TDate dadata(riga.get(sheet.cid2index(S_DADATA)));
 | 
			
		||||
  const int anno = dadata.year();
 | 
			
		||||
  TString4 mese; mese.format("%02d", dadata.month());
 | 
			
		||||
  const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
 | 
			
		||||
 | 
			
		||||
  const TRisoatt_key chiave(tipo, codice, anno, mese, tpora);
 | 
			
		||||
  const TRisoatt_key chiave(tipo, codice, dadata, tpora);
 | 
			
		||||
  TModule_table roa("&ROA");
 | 
			
		||||
  roa.put("CODTAB", chiave);
 | 
			
		||||
  int err = roa.read();
 | 
			
		||||
@ -118,6 +117,8 @@ const real TRilevamento_prev_msk::proponi_costo(TToken_string& riga)
 | 
			
		||||
    costo = roa.get_real("R1");
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
		const int anno = dadata.year();
 | 
			
		||||
		TString4 mese; mese.format("%02d", dadata.month());
 | 
			
		||||
    TString8 tmp; tmp << anno << mese;
 | 
			
		||||
    const long anme = atol(tmp);
 | 
			
		||||
    TString query;
 | 
			
		||||
@ -256,7 +257,7 @@ void TRilevamento_prev_msk::carica_default()
 | 
			
		||||
	get_anal_fields(codcosto, codcms, codfase);
 | 
			
		||||
 | 
			
		||||
	TString query;
 | 
			
		||||
  query << "USE " << LF_RILORE << "\n";
 | 
			
		||||
  query << "USE " << LF_RILORE << " KEY 2\n";
 | 
			
		||||
 | 
			
		||||
	TString select;
 | 
			
		||||
	if (risoatt.full())
 | 
			
		||||
@ -324,25 +325,25 @@ void TRilevamento_prev_msk::carica_default()
 | 
			
		||||
  {
 | 
			
		||||
    TRilevamento_ore rilore(def.cursor()->curr());    
 | 
			
		||||
    TToken_string& riga = sheet.row(-1);
 | 
			
		||||
    riga.add(rilore.tipora(), sheet.cid2index(S_RISOATT));
 | 
			
		||||
    switch(rilore.tipora())
 | 
			
		||||
		const char tipo = rilore.get(RILORE_TIPORA)[0];
 | 
			
		||||
		TString16 cod = rilore.get(RILORE_CODICE);
 | 
			
		||||
    
 | 
			
		||||
		riga.add(tipo), sheet.cid2index(S_RISOATT);
 | 
			
		||||
    switch (tipo)
 | 
			
		||||
    {
 | 
			
		||||
    case 'R': riga.add(rilore.codice(), sheet.cid2index(S_CODRIS)); break;
 | 
			
		||||
    case 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
 | 
			
		||||
    default : break;
 | 
			
		||||
			case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
 | 
			
		||||
			case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
 | 
			
		||||
			default : break;
 | 
			
		||||
    }
 | 
			
		||||
    riga.add(rilore.dadata(), sheet.cid2index(S_DADATA));
 | 
			
		||||
    riga.add(rilore.adata(), sheet.cid2index(S_ADATA));
 | 
			
		||||
    riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
 | 
			
		||||
    riga.add(da.string(), sheet.cid2index(S_DADATA));
 | 
			
		||||
    riga.add(a.string(), sheet.cid2index(S_ADATA));
 | 
			
		||||
		put_row_anal_fields(riga, rilore.codcosto(), rilore.codcms(), rilore.codfase());
 | 
			
		||||
    riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
 | 
			
		||||
    riga.add(rilore.get(RILORE_TPORA), sheet.cid2index(S_TPORA));
 | 
			
		||||
		riga.add(da.string(), sheet.cid2index(S_DADATA));
 | 
			
		||||
	  riga.add(a.string(), sheet.cid2index(S_ADATA));
 | 
			
		||||
		put_row_anal_fields(riga, rilore.get(RILORE_CODCOSTO), rilore.get(RILORE_CODCMS), rilore.get(RILORE_CODFASE));
 | 
			
		||||
    riga.add(rilore.get(RILORE_QTAORE), sheet.cid2index(S_QTAORE));
 | 
			
		||||
    riga.add(proponi_costo(riga).string(), sheet.cid2index(S_COSTO));
 | 
			
		||||
		sheet.check_row(sheet.items() - 1);
 | 
			
		||||
  }
 | 
			
		||||
  sheet.force_update();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//RIEMPI_SHEET: metodo che riempie lo sheet in base ai campi chiave
 | 
			
		||||
@ -379,7 +380,7 @@ void TRilevamento_prev_msk::riempi_sheet()
 | 
			
		||||
	get_anal_fields(codcosto, codcms, codfase);
 | 
			
		||||
 | 
			
		||||
	TString query;
 | 
			
		||||
  query << "USE " << LF_RILORE  << "\n" ;
 | 
			
		||||
  query << "USE " << LF_RILORE  << " KEY 2\n" ;
 | 
			
		||||
 | 
			
		||||
	TString select;
 | 
			
		||||
	if (risoatt.full())
 | 
			
		||||
@ -431,21 +432,23 @@ void TRilevamento_prev_msk::riempi_sheet()
 | 
			
		||||
  {
 | 
			
		||||
    TRilevamento_ore rilore(def.cursor()->curr());    
 | 
			
		||||
    TToken_string& riga = sheet.row(-1);
 | 
			
		||||
    riga.add(rilore.tipora(), sheet.cid2index(S_RISOATT));
 | 
			
		||||
    switch(rilore.tipora())
 | 
			
		||||
		const char tipo = rilore.get(RILORE_TIPORA)[0];
 | 
			
		||||
		TString16 cod = rilore.get(RILORE_CODICE);
 | 
			
		||||
 | 
			
		||||
    riga.add(tipo, sheet.cid2index(S_RISOATT));
 | 
			
		||||
    switch(tipo)
 | 
			
		||||
    {
 | 
			
		||||
    case 'R': riga.add(rilore.codice(), sheet.cid2index(S_CODRIS)); break;
 | 
			
		||||
    case 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
 | 
			
		||||
    case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
 | 
			
		||||
    case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
 | 
			
		||||
    default : break;
 | 
			
		||||
    }
 | 
			
		||||
    riga.add(rilore.dadata(), sheet.cid2index(S_DADATA));
 | 
			
		||||
    riga.add(rilore.adata(), sheet.cid2index(S_ADATA));
 | 
			
		||||
    riga.add(rilore.tpora(), sheet.cid2index(S_TPORA));
 | 
			
		||||
		put_row_anal_fields(riga, rilore.codcosto(), rilore.codcms(), rilore.codfase());
 | 
			
		||||
    riga.add(rilore.dadata(), sheet.cid2index(S_DADATA));
 | 
			
		||||
    riga.add(rilore.adata(), sheet.cid2index(S_ADATA));
 | 
			
		||||
    riga.add(rilore.qtaore(), sheet.cid2index(S_QTAORE));
 | 
			
		||||
    riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
 | 
			
		||||
    riga.add(rilore.get(RILORE_DADATA), sheet.cid2index(S_DADATA));
 | 
			
		||||
    riga.add(rilore.get(RILORE_ADATA), sheet.cid2index(S_ADATA));
 | 
			
		||||
    riga.add(rilore.get(RILORE_TPORA), sheet.cid2index(S_TPORA));
 | 
			
		||||
		put_row_anal_fields(riga, rilore.get(RILORE_CODCOSTO), rilore.get(RILORE_CODCMS), rilore.get(RILORE_CODFASE));
 | 
			
		||||
    riga.add(rilore.get(RILORE_QTAORE), sheet.cid2index(S_QTAORE));
 | 
			
		||||
    riga.add(rilore.get(RILORE_COSTO), sheet.cid2index(S_COSTO));
 | 
			
		||||
    riga.add(rilore.get(RILORE_ID), sheet.cid2index(S_ID));
 | 
			
		||||
		sheet.check_row(sheet.items() - 1);
 | 
			
		||||
	}
 | 
			
		||||
  sheet.force_update();
 | 
			
		||||
@ -493,8 +496,8 @@ void TRilevamento_prev_msk::nuova_riga()
 | 
			
		||||
    msk.enable(S_CODRIS);
 | 
			
		||||
	if (tutti || tipo == "A") 
 | 
			
		||||
    msk.enable(S_CODATT);
 | 
			
		||||
  msk.enable(S_DADATA, dadata.empty());
 | 
			
		||||
  msk.enable(S_ADATA, adata.empty());
 | 
			
		||||
//  msk.enable(S_DADATA, dadata.empty());
 | 
			
		||||
//  msk.enable(S_ADATA, adata.empty());
 | 
			
		||||
  msk.enable(S_TPORA, tpora.empty());
 | 
			
		||||
	if (_scdc_sid >= 0)
 | 
			
		||||
		for ( short id = _scdc_sid; id <= _scdc_lid; id++)
 | 
			
		||||
@ -552,8 +555,9 @@ void TRilevamento_prev_msk::registra()
 | 
			
		||||
{
 | 
			
		||||
  TRilevamento_ore rilroa;
 | 
			
		||||
  TSheet_field& sheet = sfield(F_SHEET);
 | 
			
		||||
	int err = NOERR;
 | 
			
		||||
  
 | 
			
		||||
  FOR_EACH_SHEET_ROW(sheet, r, row)
 | 
			
		||||
	FOR_EACH_SHEET_ROW(sheet, r, row)
 | 
			
		||||
  {
 | 
			
		||||
    TToken_string&  riga = *(TToken_string*)row;
 | 
			
		||||
    const char      tipora = riga.get_char(sheet.cid2index(S_RISOATT));
 | 
			
		||||
@ -561,6 +565,7 @@ void TRilevamento_prev_msk::registra()
 | 
			
		||||
    const TDate&    dadata = riga.get(sheet.cid2index(S_DADATA));
 | 
			
		||||
    const TDate&    adata  = riga.get(sheet.cid2index(S_ADATA));
 | 
			
		||||
    const TString4  tpora = riga.get(sheet.cid2index(S_TPORA));
 | 
			
		||||
		const long id = riga.get_long(sheet.cid2index(S_ID));
 | 
			
		||||
    TString80 codcosto;
 | 
			
		||||
    TString80 codcms;
 | 
			
		||||
    TString80 codfase;
 | 
			
		||||
@ -569,21 +574,39 @@ void TRilevamento_prev_msk::registra()
 | 
			
		||||
    const real costo(tmp);
 | 
			
		||||
    
 | 
			
		||||
		get_row_anal_fields(riga, codcosto, codcms, codfase);
 | 
			
		||||
 | 
			
		||||
		rilroa.read('P', dadata.year(), dadata.month(), dadata.day(), tipora, codice, tpora, codcosto, codcms, codfase);
 | 
			
		||||
 | 
			
		||||
		rilroa.read('P', id);
 | 
			
		||||
		if(qtaore == 0)
 | 
			
		||||
      rilroa.remove();
 | 
			
		||||
      err = rilroa.remove();
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      rilroa.set_dadata(dadata);
 | 
			
		||||
      rilroa.set_adata(adata);
 | 
			
		||||
      rilroa.set_qtaore(qtaore);
 | 
			
		||||
      rilroa.set_costo(costo);
 | 
			
		||||
 | 
			
		||||
      int err = rilroa.rewrite_write();
 | 
			
		||||
    {
 | 
			
		||||
			rilroa.put(RILORE_TIPO, "P");
 | 
			
		||||
      rilroa.put(RILORE_ID,  id);
 | 
			
		||||
			rilroa.put(RILORE_ANNO,     dadata.year());
 | 
			
		||||
			rilroa.put(RILORE_MESE,     dadata.month());
 | 
			
		||||
			rilroa.put(RILORE_GIORNO,   dadata.day());
 | 
			
		||||
			rilroa.put(RILORE_TIPORA,   tipora);
 | 
			
		||||
			rilroa.put(RILORE_CODICE,   codice);
 | 
			
		||||
			rilroa.put(RILORE_TPORA,    tpora);
 | 
			
		||||
			rilroa.put(RILORE_CODCOSTO, codcosto);
 | 
			
		||||
			rilroa.put(RILORE_CODCMS,   codcms);
 | 
			
		||||
			rilroa.put(RILORE_CODFASE,  codfase);
 | 
			
		||||
			rilroa.put(RILORE_DADATA, dadata);
 | 
			
		||||
      rilroa.put(RILORE_ADATA, adata);
 | 
			
		||||
      rilroa.put(RILORE_QTAORE, qtaore);
 | 
			
		||||
      rilroa.put(RILORE_COSTO, costo);
 | 
			
		||||
      err = rilroa.rewrite_write();
 | 
			
		||||
    }
 | 
			
		||||
		if (err != NOERR)
 | 
			
		||||
			break;
 | 
			
		||||
  }
 | 
			
		||||
	if (err == NOERR)
 | 
			
		||||
	{
 | 
			
		||||
		sheet.destroy();
 | 
			
		||||
		riempi_sheet();
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		error_box(FR("Errore %d in scrittura"), err);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
 | 
			
		||||
 | 
			
		||||
@ -38,3 +38,4 @@
 | 
			
		||||
#define S_CDC12				117
 | 
			
		||||
#define S_QTAORE      118
 | 
			
		||||
#define S_COSTO       119
 | 
			
		||||
#define S_ID          121
 | 
			
		||||
@ -138,14 +138,15 @@ BEGIN
 | 
			
		||||
  ITEM "Qta\nOre@5"
 | 
			
		||||
  ITEM "Costo@10"
 | 
			
		||||
  ITEM "Descrizione@50"
 | 
			
		||||
  ITEM "ID@8"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
ENDMASK
 | 
			
		||||
 | 
			
		||||
PAGE "Riga preventivo" -1 -1 78 13
 | 
			
		||||
PAGE "Riga preventivo" -1 -1 78 14
 | 
			
		||||
 | 
			
		||||
GROUPBOX DLG_NULL 76 12
 | 
			
		||||
GROUPBOX DLG_NULL 76 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 1 "@bRisorsa - Attrezzatura"
 | 
			
		||||
END
 | 
			
		||||
@ -308,6 +309,12 @@ BEGIN
 | 
			
		||||
  PROMPT 30 11 "Prezzo "
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER S_ID 8
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 12 "ID           "
 | 
			
		||||
  FLAGS "D"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
TOOLBAR "" 0 0 0 2
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										293
									
								
								ci/ci2200.cpp
									
									
									
									
									
								
							
							
						
						
									
										293
									
								
								ci/ci2200.cpp
									
									
									
									
									
								
							@ -31,7 +31,14 @@ class TRilevamento_cons_msk : public TAutomask
 | 
			
		||||
	short _sfase_sid, _sfase_lid;
 | 
			
		||||
  char  _edit_mode;
 | 
			
		||||
  TDate _datasel;
 | 
			
		||||
	TString _dett;
 | 
			
		||||
	int _anno;
 | 
			
		||||
	int _mese;
 | 
			
		||||
	int _giorno;
 | 
			
		||||
	int _first_ex;
 | 
			
		||||
	int _n_ex;
 | 
			
		||||
	int _es_array[32];
 | 
			
		||||
	TEsercizi_contabili _es;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  const real proponi_costo(TToken_string& riga);
 | 
			
		||||
@ -39,13 +46,13 @@ protected:
 | 
			
		||||
	void get_row_anal_fields(TToken_string & row, TString & cdc, TString & cms, TString & fase);
 | 
			
		||||
	void put_row_anal_fields(TToken_string & row, const TString & cdc, const TString & cms, const TString & fase);
 | 
			
		||||
  void carica_default();
 | 
			
		||||
	void update_day();
 | 
			
		||||
  void riempi_sheet();
 | 
			
		||||
  void riempi_calendario(const TString & query, const int anno, const int mese);
 | 
			
		||||
  void riempi_risoatt(int giorno);
 | 
			
		||||
  void riempi_calendario(const TString & query);
 | 
			
		||||
  void riempi_risoatt();
 | 
			
		||||
  void azzera_tutto();
 | 
			
		||||
  void registra();
 | 
			
		||||
 | 
			
		||||
  virtual void notify_focus_field(short id);
 | 
			
		||||
  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
			
		||||
  
 | 
			
		||||
public:
 | 
			
		||||
@ -65,18 +72,17 @@ const real TRilevamento_cons_msk::proponi_costo(TToken_string& riga)
 | 
			
		||||
  default : break;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  const int anno = get_int(F_ANNO);
 | 
			
		||||
  const TString4 mese = get(F_MESE);
 | 
			
		||||
  const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
 | 
			
		||||
	const TDate dal(1, _mese, _anno);
 | 
			
		||||
	const TString4 tpora = riga.get(sheet.cid2index(S_TPORA));
 | 
			
		||||
 | 
			
		||||
  const TRisoatt_key chiave(tipo, codice, anno, mese, tpora);
 | 
			
		||||
  const TRisoatt_key chiave(tipo, codice, dal, tpora);
 | 
			
		||||
	const TRectype & roa = cache().get("&ROA", chiave);
 | 
			
		||||
 | 
			
		||||
  if(!roa.empty())
 | 
			
		||||
    costo = roa.get_real("R1");
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    TString8 tmp; tmp << anno << mese;
 | 
			
		||||
    TString8 tmp; tmp << _anno << _mese;
 | 
			
		||||
    const long anme = atol(tmp);
 | 
			
		||||
    TString query;
 | 
			
		||||
    query << "USE &ROA\n"
 | 
			
		||||
@ -193,9 +199,7 @@ void TRilevamento_cons_msk::put_row_anal_fields(TToken_string & row, const TStri
 | 
			
		||||
void TRilevamento_cons_msk::carica_default()
 | 
			
		||||
{
 | 
			
		||||
  //leggo dalla maschera i campi chiave di ricerca
 | 
			
		||||
  const int       anno     = get_int(F_ANNO);
 | 
			
		||||
  const TString4  risoatt  = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
 | 
			
		||||
  const int       mese     = get_int(F_MESE);
 | 
			
		||||
  const TString4  tpora    = get(F_TPORA);
 | 
			
		||||
  TString80 codcosto;
 | 
			
		||||
  TString80 codcms;
 | 
			
		||||
@ -212,7 +216,7 @@ void TRilevamento_cons_msk::carica_default()
 | 
			
		||||
  }
 | 
			
		||||
	get_anal_fields(codcosto, codcms, codfase);
 | 
			
		||||
 | 
			
		||||
	query << "USE " << LF_RILORE  << "\n" ;
 | 
			
		||||
	query << "USE " << LF_RILORE  << " KEY 2\n" ;
 | 
			
		||||
	if (risoatt.full())
 | 
			
		||||
		select << "(" << RILORE_TIPORA << "==\""  << risoatt << "\")";
 | 
			
		||||
	if (codice.full())
 | 
			
		||||
@ -245,61 +249,104 @@ void TRilevamento_cons_msk::carica_default()
 | 
			
		||||
 | 
			
		||||
	TString fromto = RILORE_TIPO "=\"D\" ";
 | 
			
		||||
 | 
			
		||||
	if (anno > 0)
 | 
			
		||||
	if (_anno > 0)
 | 
			
		||||
	{
 | 
			
		||||
		fromto << "  " << RILORE_ANNO << "=" << anno << " ";
 | 
			
		||||
		if (mese > 0)
 | 
			
		||||
			fromto << RILORE_MESE << "=" << mese << " ";
 | 
			
		||||
		fromto << "  " << RILORE_ANNO << "=" << _anno << " ";
 | 
			
		||||
		if (_mese > 0)
 | 
			
		||||
			fromto << RILORE_MESE << "=" << _mese << " ";
 | 
			
		||||
	}
 | 
			
		||||
  riempi_calendario(query, anno, mese);
 | 
			
		||||
  riempi_calendario(query);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//RIEMPI_CALENDARIO: coloro le celle dello sheet calendario secondo le festività e i giorni occupati
 | 
			
		||||
void TRilevamento_cons_msk::riempi_calendario(const TString & query, const int anno, const int mese)
 | 
			
		||||
void TRilevamento_cons_msk::riempi_calendario(const TString & query)
 | 
			
		||||
{
 | 
			
		||||
  TSheet_field& calendario = sfield(F_CALENDARIO);
 | 
			
		||||
 | 
			
		||||
	calendario.destroy();
 | 
			
		||||
  sfield(F_SHEET).destroy();
 | 
			
		||||
 | 
			
		||||
	TToken_string & row = calendario.row(-1);
 | 
			
		||||
	TDate d(1, mese, anno); d.set_end_month();
 | 
			
		||||
	const int end_month = d.day();
 | 
			
		||||
  const short last_id = DAY2ID(end_month);
 | 
			
		||||
	TBit_array fulldays;
 | 
			
		||||
	TISAM_recordset recset(query);
 | 
			
		||||
  
 | 
			
		||||
  //abilito per default tutte le colonne del calendario
 | 
			
		||||
  for(short id = C_1; id <= C_31; id++)
 | 
			
		||||
		calendario.enable_column(calendario.cid2index(id), id <= last_id ? true : false);
 | 
			
		||||
 | 
			
		||||
	//scorro il recordset, aggiungo una riga allo sheet per ogni chiave analitica che trovo e coloro di blu
 | 
			
		||||
  //tutte le celle che corrispondono a una data interessata da qualcosa
 | 
			
		||||
  for (bool ok = recset.move_first(); ok; ok = recset.move_next())
 | 
			
		||||
	if (_dett == "A")
 | 
			
		||||
	{
 | 
			
		||||
		const int day = recset.get(RILORE_GIORNO).as_int();
 | 
			
		||||
		TBit_array full_years;
 | 
			
		||||
		TISAM_recordset recset(query);
 | 
			
		||||
	  
 | 
			
		||||
		fulldays.set(day);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
  for(short id = C_1; id <= last_id; id++)
 | 
			
		||||
	{
 | 
			
		||||
		const int column = calendario.cid2index(id);
 | 
			
		||||
 | 
			
		||||
		if (fulldays[ID2DAY(id)])
 | 
			
		||||
		for (bool ok = recset.move_first(); ok; ok = recset.move_next())
 | 
			
		||||
		{
 | 
			
		||||
	    if (_edit_mode)
 | 
			
		||||
				calendario.set_back_and_fore_color(COLOR_DKBLUE, COLOR_DKBLUE, 0, column); // coloro di blu le date con registrazioni
 | 
			
		||||
			const int anno = recset.get(RILORE_ANNO).as_int();
 | 
			
		||||
			
 | 
			
		||||
			full_years.set(anno);
 | 
			
		||||
		}
 | 
			
		||||
		for (int i = 0; i < _n_ex; i++)
 | 
			
		||||
		{
 | 
			
		||||
			TToken_string & row = calendario.row(i);
 | 
			
		||||
 | 
			
		||||
			if (full_years[_es_array[i]])
 | 
			
		||||
			{
 | 
			
		||||
				if (_edit_mode)
 | 
			
		||||
					calendario.set_back_and_fore_color(COLOR_DKBLUE, COLOR_DKBLUE, i, 0); // coloro di blu le date con registrazioni
 | 
			
		||||
			}
 | 
			
		||||
			row.add(_es_array[i]);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		if (_dett == "M")
 | 
			
		||||
		{
 | 
			
		||||
			TBit_array full_months;
 | 
			
		||||
			TISAM_recordset recset(query);
 | 
			
		||||
		  
 | 
			
		||||
			for (bool ok = recset.move_first(); ok; ok = recset.move_next())
 | 
			
		||||
			{
 | 
			
		||||
				const int mese = recset.get(RILORE_MESE).as_int();
 | 
			
		||||
				
 | 
			
		||||
				full_months.set(mese);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			for (int i = 0; i < 12; i++)
 | 
			
		||||
			{
 | 
			
		||||
				TToken_string & row = calendario.row(i);
 | 
			
		||||
 | 
			
		||||
				if (full_months[i])
 | 
			
		||||
				{
 | 
			
		||||
					if (_edit_mode)
 | 
			
		||||
						calendario.set_back_and_fore_color(COLOR_DKBLUE, COLOR_DKBLUE, i, 0); // coloro di blu le date con registrazioni
 | 
			
		||||
				}
 | 
			
		||||
				row.add(itom(i + 1));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			if (TDate(ID2DAY(id), mese, anno).is_holiday())
 | 
			
		||||
				calendario.set_back_and_fore_color(COLOR_DKRED, COLOR_DKRED, 0, column); // coloro di rosso le festività
 | 
			
		||||
		row.add(' ', column);
 | 
			
		||||
  }
 | 
			
		||||
			if (_dett == "G")
 | 
			
		||||
			{
 | 
			
		||||
				TDate d(1, _mese, _anno); d.set_end_month();
 | 
			
		||||
				const int end_month = d.day();
 | 
			
		||||
				TBit_array fulldays;
 | 
			
		||||
				TISAM_recordset recset(query);
 | 
			
		||||
			  
 | 
			
		||||
				//scorro il recordset, aggiungo una riga allo sheet per ogni chiave analitica che trovo e coloro di blu
 | 
			
		||||
				//tutte le celle che corrispondono a una data interessata da qualcosa
 | 
			
		||||
				for (bool ok = recset.move_first(); ok; ok = recset.move_next())
 | 
			
		||||
				{
 | 
			
		||||
					const int day = recset.get(RILORE_GIORNO).as_int();
 | 
			
		||||
					
 | 
			
		||||
					fulldays.set(day);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				for(int i = 0; i < end_month; i++)
 | 
			
		||||
				{
 | 
			
		||||
					TToken_string & row = calendario.row(i);
 | 
			
		||||
	
 | 
			
		||||
					if (fulldays[i])
 | 
			
		||||
					{
 | 
			
		||||
						if (_edit_mode)
 | 
			
		||||
							calendario.set_back_and_fore_color(COLOR_DKBLUE, COLOR_DKBLUE, i, 0); // coloro di blu le date con registrazioni
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
						if (TDate(i, _mese, _anno).is_holiday())
 | 
			
		||||
							calendario.set_back_and_fore_color(COLOR_DKRED, COLOR_DKRED, i, 0); // coloro di rosso le festività
 | 
			
		||||
					row.add(i + 1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
	calendario.force_update();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRilevamento_cons_msk::riempi_risoatt(int giorno)
 | 
			
		||||
void TRilevamento_cons_msk::riempi_risoatt()
 | 
			
		||||
{
 | 
			
		||||
  TSheet_field& sheet = sfield(F_SHEET);
 | 
			
		||||
 | 
			
		||||
@ -308,9 +355,7 @@ void TRilevamento_cons_msk::riempi_risoatt(int giorno)
 | 
			
		||||
  sheet.destroy();
 | 
			
		||||
 | 
			
		||||
  //leggo dalla maschera i campi chiave di ricerca
 | 
			
		||||
  const int       anno     = get_int(F_ANNO);
 | 
			
		||||
  const TString4  risoatt  = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
 | 
			
		||||
  const int  mese					 = get_int(F_MESE);
 | 
			
		||||
  const TString4  tpora    = get(F_TPORA);
 | 
			
		||||
  TString80 codcosto;
 | 
			
		||||
  TString80 codcms;
 | 
			
		||||
@ -328,7 +373,7 @@ void TRilevamento_cons_msk::riempi_risoatt(int giorno)
 | 
			
		||||
	get_anal_fields(codcosto, codcms, codfase);
 | 
			
		||||
  //preparo la query
 | 
			
		||||
  
 | 
			
		||||
	query << "USE " << LF_RILORE  << "\n" ;
 | 
			
		||||
	query << "USE " << LF_RILORE  << " KEY 2\n" ;
 | 
			
		||||
	if (risoatt.full())
 | 
			
		||||
		select << "(" << RILORE_TIPORA << "==\""  << risoatt << "\")";
 | 
			
		||||
	if (codice.full())
 | 
			
		||||
@ -365,14 +410,14 @@ void TRilevamento_cons_msk::riempi_risoatt(int giorno)
 | 
			
		||||
		fromto << "=\"C\"";
 | 
			
		||||
	else
 | 
			
		||||
		fromto << "=\"D\"";
 | 
			
		||||
  if (anno > 0)
 | 
			
		||||
  if (_anno > 0)
 | 
			
		||||
  {
 | 
			
		||||
    fromto << "  " << RILORE_ANNO << "=" << anno << " ";
 | 
			
		||||
    if (mese > 0)
 | 
			
		||||
    fromto << "  " << RILORE_ANNO << "=" << _anno << " ";
 | 
			
		||||
    if (_mese > 0)
 | 
			
		||||
    {
 | 
			
		||||
      fromto << RILORE_MESE << "=" << mese << " ";
 | 
			
		||||
			if (_edit_mode && giorno > 0)
 | 
			
		||||
        fromto << RILORE_GIORNO << "=" << giorno << " ";
 | 
			
		||||
      fromto << RILORE_MESE << "=" << _mese << " ";
 | 
			
		||||
			if (_edit_mode && _giorno > 0)
 | 
			
		||||
        fromto << RILORE_GIORNO << "=" << _giorno << " ";
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  query << "FROM " << fromto  << "\n"
 | 
			
		||||
@ -386,17 +431,22 @@ void TRilevamento_cons_msk::riempi_risoatt(int giorno)
 | 
			
		||||
    TRilevamento_ore rilore(def.cursor()->curr());    
 | 
			
		||||
    
 | 
			
		||||
    TToken_string& riga = sheet.row(-1);
 | 
			
		||||
    riga.add(rilore.tipora(), sheet.cid2index(S_RISOATT));
 | 
			
		||||
    switch(rilore.tipora())
 | 
			
		||||
		const char tipo = rilore.get(RILORE_TIPORA)[0];
 | 
			
		||||
		TString16 cod = rilore.get(RILORE_CODICE);
 | 
			
		||||
 | 
			
		||||
		riga.add(tipo, sheet.cid2index(S_RISOATT));
 | 
			
		||||
    switch(tipo)
 | 
			
		||||
    {
 | 
			
		||||
    case 'R': riga.add(rilore.codice(), sheet.cid2index(S_CODRIS)); break;
 | 
			
		||||
    case 'A': riga.add(rilore.codice(), sheet.cid2index(S_CODATT)); break;
 | 
			
		||||
    case 'R': riga.add(cod, sheet.cid2index(S_CODRIS)); break;
 | 
			
		||||
    case 'A': riga.add(cod, sheet.cid2index(S_CODATT)); break;
 | 
			
		||||
    default : break;
 | 
			
		||||
    }
 | 
			
		||||
		put_row_anal_fields(riga, rilore.codcosto(), rilore.codcms(), rilore.codfase());
 | 
			
		||||
    riga.add(rilore.tpora(),          sheet.cid2index(S_TPORA));  
 | 
			
		||||
    riga.add(rilore.qtaore(),         sheet.cid2index(S_QTAORE));
 | 
			
		||||
    riga.add(rilore.costo().string(), sheet.cid2index(S_COSTO));
 | 
			
		||||
		riga.add(rilore.get(RILORE_TPORA), sheet.cid2index(S_TPORA));
 | 
			
		||||
		put_row_anal_fields(riga, rilore.get(RILORE_CODCOSTO), rilore.get(RILORE_CODCMS), rilore.get(RILORE_CODFASE));
 | 
			
		||||
    riga.add(rilore.get(RILORE_QTAORE), sheet.cid2index(S_QTAORE));
 | 
			
		||||
    riga.add(rilore.get(RILORE_COSTO), sheet.cid2index(S_COSTO));
 | 
			
		||||
    riga.add(rilore.get(RILORE_ID), sheet.cid2index(S_ID));
 | 
			
		||||
 | 
			
		||||
		sheet.check_row(sheet.items() - 1);
 | 
			
		||||
  }
 | 
			
		||||
  sheet.force_update();
 | 
			
		||||
@ -407,9 +457,7 @@ void TRilevamento_cons_msk::riempi_risoatt(int giorno)
 | 
			
		||||
void TRilevamento_cons_msk::riempi_sheet()
 | 
			
		||||
{
 | 
			
		||||
  //leggo dalla maschera i campi chiave di ricerca
 | 
			
		||||
  const int       anno     = get_int(F_ANNO);
 | 
			
		||||
  const TString4  risoatt  = get(F_RISOATT) == "T" ? "" : get(F_RISOATT);
 | 
			
		||||
  const int       mese = get_int(F_MESE);
 | 
			
		||||
  const TString4  tpora    = get(F_TPORA);
 | 
			
		||||
  TString80 codcosto;
 | 
			
		||||
  TString80 codcms;
 | 
			
		||||
@ -428,7 +476,7 @@ void TRilevamento_cons_msk::riempi_sheet()
 | 
			
		||||
	get_anal_fields(codcosto, codcms, codfase);
 | 
			
		||||
 | 
			
		||||
  //preparo la query
 | 
			
		||||
	query << "USE " << LF_RILORE  << "\n" ;
 | 
			
		||||
	query << "USE " << LF_RILORE  << " KEY 2\n" ;
 | 
			
		||||
	if (risoatt.full())
 | 
			
		||||
		select << "(" << RILORE_TIPORA << "==\""  << risoatt << "\")";
 | 
			
		||||
	if (codice.full())
 | 
			
		||||
@ -461,15 +509,16 @@ void TRilevamento_cons_msk::riempi_sheet()
 | 
			
		||||
 | 
			
		||||
  TString fromto = RILORE_TIPO "=\"C\"";
 | 
			
		||||
 | 
			
		||||
	if (anno > 0)
 | 
			
		||||
	if (_anno > 0)
 | 
			
		||||
  {
 | 
			
		||||
    fromto << "  " << RILORE_ANNO << "=" << anno << " ";
 | 
			
		||||
    if (mese > 0)
 | 
			
		||||
      fromto << RILORE_MESE << "=" << mese << " ";
 | 
			
		||||
    fromto << "  " << RILORE_ANNO << "=" << _anno << " ";
 | 
			
		||||
    if (_mese > 0)
 | 
			
		||||
      fromto << RILORE_MESE << "=" << _mese << " ";
 | 
			
		||||
  }
 | 
			
		||||
  query << "FROM " << fromto  << "\n"
 | 
			
		||||
        << "TO "   << fromto;
 | 
			
		||||
  riempi_calendario(query, anno, mese);
 | 
			
		||||
  riempi_calendario(query);
 | 
			
		||||
	riempi_risoatt();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//AZZERA_TUTTO: metodo che azzera il valore unitario di tutte le righe visualizzate sullo sheet
 | 
			
		||||
@ -497,6 +546,7 @@ void TRilevamento_cons_msk::registra()
 | 
			
		||||
  TString80 codcosto;
 | 
			
		||||
  TString80 codcms;
 | 
			
		||||
  TString16 codfase;
 | 
			
		||||
	int err = NOERR;
 | 
			
		||||
 | 
			
		||||
	FOR_EACH_SHEET_ROW(sheet, r, row)
 | 
			
		||||
  {
 | 
			
		||||
@ -505,32 +555,66 @@ void TRilevamento_cons_msk::registra()
 | 
			
		||||
    const TString16 codice   = tipora == 'R' ? riga.get(sheet.cid2index(S_CODRIS)) : riga.get(sheet.cid2index(S_CODATT));
 | 
			
		||||
    const TString4  tpora    = riga.get(sheet.cid2index(S_TPORA));
 | 
			
		||||
    const int       qtaore   = riga.get_int(sheet.cid2index(S_QTAORE));
 | 
			
		||||
		const long id = riga.get_long(sheet.cid2index(S_ID));
 | 
			
		||||
    const real      costo(riga.get(sheet.cid2index(S_COSTO)));
 | 
			
		||||
    
 | 
			
		||||
		get_row_anal_fields(riga, codcosto, codcms, codfase);
 | 
			
		||||
    rilroa.read('C', anno, mese, _giorno, tipora, codice, tpora, codcosto, codcms, codfase);
 | 
			
		||||
    rilroa.read('C', id);
 | 
			
		||||
    if(qtaore == 0)
 | 
			
		||||
      rilroa.remove();
 | 
			
		||||
      err = rilroa.remove();
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      rilroa.set_qtaore(qtaore);
 | 
			
		||||
      rilroa.set_costo(costo);
 | 
			
		||||
 | 
			
		||||
      int err = rilroa.rewrite_write();
 | 
			
		||||
			rilroa.put(RILORE_TIPO, "C");
 | 
			
		||||
      rilroa.put(RILORE_ID,  id);
 | 
			
		||||
			rilroa.put(RILORE_ANNO,     anno);
 | 
			
		||||
			rilroa.put(RILORE_MESE,     mese);
 | 
			
		||||
			rilroa.put(RILORE_GIORNO,   _giorno);
 | 
			
		||||
			rilroa.put(RILORE_TIPORA,   tipora);
 | 
			
		||||
			rilroa.put(RILORE_CODICE,   codice);
 | 
			
		||||
			rilroa.put(RILORE_TPORA,    tpora);
 | 
			
		||||
			rilroa.put(RILORE_CODCOSTO, codcosto);
 | 
			
		||||
			rilroa.put(RILORE_CODCMS,   codcms);
 | 
			
		||||
			rilroa.put(RILORE_CODFASE,  codfase);
 | 
			
		||||
			rilroa.put(RILORE_QTAORE, qtaore);
 | 
			
		||||
      rilroa.put(RILORE_COSTO, costo);
 | 
			
		||||
      err = rilroa.rewrite_write();
 | 
			
		||||
    }
 | 
			
		||||
		if (err != NOERR)
 | 
			
		||||
			break;
 | 
			
		||||
  }
 | 
			
		||||
  riempi_sheet();
 | 
			
		||||
	riempi_risoatt(_giorno);
 | 
			
		||||
	if (err == NOERR)
 | 
			
		||||
	{
 | 
			
		||||
		sheet.destroy();
 | 
			
		||||
		riempi_sheet();
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		error_box(FR("Errore %d in scrittura"), err);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRilevamento_cons_msk::notify_focus_field(short id)
 | 
			
		||||
void TRilevamento_cons_msk::update_day()
 | 
			
		||||
{
 | 
			
		||||
  TMask::notify_focus_field(id);
 | 
			
		||||
  if(id == F_CALENDARIO)
 | 
			
		||||
  {
 | 
			
		||||
		_giorno = sfield(id).current_column();
 | 
			
		||||
    riempi_risoatt(_giorno);
 | 
			
		||||
  }
 | 
			
		||||
	const int row = sfield(F_CALENDARIO).selected();
 | 
			
		||||
 | 
			
		||||
	if (_dett == "G")
 | 
			
		||||
	{
 | 
			
		||||
		_anno = get_int(F_ANNO);
 | 
			
		||||
		_mese	= get_int(F_MESE);
 | 
			
		||||
		_giorno = row +1;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		if (_dett == "M")
 | 
			
		||||
		{
 | 
			
		||||
			_anno = get_int(F_ANNO);
 | 
			
		||||
			_mese	= row + 1;
 | 
			
		||||
			_giorno = 1;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			if (_dett == "A")
 | 
			
		||||
			{
 | 
			
		||||
				_anno = _es_array[row];
 | 
			
		||||
				_mese	= 1;
 | 
			
		||||
				_giorno = 1;
 | 
			
		||||
			}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui vari campi della maschera
 | 
			
		||||
@ -567,7 +651,17 @@ bool TRilevamento_cons_msk::on_field_event(TOperable_field& f, TField_event e, l
 | 
			
		||||
  case F_CODATT:
 | 
			
		||||
  case F_TPORA:
 | 
			
		||||
    if (e == fe_modify)
 | 
			
		||||
		{
 | 
			
		||||
			update_day();
 | 
			
		||||
      riempi_sheet();
 | 
			
		||||
		}
 | 
			
		||||
    break;
 | 
			
		||||
  case F_CALENDARIO:
 | 
			
		||||
    if (e == se_enter)
 | 
			
		||||
		{
 | 
			
		||||
			update_day();
 | 
			
		||||
      riempi_risoatt();
 | 
			
		||||
		}
 | 
			
		||||
    break;
 | 
			
		||||
  case S_RISOATT:  
 | 
			
		||||
  case S_CODRIS:
 | 
			
		||||
@ -714,6 +808,25 @@ TRilevamento_cons_msk::TRilevamento_cons_msk()
 | 
			
		||||
      s.delete_column(id);
 | 
			
		||||
  }
 | 
			
		||||
  _qtaore = 0;
 | 
			
		||||
	_dett = ini_get_string(CONFIG_DITTA, "ci", "DETTCONS");
 | 
			
		||||
	TSheet_field & sc = sfield(F_CALENDARIO);
 | 
			
		||||
 | 
			
		||||
	_n_ex = 0;
 | 
			
		||||
	for (int codes = _es.first(); codes != 0; codes = _es.next(codes))
 | 
			
		||||
		_es_array[_n_ex++] = codes;
 | 
			
		||||
	if (_dett == "A")
 | 
			
		||||
	{
 | 
			
		||||
		reset(F_ANNO);
 | 
			
		||||
		disable(F_ANNO);
 | 
			
		||||
		reset(F_MESE);
 | 
			
		||||
		disable(F_MESE);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		if (_dett == "M")
 | 
			
		||||
		{
 | 
			
		||||
			reset(F_MESE);
 | 
			
		||||
			disable(F_MESE);
 | 
			
		||||
		}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
                                      ////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										36
									
								
								ci/ci2200a.h
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								ci/ci2200a.h
									
									
									
									
									
								
							@ -19,40 +19,7 @@
 | 
			
		||||
#define DLG_CERCA     901
 | 
			
		||||
#define DLG_DEFAULT   902
 | 
			
		||||
 | 
			
		||||
#define C_0						100
 | 
			
		||||
#define C_1						101
 | 
			
		||||
#define C_2						102
 | 
			
		||||
#define C_3						103
 | 
			
		||||
#define C_4						104
 | 
			
		||||
#define C_5						105
 | 
			
		||||
#define C_6						106
 | 
			
		||||
#define C_7						107
 | 
			
		||||
#define C_8						108
 | 
			
		||||
#define C_9						109
 | 
			
		||||
#define C_10					110
 | 
			
		||||
#define C_11					111
 | 
			
		||||
#define C_12					112
 | 
			
		||||
#define C_13					113
 | 
			
		||||
#define C_14					114
 | 
			
		||||
#define C_15					115
 | 
			
		||||
#define C_16					116
 | 
			
		||||
#define C_17					117
 | 
			
		||||
#define C_18					118
 | 
			
		||||
#define C_19					119
 | 
			
		||||
#define C_20					120
 | 
			
		||||
#define C_21					121
 | 
			
		||||
#define C_22					122
 | 
			
		||||
#define C_23					123
 | 
			
		||||
#define C_24					124
 | 
			
		||||
#define C_25					125
 | 
			
		||||
#define C_26					126
 | 
			
		||||
#define C_27					127
 | 
			
		||||
#define C_28					128
 | 
			
		||||
#define C_29					129
 | 
			
		||||
#define C_30					130
 | 
			
		||||
#define C_31					131
 | 
			
		||||
#define ID2DAY(ID)		(ID - C_0)
 | 
			
		||||
#define DAY2ID(DAY)		(C_0 + DAY)
 | 
			
		||||
#define F_CONT				101
 | 
			
		||||
 | 
			
		||||
#define S_RISOATT     101
 | 
			
		||||
#define S_CODRIS      102
 | 
			
		||||
@ -75,3 +42,4 @@
 | 
			
		||||
#define S_QTAORE      116
 | 
			
		||||
#define S_COSTO       117
 | 
			
		||||
#define S_OREDIS      118
 | 
			
		||||
#define S_ID					120
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										203
									
								
								ci/ci2200a.uml
									
									
									
									
									
								
							
							
						
						
									
										203
									
								
								ci/ci2200a.uml
									
									
									
									
									
								
							@ -40,13 +40,13 @@ END
 | 
			
		||||
NUMBER F_ANNO 4
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 1 "Anno "
 | 
			
		||||
  FLAGS "A"
 | 
			
		||||
  CHECKTYPE REQUIRED
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
LISTBOX F_MESE 10
 | 
			
		||||
BEGIN 
 | 
			
		||||
  PROMPT 24 1 "Mese   "
 | 
			
		||||
  ITEM "|"
 | 
			
		||||
  FLAGS "M"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
@ -112,45 +112,15 @@ BEGIN
 | 
			
		||||
  GROUP 3
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
SPREADSHEET F_CALENDARIO -16 2
 | 
			
		||||
SPREADSHEET F_CALENDARIO 10 0
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 7 ""
 | 
			
		||||
  ITEM "1@2"
 | 
			
		||||
  ITEM "2@2"
 | 
			
		||||
  ITEM "3@2"
 | 
			
		||||
  ITEM "4@2"
 | 
			
		||||
  ITEM "5@2"
 | 
			
		||||
  ITEM "6@2"
 | 
			
		||||
  ITEM "7@2"
 | 
			
		||||
  ITEM "8@2"
 | 
			
		||||
  ITEM "9@2"
 | 
			
		||||
  ITEM "10"
 | 
			
		||||
  ITEM "11"
 | 
			
		||||
  ITEM "12"
 | 
			
		||||
  ITEM "13"
 | 
			
		||||
  ITEM "14"
 | 
			
		||||
  ITEM "15"
 | 
			
		||||
  ITEM "16"
 | 
			
		||||
  ITEM "17"
 | 
			
		||||
  ITEM "18"
 | 
			
		||||
  ITEM "19"
 | 
			
		||||
  ITEM "20"
 | 
			
		||||
  ITEM "21"
 | 
			
		||||
  ITEM "22"
 | 
			
		||||
  ITEM "23"
 | 
			
		||||
  ITEM "24"
 | 
			
		||||
  ITEM "25"
 | 
			
		||||
  ITEM "26"
 | 
			
		||||
  ITEM "27"
 | 
			
		||||
  ITEM "28"
 | 
			
		||||
  ITEM "29"
 | 
			
		||||
  ITEM "30"
 | 
			
		||||
  ITEM "31"
 | 
			
		||||
  ITEM "@4"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
SPREADSHEET F_SHEET -15 0
 | 
			
		||||
SPREADSHEET F_SHEET 65 0
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 10 ""
 | 
			
		||||
  PROMPT 15 7 ""
 | 
			
		||||
  ITEM "Tipo"
 | 
			
		||||
  ITEM "Codice@16"
 | 
			
		||||
  ITEM "Tipo\nOra@5"
 | 
			
		||||
@ -170,166 +140,17 @@ BEGIN
 | 
			
		||||
  ITEM "Costo@6"
 | 
			
		||||
  ITEM "Ore\ndisponibilità"
 | 
			
		||||
  ITEM "Descrizione@50"
 | 
			
		||||
  ITEM "ID@8"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
ENDMASK
 | 
			
		||||
 | 
			
		||||
PAGE "Calendario" -1 -1 78 13
 | 
			
		||||
PAGE "Calendario" -1 -1 78 6
 | 
			
		||||
 | 
			
		||||
STRING C_1 1
 | 
			
		||||
STRING F_CONT 20
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 4 " 1"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_2 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 6 4 " 2"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_3 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 10 4 " 3"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_4 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 14 4 " 4"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_5 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 18 4 " 5"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_6 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 22 4 " 6"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_7 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 26 4 " 7"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_8 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 30 4 " 8"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_9 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 34 4 " 9"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_10 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 38 4 "10"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_11 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 42 4 "11"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_12 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 46 4 "12"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_13 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 50 4 "13"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_14 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 54 4 "14"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_15 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 58 4 "15"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_16 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 62 4 "16"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_17 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 66 4 "17"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_18 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 70 4 "18"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_19 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 5 "19"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_20 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 6 5 "20"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_21 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 10 5 "21"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_22 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 14 5 "22"  
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_23 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 18 5 "23"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_24 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 22 5 "24"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_25 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 26 5 "25"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_26 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 30 5 "26"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_27 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 34 5 "27"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_28 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 38 5 "28"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_29 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 42 5 "29"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_30 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 46 5 "30"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING C_31 1
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 50 5 "31"
 | 
			
		||||
  PROMPT 2 2 "  "
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
@ -503,6 +324,12 @@ BEGIN
 | 
			
		||||
  PROMPT 50 11 "Quantità ore "
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
NUMBER S_ID 8
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 12 "ID           "
 | 
			
		||||
  FLAGS "D"
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
TOOLBAR "" 0 0 0 2
 | 
			
		||||
 | 
			
		||||
@ -766,10 +766,14 @@ void TRilevamento_ore::update_id()
 | 
			
		||||
		const TString4 tipo = get(RILORE_TIPO);
 | 
			
		||||
 | 
			
		||||
		rilore.put(RILORE_TIPO, tipo);
 | 
			
		||||
		rilore.put(RILORE_ID, 999999999L);
 | 
			
		||||
		rilore.put(RILORE_ID, 99999999L);
 | 
			
		||||
 | 
			
		||||
		if (rilore.read() != _isemptyfile && rilore.get(RILORE_TIPO) == tipo)
 | 
			
		||||
		if (rilore.read() != _isemptyfile)
 | 
			
		||||
		{
 | 
			
		||||
			if (rilore.get(RILORE_TIPO) != tipo)
 | 
			
		||||
				rilore.prev();
 | 
			
		||||
			id = rilore.get_long(RILORE_ID);
 | 
			
		||||
		}
 | 
			
		||||
		put(RILORE_ID, ++id);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user