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

Working on FatturaPA

This commit is contained in:
David Bomba 2024-04-10 22:07:03 +10:00
parent 9c518bfff8
commit 4f2f509b16
10 changed files with 547 additions and 406 deletions

View File

@ -21,7 +21,7 @@ class CompanyLedgerFactory
$company_ledger->company_id = $company_id; $company_ledger->company_id = $company_id;
$company_ledger->user_id = $user_id; $company_ledger->user_id = $user_id;
$company_ledger->adjustment = 0; $company_ledger->adjustment = 0;
$company_ledger->balance = 0; // $company_ledger->balance = 0;
$company_ledger->notes = ''; $company_ledger->notes = '';
$company_ledger->hash = ''; $company_ledger->hash = '';
$company_ledger->client_id = 0; $company_ledger->client_id = 0;

View File

@ -26,6 +26,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use horstoeko\zugferd\ZugferdDocumentBuilder; use horstoeko\zugferd\ZugferdDocumentBuilder;
use App\Services\EDocument\Standards\OrderXDocument; use App\Services\EDocument\Standards\OrderXDocument;
use App\Services\EDocument\Standards\FacturaEInvoice; use App\Services\EDocument\Standards\FacturaEInvoice;
use App\Services\EDocument\Standards\FatturaPA;
use App\Services\EDocument\Standards\ZugferdEDokument; use App\Services\EDocument\Standards\ZugferdEDokument;
class CreateEDocument implements ShouldQueue class CreateEDocument implements ShouldQueue
@ -62,11 +63,14 @@ class CreateEDocument implements ShouldQueue
$e_document_type = strlen($settings_entity->getSetting('e_invoice_type')) > 2 ? $settings_entity->getSetting('e_invoice_type') : "XInvoice_3_0"; $e_document_type = strlen($settings_entity->getSetting('e_invoice_type')) > 2 ? $settings_entity->getSetting('e_invoice_type') : "XInvoice_3_0";
$e_quote_type = strlen($settings_entity->getSetting('e_quote_type')) > 2 ? $settings_entity->getSetting('e_quote_type') : "OrderX_Extended"; $e_quote_type = strlen($settings_entity->getSetting('e_quote_type')) > 2 ? $settings_entity->getSetting('e_quote_type') : "OrderX_Extended";
nlog($e_document_type);
if ($this->document instanceof Invoice){ if ($this->document instanceof Invoice){
switch ($e_document_type) { switch ($e_document_type) {
case "FACT1": case "FACT1":
return (new RoEInvoice($this->document))->generateXml(); return (new RoEInvoice($this->document))->generateXml();
case "FatturaPA":
return (new FatturaPA($this->document))->run();
case "EN16931": case "EN16931":
case "XInvoice_3_0": case "XInvoice_3_0":
case "XInvoice_2_3": case "XInvoice_2_3":

View File

@ -47,34 +47,11 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
*/ */
public function handle(): void public function handle(): void
{ {
$uuid = \Illuminate\Support\Str::uuid();
// nlog("Updating company ledger for client {$this->client->id} {$uuid}");
MultiDB::setDb($this->company->db); MultiDB::setDb($this->company->db);
// $dupes = CompanyLedger::query()
// ->where('client_id', $this->client->id)
// ->where('balance', 0)
// ->where('hash', '<>', '')
// ->groupBy(['adjustment','hash'])
// ->havingRaw('COUNT(*) > 1')
// ->pluck('id');
// CompanyLedger::query()->whereIn('id', $dupes)->delete();
// $dupes = CompanyLedger::query()
// ->where('client_id', $this->client->id)
// ->where('balance', 0)
// ->where('hash', '<>', '')
// ->groupBy(['adjustment','hash'])
// ->havingRaw('COUNT(*) > 1')
// ->pluck('id');
// CompanyLedger::query()->whereIn('id', $dupes)->delete();
CompanyLedger::query() CompanyLedger::query()
->where('balance', 0) ->whereNull('balance')
->where('client_id', $this->client->id) ->where('client_id', $this->client->id)
->orderBy('id', 'ASC') ->orderBy('id', 'ASC')
->get() ->get()
@ -88,13 +65,11 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
->orderBy('id', 'DESC') ->orderBy('id', 'DESC')
->first(); ->first();
// $company_ledger->balance = $last_record->balance + $company_ledger->adjustment;
$company_ledger->balance = ($parent_ledger ? $parent_ledger->balance : 0) + $company_ledger->adjustment; $company_ledger->balance = ($parent_ledger ? $parent_ledger->balance : 0) + $company_ledger->adjustment;
$company_ledger->save(); $company_ledger->save();
}); });
// nlog("finished job {$uuid}");
} }
public function middleware() public function middleware()

