PepPol European Invoicing standard

PepPol European Invoicing standard

Postby Marc Venken » Wed Feb 14, 2024 9:37 am

Hello,

In Belgium it will be obliged to send invoices with PepPol. It is a european system that will make invoicing the same everywhere.

I have seen posts that this is already so in Italy ? but unther XML. Peppol will also be XML, so the layout and making of Italy-invoices will already be the same.

Is there someone that is willing to share the code for making that kind of invoices ? Not the invoice itself.... but printing and generating the invoices, ready for sending.
Of cource I can find parts of source in the forum, but it will be a general use and maybe a good idea for the samples directory of FW.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: PepPol European Invoicing standard

Postby Antonio Linares » Wed Feb 14, 2024 9:54 am

https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL1001-inv/

Code: Select all  Expand view
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
         xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
    <cbc:ID>123456</cbc:ID>
    <cbc:IssueDate>2024-02-14</cbc:IssueDate>
    <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode> <!-- Commercial invoice -->
    <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cac:PartyName>
                <cbc:Name>Your Company Name</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>Main Street</cbc:StreetName>
                <cbc:CityName>Marbella</cbc:CityName>
                <cbc:PostalZone>29600</cbc:PostalZone>
                <cbc:Country>ES</cbc:Country>
            </cac:PostalAddress>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
        <cac:Party>
            <cac:PartyName>
                <cbc:Name>Customer Company Name</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>Customer Street</cbc:StreetName>
                <cbc:CityName>Customer City</cbc:CityName>
                <cbc:PostalZone>12345</cbc:PostalZone>
                <cbc:Country>ES</cbc:Country>
            </cac:PostalAddress>
        </cac:Party>
    </cac:AccountingCustomerParty>
    <!-- Add more invoice details, line items, taxes, etc. -->
</Invoice>
 

<!-- Add more invoice details, line items, taxes, etc. -->
Code: Select all  Expand view
<!-- Invoice lines -->
<cac:InvoiceLine>
    <cbc:ID>1</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">10</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="EUR">150.00</cbc:LineExtensionAmount>
    <cac:Item>
        <cbc:Name>Product A</cbc:Name>
        <cbc:Description>High-quality widgets</cbc:Description>
        <cac:StandardItemIdentification>
            <cbc:ID schemeID="GTIN">1234567890123</cbc:ID>
        </cac:StandardItemIdentification>
    </cac:Item>
    <cac:Price>
        <cbc:PriceAmount currencyID="EUR">15.00</cbc:PriceAmount>
    </cac:Price>
</cac:InvoiceLine>

<!-- Tax information -->
<cac:TaxTotal>
    <cbc:TaxAmount currencyID="EUR">30.00</cbc:TaxAmount>
    <cac:TaxSubtotal>
        <cbc:TaxableAmount currencyID="EUR">150.00</cbc:TaxableAmount>
        <cbc:TaxAmount currencyID="EUR">30.00</cbc:TaxAmount>
        <cac:TaxCategory>
            <cbc:ID>S</cbc:ID>
            <cbc:Percent>20.0</cbc:Percent>
            <cac:TaxScheme>
                <cbc:ID>VAT</cbc:ID>
            </cac:TaxScheme>
        </cac:TaxCategory>
    </cac:TaxSubtotal>
</cac:TaxTotal>
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: PepPol European Invoicing standard

Postby Marc Venken » Wed Feb 14, 2024 10:01 am

The coding of this is done like older days making a html page ?

Like this

function tabel_html_code_OLD()

cTabel:='<br><p><span style="color:#0000CD;"><strong>Enkel deze maten zijn nog beschikbaar :</strong></span></p>'
cTabel= cTabel + '<table border="0" cellpadding="1" cellspacing="1" style="width:400px;"><thead>'
cTabel = cTabel + '<tr>'

for i = 1 to 13
nMaat = 36 + i
cTabel = cTabel + '<th scope="col" style="text-align: center; background-color: rgb(255, 0, 0);"><strong><span style="color:#FFFFFF;">'+str(nMaat,2)+'</span></strong></th>'
next
cTabel = cTabel + '</tr></thead><tbody><tr>'

for i = 1 to 13
nMaat = 36 + 1
cTabel = cTabel + '<td style="text-align: center;"></td>'
next
cTabel = cTabel + '</tr></tbody></table><br>'
//xbrowser(cTabel)

