Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Pollastri committed Nov 14, 2023
1 parent 901c36d commit 48bcd44
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 106 deletions.
52 changes: 52 additions & 0 deletions example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

// Test Example File

require('vendor/autoload.php');

use Axiostudio\FatturaElettronica\FatturaElettronica;

$fattura = new FatturaElettronica();

$datiTrasmissione = ['12345678910', '123'];

$anagraficaPrestatore = ['12345678910', 'fornitore srl'];
$sedePrestatore = ['via roma', '12345', 'roma', 'RM'];

$cedentePrestatore = [$anagraficaPrestatore, $sedePrestatore];

$anagraficaCommittente = ['12345678915', 'cliente srl'];
$sedeCommittente = ['via roma', '12345', 'roma', 'RM'];

$cessionarioCommittente = [$anagraficaCommittente, $sedeCommittente];

$datiGeneraliDocumento = ['123', '2021-01-01', '345.22'];

$datiGenerali = [$datiGeneraliDocumento];

$dettaglioPagamento = ['345.22'];

$datiDatiPagamento = [$dettaglioPagamento];

$dettaglioLinee = [
['Test Riga 1', '100.50'],
['Test Riga 2', '100.50'],
['Test Riga 3', '100.00', '1', 'pz', '0.00', 'N2.1'],
];

$datiRiepilogo = [
['201.00', '22.00'],
['100.00', '0.00', 'N2.1'],
];

$datiXml = $fattura->compose(
$datiTrasmissione,
$cedentePrestatore,
$cessionarioCommittente,
$datiGenerali,
$datiDatiPagamento,
$dettaglioLinee,
$datiRiepilogo
);

var_dump($datiXml);
19 changes: 17 additions & 2 deletions src/FatturaElettronica.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,26 @@ protected function create(
}

public function compose(
array $FatturaElettronicaHeader,
array $FatturaElettronicaBody,
array $datiTrasmissione,
array $cedentePrestatore,
array $cessionarioCommittente,
array $datiGenerali,
array $datiDatiPagamento,
array $DettaglioLinee,
array $DatiRiepilogo
): array {

$FatturaElettronicaHeader = [
$datiTrasmissione,
$cedentePrestatore,
$cessionarioCommittente
];

$FatturaElettronicaBody = [
$datiGenerali,
$datiDatiPagamento
];

return $this->create(
$FatturaElettronicaHeader,
$FatturaElettronicaBody,
Expand Down
104 changes: 0 additions & 104 deletions test-temp.php

This file was deleted.

0 comments on commit 48bcd44

Please sign in to comment.