View File

@ -58,7 +58,7 @@ class OtpCode extends Mailable
'title' => ctrans('texts.otp_code_subject'), 'title' => ctrans('texts.otp_code_subject'),
'content' => ctrans('texts.otp_code_body', ['code' => $this->code]), 'content' => ctrans('texts.otp_code_body', ['code' => $this->code]),
'whitelabel' => $this->company->account->isPaid(), 'whitelabel' => $this->company->account->isPaid(),
'url' => 'xx', 'url' => '',
'button' => false, 'button' => false,
'template' => $this->company->account->isPremium() ? 'email.template.admin_premium' : 'email.template.admin', 'template' => $this->company->account->isPremium() ? 'email.template.admin_premium' : 'email.template.admin',
]); ]);

View File

@ -11,50 +11,33 @@
namespace App\Services\EDocument\Standards; namespace App\Services\EDocument\Standards;
use Sabre\Xml\Service;
use App\Models\Invoice; use App\Models\Invoice;
use App\Services\AbstractService; use App\Services\AbstractService;
use SimpleXMLElement; use CleverIt\UBL\Invoice\FatturaPA\common\Sede;
use CleverIt\UBL\Invoice\FatturaPA\common\Anagrafica;
/* use CleverIt\UBL\Invoice\FatturaPA\common\DatiGenerali;
<?xml version="1.0" encoding="UTF-8"?> use CleverIt\UBL\Invoice\FatturaPA\common\IdFiscaleIVA;
<FatturaElettronica versione="FPR12" xmlns="http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2"> use CleverIt\UBL\Invoice\FatturaPA\common\DatiContratto;
<FatturaElettronicaHeader> use CleverIt\UBL\Invoice\FatturaPA\common\DatiPagamento;
<DatiTrasmissione>// Transmission data use CleverIt\UBL\Invoice\FatturaPA\common\DatiRicezione;
<IdTrasmittente>// Transmitter ID use CleverIt\UBL\Invoice\FatturaPA\common\DatiRiepilogo;
<IdPaese>IT</IdPaese> //Country code use CleverIt\UBL\Invoice\FatturaPA\common\DatiTrasporto;
<IdCodice>01234567890</IdCodice> //Taxpayer code use CleverIt\UBL\Invoice\FatturaPA\common\RegimeFiscale;
</IdTrasmittente> use CleverIt\UBL\Invoice\FatturaPA\common\DatiAnagrafici;
<ProgressivoInvio>00001</ProgressivoInvio> // Transmission progress use CleverIt\UBL\Invoice\FatturaPA\common\DettaglioLinee;
<FormatoTrasmissione>FPR12</FormatoTrasmissione>// Transmission format use CleverIt\UBL\Invoice\FatturaPA\common\IdTrasmittente;
<CodiceDestinatario>ABCDE1</CodiceDestinatario>// Receiver code use CleverIt\UBL\Invoice\FatturaPA\common\DatiBeniServizi;
</DatiTrasmissione> use CleverIt\UBL\Invoice\FatturaPA\common\DatiTrasmissione;
<CedentePrestatore>//Seller/Provider use CleverIt\UBL\Invoice\FatturaPA\common\CedentePrestatore;
<!-- Company information of the sender (seller/provider) --> use CleverIt\UBL\Invoice\FatturaPA\common\DatiOrdineAcquisto;
</CedentePrestatore> use CleverIt\UBL\Invoice\FatturaPA\common\DettaglioPagamento;
<CessionarioCommittente>//Buyer/Recipient use CleverIt\UBL\Invoice\FatturaPA\common\FatturaElettronica;
<!-- Company information of the receiver (buyer) --> use CleverIt\UBL\Invoice\FatturaPA\common\DatiAnagraficiVettore;
</CessionarioCommittente> use CleverIt\UBL\Invoice\FatturaPA\common\DatiGeneraliDocumento;
</FatturaElettronicaHeader> use CleverIt\UBL\Invoice\FatturaPA\common\CessionarioCommittente;
<FatturaElettronicaBody> use CleverIt\UBL\Invoice\FatturaPA\common\FatturaElettronicaBody;
<DatiGenerali>//General data use CleverIt\UBL\Invoice\FatturaPA\common\FatturaElettronicaHeader;
<DatiGeneraliDocumento>// Document general data
<TipoDocumento>TD01</TipoDocumento>// Document type
<Divisa>EUR</Divisa>// Currency
<Data>2023-04-21</Data>// Date
<Numero>1</Numero>// Number
<!-- Add other information as needed -->
</DatiGeneraliDocumento>
<!-- Add other general data as needed -->
</DatiGenerali>
<DatiBeniServizi>//Goods and services data
<!-- List of items or services -->
</DatiBeniServizi>
<DatiPagamento>//Payment data
<!-- Payment details -->
</DatiPagamento>
</FatturaElettronicaBody>
</FatturaElettronica>
*/
class FatturaPA extends AbstractService class FatturaPA extends AbstractService
{ {
@ -71,93 +54,287 @@ class FatturaPA extends AbstractService
* EI03 => UTENTE NON ABILITATO * EI03 => UTENTE NON ABILITATO
*/ */
/** Regime Fiscale
*
* //@todo - custom ui settings
*
* private array $types = [
* "RF01" => "Regime ordinario",
* "RF02" => "Regime dei contribuenti minimi (art. 1,c.96-117, L. 244/2007)",
* "RF04" => "Agricoltura e attività connesse e pesca (artt. 34 e 34-bis, D.P.R. 633/1972)",
* "RF05" => "Vendita sali e tabacchi (art. 74, c.1, D.P.R. 633/1972)",
* "RF06" => "Commercio dei fiammiferi (art. 74, c.1, D.P.R. 633/1972)",
* "RF07" => "Editoria (art. 74, c.1, D.P.R. 633/1972)",
* "RF08" => "Gestione di servizi di telefonia pubblica (art. 74, c.1, D.P.R. 633/1972)" ,
* "RF09" => "Rivendita di documenti di trasporto pubblico e di sosta (art. 74, c.1, D.P.R. 633/1972)" ,
* "RF10" => "Intrattenimenti, giochi e altre attività di cui alla tariffa allegata al D.P.R. 640/72 (art. 74, c.6, D.P.R. 633/1972)" ,
* "RF11" => "Agenzie di viaggi e turismo (art. 74-ter, D.P.R. 633/1972)" ,
* "RF12" => "Agriturismo (art. 5, c.2, L. 413/1991)" ,
* "RF13" => "Vendite a domicilio (art. 25-bis, c.6, D.P.R. 600/1973)" ,
* "RF14" => "Rivendita di beni usati, di oggetti darte, dantiquariato o da collezione (art. 36, D.L. 41/1995)" ,
* "RF15" => "Agenzie di vendite allasta di oggetti darte, antiquariato o da collezione (art. 40-bis, D.L. 41/1995)" ,
* "RF16" => "IVA per cassa P.A. (art. 6, c.5, D.P.R. 633/1972)" ,
* "RF17" => "IVA per cassa (art. 32-bis, D.L. 83/2012)" ,
* "RF19" => "Regime forfettario" ,
* "RF18" => "Altro"
* ];
*/
/** Formato Trasmissione
* FPA12: This is the format used for FatturaPA version 1.2.
* FPR12: This format is used for FatturaPA version 1.2 in cases where the invoice is destined for the Public Administration.
* FPA1.2: This format is used for FatturaPA version 1.2.
* FPR1.2: This format is used for FatturaPA version 1.2 in cases where the invoice is destined for the Public Administration.
* FPR10: This format is used for FatturaPA version 1.0 in cases where the invoice is destined for the Public Administration.
* FPA10: This format is used for FatturaPA version 1.0.
*/
/** Tipo Documento
*
* TD01 Fattura
* TD02 Acconto/Anticipo su fattura
* TD03 Acconto/Anticipo su parcella
* TD04 Nota di Credito
* TD05 Nota di Debito
* TD06 Parcella
* TD16 Integrazione fattura reverse charge interno
* TD17 Integrazione/autofattura per acquisto servizi dallestero
* TD18 Integrazione per acquisto di beni intracomunitari
* TD19 Integrazione/autofattura per acquisto di beni ex art.17 c.2 DPR 633/72
* TD20 Autofattura per regolarizzazione e integrazione delle
* fatture (ex art.6 c.8 e 9-bis d.lgs. 471/97 o art.46 c.5 D.L. 331/93)
* TD21 Autofattura per splafonamento
* TD22 Estrazione beni da Deposito IVA
* TD23 Estrazione beni da Deposito IVA con versamento dellIVA
* TD24 Fattura differita di cui allart.21, comma 4, lett. a)
* TD25 Fattura differita di cui allart.21, comma 4, terzo periodo lett. b)
* TD26 Cessione di beni ammortizzabili e per passaggi interni (ex art.36 DPR 633/72)
* TD27 Fattura per autoconsumo o per cessioni gratuite senza rivalsa
*/
/** Esigibilità IVA
* "I" (Immediata): VAT is due and payable immediately upon issuance of the invoice.
* "D" (Differita): VAT is due at a later date, typically when payment for the goods or services is received.
* "S" (Soggetta): VAT is due under the reverse charge mechanism, where the recipient of the goods or services is responsible for accounting for the VAT.
*/
/**
* MP01 contanti //cash
* MP02 assegno //check
* MP03 assegno circolare //cashier's check
* MP04 contanti presso Tesoreria //cash at treasury
* MP05 bonifico //bank transfer
* MP06 vaglia cambiario //bill of exchange
* MP07 bollettino bancario //bank bulletin
* MP08 carta di pagamento //payment card
* MP09 RID //RID
* MP10 RID utenze //RID utilities
* MP11 RID veloce //fast RID
* MP12 Riba //Riba
* MP13 MAV //MAV
* MP14 quietanza erario stato //state treasury receipt
* MP15 giroconto su conti di contabilità speciale //transfer to special accounting accounts
* MP16 domiciliazione bancaria //bank domiciliation
* MP17 domiciliazione postale //postal domiciliation
* MP18 bollettino di c/c postale //postal giro account
* MP19 SEPA Direct Debit //SEPA Direct Debit
* MP20 SEPA Direct Debit CORE //SEPA Direct Debit CORE
* MP21 SEPA Direct Debit B2B //SEPA Direct Debit B2B
* MP22 Trattenuta su somme già riscosse //Withholding on sums already collected
* MP23 PagoPA //PagoPA
*/
/**
* TP01 pagamento a rate //payment in installments
* TP02 pagamento completo //full payment
* TP03 anticipo //advance
*/
/** /**
* @param Invoice $invoice * @param Invoice $invoice
*/ */
public function __construct(public Invoice $invoice) public function __construct(public Invoice $invoice)
{ {
$this->xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><FatturaElettronica></FatturaElettronica>');
} }
public function run() public function run()
{ {
return $this->addHeader()->getXml();
}
public function addHeader() $fatturaHeader = new FatturaElettronicaHeader();
$datiTrasmissione = new DatiTrasmissione();
$datiTrasmissione->setFormatoTrasmissione("FPR12");
$datiTrasmissione->setCodiceDestinatario($this->invoice->client->routing_id);
$datiTrasmissione->setProgressivoInvio($this->invoice->number);
$idPaese = new IdTrasmittente();
$idPaese->setIdPaese($this->invoice->company->country()->iso_3166_2);
$idPaese->setIdCodice($this->invoice->company->settings->vat_number);
$datiTrasmissione->setIdTrasmittente($idPaese);
$fatturaHeader->setDatiTrasmissione($datiTrasmissione);
$cedentePrestatore = new CedentePrestatore();
$datiAnagrafici = new DatiAnagrafici();
$idFiscaleIVA = new IdFiscaleIVA(IdPaese: $this->invoice->company->country()->iso_3166_2, IdCodice: $this->invoice->company->settings->vat_number);
$datiAnagrafici->setIdFiscaleIVA($idFiscaleIVA);
$anagrafica = new Anagrafica(Denominazione: $this->invoice->company->present()->name());
$datiAnagrafici->setAnagrafica($anagrafica);
$datiAnagrafici->setRegimeFiscale("RF01"); //swap this out with the custom settings.
$cedentePrestatore->setDatiAnagrafici($datiAnagrafici);
$sede = new Sede(Indirizzo: $this->invoice->company->settings->address1,
CAP: $this->invoice->company->settings->postal_code,
Comune: $this->invoice->company->settings->city,
Provincia: $this->invoice->company->settings->state);
$cedentePrestatore->setSede($sede);
$fatturaHeader->setCedentePrestatore($cedentePrestatore);
//client details
$datiAnagrafici = new DatiAnagrafici();
//for some reason the validation does not like codice fiscale for the client?
//perhaps it may need IdFiscaleIVA?
// $datiAnagrafici->setCodiceFiscale("09876543210");
$anagrafica = new Anagrafica(Denominazione: $this->invoice->client->present()->name());
$datiAnagrafici->setAnagrafica($anagrafica);
$sede = new Sede(Indirizzo: $this->invoice->client->address1,
CAP: $this->invoice->client->postal_code,
Comune: $this->invoice->client->city,
Provincia: $this->invoice->client->state);
$cessionarioCommittente = new CessionarioCommittente($datiAnagrafici, $sede);
$fatturaHeader->setCessionarioCommittente($cessionarioCommittente);
////////////////// Fattura Body //////////////////
$fatturaBody = new FatturaElettronicaBody();
$datiGeneraliDocument = new DatiGeneraliDocumento();
$datiGeneraliDocument->setTipoDocumento("TD01")
->setDivisa($this->invoice->client->currency()->code)
->setData($this->invoice->date)
->setNumero($this->invoice->number)
->setCausale($this->invoice->public_notes ?? ''); //unsure...
/**PO information
$datiOrdineAcquisto = new DatiOrdineAcquisto();
$datiOrdineAcquisto->setRiferimentoNumeroLinea(1)
->setIdDocumento($this->invoice->po_number)
->setNumItem(1)
->setCodiceCIG("123abc") // special invoice props
->setCodiceCUP("456def"); // special invoice props
*/
/**Contract data
$datiContratto = new DatiContratto(
RiferimentoNumeroLinea: 1,
IdDocumento: 6685,
Data: "2024-01-01",
NumItem: 5,
CodiceCUP: "123abc",
CodiceCIG: "456def",
);
*/
/**Shipping/Delivery Data
$datiRicezione = new DatiRicezione(
RiferimentoNumeroLinea: 1,
IdDocumento: 6685,
Data: "2024-01-01",
NumItem: 5,
CodiceCUP: "123abc",
CodiceCIG: "456def",
);
*/
/**Shippers details
$datiAnagraficiVettore = new DatiAnagraficiVettore();
$idFiscaleIVA = new IdFiscaleIVA("IT", "24681012141");
$anagrafica = new Anagrafica("Trasport SPA");
$datiAnagraficiVettore->setIdFiscaleIVA($idFiscaleIVA)
->setAnagrafica($anagrafica);
$datiTrasporto = new DatiTrasporto();
$datiTrasporto->setDatiAnagraficiVettore($datiAnagraficiVettore)
->setDataOraConsegna("2017-01-10T16:46:12.000+02:00");
*/
$datiGenerali = new DatiGenerali();
$datiGenerali->setDatiGeneraliDocumento($datiGeneraliDocument);
// ->setDatiOrdineAcquisto($datiOrdineAcquisto)
// ->setDatiContratto($datiContratto)
// ->setDatiRicezione($datiRicezione);
$datiBeniServizi = new DatiBeniServizi();
$tax_rate_level = 0;
//line items
foreach ($this->invoice->line_items as $key => $item)
{ {
$this->xml->addChild('FatturaElettronicaHeader');
return $this; $numero = $key+1;
$dettaglioLinee = new DettaglioLinee(
NumeroLinea: "{$numero}",
Descrizione: $item->notes ?? 'Descrizione',
Quantita: sprintf('%0.2f', $item->quantity),
PrezzoUnitario: sprintf('%0.2f', $item->cost),
PrezzoTotale: sprintf('%0.2f', $item->line_total),
AliquotaIVA: sprintf('%0.2f', $item->tax_rate1),
);
$datiBeniServizi->setDettaglioLinee($dettaglioLinee);
if ($item->tax_rate1 > $tax_rate_level) {
$tax_rate_level = sprintf('%0.2f', $item->tax_rate1);
} }
public function addTrasmissioneData($idPaese, $idCodice, $progressivoInvio, $formatoTrasmissione, $codiceDestinatario)
{
$datiTrasmissione = $this->xml->FatturaElettronicaHeader->addChild('DatiTrasmissione');
$idTrasmittente = $datiTrasmissione->addChild('IdTrasmittente');
$idTrasmittente->addChild('IdPaese', $idPaese);
$idTrasmittente->addChild('IdCodice', $idCodice);
$datiTrasmissione->addChild('ProgressivoInvio', $progressivoInvio);
$datiTrasmissione->addChild('FormatoTrasmissione', $formatoTrasmissione);
$datiTrasmissione->addChild('CodiceDestinatario', $codiceDestinatario);
return $this;
} }
public function addCedentePrestatore($data) //totals
{ if($this->invoice->tax_rate1 > $tax_rate_level) {
// Add CedentePrestatore data $tax_rate_level = sprintf('%0.2f', $this->invoice->tax_rate1);
} }
public function addCessionarioCommittente($data) $calc = $this->invoice->calc();
{ $subtotal = sprintf('%0.2f', $calc->getSubTotal());
// Add CessionarioCommittente data $taxes = sprintf('%0.2f', $calc->getTotalTaxes());
$datiRiepilogo = new DatiRiepilogo(
AliquotaIVA: "{$tax_rate_level}",
ImponibileImporto: "{$subtotal}",
Imposta: "{$taxes}",
EsigibilitaIVA: "I",
);
$datiBeniServizi->setDatiRiepilogo($datiRiepilogo);
$dettalioPagament = new DettaglioPagamento(
ModalitaPagamento: "MP01", //String
DataScadenzaPagamento: (string) $this->invoice->due_date ?? $this->invoice->date,
ImportoPagamento: (string) sprintf('%0.2f', $this->invoice->balance),
);
$datiPagamento = new DatiPagamento();
$datiPagamento->setCondizioniPagamento("TP02")
->setDettaglioPagamento($dettalioPagament);
$fatturaBody->setDatiGenerali($datiGenerali)
->setDatiBeniServizi($datiBeniServizi)
->setDatiPagamento($datiPagamento);
////////////////////////////////////
$xmlService = new Service();
$xml = $xmlService->write('p:FatturaElettronica', new FatturaElettronica($fatturaHeader, $fatturaBody));
return $xml;
} }
public function addBody()
{
$this->xml->addChild('FatturaElettronicaBody');
return $this;
}
public function addDatiGenerali($data)
{
// Add DatiGenerali data
}
public function addLineItem($data)
{
if (!isset($this->xml->FatturaElettronicaBody->DatiBeniServizi)) {
$this->xml->FatturaElettronicaBody->addChild('DatiBeniServizi');
}
$lineItem = $this->xml->FatturaElettronicaBody->DatiBeniServizi->addChild('DettaglioLinee');
$lineItem->addChild('NumeroLinea', $data['NumeroLinea']);
$lineItem->addChild('Descrizione', $data['notes']);
$lineItem->addChild('Quantita', $data['quantity']);
$lineItem->addChild('PrezzoUnitario', $data['cost']);
$lineItem->addChild('PrezzoTotale', $data['line_total']);
$lineItem->addChild('AliquotaIVA', $data['tax_rate1']);
if (isset($data['UnitaMisura'])) {
$lineItem->addChild('UnitaMisura', $data['UnitaMisura']);
}
return $this;
}
public function addDatiPagamento($data)
{
// Add DatiPagamento data
}
public function getXml()
{
return $this->xml->asXML();
}
} }
// $fattura = new FatturaPA();
// $fattura
// ->addHeader()
// ->addTrasmissioneData('IT', '01234567890', '00001', 'FPR12', 'ABCDE1');
// echo $fattura->getXml();

