mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-03-18 04:00:12 +01:00
feat: generazione barcode interno
This commit is contained in:
parent
02c1e72355
commit
8fe7ecd5da
@ -41,15 +41,16 @@
|
||||
"intervention/image": "^2.3",
|
||||
"jurosh/pdf-merge": "^2.1",
|
||||
"league/csv": "^9.7.0",
|
||||
"league/oauth2-client": "^2.6",
|
||||
"league/oauth2-google": "^4.0",
|
||||
"league/flysystem": "^3.0",
|
||||
"league/flysystem-ftp": "^3.0",
|
||||
"league/oauth2-client": "^2.6",
|
||||
"league/oauth2-google": "^4.0",
|
||||
"monolog/monolog": "^1.27",
|
||||
"mpdf/mpdf": "^v8.0.10",
|
||||
"mpociot/vat-calculator": "^2.3",
|
||||
"owasp/csrf-protector-php": "^1.0",
|
||||
"phpmailer/phpmailer": "^6.0",
|
||||
"picqer/php-barcode-generator": "^3.2",
|
||||
"respect/validation": "^2.0",
|
||||
"servo/fluidxml": "^2.0",
|
||||
"slim/flash": "^0.4.0",
|
||||
|
@ -61,7 +61,12 @@ switch (post('op')) {
|
||||
if (Models\Locale::getDefault()->id == Models\Locale::getPredefined()->id) {
|
||||
$articolo->name = post('descrizione');
|
||||
}
|
||||
$articolo->barcode = post('barcode');
|
||||
|
||||
if (post('genera_barcode')) {
|
||||
$codice = "200".str_pad($articolo->id, 9, "0", STR_PAD_LEFT);
|
||||
$barcode = (new Picqer\Barcode\Types\TypeEan13())->getBarcode($codice)->getBarcode();
|
||||
}
|
||||
$articolo->barcode = $barcode ?: post('barcode');
|
||||
$articolo->coefficiente = post('coefficiente');
|
||||
$articolo->idiva_vendita = post('idiva_vendita');
|
||||
$articolo->prezzo_acquisto = post('prezzo_acquisto');
|
||||
@ -455,6 +460,16 @@ switch (post('op')) {
|
||||
|
||||
flash()->info(tr('Giacenza aggiornata!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'generate-barcode':
|
||||
$codice = "200".str_pad($id_record, 9, "0", STR_PAD_LEFT);
|
||||
$barcode = (new Picqer\Barcode\Types\TypeEan13())->getBarcode($codice)->getBarcode();
|
||||
|
||||
echo json_encode([
|
||||
'barcode' => $barcode
|
||||
]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ $aliquota_predefinita = floatval(Aliquota::find($iva_predefinita)->percentuale);
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<span class="pull-right tip text-muted"><input type="checkbox" id="genera_barcode" name="genera_barcode" /> <?php echo tr('Generazione automatica'); ?></span>
|
||||
{[ "type": "text", "label": "<?php echo tr('Barcode'); ?>", "name": "barcode", "required": 0, "value": "<?php echo htmlentities(filter('barcode')) ?: ''; ?>", "validation": "barcode" ]}
|
||||
</div>
|
||||
</div>
|
||||
@ -223,4 +224,8 @@ function scorpora_iva_add() {
|
||||
let scorporato = prezzo * 100 / (100 + percentuale);
|
||||
input.val(scorporato);
|
||||
}
|
||||
|
||||
$("#genera_barcode").click(function(){
|
||||
$(".modal #barcode").attr("disabled", $(this).is(":checked")).val("");
|
||||
});
|
||||
</script>
|
||||
|
@ -441,6 +441,20 @@ switch (post('op')) {
|
||||
|
||||
flash()->info(tr('Listino aggiornato correttamente!'));
|
||||
|
||||
break;
|
||||
|
||||
case 'generate-barcode-bulk':
|
||||
foreach ($id_records as $id) {
|
||||
$codice = "200".str_pad($id, 9, "0", STR_PAD_LEFT);
|
||||
$barcode = (new Picqer\Barcode\Types\TypeEan13())->getBarcode($codice)->getBarcode();
|
||||
|
||||
$articolo = Articolo::find($id);
|
||||
$articolo->barcode = $barcode;
|
||||
$articolo->save();
|
||||
}
|
||||
|
||||
flash()->info(tr('Barcode generati correttamente!'));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -632,4 +646,15 @@ $operations['stampa-etichette'] = [
|
||||
],
|
||||
];
|
||||
|
||||
$operations['generate-barcode-bulk'] = [
|
||||
'text' => '<span><i class="fa fa-magic"></i> '.tr('Genera barcode').'</span>',
|
||||
'data' => [
|
||||
'title' => tr('Generare il barcode per gli articoli selezionati?'),
|
||||
'msg' => 'Il barcode sarà generato in maniera random con tipologia EAN-13',
|
||||
'button' => tr('Genera'),
|
||||
'class' => 'btn btn-lg btn-success',
|
||||
'blank' => false,
|
||||
],
|
||||
];
|
||||
|
||||
return $operations;
|
||||
|
@ -50,7 +50,8 @@ use Modules\Iva\Aliquota;
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "<?php echo tr('Barcode'); ?>", "name": "barcode", "value": "$barcode$" ]}
|
||||
<button type="button" class="btn btn-default btn-xs tip pull-right" id="generaBarcode"><i class="fa fa-refresh"></i> <?php echo tr('Genera'); ?></button>
|
||||
{[ "type": "text", "label": "<?php echo tr('Barcode'); ?>", "name": "barcode", "validation": "barcode", "class": "text-center", "value": "$barcode$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
@ -359,6 +360,29 @@ function scorporaIva() {
|
||||
$("#scorporaIva").click( function() {
|
||||
scorporaIva();
|
||||
});
|
||||
|
||||
function generaBarcode() {
|
||||
$.ajax({
|
||||
url: globals.rootdir + "/actions.php",
|
||||
type: "POST",
|
||||
data: {
|
||||
id_module: globals.id_module,
|
||||
id_record: globals.id_record,
|
||||
op: "generate-barcode"
|
||||
},
|
||||
success: function(response) {
|
||||
response = JSON.parse(response);
|
||||
let input = $("#barcode");
|
||||
input.val(response.barcode);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#generaBarcode").click( function() {
|
||||
generaBarcode();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user