trabajando en servicios encuadernacion

This commit is contained in:
2023-11-20 21:11:20 +01:00
parent d7fda0e8db
commit 58af5bf90f
12 changed files with 114 additions and 1318 deletions

View File

@ -50,8 +50,10 @@ class PresupuestoEncuadernaciones extends \App\Controllers\GoBaseResourceControl
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_P = $reqData['id_presupuesto'] ?? -1;
$tipoPresupuesto = $reqData['tipo_presupuesto'] ?? -1;
$solapas = $reqData['solapas'] ?? false;
$resourceData = $this->model->getResource($id_P)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
$resourceData = $this->model->getResource($id_P, $tipoPresupuesto, $solapas)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,

View File

@ -17,9 +17,15 @@ class Test extends BaseController
public function index()
{
$this->getLP();
var_dump($this->get_tarifas_encuadernacion(4, true));
}
public function get_tarifas_encuadernacion($tipo_presupuesto, $solapas){
$model = model('App\Models\Presupuestos\TipoPresupuestoTarifaEncuadernacionModel');
return $model->get_tarifas($tipo_presupuesto,$solapas);
}
public function timeToSeconds(){
$time = '99:59:59';
@ -34,8 +40,8 @@ class Test extends BaseController
$papel_imp_model = model('App\Models\Configuracion\PapelImpresionModel');
$maquina_model = model('App\Models\Configuracion\MaquinaModel');
foreach($data as $linea){
$linea->papel_impresion_id = $papel_imp_model->getValue_Nombre($linea->papel_impresion_id)[0];
$linea->maquina_id = $maquina_model->getValue_Nombre($linea->maquina_id)[0];
//$linea->papel_impresion_id = $papel_imp_model->getValue_Nombre($linea->papel_impresion_id)[0];
//$linea->maquina_id = $maquina_model->getValue_Nombre($linea->maquina_id)[0];
var_dump($linea->papel_impresion_id);
var_dump($linea->maquina_id);
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Entities\Presupuestos;
use CodeIgniter\Entity;
class TipoPresupuestoTarifaEncuadernacion extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"tipo_presupuesto_id" => null,
"tarifa_encuadernacion_id" => null,
"solapas" => null,
"is_deleted" => 0,
"deleted_at" => null,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"tipo_presupuesto_id" => "int",
"tarifa_encuadernacion_id" => "int",
"solapas" => "int",
"is_deleted" => "int",
];
}

View File