View File

@ -48,32 +48,10 @@ class LedgerService
return $this; return $this;
} }
// $timestamp = \Carbon\Carbon::createFromTimestamp($this->entity->updated_at)->format('ymdhhmmssSS');
// $hash = sha1($adjustment.$notes.$this->entity->status_id.$this->entity->client_id.$this->entity->amount.$this->entity->balance.$this->entity->company_id.Activity::UPDATE_INVOICE);
// $hash = sha1($hash);
// $hash = sha1("{$this->entity->amount}.{$this->entity->balance}");
// $hash = "{$adjustment}.{$this->entity->amount}.{$this->entity->balance}";
// $exists = CompanyLedger::query()
// ->where('client_id', $this->entity->client_id)
// ->where('company_id', $this->entity->company_id)
// ->where('activity_id', Activity::UPDATE_INVOICE)
// ->where('adjustment', $adjustment)
// ->where('hash', $hash)
// ->where('notes', $notes)
// ->where('created_at', '>=', now()->subSeconds(1))
// ->exists();
// if($exists) {
// nlog("Collision {$adjustment} {$notes}");
// return $this;
// }
$company_ledger = CompanyLedgerFactory::create($this->entity->company_id, $this->entity->user_id); $company_ledger = CompanyLedgerFactory::create($this->entity->company_id, $this->entity->user_id);
$company_ledger->client_id = $this->entity->client_id; $company_ledger->client_id = $this->entity->client_id;
$company_ledger->adjustment = $adjustment; $company_ledger->adjustment = $adjustment;
$company_ledger->notes = $notes; $company_ledger->notes = $notes;
// $company_ledger->hash = $hash;
$company_ledger->activity_id = Activity::UPDATE_INVOICE; $company_ledger->activity_id = Activity::UPDATE_INVOICE;
$company_ledger->save(); $company_ledger->save();

