FatturaPA tests

This commit is contained in:
David Bomba 2024-05-28 12:52:38 +10:00
parent 70c8e67613
commit e967373f85
2 changed files with 17 additions and 5 deletions

View File

@ -132,6 +132,12 @@ class FatturaPANew extends AbstractService
$anagrafica->Denominazione = $this->invoice->client->present()->name();
$datiAnagrafici->Anagrafica = $anagrafica;
$idFiscale = new IdFiscaleIVA;
$idFiscale->IdCodice= $this->invoice->client->vat_number;
$idFiscale->IdPaese = $this->invoice->client->country->iso_3166_2;
$datiAnagrafici->IdFiscaleIVA = $idFiscale;
$sede = new Sede;
$sede->Indirizzo = $this->invoice->client->address1;
$sede->CAP = (int)$this->invoice->client->postal_code;
@ -205,6 +211,8 @@ class FatturaPANew extends AbstractService
private function setLineItems(): self
{
$calc = $this->invoice->calc();
$datiBeniServizi = new DatiBeniServizi();
$tax_rate_level = 0;
//line items
@ -233,7 +241,6 @@ class FatturaPANew extends AbstractService
$tax_rate_level = sprintf('%0.2f', $this->invoice->tax_rate1);
}
$calc = $this->invoice->calc();
$subtotal = sprintf('%0.2f', $calc->getSubTotal());
$taxes = sprintf('%0.2f', $calc->getTotalTaxes());

View File

@ -76,7 +76,6 @@ $settings->state = 'PA';
'name' => 'Italian Client Name',
'address1' => 'Via Antonio da Legnago 68',
'city' => 'Monasterace',
'state' => 'CR',
// 'state' => 'Reggio Calabria',
'postal_code' => '89040',
@ -90,6 +89,8 @@ $settings->state = 'PA';
$item->notes = "Product Description";
$item->cost = 10;
$item->quantity = 10;
$item->tax_rate1 = 22;
$item->tax_name1 = 'IVA';
$invoice = Invoice::factory()->create([
'company_id' => $company->id,
@ -98,8 +99,12 @@ $settings->state = 'PA';
'discount' => 0,
'uses_inclusive_taxes' => false,
'status_id' => 1,
'tax_rate1' => 19,
'tax_name1' => 'IVA',
'tax_rate1' => 0,
'tax_name1' => '',
'tax_rate2' => 0,
'tax_rate3' => 0,
'tax_name2' => '',
'tax_name3' => '',
'line_items' => [$item],
'number' => 'ITA-'.rand(1000,100000)
]);