1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00

Merge pull request #9517 from turbo124/v5-develop

v5.8.56
This commit is contained in:
David Bomba 2024-05-14 07:48:47 +10:00 committed by GitHub
commit 957a36cc93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
63 changed files with 1571 additions and 159 deletions

View File

@ -1 +1 @@
5.8.54
5.8.56

View File

@ -30,7 +30,7 @@ class RevenueTrack extends GenericMixedMetric
* The name of the counter.
* @var string
*/
public $name = 'app.revenue';
public $name = 'app.cac';
/**
* The datetime of the counter measurement.
@ -59,14 +59,14 @@ class RevenueTrack extends GenericMixedMetric
*
* @var string
*/
public $string_metric7 = 'product';
public $string_metric7 = 'plan';
/**
* Gateway Reference
*
* @var string
*/
public $string_metric8 = 'gateway_reference';
public $string_metric8 = 'plan_term';
public $string_metric9 = 'entity_reference';

View File

@ -13,25 +13,19 @@ namespace App\DataMapper\EDoc;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\DatiContratto;
use App\DataMapper\EDoc\FatturaPA\DatiRicezione;
use App\DataMapper\EDoc\FatturaPA\DatiOrdineAcquisto;
use App\DataMapper\EDoc\FatturaPA\DatiAnagraficiVettore;
use App\DataMapper\EDoc\FatturaPA\FatturaElettronicaHeader;
use App\DataMapper\EDoc\FatturaPA\FatturaElettronicaBody;
// minimum required fields
// public string $RegimeFiscale = 'RF01',
// public string $TipoDocumento = 'TD01',
// public string $ModalitaPagamento = 'MP01',
// public string $CondizioniPagamento = 'TP02',
class FatturaPA extends Data
{
public DatiRicezione|Optional $DatiRicezione;
public DatiContratto|Optional $DatiContratto;
public DatiOrdineAcquisto|Optional $DatiOrdineAcquisto;
public DatiAnagraficiVettore|Optional $DatiAnagraficiVettore;
public function __construct(
public string $RegimeFiscale = 'RF01',
public string $TipoDocumento = 'TD01',
public string $ModalitaPagamento = 'MP01',
public string $CondizioniPagamento = 'TP02',
) {
}
public FatturaElettronicaHeader $FatturaElettronicaHeader;
public FatturaElettronicaBody $FatturaElettronicaBody;
}

View File

@ -0,0 +1,40 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\DatiVeicoli;
use App\DataMapper\EDoc\FatturaPA\Body\DatiGenerali;
use Spatie\LaravelData\Attributes\Validation\Max;
class Allegati extends Data
{
//string 60
#[Max(60)]
public string $NomeAttachment;
//base64 binary
public mixed $Attachment;
//string 10
#[Max(10)]
public string|Optional $AlgoritmoCompressione;
//string 10
#[Max(10)]
public string|Optional $FormatoAttachment;
//string 100
#[Max(100)]
public string|Optional $DescrizioneAttachment;
}

View File

@ -0,0 +1,42 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Illuminate\Support\Carbon;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Attributes\Validation\Regex;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class AltriDatiGestionali extends Data
{
//string 10
#[Max(10)]
public string $TipoDato;
//String60LatinType
#[Max(60)]
public string|Optional $RiferimentoTesto;
//Amount8DecimalType
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2,8}$/')]
public float|Optional $RiferimentoNumero;
//date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public Carbon|Optional $RiferimentoData;
}

View File

@ -0,0 +1,35 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Data;
class Anagrafica extends Data
{
//choice
//either Deminominazione OR
//string length 80
#[Max(80)]
public string $Denominazione = '';
////////////////////////////////////////////
//2. Nome AND CogNome
//string length 60
#[Max(60)]
public string $Nome = '';
//string length 60
#[Max(60)]
public string $CogNome = '';
}

View File

@ -0,0 +1,30 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Body;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\Validation\Size;
use Spatie\LaravelData\Attributes\Validation\Regex;
class DatiBollo extends Data
{
//SI
#[Size(2)]
public string $BolloVirtuale = 'SI';
//Amount2DecimalType
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2}$/')]
public float|Optional $ImportoBollo;
}

View File

@ -0,0 +1,53 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Body;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Size;
use Spatie\LaravelData\Attributes\Validation\Regex;
class DatiCassaPrevidenziale extends Data
{
//string 4char options
#[Size(4)]
public string $TipoCassa;
//rate type 0-100
#[Regex('/^[0-9]{1,3}\.[0-9]{2}$/')]
public float $AlCassa = 0;
//Amount2DecimalType
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2}$/')]
public float $ImportoContributoCassa;
//rate type 0-100
#[Regex('/^[0-9]{1,3}\.[0-9]{2}$/')]
public float $AliquotaIVA;
//Amount2DecimalType
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2}$/')]
public float|Optional $ImponibileCassa;
//string string options
#[Size(4)]
public string|Optional $Ritenuta;
//string 2char options
public string|Optional $Natura;
//String20Type
#[Max(20)]
public string|Optional $RiferimentoAmministrazione;
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Body;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\DatiTrasporto;
use App\DataMapper\EDoc\FatturaPA\Generics\DatiDDT;
use App\DataMapper\EDoc\FatturaPA\Generics\DatiSAL;
use App\DataMapper\EDoc\FatturaPA\FatturaPrincipale;
use App\DataMapper\EDoc\FatturaPA\Generics\DatiDocumentiCorrelatiType;
class DatiGenerali extends Data
{
public DatiGeneraliDocumento $DatiGeneraliDocumento;
public DatiDocumentiCorrelatiType|Optional $DatiOrdineAcquisto;
public DatiDocumentiCorrelatiType|Optional $DatiContratto;
public DatiDocumentiCorrelatiType|Optional $DatiConvenzione;
public DatiDocumentiCorrelatiType|Optional $DatiRicezione;
public DatiDocumentiCorrelatiType|Optional $DatiFattureCollegate;
public DatiSAL|Optional $DatiSAL;
public DatiDDT|Optional $DatiDDT;
public DatiTrasporto|Optional $DatiTrasporto;
public FatturaPrincipale|Optional $FatturaPrincipale;
}

