. */ include_once __DIR__.'/../../core.php'; use Models\Module; use Modules\Ordini\Stato; $block_edit = $record['flag_completato']; $module = Module::find($id_module); if ($module->getTranslation('name', Models\Locale::getPredefined()->id) == 'Ordini cliente') { $dir = 'entrata'; } else { $dir = 'uscita'; } $righe = $ordine->getRighe(); $righe_vuote = false; foreach ($righe as $riga) { if ($riga->qta == 0) { $righe_vuote = true; } } if ($righe_vuote) { echo '
'.tr('Nel documento sono presenti delle righe con quantità a 0.').'
'; } ?>

> {[ "type": "text", "label": "", "name": "numero", "required": 1, "class": "text-center", "value": "$numero$" ]}
{[ "type": "text", "label": "", "name": "numero_esterno", "class": "text-center", "value": "$numero_esterno$" ]}
{[ "type": "date", "label": "", "name": "data", "required": 1, "value": "$data$" ]}
getByField('name', 'Evaso', Models\Locale::getPredefined()->id); $id_stato_parz_evaso = (new Stato())->getByField('name', 'Parzialmente evaso', Models\Locale::getPredefined()->id); $id_stato_fatt = (new Stato())->getByField('name', 'Fatturato', Models\Locale::getPredefined()->id); $id_stato_parz_fatt = (new Stato())->getByField('name', 'Parzialmente fatturato', Models\Locale::getPredefined()->id); $id_stato_accettato = (new Stato())->getByField('name', 'Accettato', Models\Locale::getPredefined()->id); if ($ordine->stato->id == $id_stato_fatt || $ordine->stato->id == $id_stato_parz_fatt || $ordine->stato->id == $id_stato_evaso || $ordine->stato->id == $id_stato_parz_evaso) { ?> {[ "type": "select", "label": "", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `or_statiordine_lang`.`name` as descrizione, `colore` AS _bgcolor_ FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = id); ?>) ORDER BY `name`", "value": "$idstatoordine$", "extra": "readonly", "class": "unblockable" ]} {[ "type": "select", "label": "", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `or_statiordine_lang`.`name` as descrizione, `colore` AS _bgcolor_ FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = id); ?>) WHERE (`is_fatturabile` = 0 AND `or_statiordine`.`id` != || `or_statiordine`.`id` = ) ORDER BY `name`", "value": "$idstatoordine$", "class": "unblockable" ]} {[ "type": "select", "label": "", "name": "idstatoordine", "required": 1, "values": "query=SELECT `or_statiordine`.*, `colore` AS _bgcolor_, `or_statiordine_lang`.`name` as descrizione FROM `or_statiordine` LEFT JOIN `or_statiordine_lang` ON (`or_statiordine_lang`.`id_record` = `or_statiordine`.`id` AND `or_statiordine_lang`.`id_lang` = id); ?>) ORDER BY `name`", "value": "$idstatoordine$", "class": "unblockable" ]}
'; if ($record['idagente'] != 0) { echo Modules::link('Anagrafiche', $record['idagente'], null, null, 'class="pull-right"'); } echo ' {[ "type": "select", "label": "'.tr('Agente').'", "name": "idagente", "ajax-source": "agenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "$idagente$" ]}
'; } ?>
{[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "value": "$idanagrafica$", "ajax-source": "clienti" ]} {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "ajax-source": "fornitori", "value": "$idanagrafica$" ]}
'; if (!empty($record['idreferente'])) { echo Plugins::link('Referenti', $record['idanagrafica'], null, null, 'class="pull-right"'); } echo ' {[ "type": "select", "label": "'.tr('Referente').'", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti", "select-options": {"idanagrafica": '.$record['idanagrafica'].', "idsede_destinazione": '.$record['idsede'].'} ]}
{[ "type": "select", "label": "'.tr('Sede').'", "name": "idsede", "required": 1, "ajax-source": "sedi", "select-options": {"idanagrafica": '.$record['idanagrafica'].'}, "value": "'.$record['idsede'].'" ]}
{[ "type": "select", "label": "'.tr('Pagamento').'", "name": "idpagamento", "required": 0, "ajax-source": "pagamenti", "value": "$idpagamento$" ]}
'; if ($dir == 'entrata') { ?>
{[ "type": "text", "label": "", "name": "numero_cliente", "required":0, "value": "", "help": "Obbligatorio per valorizzare CIG/CUP. È possible inserire:
  • N. determina
  • RDO
  • Ordine MEPA
'); ?>" ]}
{[ "type": "date", "label": "", "name": "data_cliente", "value": "" ]}
{[ "type": "number", "label": "", "name": "sconto_finale", "value": "sconto_finale_percentuale ?: $ordine->sconto_finale; ?>", "icon-after": "choice|untprc|sconto_finale) ? 'PRC' : 'UNT'; ?>", "help": "." ]}
'ckeditor', 'use_full_ckeditor' => 0, 'label' => tr('Condizioni generali di fornitura'), 'name' => 'condizioni_fornitura', 'value' => $record['condizioni_fornitura'], ]); ?>
{[ "type": "textarea", "label": "", "name": "note", "value": "$note$" ]}
{[ "type": "textarea", "label": "", "name": "note_aggiuntive", "value": "$note_aggiuntive$" ]}

{[ "type": "text", "label": "", "name": "codice_commessa", "required": 0, "value": "$codice_commessa$", "maxlength": 100 ]}
{[ "type": "text", "label": "", "name": "num_item", "required": 0, "value": "$num_item$", "maxlength": 15 ]}
{[ "type": "text", "label": "", "name": "codice_cig", "required": 0, "value": "$codice_cig$", "maxlength": 15 ]}
{[ "type": "text", "label": "", "name": "codice_cup", "required": 0, "value": "$codice_cup$", "maxlength": 15 ]}

'.tr('Righe').'

'; if (!$block_edit) { $prev_query = 'SELECT COUNT(*) AS tot FROM `co_preventivi` INNER JOIN `co_statipreventivi` ON `co_statipreventivi`.`id` = `co_preventivi`.`idstato` INNER JOIN `co_righe_preventivi` ON `co_preventivi`.`id` = `co_righe_preventivi`.`idpreventivo` WHERE `idanagrafica`='.prepare($record['idanagrafica']).' AND `co_statipreventivi`.`is_fatturabile` = 1 AND `default_revision`=1 AND (`co_righe_preventivi`.`qta` - `co_righe_preventivi`.`qta_evasa` > 0)'; $preventivi = $dbo->fetchArray($prev_query)[0]['tot']; echo '
'; // Form di inserimento riga documento echo ' '; } echo '
{( "name": "filelist_and_upload", "id_module": "$id_module$", "id_record": "$id_record$" )} {( "name": "log_email", "id_module": "$id_module$", "id_record": "$id_record$" )} '; // Collegamenti diretti // Fatture o ddt collegati a questo ordine $elementi = $dbo->fetchArray('SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `co_tipidocumento_lang`.`name` AS tipo_documento, `co_tipidocumento`.`dir` FROM `co_documenti` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento_lang`.`id_record` = `co_tipidocumento`.`id` AND `co_tipidocumento_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `co_righe_documenti` ON `co_righe_documenti`.`iddocumento` = `co_documenti`.`id` WHERE `co_righe_documenti`.`idordine` = '.prepare($id_record).') UNION SELECT `dt_ddt`.`id`, `dt_ddt`.`data`, `dt_ddt`.`numero`, `dt_ddt`.`numero_esterno`, `dt_tipiddt_lang`.`name` AS tipo_documento, `dt_tipiddt`.`dir` FROM `dt_ddt` INNER JOIN `dt_tipiddt` ON `dt_tipiddt`.`id` = `dt_ddt`.`idtipoddt` LEFT JOIN `dt_tipiddt_lang` ON (`dt_tipiddt_lang`.`id_record` = `dt_tipiddt`.`id` AND `dt_tipiddt_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `dt_righe_ddt` ON `dt_righe_ddt`.`idddt` = `dt_ddt`.`id` WHERE `dt_righe_ddt`.`idordine` = '.prepare($id_record).') ORDER BY `data`'); if (!empty($elementi)) { echo '

'.tr('Documenti collegati: _NUM_', [ '_NUM_' => count($elementi), ]).'

'; } if (!empty($elementi)) { echo '
'.tr('Eliminando questo documento si potrebbero verificare problemi nelle altre sezioni del gestionale').'.
'; } ?>