477
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -243,6 +243,6 @@ return [
'public_key' => env('NINJA_PUBLIC_KEY', false), 'public_key' => env('NINJA_PUBLIC_KEY', false),
'private_key' => env('NINJA_PRIVATE_KEY', false), 'private_key' => env('NINJA_PRIVATE_KEY', false),
], ],
'upload_extensions' => env('ADDITIONAL_UPLOAD_EXTENSIONS', false), 'upload_extensions' => env('ADDITIONAL_UPLOAD_EXTENSIONS', ''),
]; ];

View File

@ -1539,7 +1539,7 @@ Ensure the default browser behavior of the `hidden` attribute.
</div> </div>
</div> </div>
<div class="flex justify-start mb-[25px]"> <div class="flex justify-start mb-[25px]">
<span class="text-[12px]">* At the end of your 14 day trial your card will be charged $10/month. Cancel anytime.</span> <span class="text-[12px]">* At the end of your 14 day trial your card will be charged $12/month. Cancel anytime.</span>
</div> </div>
<div class="flex justify-end"> <div class="flex justify-end">
<button <button

View File

@ -45,6 +45,8 @@ Route::group(['middleware' => ['auth:vendor', 'vendor_locale', 'domain_db'], 'pr
Route::post('documents/download_multiple', [App\Http\Controllers\VendorPortal\DocumentController::class, 'downloadMultiple'])->name('documents.download_multiple'); Route::post('documents/download_multiple', [App\Http\Controllers\VendorPortal\DocumentController::class, 'downloadMultiple'])->name('documents.download_multiple');
Route::get('documents/{document}/download', [App\Http\Controllers\VendorPortal\DocumentController::class, 'download'])->name('documents.download'); Route::get('documents/{document}/download', [App\Http\Controllers\VendorPortal\DocumentController::class, 'download'])->name('documents.download');
Route::get('documents/{document}/download_pdf', [App\Http\Controllers\VendorPortal\DocumentController::class, 'download'])->name('documents.download_pdf'); Route::get('documents/{document}/download_pdf', [App\Http\Controllers\VendorPortal\DocumentController::class, 'download'])->name('documents.download_pdf');
Route::get('purchase_order/{invitation_key}/download_e_purchase_order', [App\Http\Controllers\PurchaseOrderController::class, 'downloadEPurchaseOrder'])->name('purchase_order.download_e_purchase_order')->middleware('token_auth');
Route::resource('documents', App\Http\Controllers\VendorPortal\DocumentController::class)->only(['index', 'show']); Route::resource('documents', App\Http\Controllers\VendorPortal\DocumentController::class)->only(['index', 'show']);
}); });