diff --git a/Extension/Controller/Randomizer.php b/Extension/Controller/Randomizer.php
new file mode 100644
index 0000000..4ca1900
--- /dev/null
+++ b/Extension/Controller/Randomizer.php
@@ -0,0 +1,35 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+namespace FacturaScripts\Plugins\Comisiones\Extension\Controller;
+
+use Closure;
+
+/**
+ * @author Esteban Sánchez Martínez
+ */
+class Randomizer
+{
+ protected function loadButtons(): Closure
+ {
+ return function () {
+ $this->addButton('sales', 'comisiones', 'generated-commissions', 'commissions', 'fa-solid fa-percentage', 'Random\\Comisiones', 'Comision');
+ };
+ }
+}
diff --git a/Init.php b/Init.php
index 473aab5..d534bd9 100644
--- a/Init.php
+++ b/Init.php
@@ -1,7 +1,7 @@
+ * Copyright (C) 2022-2026 Carlos Garcia Gomez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -49,6 +49,10 @@ public function init(): void
SalesLineHTML::addMod(new Mod\SalesLineHTMLMod());
TransformerDocument::addUnlockedField('totalcomision');
+
+ if (class_exists('FacturaScripts\\Dinamic\\Controller\\Randomizer')) {
+ $this->loadExtension(new Extension\Controller\Randomizer());
+ }
}
public function uninstall(): void
diff --git a/Lib/Random/Comisiones.php b/Lib/Random/Comisiones.php
new file mode 100644
index 0000000..560e286
--- /dev/null
+++ b/Lib/Random/Comisiones.php
@@ -0,0 +1,56 @@
+
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ */
+
+namespace FacturaScripts\Plugins\Comisiones\Lib\Random;
+
+use FacturaScripts\Plugins\Comisiones\Model\Comision;
+use FacturaScripts\Plugins\Randomizer\Lib\Random\NewItems;
+use Faker;
+
+/**
+ * @author Esteban Sánchez Martínez
+ */
+class Comisiones extends NewItems
+{
+ public static function create(int $number = 50): int
+ {
+ $faker = Faker\Factory::create('es_ES');
+
+ for ($generated = 0; $generated < $number; $generated++) {
+ $comision = new Comision();
+ $comision->codagente = static::codagente();
+ $comision->codcliente = static::codcliente();
+ $comision->codfamilia = static::codfamilia();
+ $comision->idempresa = static::idempresa();
+ $comision->idproducto = static::idproducto();
+ $comision->porcentaje = $faker->numberBetween(1, 30);
+ $comision->prioridad = $faker->optional(0.1)->numberBetween(1, 10);
+
+ if ($comision->exists()) {
+ continue;
+ }
+
+ if (false === $comision->save()) {
+ break;
+ }
+ }
+
+ return $generated;
+ }
+}
diff --git a/Translation/es_ES.json b/Translation/es_ES.json
index cf709e0..1570d19 100644
--- a/Translation/es_ES.json
+++ b/Translation/es_ES.json
@@ -16,5 +16,6 @@
"total-position": "Posición del Total",
"until-dto": "Hasta descuento",
"until-penalty-info": "Fin del rango del descuento al que se aplica la penalización. '100' indica máximo del rango",
- "edit-commission": "Editar Comisión"
+ "edit-commission": "Editar Comisión",
+ "generated-commissions": "Comisiones generadas: %quantity%"
}