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