View File

@ -0,0 +1,64 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Body;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\Body\DatiBollo;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Size;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Attributes\Validation\Regex;
use App\DataMapper\EDoc\FatturaPA\Body\DatiRitenuta;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DatiGeneraliDocumento extends Data
{
//string regex [A-Z]{3}
public string $Divisa;
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d\TH:i:s.uP')]
public \Illuminate\Support\Carbon $Data;
//string max 20 char
#[Max(20)]
public string $Numero;
public DatiRitenuta|Optional $DatiRitenuta;
public DatiBollo|Optional $DatiBollo;
public DatiCassaPrevidenziale|Optional $DatiCassaPrevidenziale;
public ScontoMaggiorazione|Optional $ScontoMaggiorazione;
//float 2 decimal type
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2}$/')]
public float|Optional $ImportoTotaleDocumento;
//float 2 decimal type
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2}$/')]
public float|Optional $Arrotondamento;
//string 200char
/** @var string[] */
public array|Optional $Causale;
//SI = Documento emesso secondo modalità e termini stabiliti con DM ai sensi dell'art. 73 DPR 633/72
//optional 2 char - only value possible = SI
#[Size(2)]
public string|Optional $Art73;
//length 4 - optional
#[Size(4)]
public string $TipoDocumento = 'TD01';
}

View File

@ -0,0 +1,70 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Body;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Size;
use Spatie\LaravelData\Attributes\Validation\Regex;
class DatiRitenuta extends Data
{
//string 4 char options
#[Size(4)]
public string $TipoRitenuta;
//float 2 decimal
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2}$/')]
public float $ImportoRitenuta;
// <xs:restriction base="xs:decimal">
// <xs:maxInclusive value="100.00" />
// <xs:pattern value="/^[0-9]{1,3}\.[0-9]{2}$/" />
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2}$/')]
public float $AliquotaRitenuta;
/*
<xs:enumeration value="A" />
<xs:enumeration value="B" />
<xs:enumeration value="C" />
<xs:enumeration value="D" />
<xs:enumeration value="E" />
<xs:enumeration value="G" />
<xs:enumeration value="H" />
<xs:enumeration value="I" />
<xs:enumeration value="L" />
<xs:enumeration value="M" />
<xs:enumeration value="N" />
<xs:enumeration value="O" />
<xs:enumeration value="P" />
<xs:enumeration value="Q" />
<xs:enumeration value="R" />
<xs:enumeration value="S" />
<xs:enumeration value="T" />
<xs:enumeration value="U" />
<xs:enumeration value="V" />
<xs:enumeration value="W" />
<xs:enumeration value="X" />
<xs:enumeration value="Y" />
<!-- IL CODICE SEGUENTE (Z) NON SARA' PIU' VALIDO PER LE FATTURE EMESSE A PARTIRE DAL PRIMO GENNAIO 2021-->
<xs:enumeration value="Z" />
<xs:enumeration value="L1" />
<xs:enumeration value="M1" />
<xs:enumeration value="M2" />
<xs:enumeration value="O1" />
<xs:enumeration value="V1" />
<xs:enumeration value="ZO" />
*/
#[Max(2)]
public string $CausalePagamento;
}

View File