return cTabel
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: PepPol European Invoicing standard

Postby Antonio Linares » Wed Feb 14, 2024 10:05 am

Better use:

Code: Select all  Expand view
TEXT INTO cInvoice
   ...
ENDTEXT
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: PepPol European Invoicing standard

Postby Marc Venken » Wed Feb 14, 2024 10:19 am

So, since it will be general used in more countries, it could become a tool for more people in the forum.
Here, 01/01/2026 is the deadline for working with it.

I will look into the text....

Maybe a good idea to use Yunus invoicing as the program to build the text function on, so there is a general use if it is complete and it will be a extra for all members...

Maybe a Hash ?

//
Match variables from any database before we call the TEXT function.

hXml["Name"] = oDbf[name]



Then in TEXT function use the Hash hXml["Name"] .......so that anyone can use it if he will link his own database items to the hXml Hash

Does this make sence ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: PepPol European Invoicing standard

Postby Otto » Wed Feb 14, 2024 10:38 am

Marc, I support your idea to develop a finished business module together.
I am sure it will also become mandatory in Austria.
Kind regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6003
Joined: Fri Oct 07, 2005 7:07 pm

Re: PepPol European Invoicing standard

Postby Marc Venken » Wed Feb 14, 2024 10:52 am

Great !!

But we have to keep in mind that here are many users using FW as it is and also users that use FW with extras :wink: :wink:

So finaly there can be more ways, but if possible the FWH plain version as a starter )))

Great community ....
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: PepPol European Invoicing standard

Postby paquitohm » Wed Feb 14, 2024 11:02 am

Antonio Linares wrote:Better use:

Code: Select all  Expand view
TEXT INTO cInvoice
   ...
ENDTEXT


Hola a todos

Muy interesante hilo

A mi me gusta la solucion TEXT INTO y es la que utilizo, pero los xml a generar son más que simple texto porque tienen tags que pueden o no llevar valores y quizas ramas completas que quedan vacias y tambien tienen ramas que pueden repetirse más de una vez.
En ambos casos desarrolle soluciones que borran ramas vacias agrupaciones que pueden aparecer mas de una vez

Dicho de otra forma, aunque TEXT INTO a simple vista puede ser lo mejor, cuando el formato es complejo, puede hacerse complicado el manejo del TEXTO INTO. Aun asi, la construccion manual, mediante hashes o simple encadenamiento de strings tampoco es mas facil y mucho menos más clara.

Saludos
paquitohm
 
Posts: 108
Joined: Fri Jan 14, 2022 8:37 am

Re: PepPol European Invoicing standard

Postby Marc Venken » Wed Feb 14, 2024 11:30 am

In early days I made some HTML Pages from source for generation Webshop pages with all kind of data and layout.
If I look into that code, I see options to modify it like that ?

Code: Select all  Expand view