@ -45,6 +45,21 @@ class PresupuestoEncuadernacionesModel extends \App\Models\GoBaseModel
];
public function initPresupuesto($tipoPresupuesto, $solapas){
$model = model('App\Models\Presupuestos\TipoPresupuestoTarifaEncuadernacionModel');
$tarifas_ids = $model->get_tarifas($tipo_presupuesto,$solapas);
}
public function delete($presupuesto_id){
$builder = $this->db
->table($this->table . " t1")
->where('t1.presupuesto_id', $presupuesto_id)
->delete();
}
/**
* Get resource data.
*

View File

@ -211,7 +211,7 @@ class PresupuestoModel extends \App\Models\GoBaseModel
protected $validationRulesAdd = [
"autor" => [
"label" => "Presupuestos.autor",
"rules" => "trim|required|max_length[150]",
"rules" => "trim|max_length[150]",
],
"titulo" => [
"label" => "Presupuestos.titulo",

View File

@ -0,0 +1,38 @@
<?php
namespace App\Models\Presupuestos;
class TipoPresupuestoTarifaEncuadernacionModel extends \App\Models\GoBaseModel
{
protected $table = "tipos_presupuestos_tarifas_encuadernacion";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
protected $allowedFields = ["tipo_presupuesto_id", "tarifa_encuadernacion_id", "solapas", "is_deleted"];
protected $returnType = "App\Entities\Presupuestos\TipoPresupuestoTarifaEncuadernacionEntity";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "tipo_presupuesto_id";
public function get_tarifas($tipo_presupuesto=-1, $solapas=0){
$where = "t1.solapas IS NULL OR t1.solapas='" . $solapas . "'";
$builder = $this->db
->table($this->table . " t1")
->select("t1.tarifa_encuadernacion_id AS tarifa_encuadernacion_id")
->where("t1.tipo_presupuesto_id", $tipo_presupuesto)
->where($where);
return $builder->get()->getResultArray();
}
}

View File

@ -81,7 +81,7 @@
<div class="col-md-12 col-lg-6 px-4">
<div class="mb-3">
<label for="autor" class="form-label">
<?=lang('Presupuestos.autor') ?>*
<?=lang('Presupuestos.autor') ?>
</label>
<input type="text" id="autor" name="autor" maxLength="150" class="form-control" value="<?=old('autor', $presupuestoEntity->autor) ?>">
</div><!--//.mb-3 -->

View File

@ -242,6 +242,7 @@
});
var theTable = $('#tableOfServiciosAcabado').DataTable( {
draw: 1,
serverSide: true,
processing: true,
autoWidth: true,
@ -261,7 +262,7 @@
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
async: false,
}),
columns: [
{'data': 'tarifa_acabado_id',
@ -375,6 +376,7 @@
var theTable2 = $('#tableOfServiciosEncuadernacion').DataTable( {
draw: 2,
serverSide: true,
processing: true,
autoWidth: true,
@ -391,6 +393,8 @@
url: '<?= route_to('dataTableOfPresupuestoEncuadernaciones') ?>',
data: {
id_presupuesto: id,
tipo_presupuesto: 4,
solapas: $('#solapas').is(':checked'),
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
@ -511,6 +515,7 @@
var theTable3 = $('#tableOfServiciosManipulado').DataTable( {
draw: 3,
serverSide: true,
processing: true,
autoWidth: true,
@ -648,6 +653,7 @@
var theTable4 = $('#tableOfServiciosPreimpresion').DataTable( {
draw: 4,
serverSide: true,
processing: true,
autoWidth: true,

View File

@ -5,7 +5,7 @@
data-bs-target="#accordionPreviewTip" aria-expanded="false"
aria-controls="accordionPreviewTip">
<h4><?= lang("Presupuestos.preview") ?></h4>
</button>
</button>
</h2>
<div id="accordionPreviewTip" class="accordion-collapse collapse show"

View File

@ -16,7 +16,6 @@ $('#compPaginasNegro').on("change", function () {
document.getElementById('compPaginasColor').value = newValue >= 0 ? newValue : 0;
$('#compPaginasColor').change();
}
}
});
@ -37,16 +36,23 @@ $('#compPaginasColor').on("change", function () {
});
$('#compPaginasNegrohq').on("change", function () {
if (document.getElementById('paginas').value < document.getElementById('compPaginasNegrohq').value) {
document.getElementById('compPaginasNegrohq').value = document.getElementById('paginas').value;
}
if ($('#tipoImpresion').select2('data')[0].id == 'color') {
if (document.getElementById('compPaginasNegrohq').value + document.getElementById('compPaginasColorhq').value > document.getElementById('paginas').value) {
var newValue = document.getElementById('paginas').value - document.getElementById('compPaginasNegrohq').value;
var negro = parseInt(document.getElementById('compPaginasNegrohq').value);
const paginas = parseInt(document.getElementById('paginas').value);
if (paginas < negro) {
document.getElementById('compPaginasNegrogq').value = paginas;
negro = paginas;
}
var color = parseInt(document.getElementById('compPaginasColorhq').value);
if ($('#tipoImpresion').select2('data')[0].id == 'colorhq') {
var newValue = paginas - negro;
if (newValue != color) {
document.getElementById('compPaginasColorhq').value = newValue >= 0 ? newValue : 0;
$('#compPaginasColorhq').change();
}
}
});
$('#compPaginasColorhq').on("change", function () {

View File

@ -133,6 +133,8 @@ $('#presupuestoForm').on( "submit", function( event ) {
return false; //stop the actual form post !important!
});
<?= $this->endSection() ?>
<?php endif; ?>