Invantive SQL supporta Exact Online con oltre 1.100 tabelle. Inoltre esistono prodotti come Get My Report in cui report predefiniti mettono a disposizione i dati come download su più amministrazioni contemporaneamente.
Talvolta però è preferibile disporre di uno strumento di reportistica personalizzato, in cui i report possano essere recuperati dagli utenti dell’azienda in un formato proprio fisso. Con Invantive Cloud questo è possibile, anche senza l’uso di Power BI o Qlik.
Questo argomento mostra come selezionare e scaricare in un’unica operazione tutte le righe delle fatture di vendita con informazioni aggiuntive, tramite una propria app Invantive Cloud. Il formato di download Excel è un formato molto utilizzato da sales manager e venditori che vogliono analizzare le proprie attività commerciali di Exact Online tramite tabelle pivot personalizzate. La query SQL di Exact Online è il modulo Righe Fattura di Vendita su Get My Report per Exact Online.
I dati di vendita possono provenire da un’unica amministrazione finanziaria o da più amministrazioni contemporaneamente, a seconda di come è configurato il database Exact Online in Invantive Cloud. Tieni presente che i dati finanziari provenienti dal libro vendite di amministrazioni diverse possono avere basi differenti, ad esempio in Euro e in Dollari USA.
Se un’app richiede più di 3 minuti o deve essere richiamata in modo automatizzato, è possibile farlo tramite Invantive App Online, il “fratellino” di Invantive Bridge Online per Power BI. Vedi anche Wat is Invantive App Online?.
Preparazioni
Sono necessarie le seguenti preparazioni:
- Un codice di accesso su Invantive Cloud.
- Un codice di accesso su Exact Online con una o più amministrazioni.
Definizione del Database Exact Online
Il primo passo consiste nel definire un database Exact Online. Puoi farlo molto facilmente seguendo questa procedura:
Questo database Exact Online può essere utilizzato per Power BI, Power Query o Azure Data Factory, ma altrettanto facilmente, ad esempio, per Access OData oppure — come in questo caso — come fonte per un’applicazione Invantive Cloud.
Definizione dell’Applicazione Cloud
Il passo successivo è definire un’app su Invantive Cloud che recuperi i dati di vendita da Exact Online. Segui questi passaggi:
- Seleziona nel menu a sinistra ‘Applicazioni’:
- Scegli ‘Nuovo’.
- Compila i campi come segue:
- Scegli ‘Moduli’.
- Scegli ‘Nuovo’.
- Compila i campi come segue:
Creare e Popolare il File Excel con i Dati di Vendita di Exact Online
Questo modulo conterrà il codice per impostare i parametri e successivamente creare il file Excel contenente i dati di vendita provenienti da Exact Online.
Il codice completo si trova alla fine di questo articolo.
Vuoi procedere rapidamente?
- Incolla il codice nel modulo, nel campo “Codice sorgente”.
- Scegli “My First App” nel percorso di navigazione in alto.
- Scegli “Esegui”.
- Scegli il database Exact Online (se ci sono più database).
- Scegli “Esegui”:
- Scegli il modulo:
- Inserisci la data di inizio e di fine:
- Il file Excel verrà scaricato.
Altri esempi di app
Altri esempi di app personalizzate sono disponibili qui:
- Hoe kan ik openstaande posten en bankmutaties downloaden in Google Sheets vanuit Exact Online?
- Create a mini-site to download your Exact Online articles (Inglese)
- Excel download uit Exact Online in eigen formaat met een cloud app
- Upload and process a file using Invantive App Online (Inglese)
- App Online download van Exact Online voor WICS bevat niet laatste transacties
- Uploaden WICS XML pick files naar Invantive App Online
- Generate JSON from Invantive UniversalSQL queries
Codice Sorgente Report di Vendita
Il seguente codice sorgente è lo strumento di reportistica per scaricare le informazioni di vendita di Exact Online come un foglio di lavoro Excel. Finché la variabile p_run non è true, verrà mostrata la schermata di inserimento per la data di inizio e di fine. Il foglio di lavoro Excel viene scaricato quando la variabile p_run viene impostata su true tramite la schermata di inserimento.
declare
p_run boolean := false;
p_cfn_factuur_datum_vanaf date := null;
p_cfn_factuur_datum_tot date := null;
--
l_workbook excel_workbook;
l_worksheet excel_worksheet;
l_binary blob;
begin
--
-- Recupera i parametri.
--
p_run := cast(cloud_http.get_request_query_parameter_value('p_run') as boolean);
--
p_cfn_factuur_datum_vanaf := to_date(cloud_http.get_request_query_parameter_value('p_cfn_factuur_datum_vanaf'), 'YYYY-MM-DD');
p_cfn_factuur_datum_tot := to_date(cloud_http.get_request_query_parameter_value('p_cfn_factuur_datum_tot'), 'YYYY-MM-DD');
--
if coalesce(p_run, false) = false
then
cloud_http.set_use_template(true);
cloud_http.set_template_step_name(translate_resources('{res:itgen_parameters}'));
cloud_http.append_line_to_response_body_text('<form>');
cloud_http.append_line_to_response_body_text('<input type="hidden" id="p_run" name="p_run" value="true"/>');
cloud_http.append_line_to_response_body_text('<ul>');
cloud_http.append_line_to_response_body_text('<li><label for="p_cfn_factuur_datum_vanaf">' || translate_resources('{res:itgen_invoice_date_from}') || '</label></li><li><input id="p_cfn_factuur_datum_vanaf" name="p_cfn_factuur_datum_vanaf" type="date" value="' || to_char(add_months(trunc(sysdateutc, -1), -1), 'YYYY-MM-DD') || '"/></li>');
cloud_http.append_line_to_response_body_text('<li><label for="p_cfn_factuur_datum_tot">' || translate_resources('{res:itgen_invoice_date_to}') || '</label></li><li><input id="p_cfn_factuur_datum_tot" name="p_cfn_factuur_datum_tot" type="date" value="' || to_char(add_months(trunc(sysdateutc, -1), +1), 'YYYY-MM-DD') || '"/></li>');
cloud_http.append_line_to_response_body_text('<li><input type="submit" value="Start"/></li>');
cloud_http.append_line_to_response_body_text('</ul>');
cloud_http.append_line_to_response_body_text('</form>');
else
--
-- Verifica i parametri.
--
-- Nessun controllo.
--
-- Crea un foglio di lavoro Excel.
--
l_workbook := excel.new();
--
-- Aggiungi un foglio per le righe delle fatture di vendita di Exact Online.
--
l_worksheet := excel.add_worksheet
( l_workbook
, 'SALES SOURCE DATA'
);
--
-- Crea un elenco delle righe delle fatture di vendita.
--
create or replace table rpt@inmemorystorage
as
select /*+ result_set_name("SalesInvoiceLines") */
sie.invoicenumber
label 'Invoice Number'
, sle.LineNumber
label 'Line Number'
, sie.invoicedate
label 'Invoice Date'
, sie.ordernumber
label 'Order Number'
, sie.orderdate
label 'Order Date'
, sie.SalespersonFullName
label 'Sales Person Full Name'
, actord.code
label 'Ordered by Code'
, actord.name
label 'Ordered by Name'
, cttord.fullname
label 'Ordered by Contact'
, amrord.FullName AccountManagerFullName
label 'Ordered by Account Manager'
, actord.Email
label 'Ordered by Email'
, actdlr.code
label 'Deliver to Company Code'
, actdlr.name
label 'Deliver to Company Name'
, sie.delivertocontactpersonfullname
label 'Deliver to Contact'
, adsdlr.addressline1
label 'Deliver to Address Line 1'
, adsdlr.postcode
label 'Deliver to Postcode'
, adsdlr.city
label 'Deliver to City'
, adsdlr.country
label 'Deliver to Country'
, actdlr.email
label 'Deliver to Email'
, amrive.FullName AccountManagerFullName
label 'Invoice Account Manager'
, active.name
label 'Invoice Company Name'
, active.Email
label 'Invoice Email'
, active.AddressLine1
label 'Invoice Address Line 1'
, active.Postcode
label 'Invoice Postcode'
, active.City
label 'Invoice City'
, active.Country
label 'Invoice Country'
, sie.duedate
label 'Due Date'
, gat.Code GLAccountCode
label 'General Ledger Account'
, igp.code itemgroupcode
label 'Item Group'
, sle.itemcode
label 'Item Code'
, sle.itemdescription
label 'Item Description'
, sle.description
label 'Description'
, sim.SupplierCode
label 'Main Supplier Code'
, sim.SupplierDescription
label 'Main Supplier Name'
, sle.StartTime
label 'Start'
, sle.EndTime
label 'End'
, sle.quantity
label 'Quantity'
, sle.UnitDescription
label 'Unit Description'
, sle.NetPrice
label 'Net Price'
, sle.unitprice
label 'Unit Price'
, sle.discount * 100
label 'Discount'
, sle.unitprice * ( 1 - sle.discount )
label 'Net Price per Unit'
, sle.netamountdc
label 'Net Price Total'
, sle.unitprice * sle.discount * sle.quantity
label 'Amount Discount'
, sle.VATAmountDC
label 'VAT Amount (EUR)'
, itm.costpricecurrency
label 'Cost Price Currency'
, itm.costpricestandard
label 'Cost Price Standard'
, itm.costpricestandard * sle.quantity
label 'Standard Cost Price Total'
, itm.NetWeight
label 'Net Weight'
, itm.GrossWeight
label 'Gross Weight'
from exactonlinerest..salesinvoicesbulk@eol sie
join exactonlinerest..salesinvoicelinesBulk@eol sle
on sle.division = sie.division
and sle.invoiceid = sie.invoiceid
join ItemsIncremental@eol itm
on itm.division = sle.division
and itm.id = sle.item
join ItemGroups@eol igp
on igp.division = itm.division
and igp.id = itm.ItemGroup
join GLAccountsIncremental@eol gat
on gat.Id = sle.GLAccount
join AccountsIncremental@eol actord
on actord.division = sie.division
and actord.id = sie.orderedby
left
outer
join exactonlinerest..users@eol amrord
on amrord.userId = actord.AccountManager
left
outer
join ContactsIncremental@eol cttord
on cttord.id = sie.orderedbycontactperson
join AccountsIncremental@eol actdlr
on actdlr.id = sie.deliverto
left
outer
join AddressesIncremental@eol adsdlr
on adsdlr.id = sie.delivertoaddress
join AccountsIncremental@eol active
on active.id = sie.invoiceto
left
outer
join exactonlinerest..users@eol amrive
on amrive.userId = actord.AccountManager
left
outer
join SupplierItems@eol sim
on sim.division = sle.division
and sim.ItemCode = sle.itemcode
and sim.MainSupplier = true
where sie.status = 50
and sie.invoicedate between coalesce(p_cfn_factuur_datum_vanaf, sie.invoicedate) and coalesce(p_cfn_factuur_datum_tot, sie.invoicedate)
order
by sie.invoicenumber
, sie.ordernumber
, sle.linenumber
;
--
-- Inserisci gli elementi nel foglio di lavoro Excel.
--
excel.fill_using_query(l_worksheet, 'select * except rowid$ from rpt@inmemorystorage');
--
-- Aggiungi un foglio con un titolo.
--
l_worksheet := excel.add_worksheet
( l_workbook
, 'FILTER'
);
excel.set_cell_contents(l_worksheet, 'A1', 'Sales Invoices');
excel.set_cell_contents(l_worksheet, 'A3', translate_resources('{res:itgen_user}'));
excel.set_cell_contents(l_worksheet, 'B3', sys_context('USERENV', 'USER_FULL_NAME', 'eol'));
--
excel.set_cell_contents(l_worksheet, 'A4', translate_resources('{res:itgen_generated}'));
excel.set_cell_contents(l_worksheet, 'B4', to_char(sysdateutc, 'DD-MM-YYYY HH24:MI:SS'));
--
excel.set_cell_contents(l_worksheet, 'A6', translate_resources('{res:itgen_invoice_date_from}'));
excel.set_cell_contents(l_worksheet, 'B6', p_cfn_factuur_datum_vanaf);
--
excel.set_cell_contents(l_worksheet, 'A7', translate_resources('{res:itgen_invoice_date_to}'));
excel.set_cell_contents(l_worksheet, 'B7', p_cfn_factuur_datum_tot);
--
-- Recupera il file XLSX risultante.
--
l_binary := excel.export_to_xlsx(l_workbook);
--
-- Restituisci il file XLSX all'utente.
--
cloud_http.set_response_body_binary(l_binary);
cloud_http.set_response_content_type('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
cloud_http.set_response_header_value
( 'Content-Disposition'
, 'attachment; filename="Sales Invoices Fixed Format.xlsx'
);
end if;
end;