Function CreateOneHtmlPag()  // Dbf is already open !!

   cFile = "c:\maveco\website\html\maveco folder\pag"+alltrim(fotoinde->code)+".htm"
   Fzoeken := FCREATE(cFile)

   FWRITE(Fzoeken,  "<html>" + chr(10)  )
   FWRITE(Fzoeken,  "<head>" + chr(10) )
   FWRITE(Fzoeken,  '<title>'+alltrim(fotoinde->titel)+'</title>' + chr(10))
   FWRITE(Fzoeken,  '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'  + chr(10))
   FWRITE(Fzoeken,  '</HEAD> ' + chr(10))
   FWRITE(Fzoeken,  '<body bgcolor="#FFFFFF" text="#000000" background="../../Internet%20Sources/Achtergrond.jpg" leftmargin="30">' + chr(10))

   FWRITE(Fzoeken,  '<table width="600" border="1" cellspacing="5" cellpadding="0"> ' + chr(10))
   FWRITE(Fzoeken,  '<tr>' + chr(10))
   FWRITE(Fzoeken,  '<td colspan="4"> ' + chr(10))
   FWRITE(Fzoeken,  '<div align="center"><font color="#0000FF"><b><font size="5">'+alltrim(fotoinde->titel) +'</font></b></font></div> ' + chr(10))
   FWRITE(Fzoeken,  '</td> ' + chr(10))
   FWRITE(Fzoeken,  '</tr> ' + chr(10))
   FWRITE(Fzoeken,  '<tr>' + chr(10))
   FWRITE(Fzoeken,  '<td width="140" height="99">  ' + chr(10))
   FWRITE(Fzoeken,  '<div align="center"><font color="#0000FF" size="5">'+alltrim(fotoinde->code)+'</font></div> ' + chr(10))
   FWRITE(Fzoeken,  '</td> ' + chr(10))
   FWRITE(Fzoeken,  '<td colspan="3" valign="top" height="77">' + chr(10))
   aText = formatMemo("FOTOPAG",fotoinde->info)
   FWRITE(Fzoeken,  '<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">' + chr(10))
   for mTel = 1 to Len(aText)
      FWRITE(Fzoeken,  alltrim(aText[mTel])+'<br>' + chr(10))
   next
   FWRITE(Fzoeken,  '</font></p> ' + chr(10))
   FWRITE(Fzoeken,  '</td> ' + chr(10))
   FWRITE(Fzoeken,  '</tr> ' + chr(10))

   fotodata->(dbseek(fotoinde->code))
   aInfo:={"","","",""} // 4 lege velden
   aPic150:={"","","",""}
   aPic400:={"","","",""}
   aHtmlFoto150:={"","","",""}
   aHtmlFoto400:={"","","",""}
   aHtmlArtNr :={"","","",""}
   aHtmlNom1 :={"","","",""}
   aHtmlNom2 :={"","","",""}
   nPosPag = 1
   do while fotodata->code = fotoinde->code
      if  empty(fotodata->artikel_nr)
          fotodata->(dbskip())
          loop
      endif
      artikel->(dbseek(fotodata->artikel_nr))
      if artikel->(rlock())
         artikel->fotopag = fotoinde->code
         artikel->online  = "PAG "+fotoinde->code
         artikel->(dbunlock())
      endif
      aPic150[nPosPag] = "c:\pictures\web150\"+substr(artikel->artikel_nr,1,3)+substr(artikel->artikel_nr,5,2)+substr(artikel->artikel_nr,8,2)+".jpg"
      aPic400[nPosPag] = "