@ -0,0 +1,33 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Body;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\Validation\Size;
use Spatie\LaravelData\Attributes\Validation\Regex;
class ScontoMaggiorazione extends Data
{
//string options
//SC - Sconto //discount
//MG - Maggiorazione //surcharge
#[Size(2)]
public string $Tipo;
//float 0-100
#[Regex('/^[0-9]{1,3}\.[0-9]{2}$/')]
public float|Optional $Percentuale;
//Amount8DecimalType
#[Regex('/^[\-]?[0-9]{1,11}\.[0-9]{2,8}$/')]
public float|Optional $Importo;
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
class Contatti extends Data
{
public string|Optional $Telefono;
public string|Optional $Fax;
public string|Optional $Email;
}

View File

@ -12,17 +12,17 @@
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\Header\IdFiscaleIVA;
class DatiAnagraficiVettore extends Data
{
public function __construct(
public string $IdFiscaleIVA = '',
public string $CodiceFiscale = '',
public string $Anagrafica = '',
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d\TH:i:s.uP')]
public \DateTime $DataOraConsegna = new \DateTime(),
){}
public IdFiscaleIVA $IdFiscaleIVA;
public Anagrafica $Anagrafica;
public string|Optional $CodiceFiscale;
//String20Type
public string|Optional $NumeroLicenzaGuida;
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use App\DataMapper\EDoc\FatturaPA\DettaglioLinee;
class DatiBeniServizi extends Data
{
public DettaglioLinee $DettaglioLinee;
public DatiRiepilogo $DatiRiepilogo;
}

View File

@ -1,28 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
class DatiContratto extends Data
{
public function __construct(
public string $RiferimentoNumeroLinea = '',
public string $IdDocumento = '',
public string $Data = '',
public string $NumItem = '',
public string $CodiceCommessaConvenzione = '',
public string $CodiceCUP = '',
public string $CodiceCIG = '',
) {
}
}

View File

@ -1,28 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
class DatiOrdineAcquisto extends Data
{
public function __construct(
public string $RiferimentoNumeroLinea = '',
public string $IdDocumento = '',
public string $Data = '',
public string $NumItem = '',
public string $CodiceCommessaConvenzione = '',
public string $CodiceCUP = '',
public string $CodiceCIG = '',
) {
}
}

View File

@ -0,0 +1,23 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use App\DataMapper\EDoc\FatturaPA\DettaglioPagamento;
use Spatie\LaravelData\Data;
class DatiPagamento extends Data
{
//string min4 max4 - optionlist
public string $CondizioniPagamento = 'TP02';
public DettaglioPagamento $DettaglioPagamento;
}

View File

@ -1,28 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
class DatiRicezione extends Data
{
public function __construct(
public string $RiferimentoNumeroLinea = '',
public string $IdDocumento = '',
public string $Data = '',
public string $NumItem = '',
public string $CodiceCommessaConvenzione = '',
public string $CodiceCUP = '',
public string $CodiceCIG = '',
) {
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
class DatiRiepilogo extends Data
{
//float 0-100.0
public float $AliquotaIVA;
//Amount2DecimalType
public float $ImponibileImporto;
//Amount2DecimalType
public float $Imposta;
//string - options
public string|Optional $Natura;
//Amount2DecimalType
public float|Optional $SpeseAccessorie;
//Amount8DecimalType
public float|Optional $Arrotondamento;
//string options D/I/S
public string|Optional $EsigibilitaIVA;
//String100LatinType
public string|Optional $RiferimentoNormativo;
}

View File

@ -0,0 +1,70 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Illuminate\Support\Carbon;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DatiTrasporto extends Data
{
public DatiAnagraficiVettore|Optional $DatiAnagraficiVettore;
//String80LatinType
public string|Optional $MezzoTrasporto;
//String100LatinType
public string|Optional $CausaleTrasporto;
//int 1-9999
public int|Optional $NumeroColli;
//String100LatinType
public string|Optional $Descrizione;
//String10Type
public string|Optional $UnitaMisuraPeso;
//[0-9]{1,4}\.[0-9]{1,2} //decimal
public float|Optional $PesoLordo;
//[0-9]{1,4}\.[0-9]{1,2} //decimal
public float|Optional $PesoNetto;
//dateTime
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d\TH:i:s.uP')]
public Carbon|Optional $DataOraRitiro;
//date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public Carbon|Optional $DataInizioTrasporto;
//[A-Z]{3}
public string|Optional $TipoResa;
public Sede|Optional $IndirizzoResa;
//dateTime
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public Carbon|Optional $DataOraConsegna;
// public function __construct()
// {
// $this->DataOraConsegna = new \DateTime();
// $this->DataInizioTrasporto = new \DateTime();
// $this->DataInizioTrasporto = new \DateTime();
// }
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Illuminate\Support\Carbon;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DatiVeicoli extends Data
{
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public Carbon|Optional $Data;
//String15Type
public string $TotalePercorso;
public function __construct()
{
// $this->Data = new \DateTime();
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\WithTransformer;
use App\DataMapper\EDoc\FatturaPA\Generics\CodiceArticolo;
use App\DataMapper\EDoc\FatturaPA\Body\ScontoMaggiorazione;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DettaglioLinee extends Data
{
//1-9999
public int $NumeroLinea;
//String1000LatinType
public string $Descrizione;
//Amount8DecimalType
public float $PrezzoUnitario;
// Amount8DecimalType
public float $PrezzoTotale;
// <xs:restriction base="xs:decimal">
// <xs:maxInclusive value="100.00" />
// <xs:pattern value="/^[0-9]{1,3}\.[0-9]{2}$/" />
// 0-100
public float $AliquotaIVA;
//string 2 char options
public string|Optional $TipoCessionePrestazione;
public CodiceArticolo|Optional $CodiceArticolo;
// <xs:restriction base="xs:decimal">
// <xs:pattern value="[0-9]{1,12}\.[0-9]{2,8}" />
public float|Optional $Quantita;
//String10Type
public string|Optional $UnitaMisura;
//date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon|Optional $DataInizioPeriodo;
//date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon|Optional $DataFinePeriodo;
public ScontoMaggiorazione|Optional $ScontoMaggiorazione;
//4 char options
public string|Optional $Ritenuta;
//string options
public string|Optional $Natura;
//string 20 char
public string|Optional $RiferimentoAmministrazione;
public AltriDatiGestionali|Optional $AltriDatiGestionali;
}

View File

@ -0,0 +1,92 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\DatiVeicoli;
use Spatie\LaravelData\Attributes\WithTransformer;
use App\DataMapper\EDoc\FatturaPA\Body\DatiGenerali;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DettaglioPagamento extends Data
{
//string length 4 - options
public string $ModalitaPagamento = 'MP01';
// Amount2DecimalType
public float $ImportoPagamento;
//String200LatinType
public string|Optional $Beneficiario;
//date
public string|Optional $DataRiferimentoTerminiPagamento;
// <xs:restriction base="xs:integer">
// <xs:minInclusive value="0" />
// <xs:maxInclusive value="999" />
public int|Optional $GiorniTerminiPagamento;
//date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon|Optional $DataScadenzaPagamento;
//String20Type
public string|Optional $CodUfficioPostale;
//String60LatinType
public string|Optional $CognomeQuietanzante;
//String60LatinType
public string|Optional $NomeQuietanzante;
//string [A-Z0-9]{16}
public string|Optional $CFQuietanzante;
//string {IsBasicLatin}{2,10}
public string|Optional $TitoloQuietanzante;
//string String80LatinType
public string|Optional $IstitutoFinanziario;
//[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{11,30}
public string|Optional $IBAN;
// string [0-9][0-9][0-9][0-9][0-9]
public string|Optional $ABI;
//[0-9][0-9][0-9][0-9][0-9]
public string|Optional $CAB;
//[A-Z]{6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3}){0,1}
public string|Optional $BIC;
//Amount2DecimalType
public float|Optional $ScontoPagamentoAnticipato;
//Date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon|Optional $DataLimitePagamentoAnticipato;
//Amount2DecimalType
public float|Optional $PenalitaPagamentiRitardati;
//date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon|Optional $DataDecorrenzaPenale;
//String60Type
public string|Optional $CodicePagamento;
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\DatiVeicoli;
use App\DataMapper\EDoc\FatturaPA\DatiBeniServizi;
use App\DataMapper\EDoc\FatturaPA\Body\DatiGenerali;
class FatturaElettronicaBody extends Data
{
public DatiGenerali $DatiGenerali;
public DatiBeniServizi $DatiBeniServizi;
public DatiVeicoli|Optional $DatiVeicoli;
public DatiPagamento|Optional $DatiPagamento;
public Allegati|Optional $Allegati;
}

View File

@ -0,0 +1,24 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use App\DataMapper\EDoc\FatturaPA\Header\DatiTrasmissione;
use App\DataMapper\EDoc\FatturaPA\Header\CedentePrestatore;
use App\DataMapper\EDoc\FatturaPA\Header\CessionarioCommittente;
class FatturaElettronicaHeader extends Data
{
public DatiTrasmissione $DatiTrasmissione; //DatiTrasmissione
public CedentePrestatore $CedentePrestatore; //CedentePrestatore
public CessionarioCommittente $CessionarioCommittente; //CessionarioCommittente
}

View File

@ -0,0 +1,26 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class FatturaPrincipale extends Data
{
//String20Type
public string $NumeroFatturaPrincipale;
//dateTime
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon|Optional $DataFatturaPrincipale;
}

View File

@ -0,0 +1,27 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Generics;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\Validation\Max;
class CodiceArticolo extends Data
{
//string 35 char
#[Max(35)]
public string $CodiceTipo;
//string 35 char
#[Max(35)]
public string $CodiceValore;
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Generics;
use Spatie\LaravelData\Attributes\Validation\Between;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DatiDDT extends Data
{
//String20Type
public string $NumeroDDT;
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon $DataDDT;
//int 1-9999
#[Between(1,9999)]
public int|Optional $RiferimentoNumeroLinea;
}

View File

@ -0,0 +1,43 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Generics;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Attributes\Validation\Between;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DatiDocumentiCorrelatiType extends Data
{
//String20Type
#[Max(20)]
public string $IdDocumento;
//int 1-9999
#[Between(1,9999)]
public int|Optional $RiferimentoNumeroLinea;
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Illuminate\Support\Carbon|Optional $Data;
//String20Type
#[Max(20)]
public string|Optional $NumItem;
//String100LatinType
#[Max(100)]
public string|Optional $CodiceCommessaConvenzione;
//String15Type
#[Max(15)]
public string|Optional $CodiceCUP;
//String15Type
#[Max(15)]
public string|Optional $CodiceCIG;
}

View File

@ -0,0 +1,24 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Generics;
use Spatie\LaravelData\Attributes\Validation\Between;
use Spatie\LaravelData\Data;
class DatiSAL extends Data
{
//int 1-999
#[Between(1,999)]
public int $RiferimentoFase;
}

View File

@ -0,0 +1,40 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Header;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\Sede;
use App\DataMapper\EDoc\FatturaPA\Contatti;
use App\DataMapper\EDoc\FatturaPA\IscrizioneREA;
use App\DataMapper\EDoc\FatturaPA\Header\DatiAnagrafici;
use App\DataMapper\EDoc\FatturaPA\StabileOrganizzazione;
class CedentePrestatore extends Data
{
public function __construct(
public DatiAnagrafici $DatiAnagrafici,
public Sede $Sede,
public StabileOrganizzazione|Optional $StabileOrganizzazione,
public IscrizioneREA|Optional $IscrizioneREA,
public Contatti|Optional $Contatti,
public string|Optional $RiferimentoAmministrazione,
){}
}

View File

@ -0,0 +1,31 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Header;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\Sede;
use App\DataMapper\EDoc\FatturaPA\RappresentanteFiscale;
use App\DataMapper\EDoc\FatturaPA\Header\DatiAnagraficiCedenteType;
class CessionarioCommittente extends Data
{
public DatiAnagraficiCedenteType $DatiAnagrafici;
/** @var Sede[] */
public array $Sede;
/** @var Sede[] */
public array|Optional $StabileOrganizzazione;
public RappresentanteFiscale|Optional $RappresentanteFiscale;
}

View File

@ -0,0 +1,57 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Header;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\Anagrafica;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Size;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Attributes\Validation\Regex;
use App\DataMapper\EDoc\FatturaPA\Header\IdFiscaleIVA;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DatiAnagrafici extends Data
{
public function __construct(
public Anagrafica $Anagrafica,
public IdFiscaleIVA $IdFiscaleIVA,
// string length 4 - options = 'RF01'
#[Max(4)]
public string|Optional $RegimeFiscale,
#[Regex('/^[A-Z0-9]{11,16}$/')]
public string|Optional $CodiceFiscale,
//string 60 char
#[Max(60)]
public string|Optional $AlboProfessionale,
//string 2 char
#[Regex('/^[A-Z]{2}$/')]
#[Size(2)]
public string|Optional $ProvinciaAlbo,
//string 60 char
#[Max(60)]
public string|Optional $NumeroIscrizioneAlbo,
//Date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Datetime|Optional $DataIscrizioneAlbo,
){}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Header;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
use App\DataMapper\EDoc\FatturaPA\Anagrafica;
use Spatie\LaravelData\Attributes\WithTransformer;
use App\DataMapper\EDoc\FatturaPA\Header\IdFiscaleIVA;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Regex;
use Spatie\LaravelData\Attributes\Validation\Size;
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
class DatiAnagraficiCedenteType extends Data
{
public function __construct(
public Anagrafica $Anagrafica,
public IdFiscaleIVA|Optional $IdFiscaleIVA,
// string length 4 - options = 'RF01'
#[Size(4)]
public string|Optional $RegimeFiscale,
//[A-Z0-9]{11,16}
#[Regex('/^[A-Z0-9]{11,16}$/')]
public string|Optional $CodiceFiscale,
//string 60 char
#[Max(20)]
public string|Optional $AlboProfessionale,
//string 2 chat [A-Z]{2}
#[Size(2)]
#[Regex('/^[A-Z]{2}$/')]
public string|Optional $ProvinciaAlbo,
//string 60 char
#[Max(60)]
public string|Optional $NumeroIscrizioneAlbo,
//Date
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d')]
public \Datetime|Optional $DataIscrizioneAlbo,
){}
}

View File

@ -0,0 +1,33 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Header;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Regex;
use Spatie\LaravelData\Attributes\Validation\Size;
class DatiTrasmissione extends Data
{
public IdTrasmittente $IdTrasmittente; //IdTrasmittente
#[Max(10)]
public string $ProgressivoInvio = ''; //String
#[Size(5)]
public string $FormatoTrasmissione = ''; //String
#[Regex('/^[A-Z0-9]{6,7}$/')]
public string $CodiceDestinatario = ''; //String
}

View File

@ -0,0 +1,31 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Header;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Attributes\Validation\Regex;
use Spatie\LaravelData\Data;
class IdFiscaleIVA extends Data
{
public function __construct(
// #[\Required]
#[Regex('/^[A-Z]{2}$/')]
public string $IdPaese = '',
// #[\Required]
#[Min(1)]
#[Max(28)]
public string $IdCodice = '',
){}
}

View File

@ -0,0 +1,28 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA\Header;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Attributes\Validation\Regex;
class IdTrasmittente extends Data
{
#[Regex('/^[A-Z]{2}$/')]
public string $IdPaese; //String
#[Min(1)]
#[Max(28)]
public string $IdCodice; //String
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
class IscrizioneREA extends Data
{
//[A-Z]{2}
public string $Ufficio;
//string length 20
public string|Optional $NumeroREA;
//precision 2
public float|Optional $CapitaleSociale;
// options
// SU - socio unico (sole trader)
// SN - piu soci (multiple shareholders)
public string|Optional $SocioUnico;
// options
// LS - In Liquidation
// LN - Not in liquidation
public string $StatoLiquidazione = 'LN';
}

View File

@ -0,0 +1,26 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use App\DataMapper\EDoc\FatturaPA\Header\IdFiscaleIVA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
class RappresentanteFiscale extends Data
{
public IdFiscaleIVA $IdFiscaleIVA;
public Anagrafica $Anagrafica;
// <xs:pattern value="[A-Z0-9]{11,16}" />
public string|Optional $CodiceFiscaleType;
}

View File

@ -0,0 +1,30 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\Optional;
class Sede extends Data
{
public string $Indirizzo = ''; //string - address, 60char limit
public int $CAP = 12345; //[0-9][0-9][0-9][0-9][0-9] ie 12345
public string $Comune = ''; //String 60char limit
public string $Nazione = 'IT'; //String default IT
public string|Optional $Provincia; //String [A-Z]{2}
public string|Optional $NumeroCivico; // regex \p{IsBasicLatin}{1,8})
}

View File

@ -0,0 +1,17 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\EDoc\FatturaPA;
class StabileOrganizzazione extends Sede
{
}

File diff suppressed because one or more lines are too long

View File

@ -44,3 +44,29 @@ function nlog($output, $context = []): void
$output = null;
$context = null;
}
function nrlog($output, $context = []): void
{
if (! config('ninja.expanded_logging')) {
return;
}
if (gettype($output) == 'object') {
$output = print_r($output, 1);
}
// $trace = debug_backtrace();
if (Ninja::isHosted()) {
try {
info($output);
} catch (\Exception $e) {
}
} else {
\Illuminate\Support\Facades\Log::channel('invoiceninja-reminders')->info($output, $context);
}
$output = null;
$context = null;
}

View File

@ -11,36 +11,37 @@
namespace App\Http\Controllers;
use App\Models\Account;
use App\Models\BankIntegration;
use App\Models\BankTransaction;
use App\Models\BankTransactionRule;
use App\Models\User;
use App\Utils\Ninja;
use App\Models\Client;
use App\Models\CompanyGateway;
use App\Models\Design;
use App\Models\ExpenseCategory;
use App\Models\GroupSetting;
use App\Models\PaymentTerm;
use App\Utils\Statics;
use App\Models\Account;
use App\Models\TaxRate;
use App\Models\Webhook;
use App\Models\Scheduler;
use App\Models\TaskStatus;
use App\Models\TaxRate;
use App\Models\User;
use App\Models\Webhook;
use App\Transformers\ArraySerializer;
use App\Transformers\EntityTransformer;
use App\Utils\Ninja;
use App\Utils\Statics;
use App\Utils\Traits\AppSetup;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use App\Models\PaymentTerm;
use Illuminate\Support\Str;
use League\Fractal\Manager;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection;
use App\Models\GroupSetting;
use Illuminate\Http\Response;
use App\Models\CompanyGateway;
use App\Utils\Traits\AppSetup;
use App\Models\BankIntegration;
use App\Models\BankTransaction;
use App\Models\ExpenseCategory;
use League\Fractal\Resource\Item;
use App\DataMapper\EDoc\Schema\RO;
use App\Models\BankTransactionRule;
use Illuminate\Support\Facades\Auth;
use App\Transformers\ArraySerializer;
use App\Transformers\EntityTransformer;
use League\Fractal\Resource\Collection;
use Illuminate\Database\Eloquent\Builder;
use League\Fractal\Serializer\JsonApiSerializer;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use Illuminate\Contracts\Container\BindingResolutionException;
/**
* Class BaseController.
@ -993,7 +994,17 @@ class BaseController extends Controller
/** @var \App\Models\User $user */
$user = auth()->user();
$response['static'] = Statics::company($user->getCompany()->getLocale());
$response_data = Statics::company($user->getCompany()->getLocale());
if(request()->has('einvoice')){
$ro = new RO();
$response_data['einvoice_schema'] = $ro();
}
$response['static'] = $response_data;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Http\Controllers;
use App\DataMapper\EDoc\Schema\RO;
use App\Utils\Statics;
use Illuminate\Http\Response;
@ -56,8 +57,15 @@ class StaticController extends BaseController
/** @var \App\Models\User $user */
$user = auth()->user();
$response = Statics::company($user->getLocale() ?? $user->company()->getLocale());
$response_data = Statics::company($user->getLocale() ?? $user->company()->getLocale());
return response()->json($response, 200, ['Content-type' => 'application/json; charset=utf-8'], JSON_PRETTY_PRINT);
if(request()->has('einvoice')){
$ro = new RO;
$response_data['einvoice_schema'] = $ro();
}
return response()->json($response_data, 200, ['Content-type' => 'application/json; charset=utf-8'], JSON_PRETTY_PRINT);
}
}

View File

@ -78,6 +78,8 @@ class StoreCreditRequest extends Request
$rules['exchange_rate'] = 'bail|sometimes|numeric';
$rules['amount'] = ['sometimes', 'bail', 'numeric', 'max:99999999999999'];
$rules['date'] = 'bail|sometimes|date:Y-m-d';
if ($this->invoice_id) {
$rules['invoice_id'] = new ValidInvoiceCreditRule();
}

View File

@ -68,7 +68,9 @@ class UpdateCreditRequest extends Request
$rules['line_items'] = 'array';
$rules['discount'] = 'sometimes|numeric|max:99999999999999';
$rules['date'] = 'bail|sometimes|date:Y-m-d';
$rules['discount'] = 'sometimes|numeric|max:99999999999999';
$rules['is_amount_discount'] = ['boolean'];
$rules['tax_rate1'] = 'bail|sometimes|numeric';
$rules['tax_rate2'] = 'bail|sometimes|numeric';

View File

@ -66,6 +66,8 @@ class StoreInvoiceRequest extends Request
$rules['project_id'] = ['bail', 'sometimes', new ValidProjectForClient($this->all())];
$rules['is_amount_discount'] = ['boolean'];
$rules['date'] = 'bail|sometimes|date:Y-m-d';
$rules['line_items'] = 'array';
$rules['discount'] = 'sometimes|numeric|max:99999999999999';
$rules['tax_rate1'] = 'bail|sometimes|numeric';

View File

@ -80,6 +80,8 @@ $rules['discount'] = 'sometimes|numeric|max:99999999999999';
$rules['partial'] = 'bail|sometimes|nullable|numeric';
$rules['amount'] = ['sometimes', 'bail', 'numeric', 'max:99999999999999'];
$rules['date'] = 'bail|sometimes|date:Y-m-d';
// $rules['partial_due_date'] = ['bail', 'sometimes', 'exclude_if:partial,0', Rule::requiredIf(fn () => $this->partial > 0), 'date', 'before:due_date'];
// $rules['due_date'] = ['bail', 'sometimes', 'nullable', 'after:partial_due_date', Rule::requiredIf(fn () => strlen($this->partial_due_date) > 1), 'date'];

View File

@ -61,10 +61,11 @@ class StoreQuoteRequest extends Request
$rules['number'] = ['nullable', Rule::unique('quotes')->where('company_id', $user->company()->id)];
$rules['discount'] = 'sometimes|numeric|max:99999999999999';
$rules['discount'] = 'sometimes|numeric|max:99999999999999';
$rules['is_amount_discount'] = ['boolean'];
$rules['exchange_rate'] = 'bail|sometimes|numeric';
$rules['line_items'] = 'array';
$rules['date'] = 'bail|sometimes|date:Y-m-d';
$rules['partial_due_date'] = ['bail', 'sometimes', 'exclude_if:partial,0', Rule::requiredIf(fn () => $this->partial > 0), 'date', 'before:due_date', 'after_or_equal:date'];
$rules['due_date'] = ['bail', 'sometimes', 'nullable', 'after:partial_due_date', Rule::requiredIf(fn () => strlen($this->partial_due_date) > 1), 'date'];
$rules['amount'] = ['sometimes', 'bail', 'numeric', 'max:99999999999999'];

View File

@ -63,6 +63,8 @@ class UpdateQuoteRequest extends Request
$rules['is_amount_discount'] = ['boolean'];
$rules['exchange_rate'] = 'bail|sometimes|numeric';
$rules['date'] = 'bail|sometimes|date:Y-m-d';
$rules['partial_due_date'] = ['bail', 'sometimes', 'exclude_if:partial,0', Rule::requiredIf(fn () => $this->partial > 0), 'date', 'before:due_date'];
$rules['due_date'] = ['bail', 'sometimes', 'nullable', 'after:partial_due_date', 'after_or_equal:date', Rule::requiredIf(fn () => strlen($this->partial_due_date) > 1), 'date'];
$rules['amount'] = ['sometimes', 'bail', 'numeric', 'max:99999999999999'];

View File

@ -11,13 +11,16 @@
namespace App\Jobs\Credit;
use App\Utils\Number;
use App\Models\Credit;
use App\Models\Payment;
use Illuminate\Bus\Queueable;
use Illuminate\Support\Carbon;
use App\DataMapper\InvoiceItem;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ApplyCreditPayment implements ShouldQueue
{
@ -67,6 +70,19 @@ class ApplyCreditPayment implements ShouldQueue
$credit_balance = $this->credit->balance;
$item_date = Carbon::parse($this->payment->date)->format($this->payment->client->date_format());
$invoice_numbers = $this->payment->invoices->pluck('number')->implode(",");
$item = new InvoiceItem();
$item->quantity = 0;
$item->cost = $this->amount * -1;
$item->notes = "{$item_date} - " . ctrans('texts.credit_payment', ['invoice_number' => $invoice_numbers]) . " ". Number::formatMoney($this->amount, $this->payment->client);
$item->type_id = "1";
$line_items = $this->credit->line_items;
$line_items[] = $item;
$this->credit->line_items = $line_items;
if ($this->amount == $credit_balance) { //total credit applied.
$this->credit
->service()
@ -90,7 +106,7 @@ class ApplyCreditPayment implements ShouldQueue
->client
->service()
->adjustCreditBalance($this->amount * -1)
->save();
->save();
/* Update Payment Applied Amount*/
$this->payment->save();

View File

@ -103,6 +103,7 @@ class CreateUbl implements ShouldQueue
$ubl_invoice->setLegalMonetaryTotal((new LegalMonetaryTotal())
//->setLineExtensionAmount()
->setTaxInclusiveAmount($taxtotal->getTaxAmount())
->setTaxExclusiveAmount($taxable)
->setPayableAmount($invoice->balance));

View File

@ -56,7 +56,7 @@ class ReminderJob implements ShouldQueue
Auth::logout();
if (! config('ninja.db.multi_db_enabled')) {
nlog("Sending invoice reminders on ".now()->format('Y-m-d h:i:s'));
nrlog("Sending invoice reminders on ".now()->format('Y-m-d h:i:s'));
Invoice::query()
->where('is_deleted', 0)
@ -84,7 +84,7 @@ class ReminderJob implements ShouldQueue
foreach (MultiDB::$dbs as $db) {
MultiDB::setDB($db);
nlog("Sending invoice reminders on db {$db} ".now()->format('Y-m-d h:i:s'));
nrlog("Sending invoice reminders on db {$db} ".now()->format('Y-m-d h:i:s'));
Invoice::query()
->where('is_deleted', 0)
@ -121,12 +121,12 @@ class ReminderJob implements ShouldQueue
if ($invoice->isPayable()) {
//Attempts to prevent duplicates from sending
if ($invoice->reminder_last_sent && Carbon::parse($invoice->reminder_last_sent)->startOfDay()->eq(now()->startOfDay())) {
nlog("caught a duplicate reminder for invoice {$invoice->number}");
nrlog("caught a duplicate reminder for invoice {$invoice->number}");
return;
}
$reminder_template = $invoice->calculateTemplate('invoice');
nlog("reminder template = {$reminder_template}");
nrlog("reminder template = {$reminder_template}");
$invoice->service()->touchReminder($reminder_template)->save();
$fees = $this->calcLateFee($invoice, $reminder_template);
@ -149,7 +149,7 @@ class ReminderJob implements ShouldQueue
$invoice->invitations->each(function ($invitation) use ($invoice, $reminder_template) {
if ($invitation->contact && !$invitation->contact->trashed() && $invitation->contact->email) {
EmailEntity::dispatch($invitation, $invitation->company, $reminder_template);
nlog("Firing reminder email for invoice {$invoice->number} - {$reminder_template}");
nrlog("Firing reminder email for invoice {$invoice->number} - {$reminder_template}");
$invoice->entityEmailEvent($invitation, $reminder_template);
$invoice->sendEvent(Webhook::EVENT_REMIND_INVOICE, "client");
}
@ -220,7 +220,7 @@ class ReminderJob implements ShouldQueue
$invoice->invitations->each(function ($invitation) use ($invoice, $reminder_template) {
if ($invitation->contact && !$invitation->contact->trashed() && $invitation->contact->email) {
EmailEntity::dispatch($invitation, $invitation->company, $reminder_template);
nlog("Firing reminder email for invoice {$invoice->number} - {$reminder_template}");
nrlog("Firing reminder email for invoice {$invoice->number} - {$reminder_template}");
$invoice->entityEmailEvent($invitation, $reminder_template);
$invoice->sendEvent(Webhook::EVENT_REMIND_INVOICE, "client");
}

View File

@ -262,6 +262,9 @@ class TaskRepository extends BaseRepository
if($this->task_round_up)
return $start_time + (int)ceil($interval/$this->task_round_to_nearest)*$this->task_round_to_nearest;
if($interval <= $this->task_round_to_nearest)
return $start_time;
return $start_time - (int)floor($interval/$this->task_round_to_nearest) * $this->task_round_to_nearest;
}

View File

@ -375,7 +375,8 @@ class Statement
->whereIn('status_id', [Credit::STATUS_SENT, Credit::STATUS_PARTIAL, Credit::STATUS_APPLIED])
->whereBetween('date', [Carbon::parse($this->options['start_date']), Carbon::parse($this->options['end_date'])])
->where(function ($query) {
$query->whereDate('due_date', '>=', $this->options['end_date'])
// $query->whereDate('due_date', '>=', $this->options['end_date'])
$query->whereDate('due_date', '>=', now())
->orWhereNull('due_date');
})
->orderBy('date', 'ASC');

View File

@ -488,7 +488,7 @@ class InvoiceService
/*When a reminder is sent we want to touch the dates they were sent*/
public function touchReminder(string $reminder_template)
{
{ nrlog(now()->format('Y-m-d h:i:s') . " INV #{$this->invoice->number} : Touching Reminder => {$reminder_template}");
switch ($reminder_template) {
case 'reminder1':
$this->invoice->reminder1_sent = now();

View File

@ -822,8 +822,16 @@ class TemplateService
$credits = collect($credits)
->map(function ($credit) {
$payments = [];
$this->entity = $credit;
if($credit->payments ?? false) {
$payments = $credit->payments->map(function ($payment) {
return $this->transformPayment($payment);
})->toArray();
}
return [
'amount' => Number::formatMoney($credit->amount, $credit->client),
'balance' => Number::formatMoney($credit->balance, $credit->client),
@ -879,7 +887,7 @@ class TemplateService
'vat_number' => $credit->client->vat_number ?? '',
'currency' => $credit->client->currency()->code ?? 'USD',
],
'payments' => [],
'payments' => $payments,
'total_tax_map' => $credit->calc()->getTotalTaxMap(),
'line_tax_map' => $credit->calc()->getTaxMap(),
];

View File

@ -6,7 +6,10 @@ return [
* is an array, it will try to convert from the first format that works,
* and will serialize dates using the first format from the array.
*/
'date_format' => DATE_ATOM,
'date_format' => [
'Y-m-d',
'Y-m-d\TH:i:s.uP',
],
/*
* Global transformers will take complex types and transform them into simple

View File

@ -58,7 +58,12 @@ return [
'level' => env('LOG_LEVEL', 'debug'),
'days' => 7,
],
'invoiceninja-reminders' => [
'driver' => 'single',
'path' => storage_path('logs/invoiceninja-reminders.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 90,
],
'stack' => [
'driver' => 'stack',
'channels' => ['single'],

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.8.54'),
'app_tag' => env('APP_TAG', '5.8.54'),
'app_version' => env('APP_VERSION', '5.8.56'),
'app_tag' => env('APP_TAG', '5.8.56'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -60,7 +60,7 @@
<script>
@if($company_gateway->getConfigField('account_id'))
var stripe = Stripe({{ config('ninja.ninja_stripe_publishable_key') }}, {
var stripe = Stripe('{{ config('ninja.ninja_stripe_publishable_key') }}', {
stripeAccount: '{{ $company_gateway->getConfigField('account_id') }}',
});
@else