mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en obtener el gramaje. las funcion calcular mermas hay que colocarla en mejor sitio
This commit is contained in:
@ -149,13 +149,18 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
|
||||
$presupuestoEntity = isset($sanitizedData) ? new PresupuestoEntity($sanitizedData) : new PresupuestoEntity();
|
||||
$presupuestoEntity->POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
$presupuestoEntity->clienteId = $clienteId;
|
||||
|
||||
$datosPresupuesto = (object)array();
|
||||
$datosPresupuesto->POD = model('App\Models\Configuracion\ConfiguracionSistemaModel')->getPOD();
|
||||
$datosPresupuesto->paisList = model('App\Models\Configuracion\PaisModel')->getAllForMenu('id, nombre', 'nombre', true);
|
||||
$datosPresupuesto->papelFormatoList = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
||||
|
||||
$datosPresupuesto->papelInteriorNegro = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('negro', false, false);
|
||||
$datosPresupuesto->papelInteriorNegroHq = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('negrohq', false, false);
|
||||
$datosPresupuesto->papelInteriorColor = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('color', false, false);
|
||||
$datosPresupuesto->papelInteriorColorHq = model('App\Models\Configuracion\PapelGenericoModel')->getPapelForComparador('colorhq', false, false);
|
||||
|
||||
$this->viewData['formAction'] = route_to('crearPresupuestoCliente');
|
||||
|
||||
$this->viewData['presupuestoEntity'] = $presupuestoEntity;
|
||||
@ -468,6 +473,39 @@ class Presupuestocliente extends \App\Controllers\GoBaseResourceController
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getGramaje(){
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
try {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
$tirada = $reqData['tirada'] ?? 0;
|
||||
$merma = $reqData['merma'] ?? 0;
|
||||
$papel = $reqData['papel'] ?? "";
|
||||
$uso = $reqData['uso'] ?? "";
|
||||
|
||||
$model = new PapelGenericoModel();
|
||||
$menu = $model->getGramajeComparador($papel, $uso, intval($tirada + $merma));
|
||||
|
||||
$data = [
|
||||
'menu' => $menu,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
} catch (Exception $e) {
|
||||
$data = [
|
||||
'error' => $e,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
} finally {
|
||||
return $this->respond($data);
|
||||
}
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user