--select * from wh.Maledetti
CREATE procedure [C6MartPeriodico].[PL_FD188PaiESG_bkp_20241126] --'F','00545400483'
 -- Add the parameters for the stored procedure here
 @Rete char(1), 
 @CodiceFiscale varchar(16)
AS
BEGIN
declare @pref_esg varchar(2)
select @pref_esg=Preferenza_esg_cliente from C6MartPeriodico.BrsClienteESG where rete=@Rete and cod_fiscale=@CodiceFiscale
if(@pref_esg='1')
begin
select 1 as ID,
	'Prodotti che considerano almeno un PAI ambientale' as Descrizione,
	'73,65' as Peso,
	'PAI Ambientali' as Tabella
		,'N' as isNA
	union
select 2 as ID,
	'di cui in linea con le Preferenze di Sostenibilità' as Descrizione,
	'40,00' as Peso,
	'PAI Ambientali' as Tabella
		,'N' as isNA
	union
select 3 as ID,
	'Prodotti che non considerano PAI ambientali' as Descrizione,
	'26,35' as Peso,
	'PAI Ambientali' as Tabella
		,'N' as isNA
	union
select 4 as ID,
	'TOTALE' as Descrizione,
	'100,00' as Peso,
	'PAI Ambientali' as Tabella
		,'N' as isNA
	union
select 5 as ID,
	'Prodotti che considerano almeno un PAI sociale' as Descrizione,
	'5,00' as Peso,
	'PAI Sociali' as Tabella
		,'N' as isNA
	union
select 6 as ID,
	'di cui in linea con le Preferenze di Sostenibilità' as Descrizione,
	'10,00' as Peso,
	'PAI Sociali' as Tabella
		,'N' as isNA
	union
select 7 as ID,
	'Prodotti che non considerano PAI sociali' as Descrizione,
	'95,00' as Peso,
	'PAI Sociali' as Tabella
		,'N' as isNA
	union
select 8 as ID,
	'TOTALE' as Descrizione,
	'100,00' as Peso,
	'PAI Sociali' as Tabella
		,'N' as isNA
	end														 
END