Skip to content

Commit

Permalink
republica_dominicana:
Browse files Browse the repository at this point in the history
- Fixed a typo in pk for ncf_tipo_pago_compras table.
- Added new NCF types 16 and 17
- Renamed NCF Description Types
- Added company phone number in TPV invoice print format
  • Loading branch information
joenilson committed Jun 15, 2019
1 parent 612deda commit e4d3cef
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 19 deletions.
60 changes: 42 additions & 18 deletions model/core/ncf_tipo.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ class ncf_tipo extends \fs_model
public $compras;
public $contribuyente;
public $array_comprobantes = array(
array ('tipo' => '01', 'descripcion' => 'FACTURA DE CREDITO FISCAL'),
array ('tipo' => '02', 'descripcion' => 'FACTURA DE CONSUMO'),
array ('tipo' => '03', 'descripcion' => 'NOTA DE DEBITO'),
array ('tipo' => '04', 'descripcion' => 'NOTA DE CREDITO'),
array ('tipo' => '11', 'descripcion' => 'REGISTRO DE PROVEEDORES INFORMALES'),
array ('tipo' => '12', 'descripcion' => 'REGISTRO UNICO DE INGRESOS'),
array ('tipo' => '13', 'descripcion' => 'REGISTRO DE GASTOS MENORES'),
array ('tipo' => '14', 'descripcion' => 'REGIMEN ESPECIAL DE TRIBUTACION'),
array ('tipo' => '15', 'descripcion' => 'COMPROBANTE GUBERNAMENTAL')
array ('tipo' => '01', 'descripcion' => 'FACTURA DE CREDITO FISCAL', 'clase_movimiento'=>'suma', 'ventas'=>'X', 'compras'=>'X', 'contribuyente'=>'X'),
array ('tipo' => '02', 'descripcion' => 'FACTURA DE CONSUMO', 'clase_movimiento'=>'suma', 'ventas'=>'X', 'compras'=>'', 'contribuyente'=>'X'),
array ('tipo' => '03', 'descripcion' => 'NOTA DE DEBITO', 'clase_movimiento'=>'suma', 'ventas'=>'X', 'compras'=>'X', 'contribuyente'=>''),
array ('tipo' => '04', 'descripcion' => 'NOTA DE CREDITO', 'clase_movimiento'=>'resta', 'ventas'=>'X', 'compras'=>'X', 'contribuyente'=>''),
array ('tipo' => '11', 'descripcion' => 'COMPROBANTE DE COMPRAS', 'clase_movimiento'=>'suma', 'ventas'=>'', 'compras'=>'X', 'contribuyente'=>'X'),
array ('tipo' => '12', 'descripcion' => 'REGISTRO UNICO DE INGRESOS', 'clase_movimiento'=>'suma', 'ventas'=>'X', 'compras'=>'', 'contribuyente'=>''),
array ('tipo' => '13', 'descripcion' => 'COMPROBANTE PARA GASTOS MENORES', 'clase_movimiento'=>'suma', 'ventas'=>'', 'compras'=>'X', 'contribuyente'=>''),
array ('tipo' => '14', 'descripcion' => 'COMPROBANTE DE REGIMENES ESPECIALES', 'clase_movimiento'=>'suma', 'ventas'=>'X', 'compras'=>'X', 'contribuyente'=>'X'),
array ('tipo' => '15', 'descripcion' => 'COMPROBANTE GUBERNAMENTAL', 'clase_movimiento'=>'suma', 'ventas'=>'X', 'compras'=>'X', 'contribuyente'=>'X'),
array ('tipo' => '16', 'descripcion' => 'COMPROBANTE PARA EXPORTACIONES', 'clase_movimiento'=>'suma', 'ventas'=>'X', 'compras'=>'X', 'contribuyente'=>'X'),
array ('tipo' => '17', 'descripcion' => 'COMPROBANTE PARA PAGOS AL EXTERIOR', 'clase_movimiento'=>'suma', 'ventas'=>'', 'compras'=>'X', 'contribuyente'=>'X'),
);
public function __construct($t = false)
{
Expand Down Expand Up @@ -70,11 +72,13 @@ protected function install()
"('02','FACTURA DE CONSUMO',TRUE, 'suma','X',null,'X'),".
"('03','NOTA DE DEBITO',true, 'suma','X','X',null),".
"('04','NOTA DE CREDITO',TRUE, 'resta','X','X',null),".
"('11','REGISTRO DE PROVEEDORES INFORMALES',TRUE, 'suma',null,'X','X'),".
"('11','COMPROBANTE DE COMPRAS',TRUE, 'suma',null,'X','X'),".
"('12','REGISTRO UNICO DE INGRESOS',TRUE, 'suma','X',null,null),".
"('13','REGISTRO DE GASTOS MENORES',TRUE, 'suma',null,'X',null),".
"('14','REGIMEN ESPECIAL DE TRIBUTACION',TRUE, 'suma','X','X','X'),".
"('15','COMPROBANTE GUBERNAMENTAL',TRUE, 'suma','X','X','X');";
"('13','COMPROBANTE PARA GASTOS MENORES',TRUE, 'suma',null,'X',null),".
"('14','COMPROBANTE DE REGIMENES ESPECIALES',TRUE, 'suma','X','X','X'),".
"('15','COMPROBANTE GUBERNAMENTAL',TRUE, 'suma','X','X','X');".
"('16','COMPROBANTE PARA EXPORTACIONES',TRUE, 'suma','X','X','X');".
"('17','COMPROBANTE PARA PAGOS AL EXTERIOR',TRUE, 'suma',null, 'X','X');";
}

