mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-02 08:56:48 +01:00
Fix creazione nota di credito
This commit is contained in:
parent
3de31bbec4
commit
4c30f237fd
@ -4,18 +4,21 @@ namespace Common\Components;
|
||||
|
||||
trait MorphTrait
|
||||
{
|
||||
protected $original_model = null;
|
||||
|
||||
public function hasOriginal()
|
||||
{
|
||||
return !empty($this->original_type) && !empty($this->getOriginal());
|
||||
}
|
||||
|
||||
public function original()
|
||||
{
|
||||
return $this->morphedByMany($this->original_type, 'original', $this->table, 'id');
|
||||
}
|
||||
|
||||
public function getOriginal()
|
||||
{
|
||||
return $this->original()->first();
|
||||
if(!isset($this->original_model) && !empty($this->original_type)) {
|
||||
$class = $this->original_type;
|
||||
|
||||
$this->original_model = $class::find($this->original_id);
|
||||
}
|
||||
|
||||
return $this->original_model;
|
||||
}
|
||||
}
|
||||
|
@ -636,6 +636,9 @@ switch (post('op')) {
|
||||
|
||||
// Nota di credito
|
||||
case 'nota_credito':
|
||||
$id_documento = post('id_documento');
|
||||
$fattura = Fattura::find($id_documento);
|
||||
|
||||
$id_segment = post('id_segment');
|
||||
$data = post('data');
|
||||
|
||||
|
@ -2,31 +2,18 @@
|
||||
|
||||
include_once __DIR__.'/../../core.php';
|
||||
|
||||
$module = Modules::get($id_module);
|
||||
use Modules\Fatture\Fattura;
|
||||
|
||||
$documento = Fattura::find($id_record);
|
||||
|
||||
$options = [
|
||||
'type' => 'nota_credito',
|
||||
'op' => 'nota_credito',
|
||||
'id_importazione' => 'id_documento',
|
||||
'final_module' => $module['name'],
|
||||
'original_module' => $module['name'],
|
||||
'sql' => [
|
||||
'table' => 'co_documenti',
|
||||
'rows' => 'co_righe_documenti',
|
||||
'id_rows' => 'iddocumento',
|
||||
],
|
||||
'serials' => [
|
||||
'id_riga' => 'id_riga_documento',
|
||||
'condition' => '(1 = 2)',
|
||||
],
|
||||
'module' => 'Fatture di vendita',
|
||||
'documento' => $documento,
|
||||
'button' => tr('Aggiungi'),
|
||||
'dir' => $dir,
|
||||
'create_document' => true,
|
||||
'allow-empty' => true,
|
||||
];
|
||||
|
||||
$result = [
|
||||
'id_record' => $id_record,
|
||||
'id_documento' => get('iddocumento'),
|
||||
];
|
||||
|
||||
echo App::load('importa.php', $result, $options, true);
|
||||
echo App::load('importa.php', [], $options, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user