openstamanager/modules/ordini/crea_documento.php

40 lines
1.0 KiB
PHP
Raw Normal View History

2018-06-11 22:33:36 +02:00
<?php
include_once __DIR__.'/../../core.php';
$module = Modules::get($id_module);
2019-02-14 17:49:58 +01:00
if (get('documento') == 'fattura') {
$final_module = $module['name'] == 'Ordini cliente' ? 'Fatture di vendita' : 'Fatture di acquisto';
2018-06-11 22:33:36 +02:00
} else {
2019-02-14 17:49:58 +01:00
$final_module = $module['name'] == 'Ordini cliente' ? 'Ddt di vendita' : 'Ddt di acquisto';
2018-06-11 22:33:36 +02:00
}
2019-02-14 17:49:58 +01:00
$dir = $module['name'] == 'Ordini cliente' ? 'entrata' : 'uscita';
$options = [
'op' => 'add_ordine',
'id_importazione' => 'id_ordine',
'final_module' => $final_module,
'original_module' => $module['name'],
'sql' => [
'table' => 'or_ordini',
'rows' => 'or_righe_ordini',
'id_rows' => 'idordine',
],
'serials' => [
'id_riga' => 'id_riga_ordine',
'condition' => '(id_riga_ddt IS NOT NULL OR id_riga_documento IS NOT NULL)',
],
'button' => tr('Aggiungi'),
'dir' => $dir,
'create_document' => true,
];
2018-06-11 22:33:36 +02:00
2019-02-14 17:49:58 +01:00
$result = [
'id_record' => $id_record,
'id_documento' => get('iddocumento'),
];
2018-06-11 22:33:36 +02:00
2019-02-14 17:49:58 +01:00
echo App::load('importa.php', $result, $options, true);