Listar movimientos y exportar
TODO: editar
This commit is contained in:
@ -2,10 +2,11 @@
|
||||
use Incoviba\Controller\API\Contabilidad\Movimientos;
|
||||
|
||||
$app->group('/movimientos', function($app) {
|
||||
$app->post('/sociedad/mes', [Movimientos::class, 'sociedad']);
|
||||
$app->post('/segment', [Movimientos::class, 'segment']);
|
||||
$app->post('/sociedad/mes[/]', [Movimientos::class, 'sociedad']);
|
||||
$app->post('/edit[/]', [Movimientos::class, 'edit']);
|
||||
$app->post('/segment[/]', [Movimientos::class, 'segment']);
|
||||
$app->get('[/]', Movimientos::class);
|
||||
});
|
||||
$app->group('/movimiento/{movimiento_id}', function($app) {
|
||||
$app->post('/detalles', [Movimientos::class, 'detalles']);
|
||||
$app->post('/detalles[/]', [Movimientos::class, 'detalles']);
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,11 +3,11 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
class APIClient {
|
||||
static fetch(url, options=null) {
|
||||
return fetchAPI(url, options)
|
||||
static fetch(url, options=null, showErrors=false) {
|
||||
return fetchAPI(url, options, showErrors)
|
||||
}
|
||||
}
|
||||
function fetchAPI(url, options=null) {
|
||||
function fetchAPI(url, options=null, showErrors=false) {
|
||||
if (options === null) {
|
||||
options = {}
|
||||
}
|
||||
@ -23,7 +23,9 @@
|
||||
}
|
||||
throw new Error(JSON.stringify({code: response.status, message: response.statusText, url}))
|
||||
}).catch(error => {
|
||||
console.error(error)
|
||||
if (showErrors) {
|
||||
console.error(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
const datatables_defaults = {
|
||||
|
@ -83,13 +83,13 @@ class Movimientos extends Ideal\Controller
|
||||
'input' => $input,
|
||||
'movimientos' => []
|
||||
];
|
||||
try {
|
||||
$sociedades_ruts = $input['sociedades_ruts'];
|
||||
foreach ($sociedades_ruts as $sociedadRut) {
|
||||
$movimientos = $movimientoService->getAmountBySociedadAndMes($sociedadRut, new DateTimeImmutable($input['mes']), $input['amount'] ?? null);
|
||||
$output['movimientos'] = array_merge($output['movimientos'], $this->movimientosToArray($movimientos));
|
||||
}
|
||||
} catch (EmptyResult) {}
|
||||
$sociedades_ruts = $input['sociedades_ruts'];
|
||||
foreach ($sociedades_ruts as $sociedadRut) {
|
||||
try {
|
||||
$movimientos = $movimientoService->getAmountBySociedadAndMes($sociedadRut, new DateTimeImmutable($input['mes']), $input['amount'] ?? null);
|
||||
$output['movimientos'] = array_merge($output['movimientos'], $this->movimientosToArray($movimientos));
|
||||
} catch (EmptyResult) {}
|
||||
}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user