Exemplo n.º 1
0
/*
   The S flag is set only within the EAP-TLS start message
   sent from the EAP server to the peer.
*/
int eaptls_start(EAP_DS *eap_ds, int peap_flag)
{
	EAPTLS_PACKET 	reply;

	reply.code = FR_TLS_START;
	reply.length = TLS_HEADER_LEN + 1/*flags*/;

	reply.flags = peap_flag;
	reply.flags = SET_START(reply.flags);

	reply.data = NULL;
	reply.dlen = 0;

	eaptls_compose(eap_ds, &reply);

	return 1;
}
Exemplo n.º 2
0
void CMainDlg::DatiCertificato()
{
	CString str;
	int index = 0;
	int no = 0, nm = 0, OpPredef = 0, MaPredef=0;
	for( SET_START(m_pOperatoriSet); !m_pOperatoriSet->IsEOF(); m_pOperatoriSet->MoveNext() )
			{
			if( !m_pOperatoriSet->IsFieldNull(&m_pOperatoriSet->m_Sperimentatore) 
					&& m_pOperatoriSet->m_Sperimentatore ) 
				{
				str = m_pOperatoriSet->m_Titolo + " " + m_pOperatoriSet->m_Nome + " " + m_pOperatoriSet->m_Cognome;
				no = m_ComboSperimentatori.AddString(str);
				m_ComboSperimentatori.SetItemData(no, m_pOperatoriSet->m_Codice);
				nm = m_ComboMacchine.AddString(m_pOperatoriSet->m_Macchina);
				if(m_pOperatoriSet->m_Codice == *m_pUltimoSper)
					{
					OpPredef = no;
					MaPredef = nm;
					}
				}
			}

	if( !m_pSerieSet->IsFieldNull(&m_pSerieSet->m_Osservazioni) )
		{
		m_strOsservazioni = m_pSerieSet->m_Osservazioni;
		UpdateData(FALSE); //scrivo nel dialogo
		}
	if( !m_pSerieSet->IsFieldNull(&m_pSerieSet->m_Sperimentatore) )
		{
		index =	m_ComboMacchine.FindString(0,m_pSerieSet->m_Macchina);
		if(index==-1)	index = 0;
		m_ComboMacchine.SetCurSel(index);
		index =	m_ComboSperimentatori.FindString(0,m_pSerieSet->m_Sperimentatore);
		if(index==-1)	index = 0;
		m_ComboSperimentatori.SetCurSel(index);
		UpdateData(TRUE); //leggo dal dialogo
		}
	else
		{
		m_ComboMacchine.SetCurSel(MaPredef);
		m_ComboSperimentatori.SetCurSel(OpPredef);
		UpdateData(TRUE); //leggo dal dialogo
		}
}
Exemplo n.º 3
0
/*
 * This function is called when the first EAP_IDENTITY_RESPONSE message
 * was received.
 *
 * Initiates the EPA_TNC session by sending the first EAP_TNC_RESPONSE
 * to the peer. The packet has the Start-Bit set and contains no data.
 *
 *  0		   1		   2		   3
 *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |      Code     |   Identifier  |	    Length	     |
 * |	       |	       |			       |
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |      Type     |  Flags  | Ver |
 * |	       |0 0 1 0 0|0 0 1|
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 *
 * For this package, only 'Identifier' has to be set dynamically. Any
 * other information is static.
 */