public function exists()
Expand Down Expand Up @@ -188,13 +192,33 @@ public function restore_names()
$this->db->exec($sqlClean);
$counter = 0;
foreach($this->array_comprobantes as $comprobante) {
$sql = "UPDATE ".$this->table_name." SET descripcion = ".$this->var2str($comprobante['descripcion']).
" WHERE tipo_comprobante = ".$this->var2str($comprobante['tipo']);
if($this->db->exec($sql)) {
$counter ++;
}
$this->restore_name($comprobante, $counter);
}
return $counter;

}

public function restore_name($comprobante, &$counter)
{
if($this->get($comprobante['tipo'])) {
$sql = "UPDATE ".$this->table_name." SET descripcion = ".$this->var2str($comprobante['descripcion']).", "." ESTADO = TRUE ".", ".
" clase_movimiento = ".$this->var2str($comprobante['clase_movimiento']).", ".
" ventas = ".$this->var2str($comprobante['ventas']).", ".
" compras = ".$this->var2str($comprobante['compras']).", ".
" contribuyente = ".$this->var2str($comprobante['contribuyente'])." ".
" WHERE tipo_comprobante = ".$this->var2str($comprobante['tipo']);
} else {
$sql = "INSERT INTO ".$this->table_name
." (tipo_comprobante, descripcion, estado, clase_movimiento, ventas, compras, contribuyente ) VALUES ".
"('".$comprobante['tipo']."','".
$comprobante['descripcion']."',TRUE, '".
$comprobante['clase_movimiento']."','".
$comprobante['ventas']."','".
$comprobante['compras']."','".
$comprobante['contribuyente']."');";
}
if($this->db->exec($sql)) {
$counter ++;
}
}
}
14 changes: 14 additions & 0 deletions model/core/terminal_caja.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ public function imprimir_ticket(&$factura, &$empresa, $imprimir_descripciones =
$this->add_linea(
$this->center_text($this->sanitize($empresa->direccion) . " - " . $this->sanitize($empresa->ciudad)) . "\n"
);

if ($empresa->telefono != '') {
$this->add_linea(
$this->center_text($this->sanitize($empresa->telefono)) . "\n"
);
}

$this->add_linea($this->center_text(FS_CIFNIF . ": " . $empresa->cifnif));
$this->add_linea("\n\n");

Expand Down Expand Up @@ -471,6 +478,13 @@ public function imprimir_ticket_regalo(&$factura, &$empresa, $imprimir_descripci
$this->add_linea(
$this->center_text($this->sanitize($empresa->direccion) . " - " . $this->sanitize($empresa->ciudad)) . "\n"
);

if ($empresa->telefono != '') {
$this->add_linea(
$this->center_text($this->sanitize($empresa->telefono)) . "\n"
);
}

$this->add_linea($this->center_text(FS_CIFNIF . ": " . $empresa->cifnif));
$this->add_linea("\n\n");

Expand Down
2 changes: 1 addition & 1 deletion model/table/ncf_tipo_pagos_compras.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<nulo>YES</nulo>
</columna>
<restriccion>
<nombre>ncf_tipo_pagos_pkey</nombre>
<nombre>ncf_tipo_pagos_compras_pkey</nombre>
<consulta>PRIMARY KEY (codigo)</consulta>
</restriccion>
</tabla>

0 comments on commit e4d3cef

Please sign in to comment.