Facturacion
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
namespace Incoviba\Service\Contabilidad;
|
||||
|
||||
use DateTimeInterface;
|
||||
use DateTimeImmutable;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement\Exception;
|
||||
use Incoviba\Repository;
|
||||
@ -130,6 +131,34 @@ class Nubox extends Ideal\Service
|
||||
}
|
||||
return json_decode($response->getBody()->getContents(), JSON_OBJECT_AS_ARRAY);
|
||||
}
|
||||
public function getSaldoCuenta(int $inmobiliaria_rut, string $cuenta, DateTimeInterface $mes, bool $acumuladoAnual = false): array
|
||||
{
|
||||
$inmobiliaria = $this->nuboxRepository->fetchByInmobiliaria($inmobiliaria_rut);
|
||||
$from = new DateTimeImmutable($mes->format('Y-m-1'));
|
||||
$to = new DateTimeImmutable($mes->format('Y-m-t'));
|
||||
$query = [
|
||||
'NumeroSerie' => 1,
|
||||
'CodigoEmpresa' => $inmobiliaria->alias,
|
||||
'DDInicio' => $from->format('j'),
|
||||
'MMInicio' => $from->format('n'),
|
||||
'YYInicio' => $from->format('Y'),
|
||||
'DDTermino' => $to->format('j'),
|
||||
'MMTermino' => $to->format('n'),
|
||||
'YYTermino' => $to->format('Y'),
|
||||
'CodigoCentroDeCosto' => 0,
|
||||
'CodigoSucursal' => 0,
|
||||
'CodigoCuenta' => $cuenta,
|
||||
'ModoIFRS' => 'false',
|
||||
'CuentasConSaldo' => 'false',
|
||||
'IncluirCodigoCuenta' => 'true',
|
||||
];
|
||||
$uri = 'contabilidad/libro-mayor?' . http_build_query($query);
|
||||
$response = $this->send($uri, $inmobiliaria_rut);
|
||||
if ($response->getStatusCode() !== 200) {
|
||||
throw new Exception\HttpResponse($response->getReasonPhrase(), $response->getStatusCode());
|
||||
}
|
||||
return json_decode($response->getBody()->getContents(), JSON_OBJECT_AS_ARRAY);
|
||||
}
|
||||
|
||||
private function send(string $uri, int $inmobiliaria_rut, string $method = 'GET', ?StreamInterface $body = null): ResponseInterface
|
||||
{
|
||||
|
Reference in New Issue
Block a user