static int tnc_initiate(void *instance, eap_handler_t *handler)
{
	rlm_eap_tnc_t *inst = instance;
	REQUEST *request = NULL;

	char buff[71];
	ssize_t len = 0;

	TNC_Result result;
	TNC_ConnectionID conn_id;

	TNC_BufferReference eap_tnc_request;
	TNC_BufferReference eap_tnc_user;

	VALUE_PAIR *username;

	/*
	 *	Check if we run inside a secure EAP method.
	 *	FIXME check concrete outer EAP method.
	 */
	if (!handler->request || !handler->request->parent) {
		ERROR("rlm_eap_tnc: EAP_TNC must only be used as an "
		      "inner method within a protected tunneled EAP created "
		      "by an outer EAP method");

		return 0;
	}

	request = handler->request->parent;

	/*
	 *	Build the connection string
	 */
	len = radius_xlat(buff, sizeof(buff), request, inst->connection_string, NULL, NULL);
	if (len < 0){
		return 0;
	}

	RDEBUG("Getting connection from NAA-EAP");

	/*
	 *	Get connection (uses a function from the NAA-EAP-library)
	 */
	result = getConnection(buff, &conn_id);
	if (result != TNC_RESULT_SUCCESS) {
		ERROR("rlm_eap_tnc: NAA-EAP getConnection returned an "
		      "error code");

		return 0;
	}

	/*
	 *	Previous code manually parsed the EAP identity response
	 *	this was wrong. rlm_eap will *always* create the Username
	 *	from the EAP Identity response.
	 *
	 *	Something has gone very wrong if the User-Name doesn't exist.
	 */
	username = pairfind(request->packet->vps, PW_USER_NAME, 0, TAG_ANY);

	RDEBUG("Username for TNC connection: %s", username->vp_strvalue);

	/*
	 *	Stores the username associated with the connection
	 *
	 *	What becomes of username? Who knows... but we don't free it
	 *	so not safe to use talloc.
	 */
	MEM(eap_tnc_user = (TNC_BufferReference) strdup(username->vp_strvalue));

	result = storeUsername(conn_id, eap_tnc_user, username->length);
	if (result != TNC_RESULT_SUCCESS) {
		ERROR("rlm_eap_tnc: NAA-EAP storeUsername returned an "
		      "error code");

		return 0;
	}

	/*
	 *	Set connection ID
	 */
	handler->opaque = talloc(handler, TNC_ConnectionID);
	memcpy(handler->opaque, &conn_id, sizeof(TNC_ConnectionID));
	handler->free_opaque = tnc_free;

	/*
	 *	Bild first EAP TNC request
	 */

	MEM(eap_tnc_request = talloc_array(handler->eap_ds->request, uint8_t, 1));
	*eap_tnc_request = SET_START(1);

	handler->eap_ds->request->code = PW_EAP_REQUEST;
	handler->eap_ds->request->type.num = PW_EAP_TNC;

	handler->eap_ds->request->type.length = 1;

	talloc_free(handler->eap_ds->request->type.data);
	handler->eap_ds->request->type.data = eap_tnc_request;

	/*
	 *	We don't need to authorize the user at this point.
	 *
	 *	We also don't need to keep the challenge, as it's
	 *	stored in 'handler->eap_ds', which will be given back
	 *	to us...
	 */
	handler->stage = AUTHENTICATE;

	return 1;
}
Exemplo n.º 4
0
__declspec( dllexport ) int OpenDlg(long codSerie, CAllTables* tabelle, long* ultimoSperimentatore, CTime* pUltimaDataProva)
{
	CSerieSet* pSerieSet = tabelle->m_pSerieSet;
	pSerieSet->m_strFilter.Format("Codice = %d", codSerie);
	SAFETY_OPEN(pSerieSet);
	CVerbaliSet* pVerbaliSet = tabelle->m_pVerbaliSet;
	pVerbaliSet->m_strFilter.Format("Codice = %d", pSerieSet->m_Verbale);
	SAFETY_OPEN(pVerbaliSet);

	//------------------ Sistemo il servizio aggiuntivo per le serie ----------//

	if( pSerieSet->IsFieldNull(&pSerieSet->m_ServAggiungibile) 
		|| pSerieSet->m_ServAggiungibile == 0 )
		{
		byte spianaturaTrovata = FALSE;

		CCategorieServiziSet* pServSet = tabelle->m_pCategorieServiziSet;
		CVerbaliSet*					pVerbSet = tabelle->m_pVerbaliSet;

		pVerbSet->m_strFilter.Format("VERBALI.Codice = %d",pSerieSet->m_Verbale);
		SAFETY_OPEN(pVerbSet);

		//Se compare un listino particolare verifico la presenza di un servizio aggiungibile
		long codListino = 0;
		if( !pVerbSet->IsFieldNull(&pVerbSet->m_ListinoParticolare) )
			codListino = pVerbSet->m_ListinoParticolare;

		CString queryJoin, query;
		queryJoin = "CATEGORIE.Codice = SERVIZI_LISTINO.Categoria AND ";

		query.Format("Aggiuntivo = 1 AND Listino = %d AND Certificato = %d", codListino, pSerieSet->m_TipoCertificato);
		pServSet->m_strFilter = queryJoin + query;
		SAFETY_OPEN(pServSet);

		// Se non ho trovato il servizio nel listino particolare lo cerco in quello generale
		if( pServSet->IsEOF() )
			{
			query.Format("Aggiuntivo = 1 AND Listino = %d AND Certificato = %d", pVerbSet->m_ListinoGenerale, pSerieSet->m_TipoCertificato);
			pServSet->m_strFilter = queryJoin + query;
			pServSet->Requery();
			}
		// Se l'ho trovato lo inserisco nella serie
		if( !pServSet->IsEOF() )
			{
			pSerieSet->Edit();
			pSerieSet->m_ServAggiungibile = pServSet->m_Codice;
			pSerieSet->Update();
			spianaturaTrovata = TRUE;
			}

		if(!spianaturaTrovata)
			{
			AfxMessageBox("Attenzione!!! \nIl servizio di spianatura non è stato correttamente configurato.");
			pSerieSet->Edit();
			pSerieSet->m_ServAggiungibile = 0;
			pSerieSet->Update();
			}
	
		}

	

	//------------ Determino la posizione serie e certificato e le info associate ----------//

	// Carico tutte le serie associate allo stesso verbale per aggiornare i dati
	// a quelle relative allo stesso certificato memorizzando le info certificato
	pSerieSet->m_strSort = "TipoCertificato, Codice";
	pSerieSet->m_strFilter.Format("Verbale = %d",pSerieSet->m_Verbale);
	pSerieSet->Requery();

	int posCertificato = 0;
	int posSerie = 0;
	CString osservazioni = "", sperimentatore = "", macchina = "";
	
	for(SET_START(pSerieSet); !pSerieSet->IsEOF(); pSerieSet->MoveNext() )
		{
		if( pSerieSet->m_NuovoCertificato )
			{
			posCertificato++;
			posSerie = 1;
			if( !pSerieSet->IsFieldNull(&pSerieSet->m_Osservazioni) )
				osservazioni = pSerieSet->m_Osservazioni;
			if( !pSerieSet->IsFieldNull(&pSerieSet->m_Sperimentatore) )
				sperimentatore = pSerieSet->m_Sperimentatore;
			if( !pSerieSet->IsFieldNull(&pSerieSet->m_Macchina) )
				macchina = pSerieSet->m_Macchina;
			}
		else
			posSerie++;

		if( pSerieSet->m_Codice == codSerie )
			{
			if(	 !pSerieSet->m_NuovoCertificato &&
				(		
					pSerieSet->IsFieldNull(&pSerieSet->m_Osservazioni)
				||	pSerieSet->IsFieldNull(&pSerieSet->m_Sperimentatore)
				||	pSerieSet->IsFieldNull(&pSerieSet->m_Macchina)
				||	pSerieSet->m_Osservazioni		!= osservazioni
				||	pSerieSet->m_Sperimentatore	!= sperimentatore
				||	pSerieSet->m_Macchina				!= macchina))
				{
				pSerieSet->Edit();
				pSerieSet->m_Osservazioni		= osservazioni;
				pSerieSet->m_Sperimentatore = sperimentatore;
				pSerieSet->m_Macchina				= macchina;
				pSerieSet->Update();
				}
			break;
			}
			
	}
	ASSERT( !pSerieSet->IsEOF() );
	//------------------------------------------------------------------//


	// Il recordset delle serie è sincronizzato con quella in esame ma contiene 
	// tutte le serie associate al verbale di riferimento in ordine di inserimento
	
	CMainDlg dlg;
	dlg.m_pSerieSet						= pSerieSet;
	dlg.m_pProviniSet					= tabelle->m_pProviniSet;
	dlg.m_pServiziListinoSet	= tabelle->m_pServiziListinoSet;
	dlg.m_pOperatoriSet				= tabelle->m_pOperatoriSet;
	dlg.m_DataAccettazione		= pVerbaliSet->m_DataAccettazione;
	dlg.m_pUltimoSper					= ultimoSperimentatore;
	dlg.m_pUltimaDataProve		= pUltimaDataProva;
	dlg.m_strPosizione.Format("%d/%d",posSerie,posCertificato);

  //Gestione Norma UNI EN 12390-3 2003
  if (pSerieSet->m_TipoCertificato == 9)
    {
      tabelle->m_pTipiCertificatoSet->m_strFilter = "Codice = 9";
      if (!tabelle->m_pTipiCertificatoSet->IsOpen())
        tabelle->m_pTipiCertificatoSet->Open();
      else
        tabelle->m_pTipiCertificatoSet->Requery();

      
      dlg.m_strDiametro  = tabelle->m_pTipiCertificatoSet->m_Dimensione1;
      dlg.m_strLunghezza = tabelle->m_pTipiCertificatoSet->m_Dimensione2;

      dlg.m_strUMArea    = "(mm²)";
    }

	return dlg.DoModal();
}
Exemplo n.º 5
0
void CMainDlg::RiempiAlbero(boolean selezionato)
{
	BOOL trovato = FALSE;
	HTREEITEM primo,select;
	m_TreeProvini.DeleteAllItems( );
	TV_INSERTSTRUCT tvinsert;
	tvinsert.hParent = NULL;
	tvinsert.hInsertAfter = TVI_LAST;
	tvinsert.item.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT;
	tvinsert.item.hItem = NULL;
	tvinsert.item.iSelectedImage = 3;
	tvinsert.item.iImage = 2;
	CString str;
	int i = 0;
	for(SET_START(m_pProviniSet); !m_pProviniSet->IsEOF(); m_pProviniSet->MoveNext())
		{
		if(m_pProviniSet->IsFieldNull(&m_pProviniSet->m_Risultati))
			{
				m_pProviniSet->Edit();
				m_pProviniSet->m_Risultati.Copy(*InitBlob());//Se il campo è null viene inizializzato con valori di default
				m_pProviniSet->Update();
			}
		str.Format("Provino %d",i+1);				// Nome del provino
		
		tvinsert.item.pszText = str.GetBuffer(0);
		dati* tempDati = (dati*)m_pProviniSet->m_Risultati.GetData();
		if (m_pProviniSet->IsFieldNull(&m_pProviniSet->m_DataInserimento))
			{
				tvinsert.item.iImage = 0;
				tvinsert.item.iSelectedImage = 1;
			}
		else
			{
				tvinsert.item.iImage = 2;
				tvinsert.item.iSelectedImage = 3;
			}

		HTREEITEM nItem = m_TreeProvini.InsertItem(&tvinsert);
		if(i==0)
			select = primo = nItem;

		// Identifica l'item successivo a quello corrente
		if(trovato)
			{
			trovato = FALSE;
			select = nItem;
			}

		// Item Corrente
		if(selezionato && m_pProviniSet->m_Codice == m_nCodProvinoCorrente)
			trovato = TRUE;
		
		m_TreeProvini.SetItemData(nItem, m_pProviniSet->m_Codice);
		m_TreeProvini.SetItemText(nItem, str);
		i++;
		}

	if(selezionato)
		m_TreeProvini.SelectItem(select);
	else
		m_TreeProvini.SelectItem(primo);
}
Exemplo n.º 6
0
void CTotFatturatoView::OnButtonCalcola() 
{

	double	FattConcessione			= 0;
	double	FattNonConcessione	= 0;
	double	FattGeotecnica			= 0;
	double	ImpPA								= 0;
	double	TotImpPA		  			= 0;

	double TotProveCarico			= 0;
	double TotCongBituminosi	= 0;
	double TotInerti					= 0;
	double TotMonitoraggi		  = 0;
	double TotVarie						= 0;
	double TotGeotNC					= 0;
	double TotLineeVita				= 0;
	double TotIndMurature			= 0;
	double TotIndCLS					= 0;
	double TotMatMetallici		= 0;

	double	AppFC		= 0;
	double	AppFNC 	= 0;
	double	AppFG		= 0;

	int			n = 0;

	CFattureSerEroVerSet* pFattVerSerErog = NULL;
	CFattureSet* pFatturePA = NULL;

	UpdateData();

	// Apertura Recordset Fatture
	pFatturePA	= new CFattureSet(&m_pApp->m_db);

	// Apertura Recordset Fatture/Verbali/ServiziErogati
	pFattVerSerErog	= new CFattureSerEroVerSet(&m_pApp->m_db);
	if(m_cmbMese.GetItemData(m_cmbMese.GetCurSel()) == 0)
	{
		pFatturePA->m_strFilter.Format("(FATTURE.fPA > 0) And (FATTURE.Data >= '%s-01-01') And (FATTURE.Data <= '%s-31-12')", m_csAnno, m_csAnno);
		pFattVerSerErog->m_strFilter.Format("(VERBALI.Fattura = FATTURE.Codice) And (SERVIZI_EROGATI.Verbale = VERBALI.Codice) And (FATTURE.Data >= '%s-01-01') And (FATTURE.Data <= '%s-31-12')", m_csAnno, m_csAnno);
	}
	else
	{
		pFatturePA->m_strFilter.Format("(FATTURE.fPA > 0) And (FATTURE.Data >= '%s-%02d-01') And (FATTURE.Data <= '%s-%02d-31')", m_csAnno, m_cmbMese.GetItemData(m_cmbMese.GetCurSel()) ,m_csAnno, m_cmbMese.GetItemData(m_cmbMese.GetCurSel()));
		pFattVerSerErog->m_strFilter.Format("(VERBALI.Fattura = FATTURE.Codice) And (SERVIZI_EROGATI.Verbale = VERBALI.Codice) And (FATTURE.Data >= '%s-%02d-01') And (FATTURE.Data <= '%s-%02d-31')", m_csAnno, m_cmbMese.GetItemData(m_cmbMese.GetCurSel()) ,m_csAnno, m_cmbMese.GetItemData(m_cmbMese.GetCurSel()));
	}

	pFatturePA->m_strSort = "FATTURE.Data";
	pFatturePA->Open();

	pFattVerSerErog->m_strSort = "VERBALI.Codice";
	pFattVerSerErog->Open();

	AppFC		= 0;
	AppFNC 	= 0;
	AppFG		= 0;

	for(SET_START(pFattVerSerErog); !pFattVerSerErog->IsEOF(); pFattVerSerErog->MoveNext())
	{
			AppFC		= 0;
			AppFNC 	= 0;
			AppFG		= 0;

			// Controlla la tipologia del Verbale
			if(pFattVerSerErog->m_TipoVerbale == VERB_IN_CONCESSIONE)
			{
				double Val = (pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) -
										 (((pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) * pFattVerSerErog->m_ScontoSevizio) / 100);
				
				if(pFattVerSerErog->m_TipoDocumento == 1) 
				{
					AppFC -= Val;
				}
				else
				{
					AppFC += Val;
				}

				// Se il verbale ha l'urgenza deve essere aggiunta la quota pari al 50% del costo del servizio
				if(pFattVerSerErog->m_VuoiUrgenza == 1)
					AppFC += Val/2;
			}
			else if (
							(pFattVerSerErog->m_TipoVerbale == VERB_NON_IN_CONCESSIONE)		|| 
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_PROVE_DI_CARICO)		||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_CONGL_BITUMINOSI)	||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_INERTI)						||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_MONITORAGGI)				||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_VARIE)							||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_GEOTECNICA)				||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_LINEE_VITA)				||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_INDAGINI_MURATURE)	||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_INDAGINI_CLS)			||
							(pFattVerSerErog->m_TipoVerbale == VERB_NC_MAT_METALLICI)
							)
			{
				double Val = (pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) -
										 (((pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) * pFattVerSerErog->m_ScontoSevizio) / 100);
				
				if(pFattVerSerErog->m_TipoDocumento == 1) 
				{
					AppFNC -= Val;
				}
				else
				{
					AppFNC += Val;
				}

				// Se il verbale ha l'urgenza deve essere aggiunta la quota pari al 50% del costo del servizio
				if(pFattVerSerErog->m_VuoiUrgenza == 1)
						AppFNC += Val/2;
			}
			else if (pFattVerSerErog->m_TipoVerbale == VERB_GEOLOGIA)
			{
				double Val = (pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) -
										 (((pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) * pFattVerSerErog->m_ScontoSevizio) / 100); 
				if(pFattVerSerErog->m_TipoDocumento == 1) 
				{
					AppFG -= Val;
				}
				else
				{
					AppFG += Val;
				}
				
				// Se il verbale ha l'urgenza deve essere aggiunta la quota pari al 50% del costo del servizio
				if(pFattVerSerErog->m_VuoiUrgenza == 1)
					AppFG += Val/2;
			}
			else
			{
				double Val = (pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) -
										 (((pFattVerSerErog->m_Prezzo * pFattVerSerErog->m_Quantita) * pFattVerSerErog->m_ScontoSevizio) / 100);
				if(pFattVerSerErog->m_TipoDocumento == 1) 
				{
					AppFNC -= Val;
				}
				else
				{
					AppFNC += Val;
				}

				// Se il verbale ha l'urgenza deve essere aggiunta la quota pari al 50% del costo del servizio
				if(pFattVerSerErog->m_VuoiUrgenza == 1)
					AppFNC += Val/2;
			}

			// Spese per le spedizioni
