<?xml version="1.0"?>
<ROWSET>
 <ROW>
  <CODEFACTC>1</CODEFACTC>
  <DEN_EFCUSTOM>METRO</DEN_EFCUSTOM>
  <SQLCAMPURI>select
      nas.GLN as BT_29,  -- GLN  vanzator
      &apos;0209&apos; as BT_29_1,  -- identificator schema GLN  vanzator
      napartsoc.GLN as BT_46, -- GLN sediu social cumparator,
      &apos;0209&apos; as BT_46_1, -- identificator schema GLN sediu social cumparator,
      np.den_part||&apos;-&apos;||napartlivr.obs  as BT_70 -- nume partener + numele sediului de livrare
from iesiri ies
inner join npart np on np.codpart=ies.partener
inner join nsubunit nsub on ies.subunitatea=nsub.codsubunit
left join nagenda nas on nas.codsubunit=nsub.codsubunit
left join nagenda napartsoc on napartsoc.codpart= np.codpart and napartsoc.SEDIUSOCIAL in (4,5,6,7) and coalesce(napartsoc.inactiv,0)=0
left join nagenda napartlivr on napartlivr.codagenda=ies.codlocatie
where ies.codies = &lt;WM_CODDOC&gt;</SQLCAMPURI>
 </ROW>
 <ROW>
  <CODEFACTC>6</CODEFACTC>
  <DEN_EFCUSTOM>SELGROS</DEN_EFCUSTOM>
  <SQLCAMPURI>select
      nas.GLN as BT_29,  -- GLN  vanzator
      &apos;0209&apos; as BT_29_1,  -- identificator schema GLN  vanzator
      --iesext.extensie as BT_10, -- extensie la nivel de factura, unde se poate introduce codul de furnizor atribuit de Selgros
       napartsoc.GLN as BT_46, -- GLN sediu social cumparator,
      &apos;0209&apos; as BT_46_1, -- identificator schema GLN sediu social cumparator,
      np.den_part||&apos;-&apos;||napartlivr.obs  as BT_70 -- nume partener + numele sediului de livrare

from iesiri ies
inner join npart np on np.codpart=ies.partener
inner join nsubunit nsub on ies.subunitatea=nsub.codsubunit
left join nagenda nas on nas.codsubunit=nsub.codsubunit
left join nagenda napartsoc on napartsoc.codpart= np.codpart and napartsoc.SEDIUSOCIAL in (4,5,6,7) and coalesce(napartsoc.inactiv,0)=0
left join nagenda napartlivr on napartlivr.codagenda=ies.codlocatie
left join iesiriext iesext on iesext.codies=ies.codies
where ies.codies = &lt;WM_CODDOC&gt;</SQLCAMPURI>
 </ROW>
 <ROW>
  <CODEFACTC>4</CODEFACTC>
  <DEN_EFCUSTOM>PENNY</DEN_EFCUSTOM>
  <SQLCAMPURI>select
      nas.GLN as BT_29,  -- GLN  vanzator
      &apos;0209&apos; as BT_29_1,  -- identificator schema GLN  vanzator
      napartsoc.GLN as BT_46, -- GLN sediu social cumparator,
      &apos;0209&apos; as BT_46_1, -- identificator schema GLN sediu social cumparator,
      np.den_part||&apos;-&apos;||np.obs  as BT_70, -- numele partii catre care se face livrarea - magazin sau   depozit
      Case when (Select Count(*) CateStocuri from IESIRI1 I1 WHERE I1.CodIes = &lt;WM_CodDoc&gt; and I1.TIPLINIE = &apos;=&apos;) = 0 then &apos;2&apos; else &apos;1&apos; end  As BT_23 -- Business Process Type
