Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Controller/EditComision.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Controller/EditComisionPenalizacion.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Controller/EditLiquidacionComision.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/Controller/EditAgente.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/Controller/ListAgente.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/Model/Base/SalesDocument.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/Model/Base/SalesDocumentLine.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/EditAlbaranCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/EditFacturaCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/EditPedidoCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/EditPresupuestoCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/ListAlbaranCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/ListFacturaCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/ListPedidoCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Extension/XMLView/ListPresupuestoCliente.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
5 changes: 2 additions & 3 deletions Mod/CalculatorMod.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -19,13 +19,12 @@

namespace FacturaScripts\Plugins\Comisiones\Mod;

use FacturaScripts\Core\Base\Contract\CalculatorModInterface;
use FacturaScripts\Core\Base\DataBase\DataBaseWhere;
use FacturaScripts\Core\Contract\CalculatorModInterface;
use FacturaScripts\Core\Model\Base\BusinessDocument;
use FacturaScripts\Core\Model\Base\BusinessDocumentLine;
use FacturaScripts\Core\Model\Base\SalesDocument;
use FacturaScripts\Core\Model\Base\SalesDocumentLine;
use FacturaScripts\Core\Tools;

use FacturaScripts\Dinamic\Model\Comision;
use FacturaScripts\Dinamic\Model\ComisionPenalizacion;
Expand Down
36 changes: 22 additions & 14 deletions Mod/SalesFooterHTMLMod.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -19,17 +19,19 @@

namespace FacturaScripts\Plugins\Comisiones\Mod;

use FacturaScripts\Core\Contract\SalesModInterface;
use FacturaScripts\Core\Base\Contract\SalesModInterface;
use FacturaScripts\Core\Base\Translator;
use FacturaScripts\Core\Model\Base\SalesDocument;
use FacturaScripts\Core\Model\User;
use FacturaScripts\Core\Tools;

class SalesFooterHTMLMod implements SalesModInterface
{
public function apply(SalesDocument &$model, array $formData): void
public function apply(SalesDocument &$model, array $formData, User $user)
{
}

public function applyBefore(SalesDocument &$model, array $formData): void
public function applyBefore(SalesDocument &$model, array $formData, User $user)
{
}

Expand All @@ -44,29 +46,35 @@ public function newBtnFields(): array

public function newFields(): array
{
return ['totalcomision'];
return [];
}

public function newModalFields(): array
{
return [];
return ['totalcomision'];
}

public function renderField(SalesDocument $model, string $field): ?string
public function renderField(Translator $i18n, SalesDocument $model, string $field): ?string
{
if ($field === 'totalcomision') {
return $this->totalcomision($model);
return $this->totalcomision($i18n, $model);
}
return null;
}

private function totalcomision(SalesDocument $model): string
private function totalcomision(Translator $i18n, SalesDocument $model): string
{
return empty($model->{'totalcomision'}) ? '' : '<div class="col-sm">'
. '<div class="mb-3">'
. Tools::lang()->trans('commission')
. '<input type="number" name="totalcomision" value="' . $model->totalcomision . '" class="form-control" disabled />'
if (false === property_exists($model, 'totalcomision')) {
return '';
}

return '<div class="col-sm-3">'
. '<div class="form-group">'
. $i18n->trans('commission')
. '<input type="text" name="totalcomision" class="form-control text-right" disabled'
. ' value="' . Tools::money($model->totalcomision, $model->coddivisa, 2) . '"'
. '/>'
. '</div>'
. '</div>';
. '</div>';
}
}
9 changes: 5 additions & 4 deletions Mod/SalesLineHTMLMod.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -19,7 +19,8 @@

namespace FacturaScripts\Plugins\Comisiones\Mod;

use FacturaScripts\Core\Contract\SalesLineModInterface;
use FacturaScripts\Core\Base\Contract\SalesLineModInterface;
use FacturaScripts\Core\Base\Translator;
use FacturaScripts\Core\Model\Base\SalesDocument;
use FacturaScripts\Core\Model\Base\SalesDocumentLine;
use FacturaScripts\Core\Tools;
Expand Down Expand Up @@ -70,15 +71,15 @@ public function newTitles(): array
return [];
}

public function renderField(string $idlinea, SalesDocumentLine $line, SalesDocument $model, string $field): ?string
public function renderField(Translator $i18n, string $idlinea, SalesDocumentLine $line, SalesDocument $model, string $field): ?string
{
if ($field === 'porcomision') {
return $this->porcomision($idlinea, $line, $model);
}
return null;
}

public function renderTitle(SalesDocument $model, string $field): ?string
public function renderTitle(Translator $i18n, SalesDocument $model, string $field): ?string
{
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Comision.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Model/ComisionPenalizacion.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Model/Join/LiquidacionComisionFactura.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion Model/LiquidacionComision.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022-2024 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion View/Block/PenaltyInfo.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{#
/**
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion XMLView/EditComision.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion XMLView/EditComisionPenalizacion.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion XMLView/EditLiquidacionComision.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion XMLView/ListComision.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion XMLView/ListComisionPenalizacion.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion XMLView/ListLiquidacionComision.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down
2 changes: 1 addition & 1 deletion XMLView/ListLiquidacionComisionFactura.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of Comisiones plugin for FacturaScripts
* Copyright (C) 2022 Carlos Garcia Gomez <carlos@facturascripts.com>
* Copyright (C) 2022-2025 Carlos Garcia Gomez <carlos@facturascripts.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand Down