/*			if(pFattVerSerErog->m_Spese > 0)
			{
				if(AppFC)
					AppFC		+= pFattVerSerErog->m_Spese;
				else if(AppFNC) 
					AppFNC	+= pFattVerSerErog->m_Spese;
				else if(AppFG)
					AppFG		+= pFattVerSerErog->m_Spese;
			}
*/
			// Applica lo sconto alla fattura
			if(pFattVerSerErog->m_Sconto > 0)
			{
				AppFC		-= ((AppFC  * pFattVerSerErog->m_Sconto) / 100);
				AppFNC	-= ((AppFNC * pFattVerSerErog->m_Sconto) / 100);
				AppFG		-= ((AppFG  * pFattVerSerErog->m_Sconto) / 100);
			}

#if 0
			// Toglie l'eventuale ritenuta d'acconto
			if(pFattVerSerErog->m_RitenutaAcconto > 0)
			{		
				if(AppFC)
					AppFC		-= ((AppFC  * pFattVerSerErog->m_RitenutaAcconto) / 100);
				else if(AppFNC) 
					AppFNC	-= ((AppFNC * pFattVerSerErog->m_RitenutaAcconto) / 100);
				else if(AppFG)
					AppFG		-= ((AppFG  * pFattVerSerErog->m_RitenutaAcconto) / 100);
			}
