|
|
@@ -355,7 +355,7 @@
|
|
|
<div class="row gx-2 mt-3">
|
|
|
<span class="title-form d-block w-100">Dettaglio causale</span>
|
|
|
<div class="col-md-6">
|
|
|
- <input class="form-control " id="causal_detail_{{$idx}}" type="text" placeholder="Dettaglio causale" wire:model="rows.{{$idx}}.note" {{$this->dataId > 0 && !$isDuplicate ? 'disabled' : ''}}>
|
|
|
+ <textarea class="form-control" id="causal_detail_{{$idx}}" style ="background-color: #E9F0F5 !important;" placeholder="Dettaglio causale" wire:model="rows.{{$idx}}.note" {{$this->dataId > 0 && !$isDuplicate ? 'disabled' : ''}}></textarea>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -386,10 +386,36 @@
|
|
|
<span style="argin-top: 0.25rem; font-size: 0.875em; color: var(--bs-form-invalid-color);">{{ $message }}</span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
-
|
|
|
- <div class="row gx-2 mt-3 align-items-center">
|
|
|
+ @if(!$corrispettivo_fiscale)
|
|
|
+ <div class="row gx-2 mt-3 align-items-center">
|
|
|
+ <div class="col-md-6">
|
|
|
+ <span class="total primary">Sconto</span>
|
|
|
+ </div>
|
|
|
+ <div class="col-md-3"></div>
|
|
|
+ <div class="col-md-3">
|
|
|
+ @if($add)
|
|
|
+ <input type="text" class="form-control totalInput text-end" id="rows.{{$idx}}.sconto"
|
|
|
+ wire:model="rows.{{$idx}}.sconto"
|
|
|
+ onkeyup="onlyNumberAmount(this)"
|
|
|
+ onchange="updateSconto(this)"
|
|
|
+ placeholder="€ 0,00"
|
|
|
+ {{$this->dataId > 0 && !$isDuplicate ? '' : ''}}
|
|
|
+ >
|
|
|
+ @endif
|
|
|
+ @if($update)
|
|
|
+ <input type="text" class="form-control totalInput text-end" id="rows.{{$idx}}.sconto"
|
|
|
+ wire:model="rows.{{$idx}}.sconto"
|
|
|
+ onkeyup="onlyNumberAmount(this)"
|
|
|
+ onchange="updateSconto(this)"
|
|
|
+ placeholder="€ 0,00"
|
|
|
+ {{$this->dataId > 0 && !$isDuplicate ? 'disabled' : ''}}
|
|
|
+ >
|
|
|
+ @endif
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ @endif
|
|
|
+ <div class="row gx-2 mt-3 align-items-center">
|
|
|
<div class="col-md-4">
|
|
|
<span class="total primary comp">Competenza</span>
|
|
|
</div>
|
|
|
@@ -466,8 +492,28 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-md-3">
|
|
|
- <span class="title-form d-block w-100">Valore</span>
|
|
|
- <span class="netprice_p total--wrapper_netprice"><b>{{$this->currencyToDouble($rows[$idx]["amount"]) > 0 ? formatPrice(($this->currencyToDouble($rows[$idx]["amount"]) + getVatValue($this->currencyToDouble($rows[$idx]["amount"]), $rows[$idx]["vat_id"])) / sizeof($rows[$idx]["when"])) : ""}}</b></span>
|
|
|
+ <span class="title-form d-block w-100">Valore</span>
|
|
|
+ <span class="netprice_p total--wrapper_netprice">
|
|
|
+ <b>
|
|
|
+ @php
|
|
|
+ $rowAmount = $this->currencyToDouble($rows[$idx]["amount"]);
|
|
|
+ $rowSconto = isset($rows[$idx]["sconto"]) ? $this->currencyToDouble($rows[$idx]["sconto"]) : 0;
|
|
|
+ $totalValue = $rowAmount; // Use original amount for display
|
|
|
+
|
|
|
+ // Add VAT if applicable
|
|
|
+ if ($rows[$idx]["vat_id"] > 0) {
|
|
|
+ // Use amount after sconto for VAT calculation
|
|
|
+ $netAmount = max(0, $rowAmount - $rowSconto);
|
|
|
+ $vatAmount = getVatValue($netAmount, $rows[$idx]["vat_id"]);
|
|
|
+ $totalValue = $rowAmount + $vatAmount;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Calculate per period
|
|
|
+ $valuePerPeriod = sizeof($rows[$idx]["when"]) > 0 ? $totalValue / sizeof($rows[$idx]["when"]) : 0;
|
|
|
+ @endphp
|
|
|
+ {{ $rowAmount > 0 ? formatPrice($valuePerPeriod) : "" }}
|
|
|
+ </b>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<div class="col-md-2"><br>
|
|
|
@if($this->dataId == 0)
|
|
|
@@ -674,26 +720,35 @@
|
|
|
|
|
|
<footer>
|
|
|
<div class="total--wrapper">
|
|
|
+ <div class="total--wrapper_amount d-flex align-items-center justify-content-between w-100 mb-3">
|
|
|
+ <span class="amount_p"><strong>Importo</strong></span>
|
|
|
+ <span class="amount_data"><strong>{{$this->getPrice()}}</strong></span>
|
|
|
+ </div>
|
|
|
+ @php
|
|
|
+ $totalSconto = 0;
|
|
|
+ foreach ($this->rows as $row) {
|
|
|
+ if (isset($row['sconto']) && $row['sconto'] != null && $row['sconto'] != "") {
|
|
|
+ $totalSconto += $this->currencyToDouble($row['sconto']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @endphp
|
|
|
+ @if($totalSconto > 0)
|
|
|
+ <div class="total--wrapper_amount d-flex align-items-center justify-content-between w-100 mb-3" style="color: #d9534f;">
|
|
|
+ <span class="amount_p"><strong>Sconto</strong></span>
|
|
|
+ <span class="amount_data"><strong>- {{formatPrice($totalSconto)}}</strong></span>
|
|
|
+ </div>
|
|
|
+ @endif
|
|
|
+ @foreach($this->getVats() as $k => $v)
|
|
|
<div class="total--wrapper_amount d-flex align-items-center justify-content-between w-100 mb-3">
|
|
|
- <span class="amount_p"><strong>Importo</strong></span><span class="amount_data"><strong>{{$this->getPrice()}}</strong></span>
|
|
|
- </div>
|
|
|
- @if(false)
|
|
|
- <div class="total--wrapper_amount d-flex align-items-center justify-content-between w-100 mb-3">
|
|
|
- <span class="amount_p"><strong>Iva</strong></span><span class="amount_data"><strong>{{$this->getVat()}}</strong></span>
|
|
|
- </div>
|
|
|
- @endif
|
|
|
- @foreach($this->getVats() as $k => $v)
|
|
|
- <div class="total--wrapper_amount d-flex align-items-center justify-content-between w-100 mb-3">
|
|
|
- <span class="amount_p"><strong>{{$k}}</strong></span><span class="amount_data"><strong>{{formatPrice($v)}}</strong></span>
|
|
|
- </div>
|
|
|
- @endforeach
|
|
|
- <!--<div class="total--wrapper_tax d-flex align-items-center justify-content-between w-100 mb-2 pb-3">
|
|
|
- <span class="taxt_p">Ritenuta d’acconto (20%):</span><span class="tax_data">€ 20,00</span>
|
|
|
- </div>-->
|
|
|
- <div class="total--wrapper_netprice d-flex align-items-center justify-content-between w-100">
|
|
|
- <span class="netprice_p"><strong>Totale</strong></span><span class="netprice_data"><strong>{{$this->getTotal()}}</strong></span>
|
|
|
+ <span class="amount_p"><strong>{{$k}}</strong></span>
|
|
|
+ <span class="amount_data"><strong>{{formatPrice($v)}}</strong></span>
|
|
|
</div>
|
|
|
+ @endforeach
|
|
|
+ <div class="total--wrapper_netprice d-flex align-items-center justify-content-between w-100">
|
|
|
+ <span class="netprice_p"><strong>Totale</strong></span>
|
|
|
+ <span class="netprice_data"><strong>{{$this->getTotal()}}</strong></span>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
|
|
|
@if($update && !$isDuplicate && !$deleted)
|
|
|
@if($currentReceip)
|
|
|
@@ -1009,6 +1064,10 @@
|
|
|
let v = input.value.replace(/\D+/g, '');
|
|
|
if (v.length > 14) v = v.slice(0, 14);
|
|
|
input.value = "€ " + v.replace(/(\d)(\d\d)$/, "$1,$2").replace(/(^\d{1,3}|\d{3})(?=(?:\d{3})+(?:,|$))/g, '$1.');
|
|
|
+
|
|
|
+ if (input.id.includes("sconto")) {
|
|
|
+ window.livewire.emit('scontoChanged');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function setChangedAmount() {
|
|
|
@@ -1387,7 +1446,6 @@
|
|
|
window.onbeforeunload = function(){
|
|
|
if (isEdit)
|
|
|
return 'Cambiando pagina le eventuali modifiche andranno perse';
|
|
|
-
|
|
|
};
|
|
|
|
|
|
function setCommercialType(t)
|
|
|
@@ -1399,7 +1457,6 @@
|
|
|
|
|
|
Livewire.on('goToAnchor', () =>
|
|
|
{
|
|
|
- console.log("aaa");
|
|
|
window.location.href = "#top";
|
|
|
});
|
|
|
|
|
|
@@ -1408,6 +1465,13 @@
|
|
|
@this.setYear(idx, xxx);
|
|
|
}
|
|
|
|
|
|
+ function setChangedAmount() {
|
|
|
+ @this.setAmount();
|
|
|
+ }
|
|
|
+
|
|
|
+ function updateSconto(input) {
|
|
|
+ window.livewire.emit('scontoChanged');
|
|
|
+ }
|
|
|
|
|
|
</script>
|
|
|
|