1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| create procedure RechMontantFournisseur (@NumFournisseur as varchar(20),@Montant as decimal(38,20))
as
begin
select
t1.[Entry No_] as "N° Séquence",
Convert(char(10),t1.[Posting Date],103) as "Date Comptabilisation",
t1.[Vendor No_]as "N° Fournisseur",
t1.[Description] as "Nom Fournisseur",
Case
when t1.[Document Type]='0' then ' '
when t1.[Document Type]='1' then 'Paiement'
when t1.[Document Type]='2' then 'Facture'
when t1.[Document Type]='3' then 'Avoir'
when t1.[Document Type]='4' then 'Intérêts'
when t1.[Document Type]='5' then 'Relance'
when t1.[Document Type]='6' then 'Remboursement'
end
as "Type Document",
t1.[Document No_] as "N° Document",
t1.[Open] as Ouvert,
t1.[External Document No_] as "N° Doc Externe",
t2.Amount as "Montant TTC",
t1.[Lettrage],
t1.[Lettré par],
t1.[Lettré le],
convert(char(10),t1.[Date fin lettrage],103) as "Date fin lettrage",
convert(char(10),t1.[Date debut lettrage],103) as "Date debut lettrage"
from
dbo.[BASE$Vendor Ledger Entry] as T1
inner join
dbo.[BASE$Detailed Vendor Ledg_ Entry] as T2
on t1.[Entry No_] = t2.[Vendor Ledger Entry No_]
Where
t1.[Vendor No_] = @NumFournisseur
and t2.Amount = @Montant
order by t1.[Vendor No_]
end |
Partager