from iesiri ies
inner join iesiri1 ie1 on ie1.codies=ies.codies
inner join npart np on np.codpart=ies.partener
inner join nsubunit nsub on ies.subunitatea=nsub.codsubunit
left join nagenda nas on nas.codsubunit=nsub.codsubunit
left join nagenda napartsoc on napartsoc.codpart= np.codpart and napartsoc.SEDIUSOCIAL in (4,5,6,7) and coalesce(napartsoc.inactiv,0)=0
left join nagenda napartlivr on napartlivr.codagenda=ies.codlocatie
where ies.codies = &lt;WM_CodDoc&gt;</SQLCAMPURI>
 </ROW>
 <ROW>
  <CODEFACTC>5</CODEFACTC>
  <DEN_EFCUSTOM>KAUFLAND</DEN_EFCUSTOM>
  <SQLCAMPURI>select
      nas.GLN as BT_29,  --GLN  vanzator
      &apos;0088&apos; as BT_29_1,  -- identificator schema GLN  vanzator
      &apos;4049728000004&apos; as BT_46, -- GLN sediu social cumparator,
      &apos;0088&apos; as BT_46_1, -- identificator schema GLN sediu social cumparator,
      np.den_part||&apos;-&apos;||napartlivr.obs  as BT_70, -- nume partener + numele sediului de livrare
      napartlivr.GLN as BT_71, -- GLN sediu livrare cumparator,
      &apos;0088&apos; as BT_71_1 -- GLN sediu livrare cumparator
from iesiri ies
inner join npart np on np.codpart=ies.partener
inner join nsubunit nsub on ies.subunitatea=nsub.codsubunit
left join nagenda nas on nas.codsubunit=nsub.codsubunit
left join nagenda napartsoc on napartsoc.codpart= np.codpart and napartsoc.SEDIUSOCIAL in (4,5,6,7)
and coalesce(napartsoc.inactiv,0)=0
left join nagenda napartlivr on napartlivr.codagenda=ies.codlocatie
where ies.codies = &lt;WM_CODDOC&gt;
</SQLCAMPURI>
 </ROW>
 <ROW>
  <CODEFACTC>2</CODEFACTC>
  <DEN_EFCUSTOM>LIDL</DEN_EFCUSTOM>
  <SQLCAMPURI>select
      nas.GLN as BT_29,  --GLN  vanzator
      &apos;0088&apos; as BT_29_1,  -- identificator schema GLN  vanzator
      napartsoc.GLN as BT_46, -- GLN sediu social cumparator,
      &apos;0088&apos; as BT_46_1, -- identificator schema GLN sediu social cumparator,
      np.den_part||&apos;-&apos;|| napartlivr.obs  as BT_70, -- nume partener + numele sediului de livrare
      napartlivr.GLN as BT_71, -- GLN sediu livrare cumparator,
      &apos;0088&apos; as BT_71_1 -- GLN sediu livrare cumparator
from iesiri ies
inner join npart np on np.codpart=ies.partener
inner join nsubunit nsub on ies.subunitatea=nsub.codsubunit
left join nagenda nas on nas.codsubunit=nsub.codsubunit
left join nagenda napartsoc on napartsoc.codpart= np.codpart and napartsoc.SEDIUSOCIAL in (4,5,6,7) and coalesce(napartsoc.inactiv,0)=0
left join nagenda napartlivr on napartlivr.codagenda=ies.codlocatie
where ies.codies = &lt;WM_CODDOC&gt;</SQLCAMPURI>
 </ROW>
 <ROW>
  <CODEFACTC>3</CODEFACTC>
  <DEN_EFCUSTOM>MEGA IMAGE</DEN_EFCUSTOM>
  <SQLCAMPURI>select
      napartlivr.GLN as BT_71, -- GLN sediu livrare cumparator,
      &apos;0209&apos; as BT_71_1 -- GLN sediu livrare cumparator
from iesiri ies
inner join npart np on np.codpart=ies.partener
left join nagenda napartlivr on napartlivr.codagenda=ies.codlocatie
where ies.codies = &lt;WM_CODDOC&gt;
</SQLCAMPURI>
 </ROW>
</ROWSET>