c:\pictures\web400\"+substr(artikel->artikel_nr,1,3)+substr(artikel->artikel_nr,5,2)+substr(artikel->artikel_nr,8,2)+".jpg"
      if file(aPic150[nPosPag])
           cTarget = lower("
c:\maveco\website\pictures\"+substr(artikel->artikel_nr,1,3)+substr(artikel->artikel_nr,5,2)+substr(artikel->artikel_nr,8,2)+".jpg")
           copy file &(aPic150[nPosPag])  to &cTarget
      endif
      if file(aPic400[nPosPag])
           cTarget = lower("
c:\maveco\website\pictures\b"+substr(artikel->artikel_nr,1,3)+substr(artikel->artikel_nr,5,2)+substr(artikel->artikel_nr,8,2)+".jpg")
           copy file &(aPic400[nPosPag])  to &cTarget
      endif
      aHtmlFoto150[nPosPag] = '"
../../images/'+lower(substr(artikel->artikel_nr,1,3))+lower(substr(artikel->artikel_nr,5,2))+lower(substr(artikel->artikel_nr,8,2))+'.jpg" '
      //aHtmlFoto400[nPosPag] = "
'../../images/b"+substr(artikel->artikel_nr,1,3)+substr(artikel->artikel_nr,5,2)+substr(artikel->artikel_nr,8,2)+".jpg' "
      aHtmlArtNr[nPosPag] = lower(fotodata->artikel_nr)
      aHtmlNom1[nPosPag] = left(fotodata->benaming,25)
      aHtmlNom2[nPosPag] = substr(fotodata->benaming,26)
      aHtmlArtNr[nPosPag] = fotodata->artikel_nr

      nPosPag ++
      if nPosPag = 5 .or. fotodata->code <> fotoinde->code
         FWRITE(Fzoeken,  '<tr> ' + chr(10))
            for mDat = 1 to 4
               FWRITE(Fzoeken,  '<td width="
160" height="140"> ' + chr(10))
                  FWRITE(Fzoeken,  '<div align="
center">' + chr(10))
                  FWRITE(Fzoeken,  '<a href="
../../zoekindex.php?loc=zoekdetail&pcode=true&perform_query=true&pcode_query=' + lower(alltrim(aHtmlArtNr[mDat])) + '">' + chr(10))
                  FWRITE(Fzoeken,  '<img src=' + lower(aHtmlFoto150[mDat]) + ' alt="
Klik om te vergroten" border = "0" vspace="5" hspace="5" align="top" ></a></div>' + chr(10))
//                  FWRITE(Fzoeken,  '<font size="
1">' + chr(10))
//                  FWRITE(Fzoeken,  alltrim(aHtmlNom1[m])+'<br>'+ chr(10))
//                  FWRITE(Fzoeken,  alltrim(aHtmlNom2[m])+ chr(10))
//                  FWRITE(Fzoeken,  '<br><b><font size="
2">' + chr(10))
//                  FWRITE(Fzoeken,  alltrim(aHtmlArtNr[m]) + chr(10))
//                  FWRITE(Fzoeken,  '</b></font></div>' + chr(10))
               FWRITE(Fzoeken,  '</td> ' + chr(10))
            next
         FWRITE(Fzoeken,  '</tr> ' + chr(10))
         FWRITE(Fzoeken,  '<tr> ' + chr(10))
            for mDat = 1 to 4
               if empty(aHtmlArtNr[mDat])
                  FWRITE(Fzoeken,  '<td width="
160" height="26" > ' + chr(10))
               else
                  FWRITE(Fzoeken,  '<td width="
160" height="26" bgcolor="#72B8B8"> ' + chr(10))
               endif
                  FWRITE(Fzoeken,  '<div align="
center">' + chr(10))
//                  FWRITE(Fzoeken,  '<a href="
../../zoekindex.php?loc=zoekdetail&pcode=true&perform_query=true&pcode_query=' + alltrim(aHtmlArtNr[m]) + '">' + chr(10))
//                  FWRITE(Fzoeken,  '<img src=' + aHtmlFoto150[m] + ' alt="
Klik om te vergroten" border = "0" vspace="5" hspace="5" align="top" ></a> <br>' + chr(10))
                  FWRITE(Fzoeken,  '<b><font size="
2">' + chr(10))
                  FWRITE(Fzoeken,  lower(alltrim(aHtmlArtNr[mDat]))+'<br>' + chr(10))
                  FWRITE(Fzoeken,  '</b><font size="
1">' + chr(10))
                  FWRITE(Fzoeken,  alltrim(aHtmlNom1[mDat])+'<br>'+ chr(10))
                  FWRITE(Fzoeken,  alltrim(aHtmlNom2[mDat])+ chr(10))
                  FWRITE(Fzoeken,  '</font></div>' + chr(10))
            next
         FWRITE(Fzoeken,  '</tr> ' + chr(10))
         nPosPag = 1
         aInfo:={"
","","",""} // 4 lege velden
         aPic150:={"
","","",""}
         aPic400:={"
","","",""}
         aHtmlFoto150:={"
","","",""}
         aHtmlFoto400:={"
","","",""}
         aHtmlArtNr :={"
","","",""}
         aHtmlNom1 :={"
","","",""}
         aHtmlNom2 :={"
","","",""}
         endif
      fotodata->(dbskip())
   enddo
   FWRITE(Fzoeken,  '</table>' + chr(10))
   FWRITE(Fzoeken,  '</body>' + chr(10))
   FWRITE(Fzoeken,  '</html>' + chr(10))
   fClose(fZoeken)
return



Code: Select all  Expand view

function createhtmldetail()
      if artikel->(dbseek(groep->nummer))
         cFile = "c:\website\groepen\"+alltrim(groep->nummer)+".htm"
         Fzoeken := FCREATE(cFile)
         FWRITE(Fzoeken,  "
<html>" + chr(10)  )
         FWRITE(Fzoeken,  "
<head>" + chr(10) )

         FWRITE(Fzoeken,  '<title>'+cTitel+'</title>' + chr(10))
         FWRITE(Fzoeken,  '<meta http-equiv="
Content-Type" content="text/html; charset=iso-8859-1">'  + chr(10))
         FWRITE(Fzoeken,  '<META content="
MSHTML 6.00.2722.900" name=GENERATOR></HEAD> ' + chr(10))

         FWRITE(Fzoeken,  cTemplate )

         FWRITE(Fzoeken,  '<body bgcolor="
#FFFFFF" text="#000000">' + chr(10))
         FWRITE(Fzoeken,  '<table border="
1" align="center" width="746">'  + chr(10))
         FWRITE(Fzoeken,  '<tr>' + chr(10))
            FWRITE(Fzoeken,  '<TD vAlign=center align=middle width=126 height=41><div align="
center">Foto</div></TD>      ' + chr(10))
            FWRITE(Fzoeken,  '<TD vAlign=center align=middle width=374 height=41><div align="
center">Informatie</div></TD>' + chr(10))
            FWRITE(Fzoeken,  '<TD vAlign=center align=middle width=54 height=41><div align="
center">Verp</div></TD>       ' + chr(10))
            FWRITE(Fzoeken,  '<TD vAlign=center align=middle width=109 height=41><div align="
center">Maten</div></TD>     ' + chr(10))
         FWRITE(Fzoeken,  '</tr>' + chr(10))
         // titel tot hier
         DO WHILE artikel->folder = groep->nummer
            if artikel->foldernr < 0
               artikel->(dbskip())
               loop
            endif
            // hier start de kolom indeleing
            // Foto
            FWRITE(Fzoeken,  '<tr>' + chr(10))
               cFoto = '"
../images/'+substr(artikel->artikel_nr,1,3)+substr(artikel->artikel_nr,5,2)+substr(artikel->artikel_nr,8,2)+'.jpg" '
               cFullFoto = "
'../images/b"+substr(artikel->artikel_nr,1,3)+substr(artikel->artikel_nr,5,2)+substr(artikel->artikel_nr,8,2)+".jpg' "

               FWRITE(Fzoeken,  '<TD width=126 height=110 rowspan="
2"> ' + chr(10))
               FWRITE(Fzoeken,  '<DIV align=center>'+ chr(10) )

               cStr = '<img height=85 src='+cFoto+'width=110 align=middle border=0 onClick='
               cStr += '"
JustSoPicWindow('
               cStr += cFullFoto
               cStr += ",'
300','225','* * Klik om dit venster te sluiten * *','','fullscreen','0')  "
               cStr += '
;return document.MM_returnValue"'
               cStr += ' alt="
Klik om te vergroten">  '


               FWRITE(Fzoeken,  cStr )


               //FWRITE(Fzoeken,  '<img height=85 src='+cFoto+'width=110 align=middle border=0 onClick="
JustSoPicWindow('+cFoto+",'300','225','* * Click om dit venster te sluiten * *','#FFFFCC','fullscreen','0');return document.MM_returnValue')

               FWRITE(Fzoeken,  '<br><br>'+ chr(10) )  // blanko lijn
               FWRITE(Fzoeken,  '<b>'+alltrim(artikel->artikel_nr)+'</b> </DIV>'+ chr(10) )
               // Benaming
               cText = HtmlMemo(artikel->foldertxt)
               FWRITE(Fzoeken,  '<TD vAlign=top width=374 height=110 rowspan="2">' + chr(10))
               FWRITE(Fzoeken,  '<div align="left">'+cText+'</div> ' + chr(10)) // br voor pagbreake
               FWRITE(Fzoeken,  '</td>' + chr(10))
               // verp
               FWRITE(Fzoeken,  '<td height="24" width="54">' + chr(10))
               FWRITE(Fzoeken,  '<div align="center">'+alltrim(artikel->verk_verp)+'</div>' + chr(10))
               FWRITE(Fzoeken,  '</td>' + chr(10))
               // Maten
               FWRITE(Fzoeken,  '<td height="24" width="109">' + chr(10))
               FWRITE(Fzoeken,  '<div align="center">'+alltrim(artikel->maat)+'</div> ' + chr(10))
               FWRITE(Fzoeken,  '</td>' + chr(10))
               // On Stock
            FWRITE(Fzoeken,  '</tr> ' + chr(10))

            FWRITE(Fzoeken,  '<tr> ' + chr(10))
               FWRITE(Fzoeken,  '<TD colspan="2" height=54 valign="top">' + chr(10))
               cKleuren = "Postman <br> Marine"
               FWRITE(Fzoeken,  '<p>'+cKLeuren+'</p>' + chr(10))
               FWRITE(Fzoeken,  '</TD>' + chr(10))
            FWRITE(Fzoeken,  '</TR>' + chr(10))

            artikel->(dbskip())
            if ntel++ > 99999150
               lexit = .t.
               exit  // weg
            endif

         ENDDO
         FWRITE(Fzoeken,  '</table>' + chr(10))
         FWRITE(Fzoeken,  '</html> ' + chr(10))
         fClose(fZoeken)

      endif
return NIL
 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: PepPol European Invoicing standard

Postby Otto » Wed Feb 14, 2024 11:40 am

Hello,
I use this tool I made:
Image

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6003
Joined: Fri Oct 07, 2005 7:07 pm

Re: PepPol European Invoicing standard

Postby Marc Venken » Wed Feb 14, 2024 12:49 pm

Or we can Use a XBrowse to fill the data and generate from it.

Image

Code: Select all  Expand view

#include "fivewin.ch"

STATIC nTransparency, oWnd
STATIC c_path, c_path1

REQUEST DBFCDX

FUNCTION MAIN()
  local oMain

  DEFINE WINDOW oMain FROM 50 , 100 TO 1000 , 1500 PIXEL TITLE "Window"

  RunXBrowser(oMain)

  ACTIVATE WINDOW oMain CENTER

RETURN NIL



function runXbrowser(oMain)

   local oDlg, oFont, oBrw, oData

   DBCREATE( "TEST", {  {  "VGL",      "C", 4  , 0 } ;
                     ,  {  "PROG1",    "C", 100, 0 } ;
                     ,  {  "PROG2",    "C", 100, 0 } ;
                     ,  {  "datatype", "C", 3, 0 } ;
                     ,  {  "PROG3",    "C", 100, 0 } ;
                     ,  {  "PROG4",    "C", 100, 0 } ;
                     ,  {  "PROG5",    "C", 100, 0 } ;
                     }, "DBFCDX", .T., "TST" )

   FW_ArrayToDBF( { { '1000','<?xml version="1.0" encoding="UTF-8"?>',,,, },;
     { '1010','<cbc:ID>',,'DBF','ID_INVOICE','</cbc:ID>' },;
     { '1020','<cbc:IssueDate>',,'DBF','ID_DATE','</cbc:IssueDate>' },;
      } )

   CLOSE TST
   // Created

   USE TEST NEW

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   @ 20,20 XBROWSE oBrw SIZE -20,500 PIXEL OF oMain ;
      DATASOURCE "TEST" COLUMNS "VGL", "PROG1", "PROG2", "DATATYPE", "PROG3", "PROG4","PROG5" ;
      HEADERS nil, nil, nil, "Type", "Data", nil ,nil ;
      COLSIZES 40, 300, 300, 40, 70, 250, 250 ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      //:nStretchCol   := 1
      :nRowHeight    := 20
      :CreateFromCode()
   END

return nil


 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: PepPol European Invoicing standard

Postby paquitohm » Wed Feb 14, 2024 1:19 pm

A more complex xml. Characteristics:
+ Assignment of individual values ​​or repetition blocks through macros
+ Comments with //**

A parsing function does the job

Code: Select all  Expand view
METHOD BloqueFactura() CLASS TSiiDocAltaModificacionINTERMEDIA_
Local c


TEXT INTO c
         <siiLR:RegistroLRFacturasEmitidas>
            <sii:%ETI_PERIODO_IMPOSITIVO%>  //** //  06/04/18
               <sii:Ejercicio>%VALOR_EJERCICIO%</sii:Ejercicio>
               <sii:Periodo>%VALOR_PERIODO%</sii:Periodo>
            </sii:%ETI_PERIODO_IMPOSITIVO%> //** //  06/04/18
            <siiLR:IDFactura>
               <sii:IDEmisorFactura>
                  <sii:NIF>%VALOR_NIF%</sii:NIF>
               </sii:IDEmisorFactura>
               <sii:NumSerieFacturaEmisor>%VALOR_NUMSERIEFACTURAEMISOR%</sii:NumSerieFacturaEmisor>
               <sii:NumSerieFacturaEmisorResumenFin>%VALOR_NUMSERIEFACTURAEMISORRESUMENFIN%</sii:NumSerieFacturaEmisorResumenFin>
               <sii:FechaExpedicionFacturaEmisor>%VALOR_FECHAEXPEDICIONFACTURAEMISOR%</sii:FechaExpedicionFacturaEmisor>
            </siiLR:IDFactura>
            <siiLR:FacturaExpedida>
               <sii:TipoFactura>%VALOR_TIPOFACTURA%</sii:TipoFactura>


               //** Factura Rectificativa por Diferencias
               <sii:TipoRectificativa>%VALOR_TIPORECTIFICATIVA%</sii:TipoRectificativa>



               <sii:FacturasRectificadas>
                  <sii:IDFacturaRectificada>
                     <sii:NumSerieFacturaEmisor>%VALOR_FACTURASRECTIFICADAS_NUMSERIEFACTURAEMISOR%</sii:NumSerieFacturaEmisor>
                     <sii:FechaExpedicionFacturaEmisor>%VALOR_FACTURASRECTIFICADAS_FECHAEXPEDICIONFACTURAEMISOR%</sii:FechaExpedicionFacturaEmisor>
                  </sii:IDFacturaRectificada>
               </sii:FacturasRectificadas>


               //** //  07/08/17
               <sii:FechaOperacion>%VALOR_FECHAOPERACION%</sii:FechaOperacion>


               <sii:ClaveRegimenEspecialOTrascendencia>%VALOR_CLAVEREGIMENESPECIALOTRASCENDENCIA%</sii:ClaveRegimenEspecialOTrascendencia>
               //** //  12/07/17
               <sii:ImporteTotal>%VALOR_IMPORTETOTAL%</sii:ImporteTotal>
               //**
               <sii:DescripcionOperacion>%VALOR_DESCRIPCIONOPERACION%</sii:DescripcionOperacion>
               //** //  22/04/21
               <sii:DatosInmueble>
                  <sii:DetalleInmueble>
                     <sii:SituacionInmueble>%VALOR_SITUACION_INMUEBLE_1%</sii:SituacionInmueble>
                     <sii:ReferenciaCatastral>%VALOR_REFERENCIA_CATASTRAL_1%</sii:ReferenciaCatastral>
                  </sii:DetalleInmueble>
               </sii:DatosInmueble>
               //**
               <sii:Contraparte>
                  <sii:NombreRazon>%VALOR_CONTRAPARTE__NOMBRERAZON%</sii:NombreRazon>


                  //** Declarado SI censado
                  <sii:NIF>%VALOR_CONTRAPARTE__NIF%</sii:NIF>


                  //** Declarado NO censado
                  <sii:IDOtro>
                     <sii:CodigoPais>%VALOR_CONTRAPARTE__IDOTRO_CODIGOPAIS%</sii:CodigoPais>
                     <sii:IDType>%VALOR_CONTRAPARTE__IDOTRO_IDTYPE%</sii:IDType>
                     <sii:ID>%VALOR_CONTRAPARTE__IDOTRO_ID%</sii:ID>
                  </sii:IDOtro>


               </sii:Contraparte>
               <sii:TipoDesglose>


                  <sii:DesgloseFactura>


                     //** BLOQUE 1/2 - Sujeta     ~ Facturas Nacionales
                     <sii:Sujeta>

                        //** SUBBLOQUE 2. Si Exentas de IVA
                        //** Incluye Intracomunitarias y Exportacion
                        <sii:Exenta>
//**                           <sii:CausaExencion>%VALOR_DESGLOSEFACTURA_SUJETA_EXENTA_CAUSAEXENCION%</sii:CausaExencion>
//**                           <sii:BaseImponible>%VALOR_DESGLOSEFACTURA_SUJETA_EXENTA_BASEIMPONIBLE%</sii:BaseImponible>

//** //  21/06/18
%BLOQUE_DETALLE_EXENTA1%
                        </sii:Exenta>



                        //** SUBBLOQUE 1. No Exentas de IVA
                        <sii:NoExenta>   //** Terminar si exenta
                           <sii:TipoNoExenta>%VALOR_DESGLOSEFACTURA_SUJETA_NOEXENTA_TIPONOEXENTA%</sii:TipoNoExenta>



                           <sii:%ETI_DESGLOSE_IVA%>
%BLOQUE_DESGLOSEIVA%
                           </sii:%ETI_DESGLOSE_IVA%>


                        </sii:NoExenta>





                     </sii:Sujeta>





                     //**  BLOQUE 2/2. NoSujeta
                     <sii:NoSujeta>
                        //** Al menos para ISP
                        <sii:ImporteTAIReglasLocalizacion>%VALOR_DESGLOSEFACTURA_NOSUJETA_IMPORTETAIREGLASLOCALIZACION%</sii:ImporteTAIReglasLocalizacion>
                     </sii:NoSujeta>






                  </sii:DesgloseFactura>




                  //** BLOQUE 2. Facturas Intracomunitarias
                  <sii:DesgloseTipoOperacion>

                     //** SUBBLOQUE 1 para Intracomunitarias,
                     //** por PRESTACION de SERVICIOS
                     //** De momento NO LO UTILIZO... solo contemplo
                     //** entrega de bienes, de momento.

                     <sii:PrestacionServicios>
                        <sii:NoSujeta>  
                           <sii:ImporteTAIReglasLocalizacion>%VALOR_DESGLOSETIPOOPERACION_PRESTACIONSERVICIOS_NOSUJETA_IMPORTETAIREGLASLOCALIZACION</sii:ImporteTAIReglasLocalizacion>
                        </sii:NoSujeta>

                     </sii:PrestacionServicios>



                     //** SUBBLOQUE 3,
                     //** por ENTREGA DE BIENES

                     <sii:Entrega>
                        <sii:Sujeta>

                           //** SUBLOQUE 3, aptdo. 1
                           //** Exenta
                           <sii:Exenta>

%BLOQUE_DETALLE_EXENTA2%

                           </sii:Exenta>




                           //** SUBLOQUE 3, aptdo. 2
                           //** No Exenta
                           //** Usada para ISP
                           <sii:NoExenta>
                              <sii:TipoNoExenta>%VALOR_ENTREGA_SUJETA_NOEXENTA_TIPONOEXENTA%</sii:TipoNoExenta>
                              <sii:%ETI_DESGLOSE_IVA%>
%BLOQUE_ENTREGA_SUJETA_NOEXENTA_DESGLOSEIVA%
                              </sii:%ETI_DESGLOSE_IVA%>
                           </sii:NoExenta>



                        </sii:Sujeta>
                     </sii:Entrega>


                  </sii:DesgloseTipoOperacion>



               </sii:TipoDesglose>
            </siiLR:FacturaExpedida>
         </siiLR:RegistroLRFacturasEmitidas>
ENDTEXT
RETURN c
 
paquitohm
 
Posts: 108
Joined: Fri Jan 14, 2022 8:37 am

Re: PepPol European Invoicing standard

Postby FiveWiDi » Wed Feb 14, 2024 10:34 pm

paquitohm wrote:
Antonio Linares wrote:Better use:

Code: Select all  Expand view
TEXT INTO cInvoice
   ...
ENDTEXT


Hola a todos

Muy interesante hilo

A mi me gusta la solucion TEXT INTO y es la que utilizo, pero los xml a generar son más que simple texto porque tienen tags que pueden o no llevar valores y quizas ramas completas que quedan vacias y tambien tienen ramas que pueden repetirse más de una vez.
En ambos casos desarrolle soluciones que borran ramas vacias agrupaciones que pueden aparecer mas de una vez

Dicho de otra forma, aunque TEXT INTO a simple vista puede ser lo mejor, cuando el formato es complejo, puede hacerse complicado el manejo del TEXTO INTO. Aun asi, la construccion manual, mediante hashes o simple encadenamiento de strings tampoco es mas facil y mucho menos más clara.

Saludos


Soy de la opinión que un XML debería tratarse con las funciones específicas para ello, por ejemplo:

oDoc := TXMLDocument():New()
oDoc:oRoot:AddBelow( TxmlNode():New( HBXML_TYPE_PI, 'xml' , , "version='1.0' encoding='ISO-8859-1'" ) )
oDocument := TxmlNode():New( HBXML_TYPE_TAG, "Document" )
oDocument:SetAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" )
oDummyx:AddBelow( TxmlNode():New( HBXML_TYPE_TAG, 'SeqTp', , If( lPrimeraFact, "FRST", "RCUR" ) ) )
etc..

(extraídas de la programación de los recibos SEPA)

Otra cosa es que necesita de una lógica de programación que permita el encadenamiento correcto de los nodos, que precisa de la creación previa de los mismos (como un puzzle de nodos), y al final realizar su encadenado.

Mi humilde opinión.
Un Saludo
Carlos G.

FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
FiveWiDi
 
Posts: 1060
Joined: Mon Oct 10, 2005 2:38 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 62 guests