#endif

			FattConcessione			+= AppFC;
			FattNonConcessione	+= AppFNC;
			FattGeotecnica			+= AppFG;

			if(AppFNC > 0)
			{
				// Totali per sottocategoria di verbale non in concessione
				if(pFattVerSerErog->m_TipoVerbale == VERB_NC_PROVE_DI_CARICO)
					TotProveCarico += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_CONGL_BITUMINOSI)
					TotCongBituminosi += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_INERTI)
					TotInerti += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_MONITORAGGI)
					TotMonitoraggi += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_VARIE)
					TotVarie += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_GEOTECNICA)
					TotGeotNC += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_LINEE_VITA)
					TotLineeVita += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_INDAGINI_MURATURE)
					TotIndMurature += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_INDAGINI_CLS)
					TotIndCLS += AppFNC;
				else if(pFattVerSerErog->m_TipoVerbale == VERB_NC_MAT_METALLICI)
					TotMatMetallici += AppFNC;
			}
	}

	// imponibile per Pubblica Amministrazione (PA)
	for(SET_START(pFatturePA); !pFatturePA->IsEOF(); pFatturePA->MoveNext())
	{
		if(pFatturePA->m_PA > 0)
		{
//			ImpPA += pFatturePA->m_Imponibile;
			ImpPA = (100 * pFatturePA->m_Imponibile) / (100 + pFatturePA->m_Aliquota);
			TotImpPA += ImpPA;
		}
	}

	if(pFatturePA)
	{
		pFatturePA->Close();
		delete pFatturePA;
	}

	if(pFattVerSerErog)
	{
		pFattVerSerErog->Close();
		delete pFattVerSerErog;
	}

	// Cancella tutti gli elementi presenti nella lista
	m_listTotFatturato.DeleteAllItems();

	// Inserisce gli elementi nella lista
	CString app("");

	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("PC = %.2f", TotProveCarico);
  m_listTotFatturato.SetItemText(n, 2, app);
	
	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("CB = %.2f", TotCongBituminosi);
  m_listTotFatturato.SetItemText(n, 2, app);
	
	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("I  = %.2f", TotInerti);
  m_listTotFatturato.SetItemText(n, 2, app);
	
	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("MO = %.2f", TotMonitoraggi);
  m_listTotFatturato.SetItemText(n, 2, app);

	// add s.c. 14.01.2019
	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("LV = %.2f", TotLineeVita);
  m_listTotFatturato.SetItemText(n, 2, app);

	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("IM = %.2f", TotIndMurature);
  m_listTotFatturato.SetItemText(n, 2, app);

	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("IC = %.2f", TotIndCLS);
  m_listTotFatturato.SetItemText(n, 2, app);

	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("MM = %.2f", TotMatMetallici);
  m_listTotFatturato.SetItemText(n, 2, app);
	// fine add s.c. 14.01.2019

	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("V  = %.2f", TotVarie);
  m_listTotFatturato.SetItemText(n, 2, app);

	n = m_listTotFatturato.InsertItem(n, "");
	app.Format("Geo NC  = %.2f", TotGeotNC);
  m_listTotFatturato.SetItemText(n, 2, app);

	app.Format("%.2f", FattConcessione + FattNonConcessione + FattGeotecnica);
	n = m_listTotFatturato.InsertItem(n, app);

	app.Format("%.2f", FattConcessione);
  m_listTotFatturato.SetItemText(n, 1, app);

	app.Format("%.2f", FattNonConcessione);
  m_listTotFatturato.SetItemText(n, 2, app);

	app.Format("%.2f", FattGeotecnica);
	m_listTotFatturato.SetItemText(n, 3, app);

	app.Format("%.2f", TotImpPA);
	m_listTotFatturato.SetItemText(n, 4, app);
}
Exemplo n.º 7
0
void CTotFatturatoView::OnInitialUpdate() 
{
	int n				= 0;
	int year		= 0;
	int minAnno = 0;
	int maxAnno = 0;

	DWORD style;

	CFormView::OnInitialUpdate();

	if(!(m_pApp = ((CWinSigmaApp*)AfxGetApp())))
		return;
	
  // Inizializza la lista dei servizi e quella del report
  style = m_listTotFatturato.GetExtendedStyle();
  style |= LVS_EX_GRIDLINES | LVS_EX_ONECLICKACTIVATE;
	m_listTotFatturato.SetExtendedStyle(style);
  m_listTotFatturato.InsertColumn(0, "Imponibile Totale", LVCFMT_LEFT, 130, -1);
	m_listTotFatturato.InsertColumn(1, "Imp. prove in concessione", LVCFMT_LEFT, 140, -1);
	m_listTotFatturato.InsertColumn(2, "Imp. prove non in concessione", LVCFMT_LEFT, 160, -1);
	m_listTotFatturato.InsertColumn(3, "Imp. prove geotecnica", LVCFMT_LEFT, 140, -1);
	m_listTotFatturato.InsertColumn(4, "Imponibile PA", LVCFMT_LEFT, 140, -1);

	// Recupera gli anni di validità dei listini per le ricerche dei servizi erogati
	CListiniSet*	pListiniSet;
	pListiniSet = new CListiniSet(&m_pApp->m_db);
  pListiniSet->m_strFilter = "Inizio is not null";
	pListiniSet->m_strSort = "Inizio";
	pListiniSet->Open();
	
	// Caricamento degli anni nella combo
	// Prende dalle date di validità dei listini l'anno minimo e quello massimo
	if (!pListiniSet->IsEOF())
	{
		minAnno = pListiniSet->m_Inizio.GetYear();
		for(SET_START(pListiniSet); !pListiniSet->IsEOF(); pListiniSet->MoveNext());
		maxAnno = pListiniSet->m_Fine.GetYear();
	}

/*
	maxAnno++;
	for (int i = minAnno; i < maxAnno; i++)
	{
		CString Anno("");
		Anno.Format("%d", i);
		m_cmbAnno.InsertString(n, Anno);
		m_cmbAnno.SetItemData(n, i);
    n++;
	}
	// Seleziona il primo elemento della combobox
	m_cmbAnno.SetCurSel(0);
*/
	for (int i = maxAnno; i >= minAnno; i--)
	{
		CString Anno("");
		Anno.Format("%d", i);
		m_cmbAnno.InsertString(n, Anno);
		m_cmbAnno.SetItemData(n, i);
    n++;
	}
	CTime t = CTime::GetCurrentTime();
	CString curYear =  "";
	curYear.Format("%d", t.GetYear());
	m_cmbAnno.SelectString(0, curYear);
	
	// Chiusura recordSet Listini
  if(pListiniSet)
  {
  	pListiniSet->Close();
  	delete pListiniSet;
  }

	// Popola la combo dei mesi
	m_cmbMese.InsertString(0, "Tutti");
	m_cmbMese.SetItemData(0, 0);

	m_cmbMese.InsertString(1, "Gennaio");
	m_cmbMese.SetItemData(1, 1);

	m_cmbMese.InsertString(2, "Febbraio");
	m_cmbMese.SetItemData(2, 2);

	m_cmbMese.InsertString(3, "Marzo");
	m_cmbMese.SetItemData(3, 3);

	m_cmbMese.InsertString(4, "Aprile");
	m_cmbMese.SetItemData(4, 4);

	m_cmbMese.InsertString(5, "Maggio");
	m_cmbMese.SetItemData(5, 5);

	m_cmbMese.InsertString(6, "Giugno");
	m_cmbMese.SetItemData(6, 6);

	m_cmbMese.InsertString(7, "Luglio");
	m_cmbMese.SetItemData(7, 7);

	m_cmbMese.InsertString(8, "Agosto");
	m_cmbMese.SetItemData(8, 8);

	m_cmbMese.InsertString(9, "Settembre");
	m_cmbMese.SetItemData(9, 9);

	m_cmbMese.InsertString(10, "Ottobre");
	m_cmbMese.SetItemData(10, 10);

	m_cmbMese.InsertString(11, "Novembre");
	m_cmbMese.SetItemData(11, 11);

	m_cmbMese.InsertString(12, "Dicembre");
	m_cmbMese.SetItemData(12, 12);

	// Seleziona il primo elemento della combobox
	m_cmbMese.SetCurSel(0);
}