mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-16 19:40:44 +01:00
Correzione di alcuni label
This commit is contained in:
parent
a371c24f4b
commit
956c6f6762
@ -29,13 +29,13 @@ echo '
|
||||
echo '
|
||||
<div class="row">';
|
||||
|
||||
$width = $options['dir'] == 'entrata' ? 4 :6;
|
||||
$width = $options['dir'] == 'entrata' ? 4 : 6;
|
||||
$label = $options['dir'] == 'entrata' ? tr('Prezzo unitario di vendita') : tr('Prezzo unitario');
|
||||
if ($options['dir'] == 'entrata') {
|
||||
// Prezzo di acquisto unitario
|
||||
echo '
|
||||
<div class="col-md-'.$width.'">
|
||||
{[ "type": "number", "label": "'.tr('Prezzo di acquisto unitario').'", "name": "prezzo_acquisto", "value": "'.$result['prezzo_unitario_acquisto'].'", "icon-after": "€", "onkeyup": "aggiorna_guadagno()" ]}
|
||||
<span id="guadagno"></span>
|
||||
{[ "type": "number", "label": "'.tr('Prezzo unitario di acquisto').'", "name": "prezzo_acquisto", "value": "'.$result['prezzo_unitario_acquisto'].'", "icon-after": "€" ]}
|
||||
</div>';
|
||||
|
||||
// Funzione per l'aggiornamento in tempo reale del guadagno
|
||||
@ -46,7 +46,7 @@ if ($options['dir'] == 'entrata') {
|
||||
var prezzo = $("#prezzo").val().toEnglish();
|
||||
var sconto = $("#sconto").val().toEnglish();
|
||||
if ($("#tipo_sconto").val() === "PRC") {
|
||||
sconto = sconto / 100 * prezzo
|
||||
sconto = sconto / 100 * prezzo;
|
||||
}
|
||||
|
||||
var guadagno = prezzo - sconto - prezzo_acquisto;
|
||||
@ -64,20 +64,24 @@ if ($options['dir'] == 'entrata') {
|
||||
}
|
||||
|
||||
aggiorna_guadagno();
|
||||
$("#tipo_sconto").change(aggiorna_guadagno);
|
||||
|
||||
$("#prezzo").change(aggiorna_guadagno();
|
||||
$("#prezzo_acquisto").change(aggiorna_guadagno();
|
||||
$("#sconto").change(aggiorna_guadagno());
|
||||
$("#tipo_sconto").change(aggiorna_guadagno());
|
||||
</script>';
|
||||
}
|
||||
|
||||
// Prezzo di vendita unitario
|
||||
echo '
|
||||
<div class="col-md-'.$width.'">
|
||||
{[ "type": "number", "label": "'.tr('Prezzo di vendita unitario').'", "name": "prezzo", "value": "'.$result['prezzo'].'", "required": 1, "icon-after": "€", "onkeyup": "aggiorna_guadagno()" ]}
|
||||
{[ "type": "number", "label": "'.$label.'", "name": "prezzo", "value": "'.$result['prezzo'].'", "required": 1, "icon-after": "€" ]}
|
||||
</div>';
|
||||
|
||||
// Sconto unitario
|
||||
echo '
|
||||
<div class="col-md-'.$width.'">
|
||||
{[ "type": "number", "label": "'.tr('Sconto unitario').'", "name": "sconto", "value": "'.$result['sconto_unitario'].'", "icon-after": "choice|untprc|'.$result['tipo_sconto'].'", "onkeyup": "aggiorna_guadagno()"]}
|
||||
{[ "type": "number", "label": "'.tr('Sconto unitario').'", "name": "sconto", "value": "'.$result['sconto_unitario'].'", "icon-after": "choice|untprc|'.$result['tipo_sconto'].'" ]}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
@ -72,7 +72,7 @@ foreach ($righe as $riga) {
|
||||
|
||||
// Individuazione dei seriali
|
||||
if (!empty($riga['abilita_serial'])) {
|
||||
$serials = array_column($dbo->fetchArray('SELECT serial FROM mg_prodotti WHERE serial IS NOT NULL AND id_riga_documento='.prepare($riga['id'])), 'serial');
|
||||
$serials = $riga->serials;
|
||||
$mancanti = $riga['qta'] - count($serials);
|
||||
|
||||
if ($mancanti > 0) {
|
||||
@ -102,7 +102,7 @@ foreach ($righe as $riga) {
|
||||
}
|
||||
|
||||
// Aggiunta dei riferimenti ai documenti
|
||||
if (!empty($record['ref_documento'])) {
|
||||
if ($fattura->isNotaDiAccredito()) {
|
||||
$data = $dbo->fetchArray("SELECT IF(numero_esterno != '', numero_esterno, numero) AS numero, data FROM co_documenti WHERE id = ".prepare($record['ref_documento']));
|
||||
|
||||
$text = tr('Rif. fattura _NUM_ del _DATE_', [
|
||||
@ -152,10 +152,14 @@ foreach ($righe as $riga) {
|
||||
|
||||
if (!$riga instanceof Descrizione) {
|
||||
echo '
|
||||
'.Translator::numberToLocale($riga->prezzo_unitario_vendita).' €
|
||||
'.Translator::numberToLocale($riga->prezzo_unitario_vendita).' €';
|
||||
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
<br><small>
|
||||
'.tr('Acquisto').': '.Translator::numberToLocale($riga->prezzo_unitario_acquisto).' €
|
||||
</small>';
|
||||
}
|
||||
|
||||
if ($riga->sconto_unitario > 0) {
|
||||
echo '
|
||||
@ -214,7 +218,7 @@ foreach ($righe as $riga) {
|
||||
echo "
|
||||
<div class='input-group-btn'>";
|
||||
|
||||
if (empty($record['is_reversed']) && $riga instanceof Articolo && $riga['abilita_serial'] && (empty($riga['idddt']) || empty($riga['idintervento']))) {
|
||||
if (!$fattura->isNotaDiAccredito() && $riga instanceof Articolo && $riga['abilita_serial'] && (empty($riga['idddt']) || empty($riga['idintervento']))) {
|
||||
echo "
|
||||
<a class='btn btn-primary btn-xs'data-toggle='tooltip' title='Aggiorna SN...' onclick=\"launch_modal( 'Aggiorna SN', '".$rootdir.'/modules/fatture/add_serial.php?id_module='.$id_module.'&id_record='.$id_record.'&idriga='.$riga['id'].'&idarticolo='.$riga['idarticolo']."', 1 );\"><i class='fa fa-barcode' aria-hidden='true'></i></a>";
|
||||
}
|
||||
@ -383,12 +387,10 @@ if ($totale != $netto_a_pagare) {
|
||||
}
|
||||
|
||||
// GUADAGNO TOTALE
|
||||
if ($guadagno < 0) {
|
||||
$guadagno_style = 'background-color: #FFC6C6; border: 3px solid red';
|
||||
} else {
|
||||
$guadagno_style = '';
|
||||
}
|
||||
echo '
|
||||
if ($dir == 'entrata') {
|
||||
$guadagno_style = $guadagno < 0 ? 'background-color: #FFC6C6; border: 3px solid red' : '';
|
||||
|
||||
echo '
|
||||
<tr>
|
||||
<td colspan="5" class="text-right">
|
||||
<b>'.tr('Guadagno', [], ['upper' => true]).':</b>
|
||||
@ -398,6 +400,7 @@ echo '
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</table>';
|
||||
|
@ -197,13 +197,21 @@ class Fattura extends Document
|
||||
/**
|
||||
* Restituisce l'elenco delle note di credito collegate.
|
||||
*
|
||||
* @return array
|
||||
* @return iterable
|
||||
*/
|
||||
public function getNoteDiAccredito()
|
||||
{
|
||||
return database()->fetchArray("SELECT co_documenti.id, IF(numero_esterno != '', numero_esterno, numero) AS numero, data FROM co_documenti WHERE idtipodocumento IN (SELECT id FROM co_tipidocumento WHERE reversed = 1) AND ref_documento = :id", [
|
||||
':id' => $this->id,
|
||||
]);
|
||||
return self::where('ref_documento', $this->id)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce l'elenco delle note di credito collegate.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function getFatturaOriginale()
|
||||
{
|
||||
return self::find($this->ref_documento);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@ class RowHelper extends \Codeception\Module
|
||||
{
|
||||
/** @param string */
|
||||
protected $finalPattern = "//div[@class='panel-heading' and contains(string(), 'Righe')]/parent::*//table//tr[contains(string(), '|name|')]//td[2]";
|
||||
protected $dir;
|
||||
|
||||
/**
|
||||
* Completa le informazioni per la creazione di un nuovo elemento.
|
||||
@ -26,7 +27,9 @@ class RowHelper extends \Codeception\Module
|
||||
{
|
||||
$t->fillField('#descrizione_riga', $descrizione);
|
||||
$t->fillField('Q.tà', $qta);
|
||||
$t->fillField('Costo unitario', $prezzo);
|
||||
|
||||
$label = ($this->dir == 'uscita') ? 'Prezzo unitario' : 'Prezzo unitario di vendita';
|
||||
$t->fillField($label, $prezzo);
|
||||
|
||||
if (!empty($sconto)) {
|
||||
$t->fillField('Sconto unitario', $sconto);
|
||||
@ -128,8 +131,10 @@ class RowHelper extends \Codeception\Module
|
||||
*
|
||||
* @param AcceptanceTester $t
|
||||
*/
|
||||
public function testImporti(AcceptanceTester $t)
|
||||
public function testImporti(AcceptanceTester $t, $direzione = 'entrata')
|
||||
{
|
||||
$this->dir = $direzione;
|
||||
|
||||
// Righe di test (issue #98)
|
||||
$this->addRow($t, 'Riga 1', 1, 34);
|
||||
$this->addRow($t, 'Riga 2', 1, 17.44);
|
||||
|
@ -87,6 +87,6 @@ class DDTCest
|
||||
{
|
||||
$this->addDdt($t, false, 3, 1);
|
||||
|
||||
$this->rowHelper->testImporti($t);
|
||||
$this->rowHelper->testImporti($t, 'uscita');
|
||||
}
|
||||
}
|
||||
|
@ -74,8 +74,6 @@ class FattureCest
|
||||
$this->addFattura($t, true, 2, 2);
|
||||
|
||||
$this->rowHelper->testImporti($t);
|
||||
|
||||
//$t->click('Stampa');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,6 +89,6 @@ class FattureCest
|
||||
$t->select2('#idpagamento', 109);
|
||||
$t->clickAndWait('Salva');
|
||||
|
||||
$this->rowHelper->testImporti($t);
|
||||
$this->rowHelper->testImporti($t, 'uscita');
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,6 @@ class OrdiniCest
|
||||
$t->select2('#idpagamento', 109);
|
||||
$t->clickAndWait('Salva');
|
||||
|
||||
$this->rowHelper->testImporti($t);
|
||||
$this->rowHelper->testImporti($t, 'uscita');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user