mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'dev/presupuestos3' into 'dev/formas_libro'
# Conflicts: # ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php
This commit is contained in:
@ -471,8 +471,9 @@ $routes->group('cosidotapablanda', ['namespace' => 'App\Controllers\Presupuestos
|
||||
$routes->post('add', 'Cosidotapablanda::add', ['as' => 'createCosidotapablanda']);
|
||||
$routes->post('create', 'Cosidotapablanda::create', ['as' => 'ajaxCreateCosidotapablanda']);
|
||||
$routes->put('(:num)/update', 'Cosidotapablanda::update/$1', ['as' => 'ajaxUpdateCosidotapablanda']);
|
||||
$routes->post('(:num)/edit', 'Cosidotapablanda::edit/$1', ['as' => 'updateCosidotapablanda']);
|
||||
$routes->post('edit/(:num)', 'Cosidotapablanda::edit/$1', ['as' => 'updateCosidotapablanda']);
|
||||
$routes->post('datatable', 'Cosidotapablanda::datatable', ['as' => 'dataTableOfCosidotapablanda']);
|
||||
$routes->post('datatable_2', 'Cosidotapablanda::datatable_2', ['as' => 'updateDataOfCosidotapablanda']);
|
||||
$routes->post('allmenuitems', 'Cosidotapablanda::allItemsSelect', ['as' => 'select2ItemsOfCosidotapablanda']);
|
||||
$routes->post('menuitems', 'Cosidotapablanda::menuItems', ['as' => 'menuItemsOfCosidotapablanda']);
|
||||
});
|
||||
|
||||
@ -312,11 +312,16 @@ class Cliente extends \App\Controllers\GoBaseResourceController
|
||||
$onlyActiveOnes = false;
|
||||
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
|
||||
$onlyActiveOnes = false;
|
||||
try{
|
||||
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
|
||||
$nonItem = new \stdClass;
|
||||
$nonItem->id = '';
|
||||
$nonItem->text = '- ' . lang('Basic.global.None') . ' -';
|
||||
array_unshift($menu, $nonItem);
|
||||
}
|
||||
catch(Exception $e){
|
||||
$menu = [];
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
|
||||
@ -255,18 +255,28 @@ abstract class GoBaseResourceController extends \CodeIgniter\RESTful\ResourceCon
|
||||
|
||||
/**
|
||||
* Convenience method to validate form submission
|
||||
* JJO: Se le añade las reglas y los mensajes custom
|
||||
* @return bool
|
||||
*/
|
||||
protected function canValidate()
|
||||
protected function canValidate($customValidationRules = null, $customValidationMessages = null)
|
||||
{
|
||||
|
||||
if($customValidationRules == null){
|
||||
$validationRules = $this->model->validationRules ?? $this->formValidationRules ?? null;
|
||||
|
||||
}
|
||||
else{
|
||||
$validationRules = $customValidationRules;
|
||||
}
|
||||
if ($validationRules == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($customValidationMessages == null){
|
||||
$validationErrorMessages = $this->model->validationMessages ?? $this->formValidationErrorMessagess ?? null;;
|
||||
}
|
||||
else{
|
||||
$validationErrorMessages = $customValidationMessages;
|
||||
}
|
||||
|
||||
if ($validationErrorMessages != null) {
|
||||
$valid = $this->validate($validationRules, $validationErrorMessages);
|
||||
|
||||
@ -14,7 +14,7 @@ use App\Services\PresupuestoService;
|
||||
use App\Models\Configuracion\PapelImpresionModel;
|
||||
use App\Models\Configuracion\MaquinaModel;
|
||||
use App\Models\Configuracion\MaquinasTarifasImpresionModel;
|
||||
|
||||
use Exception;
|
||||
|
||||
class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
@ -96,10 +96,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$sanitizedData['user_created_id'] = $session->id_user;
|
||||
|
||||
$noException = true;
|
||||
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
if ($successfulResult = $this->canValidate($this->model->validationRulesAdd, $this->model->validationMessagesAdd)) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
|
||||
|
||||
|
||||
if ($this->canValidate()) :
|
||||
if ($this->canValidate($this->model->validationRulesAdd, $this->model->validationMessagesAdd)) :
|
||||
try {
|
||||
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
|
||||
} catch (\Exception $e) {
|
||||
@ -117,6 +116,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$id = $this->model->db->insertID();
|
||||
|
||||
$lp_model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$lp_model->createForPresupuesto($id);
|
||||
|
||||
$message = lang('Basic.global.saveSuccess', [lang('Basic.global.record')]) . '.';
|
||||
|
||||
if ($thenRedirect) :
|
||||
@ -138,27 +140,13 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
|
||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
||||
$this->viewData['papelGenericoNegroList'] = $this->getPapelGenericoNegro();
|
||||
$this->viewData['papelGenericoNegroHQList'] = $this->getPapelGenericoNegroHQ();
|
||||
$this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
|
||||
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
|
||||
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
|
||||
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
|
||||
|
||||
// Tarifas
|
||||
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
||||
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
|
||||
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
|
||||
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
|
||||
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
|
||||
|
||||
$this->viewData['formAction'] = route_to('createCosidotapablanda');
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.addNew') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.addNewSuffix');
|
||||
|
||||
/* TEST JS LOADER */
|
||||
//$this->viewData['global_js_variables'] = array('jsVarTest' => "'Hola Jaime'");
|
||||
|
||||
return $this->displayForm(__METHOD__);
|
||||
} // end function add()
|
||||
|
||||
@ -187,82 +175,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$postData['updated_at'] = gmdate('Y-m-d H:m:s', time());
|
||||
|
||||
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
|
||||
if ($this->request->getPost('recoger_en_taller') == null) {
|
||||
$sanitizedData['recoger_en_taller'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro') == null) {
|
||||
$sanitizedData['ferro'] = false;
|
||||
}
|
||||
if ($this->request->getPost('ferro_digital') == null) {
|
||||
$sanitizedData['ferro_digital'] = false;
|
||||
}
|
||||
if ($this->request->getPost('marcapaginas') == null) {
|
||||
$sanitizedData['marcapaginas'] = false;
|
||||
}
|
||||
if ($this->request->getPost('papel_formato_personalizado') == null) {
|
||||
$sanitizedData['papel_formato_personalizado'] = false;
|
||||
}
|
||||
if ($this->request->getPost('solapas') == null) {
|
||||
$sanitizedData['solapas'] = false;
|
||||
}
|
||||
if ($this->request->getPost('cosido') == null) {
|
||||
$sanitizedData['cosido'] = false;
|
||||
}
|
||||
if ($this->request->getPost('cubiertas') == null) {
|
||||
$sanitizedData['cubiertas'] = false;
|
||||
}
|
||||
if ($this->request->getPost('imagenes_bn_interior') == null) {
|
||||
$sanitizedData['imagenes_bn_interior'] = false;
|
||||
}
|
||||
if ($this->request->getPost('en_produccion') == null) {
|
||||
$sanitizedData['en_produccion'] = false;
|
||||
}
|
||||
if ($this->request->getPost('en_espera') == null) {
|
||||
$sanitizedData['en_espera'] = false;
|
||||
}
|
||||
if ($this->request->getPost('modo_comparador') == null) {
|
||||
$sanitizedData['modo_comparador'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_negro_hq') == null) {
|
||||
$sanitizedData['paginas_negro_hq'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_negro_check_papel_total') == null) {
|
||||
$sanitizedData['paginas_negro_check_papel_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_negro_check_impresion_total') == null) {
|
||||
$sanitizedData['paginas_negro_check_impresion_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_color_check_papel_total') == null) {
|
||||
$sanitizedData['paginas_color_check_papel_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_color_check_impresion_total') == null) {
|
||||
$sanitizedData['paginas_color_check_impresion_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_portada_check_papel_total') == null) {
|
||||
$sanitizedData['paginas_portada_check_papel_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_portada_check_impresion_total') == null) {
|
||||
$sanitizedData['paginas_portada_check_impresion_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_cubierta_papel_impresion_id') == null) {
|
||||
$sanitizedData['paginas_cubierta_papel_impresion_id'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_cubierta_check_papel_total') == null) {
|
||||
$sanitizedData['paginas_cubierta_check_papel_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('paginas_cubierta_check_impresion_total') == null) {
|
||||
$sanitizedData['paginas_cubierta_check_impresion_total'] = false;
|
||||
}
|
||||
if ($this->request->getPost('isDig') == null) {
|
||||
$sanitizedData['isDig'] = false;
|
||||
}
|
||||
if ($this->request->getPost('envios_recoge_cliente') == null) {
|
||||
$sanitizedData['envios_recoge_cliente'] = false;
|
||||
}
|
||||
if ($this->request->getPost('fecha_entrega_real_aviso') == null) {
|
||||
$sanitizedData['fecha_entrega_real_aviso'] = false;
|
||||
}
|
||||
|
||||
// JJO
|
||||
$sanitizedData['user_updated_id'] = $session->id_user;
|
||||
@ -287,68 +202,88 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$presupuestoEntity->fill($sanitizedData);
|
||||
|
||||
$thenRedirect = true;
|
||||
$thenRedirect = false;
|
||||
endif;
|
||||
if ($noException && $successfulResult) :
|
||||
$id = $presupuestoEntity->id ?? $id;
|
||||
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Presupuestos.presupuesto'))]) . '.';
|
||||
$message .= anchor("admin/presupuestos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
|
||||
$message = ucfirst(str_replace("'", "\'", $message));
|
||||
// $message .= anchor("admin/presupuestos/{$id}/edit", lang('Basic.global.continueEditing') . '?');
|
||||
//$message = ucfirst(str_replace("'", "\'", $message));
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else :
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'mensaje' => $message,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
else{
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
}
|
||||
|
||||
endif;
|
||||
else :
|
||||
if ($this->request->isAJAX()) {
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
'mensaje' => $message,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
return $this->respond($data);
|
||||
}
|
||||
else{
|
||||
$this->session->setFlashData('sweet-success', $message);
|
||||
}
|
||||
endif;
|
||||
|
||||
endif; // $noException && $successfulResult
|
||||
endif; // ($requestMethod === 'post')
|
||||
|
||||
$this->viewData['presupuestoEntity'] = $presupuestoEntity;
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
$this->viewData['formaPagoList'] = $this->getFormaPagoListItems();
|
||||
$this->viewData['tiposImpresionList'] = $this->getTiposImpresionListItems($presupuestoEntity->tipo_impresion_id ?? null);
|
||||
$this->viewData['tipologiasLibroList'] = $this->getTipologiasLibroListItems($presupuestoEntity->tipologia_id ?? null);
|
||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||
$this->viewData['ubicacionLibroList'] = $this->getUbicacionLibroListItems($presupuestoEntity->ubicacion_id ?? null);
|
||||
$this->viewData['presupuestoEstadoList'] = $this->getPresupuestoEstadoListItems($presupuestoEntity->estado_id ?? null);
|
||||
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
||||
$this->viewData['papelGenericoList'] = $this->getPapelGenericoListItems($presupuestoEntity->paginas_negro_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList'] = $this->getPapelImpresionListItems($presupuestoEntity->paginas_negro_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList'] = $this->getMaquinaListItems($presupuestoEntity->paginas_negro_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList'] = $this->getMaquinasTarifasImpresionListItems($presupuestoEntity->paginas_negro_tarifa_impresion_id ?? null);
|
||||
$this->viewData['papelGenericoList2'] = $this->getPapelGenericoListItems2($presupuestoEntity->paginas_color_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList2'] = $this->getPapelImpresionListItems2($presupuestoEntity->paginas_color_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList2'] = $this->getMaquinaListItems2($presupuestoEntity->paginas_color_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList2'] = $this->getMaquinasTarifasImpresionListItems2($presupuestoEntity->paginas_color_tarifa_impresion_id ?? null);
|
||||
$this->viewData['papelGenericoList3'] = $this->getPapelGenericoListItems3($presupuestoEntity->paginas_portada_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList3'] = $this->getPapelImpresionListItems3($presupuestoEntity->paginas_portada_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList3'] = $this->getMaquinaListItems3($presupuestoEntity->paginas_portada_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList3'] = $this->getMaquinasTarifasImpresionListItems3($presupuestoEntity->paginas_portada_tarifa_impresion_id ?? null);
|
||||
$this->viewData['papelGenericoList4'] = $this->getPapelGenericoListItems4($presupuestoEntity->paginas_cubierta_papel_id ?? null);
|
||||
$this->viewData['papelImpresionList4'] = $this->getPapelImpresionListItems4($presupuestoEntity->paginas_cubierta_papel_impresion_id ?? null);
|
||||
$this->viewData['maquinaList4'] = $this->getMaquinaListItems4($presupuestoEntity->paginas_cubierta_maquina_id ?? null);
|
||||
$this->viewData['maquinasTarifasImpresionList4'] = $this->getMaquinasTarifasImpresionListItems4($presupuestoEntity->paginas_cubierta_tarifa_impresion_id ?? null);
|
||||
$this->viewData['userList'] = $this->getUserListItems($presupuestoEntity->total_confirmado_user_id ?? null);
|
||||
$this->viewData['userList2'] = $this->getUserListItems2($presupuestoEntity->aprobado_user_id ?? null);
|
||||
$this->viewData['userList3'] = $this->getUserListItems3($presupuestoEntity->pedido_espera_user_id ?? null);
|
||||
$this->viewData['paginasCubiertaList'] = $this->getPaginasCubiertaOptions();
|
||||
$this->viewData['paginasPortadaList'] = $this->getPaginasPortadaOptions();
|
||||
|
||||
$this->viewData['presupuestoEntity'] = $presupuestoEntity;
|
||||
|
||||
if(!is_null($presupuestoEntity->comparador_json_data))
|
||||
$this->viewData['comp_data'] = json_decode($presupuestoEntity->comparador_json_data);
|
||||
else
|
||||
$this->viewData['comp_data'] = "";
|
||||
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||
|
||||
$this->viewData['clienteList'] = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
$this->viewData['incReiList'] = array('incidencia' => lang('Presupuestos.incidencia'), 'reimpresion' => lang('Presupuestos.reimpresion'), 'sin_cargo' => lang('Presupuestos.sinCargo'));
|
||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||
$this->viewData['papelFormatoList'] = $this->getPapelFormatoListItems($presupuestoEntity->papel_formato_id ?? null);
|
||||
$this->viewData['papelGenericoNegroList'] = $this->getPapelGenericoNegro();
|
||||
$this->viewData['papelGenericoNegroHQList'] = $this->getPapelGenericoNegroHQ();
|
||||
$this->viewData['papelGenericoColorList'] = $this->getPapelGenericoColor();
|
||||
$this->viewData['papelGenericoColorHQList'] = $this->getPapelGenericoColorHQ();
|
||||
$this->viewData['papelGenericoCubiertaList'] = $this->getPapelGenericoCubierta();
|
||||
$this->viewData['papelGenericoSobrecubiertaList'] = $this->getPapelGenericoSobreCubierta();
|
||||
$this->viewData['papelGenericoRotativaNegroList'] = $this->getPapelGenericoRotativaNegro();
|
||||
$this->viewData['papelGenericoRotativaColorList'] = $this->getPapelGenericoRotativaColor();
|
||||
|
||||
$this->viewData['formAction'] = route_to('updatePresupuesto', $id);
|
||||
// Lineas Presupuesto
|
||||
$this->viewData['lineasPresupuesto'] = $this->getLineasPresupuestoActivas($id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Presupuestos.moduleTitle') . ' ' . lang('Basic.global.edit3');
|
||||
// Tarifas
|
||||
$this->viewData['serviciosPreimpresion'] = $this->getServiciosPreimpresion();
|
||||
$this->viewData['serviciosEncuadernacion'] = $this->getServiciosEncuadernacion();
|
||||
$this->viewData['serviciosAcabado'] = $this->getServiciosAcabado();
|
||||
$this->viewData['serviciosManipulado'] = $this->getServiciosManipulado();
|
||||
|
||||
$this->viewData['tipo_impresion_id'] = 4; // Cosido tapa blanda JJO
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||
|
||||
$this->viewData['boxTitle'] = lang('Basic.global.edit2') . ' ' . lang('Presupuestos.moduleTitleCosidoTB') . ' ' . lang('Basic.global.edit3');
|
||||
|
||||
|
||||
return $this->displayForm(__METHOD__, $id);
|
||||
@ -441,6 +376,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
$gramaje = $reqData['gramaje'] ?? 0;
|
||||
|
||||
|
||||
|
||||
if ($type=='interior') {
|
||||
|
||||
$resourceData = $this->getCompIntData($type, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq);
|
||||
@ -461,7 +398,21 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
'color' => intval($reqData['paginas_color']) ?? 0,
|
||||
);
|
||||
|
||||
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas);
|
||||
$datosTipolog = $reqData['negro'] ?? null;
|
||||
if(!is_null($datosTipolog)){
|
||||
$datosTipolog = [];
|
||||
$data = (object)array(
|
||||
'negro' => intval($reqData['negro']) ?? 0,
|
||||
'cyan' => intval($reqData['cyan']) ?? 0,
|
||||
'magenta' => intval($reqData['magenta']) ?? 0,
|
||||
'amarillo' => intval($reqData['amarillo']) ?? 0,
|
||||
'gota_negro' => intval($reqData['gota_negro']) ?? 0,
|
||||
'gota_color' => intval($reqData['gota_color']) ?? 0,
|
||||
);
|
||||
array_push($datosTipolog, $data);
|
||||
}
|
||||
|
||||
$resourceData = $this->getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog);
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
@ -502,6 +453,50 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function datatable_2()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$reqData = $this->request->getPost();
|
||||
|
||||
$tipo = $reqData['tipo'] ?? '';
|
||||
|
||||
if($tipo=='lineasPresupuesto'){
|
||||
|
||||
$datos = $reqData['datos'] ?? null;
|
||||
$presupuesto_id = $reqData['presupuesto_id'] ?? -1;
|
||||
|
||||
/*foreach($datos as $key=>$linea){
|
||||
$datos[$key]['papel_id'] = $datos[$key]['papel_id'] ?? -1;
|
||||
}*/
|
||||
|
||||
|
||||
if($datos != null){
|
||||
$this->updateLineasPresupuestoActivas($presupuesto_id, $datos);
|
||||
}
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
$newTokenHash = csrf_hash();
|
||||
$csrfTokenName = csrf_token();
|
||||
$data = [
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
|
||||
return $this->respond($data);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getCompIntData($uso, $datosPedido, $papel_generico, $gramaje, $isColor, $isHq)
|
||||
{
|
||||
$tipo = $isColor? ($isHq?'colorhq':'color'): ($isHq?'negrohq':'negro');
|
||||
@ -509,14 +504,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
if( $uso == 'cubierta' ){
|
||||
$opciones_papel = array(
|
||||
'cubierta' => 1,
|
||||
'color' => 1,
|
||||
//'color' => 1,
|
||||
'rotativa' => 0,
|
||||
);
|
||||
}
|
||||
else if ( $uso == 'sobrecubierta' ){
|
||||
$opciones_papel = array(
|
||||
'sobrecubierta' => 1,
|
||||
'color' => 1,
|
||||
//'color' => 1,
|
||||
'rotativa' => 0,
|
||||
);
|
||||
}
|
||||
@ -551,6 +546,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||
is_rotativa: 0,
|
||||
tarifa_tipo: $tipo,
|
||||
uso_tarifa: $uso,
|
||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||
papel_impresion_id: $papel->id,
|
||||
);
|
||||
@ -559,11 +555,14 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
foreach ($maquinas as $maquina) {
|
||||
|
||||
$tarifamodel = new MaquinasTarifasImpresionModel();
|
||||
$tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
|
||||
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, $uso, $tipo);
|
||||
if(!is_float($tarifa)){
|
||||
continue;
|
||||
}
|
||||
$linea = PresupuestoService::getCostesLinea($uso, $datosPedido, $maquina, $papel, $opciones_papel, $tarifa);
|
||||
if(array_key_exists('error', $linea))
|
||||
continue;
|
||||
$linea['fields']['tarifa_impresion_id'] = $tarifaId;
|
||||
$linea['fields']['maquina'] = $maquina->maquina;
|
||||
$linea['fields']['maquina_id'] = $maquina->maquina_id;
|
||||
$linea['fields']['maquina_velocidad'] = $maquina->velocidad;
|
||||
@ -584,7 +583,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
return $lineas;
|
||||
}
|
||||
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas)
|
||||
public function getCompIntRotData($datosPedido, $papel_generico, $gramaje, $paginas, $datosTipolog = null)
|
||||
{
|
||||
|
||||
$uso = 'interior';
|
||||
@ -628,10 +627,20 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
foreach ($papeles as $papel) {
|
||||
|
||||
$papelImpresionTipologiaModel = new \App\Models\Configuracion\PapelImpresionTipologiaModel();
|
||||
if(is_null($datosTipolog)){
|
||||
$datosTipologias = $papelImpresionTipologiaModel
|
||||
->findTipologiasForPapelImpresion($papel->id, $parametrosRotativa->colorPages>0?'color':'negro')
|
||||
->get()->getResultObject();
|
||||
|
||||
|
||||
if(count($datosTipologias)==0){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$datosTipologias = $datosTipolog;
|
||||
}
|
||||
|
||||
$parametrosRotativa->rotativa_gota_negro = $datosTipologias[0]->gota_negro;
|
||||
$parametrosRotativa->rotativa_gota_color = $datosTipologias[0]->gota_color;
|
||||
$parametrosRotativa->rotativa_negro = $datosTipologias[0]->negro;
|
||||
@ -644,6 +653,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$maquinas = $maquinamodel->getMaquinaImpresionForPresupuesto(
|
||||
is_rotativa: 1,
|
||||
tarifa_tipo: $tipo,
|
||||
uso_tarifa: $uso,
|
||||
tirada: $datosPedido->tirada + $datosPedido->merma,
|
||||
papel_impresion_id: $papel->id,
|
||||
);
|
||||
@ -656,7 +666,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$parametrosRotativa->a_favor_fibra = $i;
|
||||
|
||||
$tarifamodel = new MaquinasTarifasImpresionModel();
|
||||
$tarifa = $tarifamodel->getTarifa($maquina->maquina_id, $uso, is_array($tipo)?'color':$tipo);
|
||||
[$tarifaId, $tarifa] = $tarifamodel->getTarifa($maquina->maquina_id, $uso, is_array($tipo)?'color':$tipo);
|
||||
if(!is_float($tarifa)){
|
||||
continue;
|
||||
}
|
||||
@ -665,6 +675,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields'] = PresupuestoService::getCostesLineaRotativa($maquina, $papel, $datosPedido, $parametrosRotativa);
|
||||
|
||||
$precio_pliego_impresion = PresupuestoService::getPrecioPliego($maquina, $papel, $datosPedido->paginas);
|
||||
|
||||
$linea['fields']['tarifa_impresion_id'] = $tarifaId;
|
||||
|
||||
$linea['fields']['precios_pliegos'] = $precio_pliego_impresion;
|
||||
|
||||
$linea['fields']['precio_libro'] = $linea['fields']['pliegos_libro'] * $precio_pliego_impresion;
|
||||
@ -678,6 +691,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields']['papel_impresion'] = $papel->nombre;
|
||||
$linea['fields']['papel_impresion_id'] = $papel->id;
|
||||
$linea['fields']['paginas'] = $datosPedido->paginas;
|
||||
$linea['fields']['paginas_color'] = $paginas->color;
|
||||
$linea['fields']['gramaje'] = $gramaje;
|
||||
$linea['fields']['papel_generico_id'] = $papel_generico['id'];
|
||||
$linea['fields']['papel_generico'] = $papel_generico['nombre'];
|
||||
@ -686,6 +700,8 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$linea['fields']['num_formas_horizontales'] = floor($linea['fields']['factor_anchura']);
|
||||
$linea['fields']['num_formas_verticales'] = floor($linea['fields']['factor_altura']);
|
||||
|
||||
$linea['fields']['datosTipologias'] = $datosTipologias[0];
|
||||
|
||||
// impresion
|
||||
$linea['fields']['precio_click'] = $tarifa;
|
||||
$linea['fields']['precio_click_pedido'] = $linea['fields']['clicks_pedido'] * $linea['fields']['precio_click'];
|
||||
@ -734,6 +750,7 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
if ($this->request->isAJAX()) {
|
||||
|
||||
$reqData = $this->request->getPost();
|
||||
try{
|
||||
|
||||
$tipo = $reqData['tipo'] ?? null;
|
||||
$uso = $reqData['uso'] ?? null;
|
||||
@ -786,8 +803,9 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$alto = $reqData['alto'] ?? null;
|
||||
// Datos contiene la tirada
|
||||
// uso: negro, negrohq, color, colorhq,
|
||||
$uso_tarifa = $reqData['uso_tarifa'] ?? 'interior';
|
||||
$model = new MaquinaModel();
|
||||
$maquinas = $model->getMaquinaImpresionForPresupuesto($is_rotativa, $uso, $datos, $papel_impresion );
|
||||
$maquinas = $model->getMaquinaImpresionForPresupuesto($is_rotativa, $uso, $uso_tarifa ,$datos, $papel_impresion );
|
||||
$menu = [];
|
||||
foreach ($maquinas as $maquina){
|
||||
|
||||
@ -811,8 +829,17 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception $e){
|
||||
$data = [
|
||||
'error' => $e,
|
||||
$csrfTokenName => $newTokenHash
|
||||
];
|
||||
}
|
||||
finally{
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
@ -846,10 +873,34 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
{
|
||||
$papelFormatoModel = model('App\Models\Configuracion\PapelFormatoModel');
|
||||
$data = $papelFormatoModel->getElementsForMenu();
|
||||
array_shift($data);
|
||||
array_unshift($data, (object)['id' => '', 'tamanio' => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papelFormatoId'))])]);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function getPapelGenericoRotativaNegro()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$data = $model->getPapelForComparador('negro', false, false, true);
|
||||
array_unshift($data, (object)array(
|
||||
"id" => 0,
|
||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPapelGenericoRotativaColor()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
$data = $model->getPapelForComparador('color', false, false, true);
|
||||
array_unshift($data, (object)array(
|
||||
"id" => 0,
|
||||
"nombre" => lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Presupuestos.papel'))])
|
||||
));
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getPapelGenericoNegro()
|
||||
{
|
||||
$model = model('App\Models\Configuracion\PapelGenericoModel');
|
||||
@ -960,7 +1011,26 @@ class Cosidotapablanda extends \App\Controllers\GoBaseResourceController
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getLineasPresupuestoActivas($presupuesto_id)
|
||||
{
|
||||
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$data = $model->getLineasPresupuesto($presupuesto_id);
|
||||
|
||||
$papel_imp_model = model('App\Models\Configuracion\PapelImpresionModel');
|
||||
$maquina_model = model('App\Models\Configuracion\MaquinaModel');
|
||||
|
||||
foreach($data as $linea){
|
||||
$linea->papel_impresion_nombre = $papel_imp_model->getNombre($linea->papel_impresion_id)[0]->text;
|
||||
$linea->maquina_nombre = $maquina_model->getNombre($linea->maquina_id)[0]->text;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function updateLineasPresupuestoActivas($presupuesto_id, $datos)
|
||||
{
|
||||
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
return $model->updateLineasPresupuesto($presupuesto_id, $datos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -17,7 +17,34 @@ class Test extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->testLineasIntPlana();
|
||||
$this->getLP();
|
||||
}
|
||||
|
||||
public function timeToSeconds(){
|
||||
$time = '99:59:59';
|
||||
|
||||
$time_parts = explode(":", $time);
|
||||
$seconds = $time_parts[2] + $time_parts[1] * 60 + $time_parts[0] * 3600;
|
||||
echo "Time in seconds: " . $seconds;
|
||||
}
|
||||
|
||||
public function getLP(){
|
||||
$lp_model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$data = $lp_model->getLineasPresupuesto(8);
|
||||
$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];
|
||||
var_dump($linea->papel_impresion_id);
|
||||
var_dump($linea->maquina_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function createLP(){
|
||||
$lp_model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$lp_model->createForPresupuesto(8);
|
||||
}
|
||||
|
||||
public function getPapelesHQ(){
|
||||
|
||||
@ -176,6 +176,8 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity
|
||||
"deleted_at" => null,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
"comp_tipo_impresion" => null,
|
||||
"comp_pos_paginas_color" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"version" => "int",
|
||||
|
||||
127
ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php
Normal file
127
ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
namespace App\Entities\Presupuestos;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id" => null,
|
||||
"presupuesto_id" => null,
|
||||
"tipo" => null,
|
||||
"paginas" => 0,
|
||||
"paginas_color_posicion" => null,
|
||||
"solapas_ancho" => 0.0,
|
||||
"papel_id" => null,
|
||||
"papel_impresion_id" => null,
|
||||
"formas" => null,
|
||||
"gramaje" => null,
|
||||
"pliegos_libro" => null,
|
||||
"pliegos_pedido" => null,
|
||||
"pliegos_precio" => null,
|
||||
"libro" => null,
|
||||
"pedido" => null,
|
||||
"mano" => null,
|
||||
"peso" => null,
|
||||
"maquina_id" => null,
|
||||
"tarifa_impresion_id" => null,
|
||||
"click" => null,
|
||||
"precio" => null,
|
||||
"rotativa_impresion" => null,
|
||||
"rotativa_pag_color" => 0,
|
||||
"rotativa_set_values" => false,
|
||||
"rotativa_negro" => 0.0,
|
||||
"rotativa_cyan" => 0.0,
|
||||
"rotativa_magenta" => 0.0,
|
||||
"rotativa_amarillo" => 0.0,
|
||||
"rotativa_gota_negro" => 0.0,
|
||||
"rotativa_gota_color" => 0.0,
|
||||
"rotativa_saturacion" => 100.0,
|
||||
"rotativa_a_favor_fibra" => true,
|
||||
"rotativa_mxm" => null,
|
||||
"rotativa_area_paginas" => null,
|
||||
"rotativa_num_gotas_negro" => 0,
|
||||
"rotativa_num_gotas_cyan" => 0,
|
||||
"rotativa_num_gotas_magenta" => 0,
|
||||
"rotativa_num_gotas_amarillo" => 0,
|
||||
"rotativa_peso_gotas_negro" => 0,
|
||||
"rotativa_peso_gotas_cyan" => 0,
|
||||
"rotativa_peso_gotas_magenta" => 0,
|
||||
"rotativa_peso_gotas_amarillo" => 0,
|
||||
"rotativa_precio_pag_negro" => null,
|
||||
"rotativa_precio_pag_color" => null,
|
||||
"rotativa_factor_altura" => null,
|
||||
"rotativa_factor_anchura" => null,
|
||||
"rotativa_pag_por_pliego" => null,
|
||||
"rotativa_metros_libro" => null,
|
||||
"rotativa_metros_total" => null,
|
||||
"rotativa_clicks_libro" => null,
|
||||
"rotativa_clicks_total" => null,
|
||||
"rotativa_precio_tinta" => null,
|
||||
"rotativa_total_impresion" => null,
|
||||
"rotativa_velocidad_corte" => 0,
|
||||
"rotativa_tiempo_corte" => 0,
|
||||
"rotativa_precio_hora_corte" => 0,
|
||||
"rotativa_total_corte" => 0,
|
||||
"isActiva" => false,
|
||||
"check_impresion_total" => false,
|
||||
"check_papel_total" => false,
|
||||
];
|
||||
protected $casts = [
|
||||
"presupuesto_id" => "int",
|
||||
"paginas" => "int",
|
||||
"solapas_ancho" => "float",
|
||||
"papel_id" => "?int",
|
||||
"papel_impresion_id" => "?int",
|
||||
"gramaje" => "?float",
|
||||
"pliegos_libro" => "?float",
|
||||
"pliegos_pedido" => "?float",
|
||||
"pliegos_precio" => "?float",
|
||||
"libro" => "?float",
|
||||
"pedido" => "?float",
|
||||
"mano" => "?float",
|
||||
"peso" => "?float",
|
||||
"maquina_id" => "?int",
|
||||
"tarifa_impresion_id" => "?int",
|
||||
"click" => "?float",
|
||||
"precio" => "?float",
|
||||
"rotativa_pag_color" => "int",
|
||||
"rotativa_set_values" => "boolean",
|
||||
"rotativa_negro" => "float",
|
||||
"rotativa_cyan" => "float",
|
||||
"rotativa_magenta" => "float",
|
||||
"rotativa_amarillo" => "float",
|
||||
"rotativa_gota_negro" => "float",
|
||||
"rotativa_gota_color" => "float",
|
||||
"rotativa_saturacion" => "float",
|
||||
"rotativa_a_favor_fibra" => "boolean",
|
||||
"rotativa_mxm" => "?float",
|
||||
"rotativa_area_paginas" => "float",
|
||||
"rotativa_num_gotas_negro" => "float",
|
||||
"rotativa_num_gotas_cyan" => "float",
|
||||
"rotativa_num_gotas_magenta" => "float",
|
||||
"rotativa_num_gotas_amarillo" => "float",
|
||||
"rotativa_peso_gotas_negro" => "float",
|
||||
"rotativa_peso_gotas_cyan" => "float",
|
||||
"rotativa_peso_gotas_magenta" => "float",
|
||||
"rotativa_peso_gotas_amarillo" => "float",
|
||||
"rotativa_precio_pag_negro" => "float",
|
||||
"rotativa_precio_pag_color" => "float",
|
||||
"rotativa_factor_altura" => "float",
|
||||
"rotativa_factor_anchura" => "float",
|
||||
"rotativa_pag_por_pliego" => "float",
|
||||
"rotativa_metros_libro" => "float",
|
||||
"rotativa_metros_total" => "float",
|
||||
"rotativa_clicks_libro" => "float",
|
||||
"rotativa_clicks_total" => "float",
|
||||
"rotativa_precio_tinta" => "float",
|
||||
"rotativa_total_impresion" => "float",
|
||||
"rotativa_velocidad_corte" => "float",
|
||||
"rotativa_tiempo_corte" => "float",
|
||||
"rotativa_precio_hora_corte" => "float",
|
||||
"rotativa_total_corte" => "float",
|
||||
"isActiva" => "boolean",
|
||||
"check_impresion_total" => "boolean",
|
||||
"check_papel_total" => "boolean",
|
||||
];
|
||||
}
|
||||
@ -22,7 +22,8 @@ return [
|
||||
'incRei' => 'Incident \ Reprint',
|
||||
'paginas' => 'Pages',
|
||||
'tirada' => 'Print',
|
||||
'totalPapelPedido' => 'Total paper budget',
|
||||
'totalPedido' => 'Total paper budget',
|
||||
'totalPresupuesto' => 'Total Budget',
|
||||
'presupuestoEstado' => 'State',
|
||||
'presupuestoEstadoBorrador' => 'Draft',
|
||||
'presupuestoEstadoAceptado' => 'Acepted',
|
||||
@ -92,6 +93,8 @@ return [
|
||||
'color' => 'Colour',
|
||||
'colorhq' => 'ColourHQ',
|
||||
'rotativa' => 'Rotary',
|
||||
'rotativa_bn' => 'Rot. BW',
|
||||
'rotativa_color' => 'Rot. Colour',
|
||||
'si' => 'Yes',
|
||||
'no' => 'No',
|
||||
'insertarLinea' => 'Insert Line',
|
||||
@ -137,6 +140,23 @@ return [
|
||||
'totalCorte' => 'Total Cut',
|
||||
'totalImpresion' => 'TOTAL PRINT',
|
||||
|
||||
'addLineaPresupuesto' => 'Add line...',
|
||||
|
||||
'validation' => [
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
'requerido' => 'The {field} field is required.',
|
||||
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
|
||||
],
|
||||
|
||||
'errores' => [
|
||||
'paginas' => 'The field pages must be greater than zero',
|
||||
'tiradas' => 'The field print must be greater than zero',
|
||||
'dimension' => 'The book dimension must be greater than 60mm',
|
||||
'lineaDuplicada' => 'That type of line already exists in the budget.',
|
||||
'errorRotColor' => 'Papers and weights must be the same in color and BW',
|
||||
],
|
||||
|
||||
/* '4x0' => '4x0',
|
||||
'4x4' => '4x4',
|
||||
'aprobadoAt' => 'Aprobado At',
|
||||
@ -321,7 +341,9 @@ return [
|
||||
|
||||
'catalogo_id' => [
|
||||
'integer' => 'The {field} field must contain an integer.',
|
||||
|
||||
'decimal' => 'The {field} field must contain a decimal number.',
|
||||
'max_length' => 'The {field} field cannot exceed {param} characters in length.',
|
||||
'required' => 'The {field} field is required.',
|
||||
],
|
||||
|
||||
'causa_cancelacion' => [
|
||||
|
||||
@ -21,7 +21,8 @@ return [
|
||||
'incRei' => 'Incidencia \ Reimpresión',
|
||||
'paginas' => 'Paginas',
|
||||
'tirada' => 'Tirada',
|
||||
'totalPedido' => 'Total Presupuesto',
|
||||
'totalPedido' => 'Total Pedido',
|
||||
'totalPresupuesto' => 'Total Presupuesto',
|
||||
'presupuestoEstado' => 'Estado',
|
||||
'presupuestoEstadoBorrador' => 'Borrador',
|
||||
'presupuestoEstadoAceptado' => 'Aceptado',
|
||||
@ -91,6 +92,8 @@ return [
|
||||
'color' => 'Color',
|
||||
'colorhq' => 'ColorHQ',
|
||||
'rotativa' => 'Rotativa',
|
||||
'rotativa_bn' => 'Rot. BN',
|
||||
'rotativa_color' => 'Rot. Color',
|
||||
'si' => 'Si',
|
||||
'no' => 'No',
|
||||
'insertarLinea' => 'Insertar Línea',
|
||||
@ -143,6 +146,8 @@ return [
|
||||
'gTintaMagentaPed' => 'G.T. Magenta Ped.',
|
||||
'gTintaAmarilloPed' => 'G.T. Amarillo Ped.',
|
||||
|
||||
'addLineaPresupuesto' => 'Añadir linea...',
|
||||
|
||||
'servicioAcabado' => 'Servicio de acabado',
|
||||
'servicioPreimpresion' => 'Servicio de preimpresión',
|
||||
'servicioEncuadernado' => 'Servicio de encuadernado',
|
||||
@ -166,10 +171,19 @@ return [
|
||||
|
||||
'validation' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'requerido' => 'El campo {field} esta requerido.',
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'requerido' => 'El campo {field} es obligatorio.',
|
||||
'max_length' => 'El campo {field} no puede exceder los {param} caracteres de longitud.',
|
||||
],
|
||||
|
||||
'errores' => [
|
||||
'paginas' => 'El campo páginas tiene que ser mayor que cero',
|
||||
'tiradas' => 'El campo tiradas tiene que ser mayor que cero',
|
||||
'dimension' => 'La dimensión del libro tiene que ser mayor que 60mm',
|
||||
'lineaDuplicada' => 'Ya existe ese tipo de linea en el presupuesto',
|
||||
'errorRotColor' => 'Papeles y gramajes deben ser iguales en color y BN',
|
||||
],
|
||||
|
||||
|
||||
/* '4x0' => '4x0',
|
||||
'4x4' => '4x4',
|
||||
|
||||
@ -336,7 +336,7 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $tirada, $papel_impresion_id = -1)
|
||||
public function getMaquinaImpresionForPresupuesto($is_rotativa, $tarifa_tipo, $uso_tarifa = 'interior', $tirada, $papel_impresion_id = -1)
|
||||
{
|
||||
/*
|
||||
1.-> tarifa_Tipo impresion
|
||||
@ -371,13 +371,26 @@ class MaquinaModel extends \App\Models\GoBaseModel
|
||||
|
||||
if(is_array($tarifa_tipo)){
|
||||
foreach($tarifa_tipo as $tarifa){
|
||||
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.is_deleted=0)");
|
||||
$builder->where("EXISTS (SELECT * FROM lg_maquinas_tarifas_impresion t2 WHERE t1.id=t2.maquina_id AND t2.tipo='{$tarifa}' AND t2.uso='{$uso_tarifa}' AND t2.is_deleted=0)");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$builder->where("t2.tipo", $tarifa_tipo);
|
||||
$builder->where("t2.uso", $uso_tarifa);
|
||||
}
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
|
||||
}
|
||||
|
||||
public function getNombre($id){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.nombre AS text");
|
||||
|
||||
$builder->where("t1.id", $id);
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.precio AS precio"
|
||||
"t1.id AS id, t1.precio AS precio"
|
||||
);
|
||||
|
||||
//JJO
|
||||
@ -135,7 +135,7 @@ class MaquinasTarifasImpresionModel extends \App\Models\GoBaseModel
|
||||
|
||||
$tarifas = $builder->get()->getResultArray();
|
||||
if (count($tarifas)>0){
|
||||
return floatval($tarifas[0]['precio']);
|
||||
return [$tarifas[0]['id'], floatval($tarifas[0]['precio'])];
|
||||
}
|
||||
return $tarifas;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
}
|
||||
|
||||
|
||||
public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null)
|
||||
public function getPapelForComparador($tipo, $is_cubierta = null, $is_sobrecubierta = null, $rotativa = null)
|
||||
{
|
||||
/*
|
||||
1.-> Tipo impresion
|
||||
@ -124,12 +124,19 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t2.cubierta", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_null($is_sobrecubierta)){
|
||||
if($is_sobrecubierta==true){
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_null($rotativa)){
|
||||
if($rotativa==true){
|
||||
$builder->where("t2.rotativa", 1);
|
||||
}
|
||||
}
|
||||
|
||||
return $builder->orderBy("t1.nombre", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
@ -163,14 +170,22 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
->where("t5.tipo", $tipo)
|
||||
->where("t1.nombre", $papel_generico_nombre);
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
if($uso == 'bn' || $uso == 'bnhq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($uso == 'color' || $uso == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
else if ($uso == 'cubierta')
|
||||
else if ($uso == 'cubierta'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
else if ($uso == 'sobrecubierta')
|
||||
}
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
$id = 1;
|
||||
@ -209,19 +224,30 @@ class PapelGenericoModel extends \App\Models\GoBaseModel
|
||||
->where("t5.tipo", $tipo)
|
||||
->where("t1.id", $papel_generico_id);
|
||||
|
||||
$uso_tarifa = 'interior';
|
||||
|
||||
if ($uso == 'cubierta'){
|
||||
$uso_tarifa = 'cubierta';
|
||||
$builder->where("t2.cubierta", 1);
|
||||
}
|
||||
else if ($uso == 'sobrecubierta'){
|
||||
$uso_tarifa = 'sobrecubierta';
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
else{
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t2.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t2.color", 1);
|
||||
if ($uso == 'cubierta')
|
||||
$builder->where("t2.cubierta", 1);
|
||||
else if ($uso == 'sobrecubierta')
|
||||
$builder->where("t2.sobrecubierta", 1);
|
||||
}
|
||||
|
||||
if($uso=='rotativa')
|
||||
$builder->where("t2.rotativa", 1);
|
||||
else
|
||||
$builder->where("t2.rotativa", 0);
|
||||
|
||||
$builder->where("t5.uso", $uso_tarifa);
|
||||
|
||||
|
||||
$values = $builder->orderBy("t2.gramaje", "asc")->get()->getResultObject();
|
||||
$id = 1;
|
||||
|
||||
@ -283,47 +283,31 @@ class PapelImpresionModel extends \App\Models\GoBaseModel
|
||||
$builder->where("t2.id", $papel_generico);
|
||||
$builder->where("t1.gramaje", $gramaje);
|
||||
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t1.color", 1);
|
||||
if ($uso == 'cubierta')
|
||||
$builder->where("t1.cubierta", 1);
|
||||
else if ($uso == 'sobrecubierta')
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
else{
|
||||
if($tipo == 'negro' || $tipo == 'negrohq')
|
||||
$builder->where("t1.bn", 1);
|
||||
else if ($tipo == 'color' || $tipo == 'colorhq')
|
||||
$builder->where("t1.color", 1);
|
||||
}
|
||||
if($uso=='rotativa')
|
||||
$builder->where("t1.rotativa", 1);
|
||||
else
|
||||
$builder->where("t1.rotativa", 0);
|
||||
/*
|
||||
if($tipo=='negro' || $tipo=='negrohq'){
|
||||
$builder->where("t1.bn", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='color' || $tipo=='colorhq'){
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='cubierta'){
|
||||
$builder->where("t1.cubierta", 1);
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='sobrecubierta'){
|
||||
$builder->where("t1.sobrecubierta", 1);
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 0);
|
||||
}
|
||||
elseif($tipo=='rot_bn'){
|
||||
$builder->where("t1.bn", 1);
|
||||
$builder->where("t1.rotativa", 1);
|
||||
}
|
||||
elseif($tipo=='rot_color'){
|
||||
$builder->where("t1.color", 1);
|
||||
$builder->where("t1.rotativa", 1);
|
||||
}
|
||||
*/
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function getNombre($id){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"t1.nombre AS text");
|
||||
|
||||
$builder->where("t1.id", $id);
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
344
ci4/app/Models/Presupuestos/PresupuestoLineaModel.php
Normal file
344
ci4/app/Models/Presupuestos/PresupuestoLineaModel.php
Normal file
@ -0,0 +1,344 @@
|
||||
<?php
|
||||
namespace App\Models\Presupuestos;
|
||||
|
||||
class PresupuestoLineaModel extends \App\Models\GoBaseModel
|
||||
{
|
||||
protected $table = "presupuesto_linea";
|
||||
|
||||
/**
|
||||
* Whether primary key uses auto increment.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
protected $allowedFields = [
|
||||
"presupuesto_id",
|
||||
"tipo",
|
||||
"paginas",
|
||||
"paginas_color_posicion",
|
||||
"solapas_ancho",
|
||||
"papel_id",
|
||||
"papel_impresion_id",
|
||||
"formas",
|
||||
"gramaje",
|
||||
"pliegos_libro",
|
||||
"pliegos_pedido",
|
||||
"pliegos_precio",
|
||||
"libro",
|
||||
"pedido",
|
||||
"mano",
|
||||
"peso",
|
||||
"maquina_id",
|
||||
"tarifa_impresion_id",
|
||||
"click",
|
||||
"precio",
|
||||
"rotativa_impresion",
|
||||
"rotativa_pag_color",
|
||||
"rotativa_set_values",
|
||||
"rotativa_negro",
|
||||
"rotativa_cyan",
|
||||
"rotativa_magenta",
|
||||
"rotativa_amarillo",
|
||||
"rotativa_gota_negro",
|
||||
"rotativa_gota_color",
|
||||
"rotativa_saturacion",
|
||||
"rotativa_a_favor_fibra",
|
||||
"rotativa_mxm",
|
||||
"rotativa_area_paginas",
|
||||
"rotativa_num_gotas_negro",
|
||||
"rotativa_num_gotas_cyan",
|
||||
"rotativa_num_gotas_magenta",
|
||||
"rotativa_num_gotas_amarillo",
|
||||
"rotativa_peso_gotas_negro",
|
||||
"rotativa_peso_gotas_cyan",
|
||||
"rotativa_peso_gotas_magenta",
|
||||
"rotativa_peso_gotas_amarillo",
|
||||
"rotativa_precio_pag_negro",
|
||||
"rotativa_precio_pag_color",
|
||||
"rotativa_factor_altura",
|
||||
"rotativa_factor_anchura",
|
||||
"rotativa_pag_por_pliego",
|
||||
"rotativa_metros_libro",
|
||||
"rotativa_metros_total",
|
||||
"rotativa_clicks_libro",
|
||||
"rotativa_clicks_total",
|
||||
"rotativa_precio_tinta",
|
||||
"rotativa_total_impresion",
|
||||
"rotativa_velocidad_corte",
|
||||
"rotativa_tiempo_corte",
|
||||
"rotativa_precio_hora_corte",
|
||||
"rotativa_total_corte",
|
||||
'check_impresion_total',
|
||||
'check_papel_total',
|
||||
"isActiva",
|
||||
];
|
||||
protected $returnType = "App\Entities\Presupuestos\PresupuestoLineaEntity";
|
||||
|
||||
public static $labelField = "presupuesto_id";
|
||||
|
||||
protected $validationRules = [
|
||||
"click" => [
|
||||
"label" => "PresupuestoLineas.click",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"formas" => [
|
||||
"label" => "PresupuestoLineas.formas",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
"gramaje" => [
|
||||
"label" => "PresupuestoLineas.gramaje",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"libro" => [
|
||||
"label" => "PresupuestoLineas.libro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"mano" => [
|
||||
"label" => "PresupuestoLineas.mano",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas" => [
|
||||
"label" => "PresupuestoLineas.paginas",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"paginas_color_posicion" => [
|
||||
"label" => "PresupuestoLineas.paginasColorPosicion",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
"pedido" => [
|
||||
"label" => "PresupuestoLineas.pedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"peso" => [
|
||||
"label" => "PresupuestoLineas.peso",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"pliegos_libro" => [
|
||||
"label" => "PresupuestoLineas.pliegosLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"pliegos_pedido" => [
|
||||
"label" => "PresupuestoLineas.pliegosPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"pliegos_precio" => [
|
||||
"label" => "PresupuestoLineas.pliegosPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"precio" => [
|
||||
"label" => "PresupuestoLineas.precio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"rotativa_amarillo" => [
|
||||
"label" => "PresupuestoLineas.rotativaAmarillo",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_area_paginas" => [
|
||||
"label" => "PresupuestoLineas.rotativaAreaPaginas",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_clicks_libro" => [
|
||||
"label" => "PresupuestoLineas.rotativaClicksLibro",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_clicks_total" => [
|
||||
"label" => "PresupuestoLineas.rotativaClicksTotal",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_cyan" => [
|
||||
"label" => "PresupuestoLineas.rotativaCyan",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_factor_altura" => [
|
||||
"label" => "PresupuestoLineas.rotativaFactorAltura",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_factor_anchura" => [
|
||||
"label" => "PresupuestoLineas.rotativaFactorAnchura",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_gota_color" => [
|
||||
"label" => "PresupuestoLineas.rotativaGotaColor",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_gota_negro" => [
|
||||
"label" => "PresupuestoLineas.rotativaGotaNegro",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_impresion" => [
|
||||
"label" => "PresupuestoLineas.rotativaImpresion",
|
||||
"rules" => "required|in_list[negro,color]",
|
||||
],
|
||||
"rotativa_magenta" => [
|
||||
"label" => "PresupuestoLineas.rotativaMagenta",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_metros_libro" => [
|
||||
"label" => "PresupuestoLineas.rotativaMetrosLibro",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_metros_total" => [
|
||||
"label" => "PresupuestoLineas.rotativaMetrosTotal",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_mxm" => [
|
||||
"label" => "PresupuestoLineas.rotativaMxm",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"rotativa_negro" => [
|
||||
"label" => "PresupuestoLineas.rotativaNegro",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_num_gotas_amarillo" => [
|
||||
"label" => "PresupuestoLineas.rotativaNumGotasAmarillo",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_num_gotas_cyan" => [
|
||||
"label" => "PresupuestoLineas.rotativaNumGotasCyan",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_num_gotas_magenta" => [
|
||||
"label" => "PresupuestoLineas.rotativaNumGotasMagenta",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_num_gotas_negro" => [
|
||||
"label" => "PresupuestoLineas.rotativaNumGotasNegro",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_pag_color" => [
|
||||
"label" => "PresupuestoLineas.rotativaPagColor",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"rotativa_pag_por_pliego" => [
|
||||
"label" => "PresupuestoLineas.rotativaPagPorPliego",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_peso_gotas_amarillo" => [
|
||||
"label" => "PresupuestoLineas.rotativaPesoGotasAmarillo",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_peso_gotas_cyan" => [
|
||||
"label" => "PresupuestoLineas.rotativaPesoGotasCyan",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_peso_gotas_magenta" => [
|
||||
"label" => "PresupuestoLineas.rotativaPesoGotasMagenta",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_peso_gotas_negro" => [
|
||||
"label" => "PresupuestoLineas.rotativaPesoGotasNegro",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_precio_hora_corte" => [
|
||||
"label" => "PresupuestoLineas.rotativaPrecioHoraCorte",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_precio_pag_color" => [
|
||||
"label" => "PresupuestoLineas.rotativaPrecioPagColor",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_precio_pag_negro" => [
|
||||
"label" => "PresupuestoLineas.rotativaPrecioPagNegro",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_precio_tinta" => [
|
||||
"label" => "PresupuestoLineas.rotativaPrecioTinta",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_saturacion" => [
|
||||
"label" => "PresupuestoLineas.rotativaSaturacion",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_tiempo_corte" => [
|
||||
"label" => "PresupuestoLineas.rotativaTiempoCorte",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_total_corte" => [
|
||||
"label" => "PresupuestoLineas.rotativaTotalCorte",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_total_impresion" => [
|
||||
"label" => "PresupuestoLineas.rotativaTotalImpresion",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"rotativa_velocidad_corte" => [
|
||||
"label" => "PresupuestoLineas.rotativaVelocidadCorte",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"solapas_ancho" => [
|
||||
"label" => "PresupuestoLineas.solapasAncho",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"tipo" => [
|
||||
"label" => "PresupuestoLineas.tipo",
|
||||
"rules" => "required|in_list[bn,bnhq,color,colorhq,cubierta,sobrecubierta,rot_bn,rot_color]",
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
{
|
||||
$sql =
|
||||
"SELECT t1." .
|
||||
$selcols .
|
||||
", t2.id AS presupuesto, t3.nombre AS papel, t4.nombre AS papel_impresion, t5.nombre AS maquina, t6.tipo AS tarifa_impresion FROM " .
|
||||
$this->table .
|
||||
" t1 LEFT JOIN presupuestos t2 ON t1.presupuesto_id = t2.id LEFT JOIN lg_papel_generico t3 ON t1.papel_id = t3.id LEFT JOIN lg_papel_impresion t4 ON t1.papel_impresion_id = t4.id LEFT JOIN lg_maquinas t5 ON t1.maquina_id = t5.id LEFT JOIN lg_maquinas_tarifas_impresion t6 ON t1.tarifa_impresion_id = t6.id";
|
||||
if (!is_null($limit) && intval($limit) > 0) {
|
||||
$sql .= " LIMIT " . intval($limit);
|
||||
}
|
||||
|
||||
if (!is_null($offset) && intval($offset) > 0) {
|
||||
$sql .= " OFFSET " . intval($offset);
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
$result = $query->getResultObject();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function createForPresupuesto($presupuesto_id){
|
||||
|
||||
$tipos = ['bn','bnhq','color','colorhq','cubierta','sobrecubierta','rot_bn','rot_color'];
|
||||
foreach($tipos as $tipo){
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1");
|
||||
$data = [
|
||||
'presupuesto_id' => $presupuesto_id,
|
||||
'tipo' => $tipo,
|
||||
];
|
||||
|
||||
$builder->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function getLineasPresupuesto($presupuesto_id = -1)
|
||||
{
|
||||
$builder = $this->db
|
||||
->table($this->table . " t1")
|
||||
->select(
|
||||
"*"
|
||||
)
|
||||
->where("t1.presupuesto_id", $presupuesto_id)
|
||||
->where("t1.isActiva", 1);
|
||||
|
||||
|
||||
return $builder->orderBy("t1.id", "asc")->get()->getResultObject();
|
||||
}
|
||||
|
||||
public function updateLineasPresupuesto($presupuesto_id = -1, $datos=[])
|
||||
{
|
||||
foreach($datos as $linea){
|
||||
|
||||
$this->db
|
||||
->table($this->table . " t1")
|
||||
->where("t1.presupuesto_id", $presupuesto_id)
|
||||
->where("t1.tipo", $linea["tipo"])
|
||||
->update($linea);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -194,6 +194,8 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
"pedido_espera_fecha",
|
||||
"pedido_espera_user_id",
|
||||
"is_deleted",
|
||||
"comp_tipo_impresion",
|
||||
"comp_pos_paginas_color",
|
||||
];
|
||||
protected $returnType = "App\Entities\Presupuestos\PresupuestoEntity";
|
||||
|
||||
@ -206,809 +208,75 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
|
||||
public static $labelField = "titulo";
|
||||
|
||||
protected $validationRules = [
|
||||
"aprobado_at" => [
|
||||
"label" => "Presupuestos.aprobadoAt",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
],
|
||||
"aprobado_json_data" => [
|
||||
"label" => "Presupuestos.aprobadoJsonData",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
protected $validationRulesAdd = [
|
||||
"autor" => [
|
||||
"label" => "Presupuestos.autor",
|
||||
"rules" => "trim|required|max_length[150]",
|
||||
],
|
||||
"base_imponible" => [
|
||||
"label" => "Presupuestos.baseImponible",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"catalogo_id" => [
|
||||
"label" => "Presupuestos.catalogoId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"causa_cancelacion" => [
|
||||
"label" => "Presupuestos.causaCancelacion",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
"coleccion" => [
|
||||
"label" => "Presupuestos.coleccion",
|
||||
"rules" => "trim|max_length[255]",
|
||||
],
|
||||
"comentarios_cliente" => [
|
||||
"label" => "Presupuestos.comentarios_cliente",
|
||||
"rules" => "trim|required|max_length[16313]",
|
||||
],
|
||||
"comentarios_pdf" => [
|
||||
"label" => "Presupuestos.comentariosPdf",
|
||||
"rules" => "trim|required|max_length[16313]",
|
||||
],
|
||||
"comentarios_safekat" => [
|
||||
"label" => "Presupuestos.comentariosSafekat",
|
||||
"rules" => "trim|required|max_length[16313]",
|
||||
],
|
||||
"comentarios_tarifa" => [
|
||||
"label" => "Presupuestos.comentariosTarifa",
|
||||
"rules" => "trim|required|max_length[16313]",
|
||||
],
|
||||
"comentarios_produccion" => [
|
||||
"label" => "Presupuestos.comentariosProduccion",
|
||||
"rules" => "trim|required|max_length[16313]",
|
||||
],
|
||||
"comparador_json_data" => [
|
||||
"label" => "Presupuestos.comparadorJsonData",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
"sobrecubiertas_ancho" => [
|
||||
"label" => "Presupuestos.sobrecubiertasAncho",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"descuento" => [
|
||||
"label" => "Presupuestos.descuento",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"fecha_encuardenado_at" => [
|
||||
"label" => "Presupuestos.fechaEncuardenadoAt",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
],
|
||||
"fecha_entrega_real_at" => [
|
||||
"label" => "Presupuestos.fechaEntregaRealAt",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
],
|
||||
"fecha_externo_at" => [
|
||||
"label" => "Presupuestos.fechaExternoAt",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
],
|
||||
"fecha_ferro_subido_at" => [
|
||||
"label" => "Presupuestos.fechaFerroSubidoAt",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
],
|
||||
"fecha_impresion_at" => [
|
||||
"label" => "Presupuestos.fechaImpresionAt",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
],
|
||||
"forzar_total" => [
|
||||
"label" => "Presupuestos.forzarTotal",
|
||||
"rules" => "required|decimal",
|
||||
"titulo" => [
|
||||
"label" => "Presupuestos.titulo",
|
||||
"rules" => "trim|required|max_length[30]",
|
||||
],
|
||||
"inc_rei" => [
|
||||
"label" => "Presupuestos.incRei",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"is_deleted" => [
|
||||
"label" => "Presupuestos.isDeleted",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"isbn" => [
|
||||
"label" => "Presupuestos.isbn",
|
||||
"rules" => "trim|max_length[50]",
|
||||
],
|
||||
"lomo" => [
|
||||
"label" => "Presupuestos.lomo",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"margen" => [
|
||||
"label" => "Presupuestos.margen",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"margen_extra" => [
|
||||
"label" => "Presupuestos.margenExtra",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"margen_manual" => [
|
||||
"label" => "Presupuestos.margenManual",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"merma" => [
|
||||
"label" => "Presupuestos.merma",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"merma_portada" => [
|
||||
"label" => "Presupuestos.mermaPortada",
|
||||
"rules" => "required|decimal",
|
||||
"coleccion" => [
|
||||
"label" => "Presupuestos.incRei",
|
||||
"rules" => "trim|max_length[255]",
|
||||
],
|
||||
"numero_edicion" => [
|
||||
"label" => "Presupuestos.numeroEdicion",
|
||||
"rules" => "trim|max_length[50]",
|
||||
],
|
||||
"paginas" => [
|
||||
"label" => "Presupuestos.paginas",
|
||||
"rules" => "required|integer",
|
||||
"isbn" => [
|
||||
"label" => "Presupuestos.isbn",
|
||||
"rules" => "trim|max_length[50]",
|
||||
],
|
||||
"paginas_color" => [
|
||||
"label" => "Presupuestos.paginasColor",
|
||||
"rules" => "integer|permit_empty",
|
||||
"pais_id" => [
|
||||
"label" => "Presupuestos.paisId",
|
||||
"rules" => "required|integer|greater_than[0]",
|
||||
],
|
||||
"paginas_color_click" => [
|
||||
"label" => "Presupuestos.paginasColorClick",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_forma_id" => [
|
||||
"label" => "Presupuestos.paginasColorFormaId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"paginas_color_gramaje" => [
|
||||
"label" => "Presupuestos.paginasColorGramaje",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_libro" => [
|
||||
"label" => "Presupuestos.paginasColorLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_mano" => [
|
||||
"label" => "Presupuestos.paginasColorMano",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_pedido" => [
|
||||
"label" => "Presupuestos.paginasColorPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_peso" => [
|
||||
"label" => "Presupuestos.paginasColorPeso",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_pliegos_libro" => [
|
||||
"label" => "Presupuestos.paginasColorPliegosLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_pliegos_pedido" => [
|
||||
"label" => "Presupuestos.paginasColorPliegosPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_pliegos_precio" => [
|
||||
"label" => "Presupuestos.paginasColorPliegosPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_color_posicion" => [
|
||||
"label" => "Presupuestos.paginasColorPosicion",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
"paginas_color_precio" => [
|
||||
"label" => "Presupuestos.paginasColorPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta" => [
|
||||
"label" => "Presupuestos.paginasCubierta",
|
||||
"rules" => "required|in_list[4x0,4x4]",
|
||||
],
|
||||
"paginas_sobrecubierta_click" => [
|
||||
"label" => "Presupuestos.paginasCubiertaClick",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_forma_id" => [
|
||||
"label" => "Presupuestos.paginasCubiertaFormaId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_gramaje" => [
|
||||
"label" => "Presupuestos.paginasCubiertaGramaje",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_libro" => [
|
||||
"label" => "Presupuestos.paginasCubiertaLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_mano" => [
|
||||
"label" => "Presupuestos.paginasCubiertaMano",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_pedido" => [
|
||||
"label" => "Presupuestos.paginasCubiertaPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_peso" => [
|
||||
"label" => "Presupuestos.paginasCubiertaPeso",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_pliegos_libro" => [
|
||||
"label" => "Presupuestos.paginasCubiertaPliegosLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_pliegos_pedido" => [
|
||||
"label" => "Presupuestos.paginasCubiertaPliegosPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_pliegos_precio" => [
|
||||
"label" => "Presupuestos.paginasCubiertaPliegosPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_sobrecubierta_precio" => [
|
||||
"label" => "Presupuestos.paginasCubiertaPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro" => [
|
||||
"label" => "Presupuestos.paginasNegro",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"paginas_negro_click" => [
|
||||
"label" => "Presupuestos.paginasNegroClick",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_forma_id" => [
|
||||
"label" => "Presupuestos.paginasNegroFormaId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"paginas_negro_gramaje" => [
|
||||
"label" => "Presupuestos.paginasNegroGramaje",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_libro" => [
|
||||
"label" => "Presupuestos.paginasNegroLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_mano" => [
|
||||
"label" => "Presupuestos.paginasNegroMano",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_pedido" => [
|
||||
"label" => "Presupuestos.paginasNegroPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_peso" => [
|
||||
"label" => "Presupuestos.paginasNegroPeso",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_pliegos_libro" => [
|
||||
"label" => "Presupuestos.paginasNegroPliegosLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_pliegos_pedido" => [
|
||||
"label" => "Presupuestos.paginasNegroPliegosPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_pliegos_precio" => [
|
||||
"label" => "Presupuestos.paginasNegroPliegosPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_negro_precio" => [
|
||||
"label" => "Presupuestos.paginasNegroPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta" => [
|
||||
"label" => "Presupuestos.paginasPortada",
|
||||
"rules" => "required|in_list[4x0,4x4]",
|
||||
],
|
||||
"paginas_cubierta_click" => [
|
||||
"label" => "Presupuestos.paginasPortadaClick",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_forma_id" => [
|
||||
"label" => "Presupuestos.paginasPortadaFormaId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_gramaje" => [
|
||||
"label" => "Presupuestos.paginasPortadaGramaje",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_libro" => [
|
||||
"label" => "Presupuestos.paginasPortadaLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_mano" => [
|
||||
"label" => "Presupuestos.paginasPortadaMano",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_pedido" => [
|
||||
"label" => "Presupuestos.paginasPortadaPedido",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"paginas_cubierta_peso" => [
|
||||
"label" => "Presupuestos.paginasPortadaPeso",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_pliegos_libro" => [
|
||||
"label" => "Presupuestos.paginasPortadaPliegosLibro",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_pliegos_pedido" => [
|
||||
"label" => "Presupuestos.paginasPortadaPliegosPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_pliegos_precio" => [
|
||||
"label" => "Presupuestos.paginasPortadaPliegosPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"paginas_cubierta_precio" => [
|
||||
"label" => "Presupuestos.paginasPortadaPrecio",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"papel_formato_alto" => [
|
||||
"label" => "Presupuestos.papelFormatoAlto",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"papel_formato_ancho" => [
|
||||
"label" => "Presupuestos.papelFormatoAncho",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"pedido_espera_fecha" => [
|
||||
"label" => "Presupuestos.pedidoEsperaFecha",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
"cliente_id" => [
|
||||
"label" => "Presupuestos.clienteId",
|
||||
"rules" => "required|integer|greater_than[0]",
|
||||
],
|
||||
"referencia_cliente" => [
|
||||
"label" => "Presupuestos.referenciaCliente",
|
||||
"rules" => "trim|required|max_length[100]",
|
||||
],
|
||||
"responsable" => [
|
||||
"label" => "Presupuestos.responsable",
|
||||
"rules" => "trim|max_length[32]",
|
||||
],
|
||||
"serie_id" => [
|
||||
"label" => "Presupuestos.serieId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"solapas_ancho" => [
|
||||
"label" => "Presupuestos.solapasAncho",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"tarifa_cliente_id" => [
|
||||
"label" => "Presupuestos.tarifaClienteId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"tirada" => [
|
||||
"label" => "Presupuestos.tirada",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"tirada_alternativa_json_data" => [
|
||||
"label" => "Presupuestos.tiradaAlternativaJsonData",
|
||||
"rules" => "trim|max_length[16313]",
|
||||
],
|
||||
"titulo" => [
|
||||
"label" => "Presupuestos.titulo",
|
||||
"rules" => "trim|required|max_length[300]",
|
||||
],
|
||||
"total" => [
|
||||
"label" => "Presupuestos.total",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_acabado" => [
|
||||
"label" => "Presupuestos.totalAcabado",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_calculado" => [
|
||||
"label" => "Presupuestos.totalCalculado",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_click" => [
|
||||
"label" => "Presupuestos.totalClick",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_confirmado" => [
|
||||
"label" => "Presupuestos.totalConfirmado",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_confirmado_update_at" => [
|
||||
"label" => "Presupuestos.totalConfirmadoUpdateAt",
|
||||
"rules" => "valid_date|permit_empty",
|
||||
],
|
||||
"total_descuento" => [
|
||||
"label" => "Presupuestos.totalDescuento",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_envios" => [
|
||||
"label" => "Presupuestos.totalEnvios",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_manipulado" => [
|
||||
"label" => "Presupuestos.totalManipulado",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_margen" => [
|
||||
"label" => "Presupuestos.totalMargen",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_margen_extra" => [
|
||||
"label" => "Presupuestos.totalMargenExtra",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_pedido" => [
|
||||
"label" => "Presupuestos.totalPedido",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_peso" => [
|
||||
"label" => "Presupuestos.totalPeso",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_preimpresion" => [
|
||||
"label" => "Presupuestos.totalPreimpresion",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_preimpresion_margen" => [
|
||||
"label" => "Presupuestos.totalPreimpresionMargen",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"total_presupuesto" => [
|
||||
"label" => "Presupuestos.totalPresupuesto",
|
||||
"rules" => "decimal|permit_empty",
|
||||
],
|
||||
"user_created_id" => [
|
||||
"label" => "Presupuestos.userCreatedId",
|
||||
"rules" => "required|integer",
|
||||
],
|
||||
"user_update_id" => [
|
||||
"label" => "Presupuestos.userUpdateId",
|
||||
"rules" => "integer|permit_empty",
|
||||
],
|
||||
"version" => [
|
||||
"label" => "Presupuestos.version",
|
||||
"rules" => "required|integer",
|
||||
"rules" => "trim|max_length[100]",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"aprobado_at" => [
|
||||
"valid_date" => "Presupuestos.validation.aprobado_at.valid_date",
|
||||
],
|
||||
"aprobado_json_data" => [
|
||||
"max_length" => "Presupuestos.validation.aprobado_json_data.max_length",
|
||||
],
|
||||
protected $validationMessagesAdd = [
|
||||
"autor" => [
|
||||
"max_length" => "Presupuestos.validation.autor.max_length",
|
||||
"required" => "Presupuestos.validation.autor.required",
|
||||
],
|
||||
"base_imponible" => [
|
||||
"decimal" => "Presupuestos.validation.base_imponible.decimal",
|
||||
],
|
||||
"catalogo_id" => [
|
||||
"integer" => "Presupuestos.validation.catalogo_id.integer",
|
||||
],
|
||||
"causa_cancelacion" => [
|
||||
"max_length" => "Presupuestos.validation.causa_cancelacion.max_length",
|
||||
],
|
||||
"coleccion" => [
|
||||
"max_length" => "Presupuestos.validation.coleccion.max_length",
|
||||
],
|
||||
"comentarios_cliente" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
"required" => "Presupuestos.validation.required",
|
||||
],
|
||||
"comentarios_pdf" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
"required" => "Presupuestos.validation.required",
|
||||
],
|
||||
"comentarios_safekat" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
"required" => "Presupuestos.validation.required",
|
||||
],
|
||||
"comentarios_tarifa" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
"required" => "Presupuestos.validation.required",
|
||||
],
|
||||
"comentarios_produccion" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
"required" => "Presupuestos.validation.required",
|
||||
],
|
||||
"comparador_json_data" => [
|
||||
"max_length" => "Presupuestos.validation.comparador_json_data.max_length",
|
||||
],
|
||||
"sobrecubiertas_ancho" => [
|
||||
"decimal" => "Presupuestos.validation.sobrecubiertas_ancho.decimal",
|
||||
"required" => "Presupuestos.validation.sobrecubiertas_ancho.required",
|
||||
],
|
||||
"descuento" => [
|
||||
"decimal" => "Presupuestos.validation.descuento.decimal",
|
||||
"required" => "Presupuestos.validation.descuento.required",
|
||||
],
|
||||
"fecha_encuardenado_at" => [
|
||||
"valid_date" => "Presupuestos.validation.fecha_encuardenado_at.valid_date",
|
||||
],
|
||||
"fecha_entrega_real_at" => [
|
||||
"valid_date" => "Presupuestos.validation.fecha_entrega_real_at.valid_date",
|
||||
],
|
||||
"fecha_externo_at" => [
|
||||
"valid_date" => "Presupuestos.validation.fecha_externo_at.valid_date",
|
||||
],
|
||||
"fecha_ferro_subido_at" => [
|
||||
"valid_date" => "Presupuestos.validation.fecha_ferro_subido_at.valid_date",
|
||||
],
|
||||
"fecha_impresion_at" => [
|
||||
"valid_date" => "Presupuestos.validation.fecha_impresion_at.valid_date",
|
||||
],
|
||||
"forzar_total" => [
|
||||
"decimal" => "Presupuestos.validation.forzar_total.decimal",
|
||||
"required" => "Presupuestos.validation.forzar_total.required",
|
||||
],
|
||||
"inc_rei" => [
|
||||
"integer" => "Presupuestos.validation.inc_rei.integer",
|
||||
],
|
||||
"is_deleted" => [
|
||||
"integer" => "Presupuestos.validation.is_deleted.integer",
|
||||
"required" => "Presupuestos.validation.is_deleted.required",
|
||||
],
|
||||
"isbn" => [
|
||||
"max_length" => "Presupuestos.validation.isbn.max_length",
|
||||
],
|
||||
"lomo" => [
|
||||
"integer" => "Presupuestos.validation.lomo.integer",
|
||||
],
|
||||
"margen" => [
|
||||
"decimal" => "Presupuestos.validation.margen.decimal",
|
||||
],
|
||||
"margen_extra" => [
|
||||
"decimal" => "Presupuestos.validation.margen_extra.decimal",
|
||||
"required" => "Presupuestos.validation.margen_extra.required",
|
||||
],
|
||||
"margen_manual" => [
|
||||
"decimal" => "Presupuestos.validation.margen_manual.decimal",
|
||||
],
|
||||
"merma" => [
|
||||
"decimal" => "Presupuestos.validation.merma.decimal",
|
||||
"required" => "Presupuestos.validation.merma.required",
|
||||
],
|
||||
"merma_portada" => [
|
||||
"decimal" => "Presupuestos.validation.merma_portada.decimal",
|
||||
"required" => "Presupuestos.validation.merma_portada.required",
|
||||
],
|
||||
"numero_edicion" => [
|
||||
"max_length" => "Presupuestos.validation.numero_edicion.max_length",
|
||||
],
|
||||
"paginas" => [
|
||||
"integer" => "Presupuestos.validation.paginas.integer",
|
||||
"required" => "Presupuestos.validation.paginas.required",
|
||||
],
|
||||
"paginas_color" => [
|
||||
"integer" => "Presupuestos.validation.paginas_color.integer",
|
||||
],
|
||||
"paginas_color_click" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_click.decimal",
|
||||
],
|
||||
"paginas_color_forma_id" => [
|
||||
"integer" => "Presupuestos.validation.paginas_color_forma_id.integer",
|
||||
],
|
||||
"paginas_color_gramaje" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_gramaje.decimal",
|
||||
],
|
||||
"paginas_color_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_libro.decimal",
|
||||
],
|
||||
"paginas_color_mano" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_mano.decimal",
|
||||
],
|
||||
"paginas_color_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_pedido.decimal",
|
||||
],
|
||||
"paginas_color_peso" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_peso.decimal",
|
||||
],
|
||||
"paginas_color_pliegos_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_pliegos_libro.decimal",
|
||||
],
|
||||
"paginas_color_pliegos_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_pliegos_pedido.decimal",
|
||||
],
|
||||
"paginas_color_pliegos_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_pliegos_precio.decimal",
|
||||
],
|
||||
"paginas_color_posicion" => [
|
||||
"max_length" => "Presupuestos.validation.paginas_color_posicion.max_length",
|
||||
],
|
||||
"paginas_color_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_color_precio.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta" => [
|
||||
"in_list" => "Presupuestos.validation.paginas_sobrecubierta.in_list",
|
||||
"required" => "Presupuestos.validation.paginas_sobrecubierta.required",
|
||||
],
|
||||
"paginas_sobrecubierta_click" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_click.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_forma_id" => [
|
||||
"integer" => "Presupuestos.validation.paginas_sobrecubierta_forma_id.integer",
|
||||
],
|
||||
"paginas_sobrecubierta_gramaje" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_gramaje.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_libro.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_mano" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_mano.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_pedido.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_peso" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_peso.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_pliegos_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_pliegos_libro.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_pliegos_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_pliegos_pedido.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_pliegos_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_pliegos_precio.decimal",
|
||||
],
|
||||
"paginas_sobrecubierta_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_sobrecubierta_precio.decimal",
|
||||
],
|
||||
"paginas_negro" => [
|
||||
"integer" => "Presupuestos.validation.paginas_negro.integer",
|
||||
],
|
||||
"paginas_negro_click" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_click.decimal",
|
||||
],
|
||||
"paginas_negro_forma_id" => [
|
||||
"integer" => "Presupuestos.validation.paginas_negro_forma_id.integer",
|
||||
],
|
||||
"paginas_negro_gramaje" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_gramaje.decimal",
|
||||
],
|
||||
"paginas_negro_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_libro.decimal",
|
||||
],
|
||||
"paginas_negro_mano" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_mano.decimal",
|
||||
],
|
||||
"paginas_negro_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_pedido.decimal",
|
||||
],
|
||||
"paginas_negro_peso" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_peso.decimal",
|
||||
],
|
||||
"paginas_negro_pliegos_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_pliegos_libro.decimal",
|
||||
],
|
||||
"paginas_negro_pliegos_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_pliegos_pedido.decimal",
|
||||
],
|
||||
"paginas_negro_pliegos_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_pliegos_precio.decimal",
|
||||
],
|
||||
"paginas_negro_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_negro_precio.decimal",
|
||||
],
|
||||
"paginas_cubierta" => [
|
||||
"in_list" => "Presupuestos.validation.paginas_cubierta.in_list",
|
||||
"required" => "Presupuestos.validation.paginas_cubierta.required",
|
||||
],
|
||||
"paginas_cubierta_click" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_click.decimal",
|
||||
],
|
||||
"paginas_cubierta_forma_id" => [
|
||||
"integer" => "Presupuestos.validation.paginas_cubierta_forma_id.integer",
|
||||
],
|
||||
"paginas_cubierta_gramaje" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_gramaje.decimal",
|
||||
],
|
||||
"paginas_cubierta_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_libro.decimal",
|
||||
],
|
||||
"paginas_cubierta_mano" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_mano.decimal",
|
||||
],
|
||||
"paginas_cubierta_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_pedido.decimal",
|
||||
"required" => "Presupuestos.validation.paginas_cubierta_pedido.required",
|
||||
],
|
||||
"paginas_cubierta_peso" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_peso.decimal",
|
||||
],
|
||||
"paginas_cubierta_pliegos_libro" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_pliegos_libro.decimal",
|
||||
],
|
||||
"paginas_cubierta_pliegos_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_pliegos_pedido.decimal",
|
||||
],
|
||||
"paginas_cubierta_pliegos_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_pliegos_precio.decimal",
|
||||
],
|
||||
"paginas_cubierta_precio" => [
|
||||
"decimal" => "Presupuestos.validation.paginas_cubierta_precio.decimal",
|
||||
],
|
||||
"papel_formato_alto" => [
|
||||
"decimal" => "Presupuestos.validation.papel_formato_alto.decimal",
|
||||
],
|
||||
"papel_formato_ancho" => [
|
||||
"decimal" => "Presupuestos.validation.papel_formato_ancho.decimal",
|
||||
],
|
||||
"pedido_espera_fecha" => [
|
||||
"valid_date" => "Presupuestos.validation.pedido_espera_fecha.valid_date",
|
||||
],
|
||||
"referencia_cliente" => [
|
||||
"max_length" => "Presupuestos.validation.referencia_cliente.max_length",
|
||||
"required" => "Presupuestos.validation.referencia_cliente.required",
|
||||
],
|
||||
"responsable" => [
|
||||
"max_length" => "Presupuestos.validation.responsable.max_length",
|
||||
],
|
||||
"serie_id" => [
|
||||
"integer" => "Presupuestos.validation.serie_id.integer",
|
||||
],
|
||||
"solapas_ancho" => [
|
||||
"decimal" => "Presupuestos.validation.solapas_ancho.decimal",
|
||||
"required" => "Presupuestos.validation.solapas_ancho.required",
|
||||
],
|
||||
"tarifa_cliente_id" => [
|
||||
"integer" => "Presupuestos.validation.tarifa_cliente_id.integer",
|
||||
],
|
||||
"tirada" => [
|
||||
"integer" => "Presupuestos.validation.tirada.integer",
|
||||
"required" => "Presupuestos.validation.tirada.required",
|
||||
],
|
||||
"tirada_alternativa_json_data" => [
|
||||
"max_length" => "Presupuestos.validation.tirada_alternativa_json_data.max_length",
|
||||
"required" => "Presupuestos.validation.requerido",
|
||||
],
|
||||
"titulo" => [
|
||||
"max_length" => "Presupuestos.validation.titulo.max_length",
|
||||
"required" => "Presupuestos.validation.titulo.required",
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
"required" => "Presupuestos.validation.requerido",
|
||||
],
|
||||
"total" => [
|
||||
"decimal" => "Presupuestos.validation.total.decimal",
|
||||
"inc_rei" => [
|
||||
"integer" => "Presupuestos.validation.integer",
|
||||
|
||||
],
|
||||
"total_acabado" => [
|
||||
"decimal" => "Presupuestos.validation.total_acabado.decimal",
|
||||
"coleccion" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
],
|
||||
"total_calculado" => [
|
||||
"decimal" => "Presupuestos.validation.total_calculado.decimal",
|
||||
"numero_edicion" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
],
|
||||
"total_click" => [
|
||||
"decimal" => "Presupuestos.validation.total_click.decimal",
|
||||
"isbn" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
],
|
||||
"total_confirmado" => [
|
||||
"decimal" => "Presupuestos.validation.total_confirmado.decimal",
|
||||
"pais_id" => [
|
||||
"required" => "Presupuestos.validation.requerido",
|
||||
],
|
||||
"total_confirmado_update_at" => [
|
||||
"valid_date" => "Presupuestos.validation.total_confirmado_update_at.valid_date",
|
||||
"cliente_id" => [
|
||||
"required" => "Presupuestos.validation.requerido",
|
||||
],
|
||||
"total_descuento" => [
|
||||
"decimal" => "Presupuestos.validation.total_descuento.decimal",
|
||||
],
|
||||
"total_envios" => [
|
||||
"decimal" => "Presupuestos.validation.total_envios.decimal",
|
||||
],
|
||||
"total_manipulado" => [
|
||||
"decimal" => "Presupuestos.validation.total_manipulado.decimal",
|
||||
],
|
||||
"total_margen" => [
|
||||
"decimal" => "Presupuestos.validation.total_margen.decimal",
|
||||
],
|
||||
"total_margen_extra" => [
|
||||
"decimal" => "Presupuestos.validation.total_margen_extra.decimal",
|
||||
],
|
||||
"total_pedido" => [
|
||||
"decimal" => "Presupuestos.validation.total_pedido.decimal",
|
||||
],
|
||||
"total_peso" => [
|
||||
"decimal" => "Presupuestos.validation.total_peso.decimal",
|
||||
],
|
||||
"total_preimpresion" => [
|
||||
"decimal" => "Presupuestos.validation.total_preimpresion.decimal",
|
||||
],
|
||||
"total_preimpresion_margen" => [
|
||||
"decimal" => "Presupuestos.validation.total_preimpresion_margen.decimal",
|
||||
],
|
||||
"total_presupuesto" => [
|
||||
"decimal" => "Presupuestos.validation.total_presupuesto.decimal",
|
||||
],
|
||||
"user_created_id" => [
|
||||
"integer" => "Presupuestos.validation.user_created_id.integer",
|
||||
"required" => "Presupuestos.validation.user_created_id.required",
|
||||
],
|
||||
"user_update_id" => [
|
||||
"integer" => "Presupuestos.validation.user_update_id.integer",
|
||||
],
|
||||
"version" => [
|
||||
"integer" => "Presupuestos.validation.version.integer",
|
||||
"required" => "Presupuestos.validation.version.required",
|
||||
"referencia_cliente" => [
|
||||
"max_length" => "Presupuestos.validation.max_length",
|
||||
],
|
||||
];
|
||||
public function findAllWithAllRelations(string $selcols = "*", int $limit = null, int $offset = 0)
|
||||
@ -1047,13 +315,15 @@ class PresupuestoModel extends \App\Models\GoBaseModel
|
||||
"t1.id AS id, t1.created_at AS fecha, t2.nombre AS cliente,
|
||||
CONCAT(t3.first_name, ' ', t3.last_name) AS comercial, t1.titulo AS titulo,
|
||||
t5.nombre AS pais, t1.inc_rei AS inc_rei, t1.paginas AS paginas, t1.tirada AS tirada,
|
||||
t1.total_pedido AS total_pedido, t6.estado AS estado"
|
||||
t1.total_pedido AS total_pedido, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
|
||||
);
|
||||
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
|
||||
$builder->join("auth_user t3", "t1.user_update_id = t3.id_user", "left");
|
||||
$builder->join("lg_paises t5", "t1.pais_id = t5.id", "left");
|
||||
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
|
||||
|
||||
$builder->where("t1.is_deleted", 0);
|
||||
|
||||
return empty($search)
|
||||
? $builder
|
||||
: $builder
|
||||
|
||||
@ -233,6 +233,8 @@ class PresupuestoService extends BaseService
|
||||
$data['precio_pagina_color'] = round($pag_color ? $data['precio_tinta'] / ($pag_color * ($datosPedido->tirada + $datosPedido->merma)) : 0, 6);
|
||||
|
||||
// calculo de corte
|
||||
$data['velocidad_corte'] = $maquina->velocidad_corte;
|
||||
$data['precio_hora_corte'] = $maquina->precio_hora_corte;
|
||||
$data['tiempo_corte'] = $maquina->velocidad_corte > 0 ? round($metros_papel_total / $maquina->velocidad_corte, 2) : 0;
|
||||
$data['total_corte'] = round(($data['tiempo_corte'] / 60.0) * $maquina->precio_hora_corte, 2);
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ if (session()->has('error')) {
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
function popAlert(message, alertClass, alertIcon){
|
||||
function popAlert(message, alertClass, alertIcon, containerId = 'sk-alert'){
|
||||
var htmlString = `
|
||||
<div class="alert ${alertClass} d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
@ -34,24 +34,26 @@ function popAlert(message, alertClass, alertIcon){
|
||||
<h5 class="alert-heading mb-2">${message}</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
if(containerId == 'sk-alert'){
|
||||
$(window).scrollTop(0);
|
||||
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
}
|
||||
$('#' + containerId).hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
setTimeout(function(){
|
||||
$('#sk-alert').fadeOut("slow");
|
||||
$('#' + containerId).fadeOut("slow");
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function popSuccessAlert(successMsg){
|
||||
popAlert(successMsg, "alert-success", "ti-check");
|
||||
function popSuccessAlert(successMsg, containerId = 'sk-alert'){
|
||||
popAlert(successMsg, "alert-success", "ti-check", containerId);
|
||||
}
|
||||
|
||||
function popWarningAlert(warningMsg){
|
||||
popAlert(warningMsg, "alert-warning", "ti-bell");
|
||||
function popWarningAlert(warningMsg, containerId = 'sk-alert'){
|
||||
popAlert(warningMsg, "alert-warning", "ti-bell", containerId);
|
||||
}
|
||||
|
||||
function popErrorAlert(errorMsg){
|
||||
popAlert(errorMsg, "alert-danger", "ti-ban");
|
||||
function popErrorAlert(errorMsg, containerId = 'sk-alert'){
|
||||
popAlert(errorMsg, "alert-danger", "ti-ban", containerId);
|
||||
}
|
||||
|
||||
<?php if (isset($successMessage) && $successMessage){ ?>
|
||||
|
||||
@ -95,7 +95,7 @@
|
||||
rows="3"
|
||||
id="comentariosCliente"
|
||||
name="comentarios_cliente"
|
||||
required style="height: 10em;"
|
||||
style="height: 10em;"
|
||||
class="form-control"><?= old('comentarios', $presupuestoEntity->comentarios_cliente) ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@ -110,7 +110,6 @@
|
||||
rows="3"
|
||||
id="comentariosSafekat"
|
||||
name="comentarios_safekat"
|
||||
required
|
||||
style="height: 10em;"
|
||||
class="form-control"><?=old('comentarios_safekat', $presupuestoEntity->comentarios_safekat) ?></textarea>
|
||||
</div>
|
||||
@ -127,7 +126,7 @@
|
||||
rows="3"
|
||||
id="comentariosPdf"
|
||||
name="comentarios_pdf"
|
||||
required style="height: 10em;"
|
||||
style="height: 10em;"
|
||||
class="form-control"><?=old('comentarios_pdf', $presupuestoEntity->comentarios_pdf) ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@ -143,7 +142,6 @@
|
||||
rows="3"
|
||||
id="comentariosProduccion"
|
||||
name="comentarios_produccion"
|
||||
required
|
||||
style="height: 10em;"
|
||||
class="form-control"><?=old('comentarios_pdf', $presupuestoEntity->comentarios_produccion) ?></textarea>
|
||||
</div>
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<label for="paginas" class="form-label">
|
||||
<?= lang('Presupuestos.paginas') ?>*
|
||||
</label>
|
||||
<input type="number" id="paginas" name="paginas" maxLength="11" class="form-control" value="<?= old('paginas', $presupuestoEntity->paginas) ?>">
|
||||
<input type="number" id="paginas" name="paginas" tabindex="1" maxLength="11" class="form-control" value="<?= old('paginas', $presupuestoEntity->paginas) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
|
||||
</div>
|
||||
@ -29,7 +29,7 @@
|
||||
<div class="mb-3">
|
||||
|
||||
<div class="form-check form-switch mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="solapas" name="solapas" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
|
||||
<input class="form-check-input" type="checkbox" id="solapas" name="solapas" tabindex="6" value="1" <?= $presupuestoEntity->solapas == true ? 'checked' : ''; ?>>
|
||||
<label class="form-check-label" for="papelFormatoPersonalizado"><?= lang('Presupuestos.solapasCubierta') ?></label>
|
||||
</div>
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<label for="tirada" class="form-label">
|
||||
<?= lang('Presupuestos.tirada') ?>*
|
||||
</label>
|
||||
<input type="number" id="tirada" name="tirada" maxLength="11" class="form-control" value="<?= old('tirada', $presupuestoEntity->tirada) ?>">
|
||||
<input type="number" id="tirada" name="tirada" tabindex="2" maxLength="11" class="form-control" value="<?= old('tirada', $presupuestoEntity->tirada) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<?= lang('Presupuestos.papelFormatoId') ?>*
|
||||
</label>
|
||||
|
||||
<select id="papelFormatoId" name="papel_formato_id" class="form-control select2bs2" style="width: 100%;">
|
||||
<select id="papelFormatoId" name="papel_formato_id" tabindex="3" class="form-control select2bs2" style="width: 100%;">
|
||||
|
||||
<?php if (isset($papelFormatoList) && is_array($papelFormatoList) && !empty($papelFormatoList)) :
|
||||
foreach ($papelFormatoList as $formato) : ?>
|
||||
@ -95,7 +95,7 @@
|
||||
<label for="merma" class="form-label">
|
||||
<?= lang('Presupuestos.merma') ?>*
|
||||
</label>
|
||||
<input type="number" id="merma" name="merma" maxLength="8" step="1" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
|
||||
<input type="number" id="merma" name="merma" maxLength="8" tabindex="4" step="1" class="form-control" value="<?= old('merma', $presupuestoEntity->merma) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
<label for="mermacubierta" class="form-label">
|
||||
<?= lang('Presupuestos.mermacubierta') ?>*
|
||||
</label>
|
||||
<input type="number" id="mermacubierta" name="merma_cubierta" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
|
||||
<input type="number" id="mermacubierta" name="merma_cubierta" tabindex="5" placeholder="10" maxLength="8" step="1" class="form-control" value="<?= old('merma_cubierta', $presupuestoEntity->merma_cubierta) ?>">
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -116,7 +116,11 @@
|
||||
|
||||
</div>
|
||||
|
||||
<?php if($presupuestoEntity->solapas == true): ?>
|
||||
<div class="row" id="div_solapas_ancho">
|
||||
<?php else: ?>
|
||||
<div class="row" id="div_solapas_ancho" style="display:none;">
|
||||
<?php endif; ?>
|
||||
<div class="col-md-12 col-lg-2 px-4">
|
||||
<div class="mb-3">
|
||||
<label for="solapas_ancho" class="form-label">
|
||||
@ -260,3 +264,31 @@
|
||||
</div> <!-- //.accordion-collapse -->
|
||||
</div> <!-- //.accordion-item -->
|
||||
</div> <!-- //.accordion -->
|
||||
|
||||
<!------------------------------------------->
|
||||
<!-- Código JS comportamiento general pag. -->
|
||||
<!------------------------------------------->
|
||||
<?= $this->section("additionalInlineJs") ?>
|
||||
$('#papelFormatoPersonalizado').on("click",function(){
|
||||
var checkbox = document.getElementById('papelFormatoPersonalizado');
|
||||
if(checkbox.checked == true){
|
||||
document.getElementById("papelFormatoAncho").style.display = "block";
|
||||
document.getElementById("papelFormatoAlto").style.display = "block";
|
||||
$('#papelFormatoId').next(".select2-container").hide();
|
||||
$('#papelFormatoId').val('').change();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?> (" +
|
||||
"<?=lang('Presupuestos.papelFormatoAncho') ?> x <?=lang('Presupuestos.papelFormatoAncho') ?>)*";
|
||||
}
|
||||
else{
|
||||
document.getElementById("papelFormatoAncho").value= "";
|
||||
document.getElementById("papelFormatoAlto").value= "";
|
||||
document.getElementById("papelFormatoAncho").style.display = "none";
|
||||
document.getElementById("papelFormatoAlto").style.display = "none";
|
||||
$('#papelFormatoId').next(".select2-container").show();
|
||||
document.getElementById("label_papelFormatoId").innerHTML =
|
||||
"<?=lang('Presupuestos.papelFormatoId') ?>*";
|
||||
}
|
||||
});
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,11 @@
|
||||
<label for="created_at" class="form-label">
|
||||
<?= lang('Presupuestos.created_at') ?>
|
||||
</label>
|
||||
<input readonly style="background: #E8E8E8;" id="created_at" name="created_at" maxLength="12" class="form-control" value="<?= old('created_at', (isset($presupuestoEntity->created_at)) ? $presupuestoEntity->created_at : date("d/m/Y")) ?>">
|
||||
<?php if(str_contains($formAction,'edit')): ?>
|
||||
<input readonly style="background: #E8E8E8;" id="updated_at" name="updated_at" maxLength="12" class="form-control" value="<?= old('created_at', (isset($presupuestoEntity->updated_at)) ? date ('d/m/Y', strtotime($presupuestoEntity->updated_at)) : "") ?>">
|
||||
<?php else: ?>
|
||||
<input readonly style="background: #E8E8E8;" id="created_at" name="created_at" maxLength="12" class="form-control" value="<?= old('created_at', (isset($presupuestoEntity->created_at)) ? date ('d/m/Y', strtotime($presupuestoEntity->created_at)) : "") ?>">
|
||||
<?php endif; ?>
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -34,7 +38,10 @@
|
||||
<label for="estadoId" class="form-label">
|
||||
<?= lang('Presupuestos.presupuestoEstado') ?>
|
||||
</label>
|
||||
<input readonly style="background: #E8E8E8 ;" id="estadoId" name="estado_id" maxLength="12" class="form-control" value="<?= old('estadoId', (isset($presupuestoEntity->estadoId)) ? $presupuestoEntity->estadoId : lang('Presupuestos.presupuestoEstadoBorrador')) ?>">
|
||||
<select disabled id="estadoId" name="estado_id" maxLength="11" style="background-color: #E8E8E8;" class="form-control" value="<?= old(1, $presupuestoEntity->estado_id) ?>">
|
||||
<option value=1><?=lang('Presupuestos.presupuestoEstadoBorrador') ?></option>
|
||||
<option value=2><?=lang('Presupuestos.presupuestoEstadoAceptado') ?></option>
|
||||
</select>
|
||||
</div><!--//.mb-3 -->
|
||||
</div><!--//.col -->
|
||||
|
||||
@ -47,7 +54,7 @@
|
||||
<?php if (isset($incReiList) && is_array($incReiList) && !empty($incReiList)) : ?>
|
||||
<option> </option>
|
||||
<?php foreach ($incReiList as $k => $v) : ?>
|
||||
<option value="<?= $k ?>" <?= $k == $presupuestoEntity->estado_id ? ' selected' : '' ?>>
|
||||
<option value="<?= $k ?>" <?= $k == $presupuestoEntity->inc_rei ? ' selected' : '' ?>>
|
||||
<?= $v ?>
|
||||
</option>
|
||||
<?php endforeach;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -151,50 +151,6 @@ $('.accordion-button').on('click', function (e) {
|
||||
/*******************************
|
||||
* Metodos
|
||||
*******************************/
|
||||
$('.insertarLinea').on("click", function (e) {
|
||||
|
||||
if(e.target.id.includes("Plana")){
|
||||
// Se borran todas las líneas que no sean cubierta y sobrecubierta
|
||||
$('#tableLineasPresupuesto').DataTable()
|
||||
.rows( function ( idx, data, node ) {
|
||||
return data[0] !== 'cubierta' && data[0] !== 'sobrecubierta';
|
||||
} )
|
||||
.remove()
|
||||
.draw();
|
||||
|
||||
var rows = $("#tableCompIntPlana").DataTable().rows( '.selected' ).data().toArray();
|
||||
console.log(rows);
|
||||
for(row of rows){
|
||||
$('#tableLineasPresupuesto').DataTable().row.add({
|
||||
'tipo': row['tipo'],
|
||||
'paginas': row['paginas'],
|
||||
'papel': row['papel'],
|
||||
'gramaje': row['gramaje'],
|
||||
'marca': row['marca'],
|
||||
'maquina': row['maquina'],
|
||||
'tiempo': row['tiempoMaquina'],
|
||||
'numeroPliegos': row['numeroPliegos'],
|
||||
'pliegosPedido': row['pliegosPedido'],
|
||||
'precioPliego': row['precioPliego'],
|
||||
'libro': row['libro'],
|
||||
'totalPapelPedido': row['totalPapelPedido'],
|
||||
'chekPapel': true,
|
||||
'lomo': row['lomo'],
|
||||
'peso': row['peso'],
|
||||
'click': row['click'],
|
||||
'totalClicks': row['totalClicks'],
|
||||
'chekClicks': true,
|
||||
'maquinaId': row['maquinaId'],
|
||||
'maquinaVelocidad': row['maquinaVelocidad'],
|
||||
'papelGenericoId': row['papelGenericoId'],
|
||||
'papelImpresionId': row['papelImpresionId'],
|
||||
}
|
||||
).draw();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function getRowFromLineaInt(tipo, linea) {
|
||||
|
||||
return {
|
||||
@ -220,6 +176,7 @@ function getRowFromLineaInt(tipo, linea) {
|
||||
'tiempoMaquina': linea.fields.tiempo_maquina,
|
||||
'papelGenericoId': linea.fields.papel_generico_id,
|
||||
'papelImpresionId': linea.fields.papel_impresion_id,
|
||||
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,29 +209,13 @@ function getRowFromLineaRot(linea) {
|
||||
'tiempoMaquina': linea.fields.tiempo_maquina,
|
||||
'papelGenericoId': linea.fields.papel_generico_id,
|
||||
'papelImpresionId': linea.fields.papel_impresion_id,
|
||||
'paginasColor': linea.fields.paginas_color,
|
||||
'tarifa_impresion_id': linea.fields.tarifa_impresion_id,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDatosPedidoForComp() {
|
||||
|
||||
if (parseInt($('#paginas').val()) > 0 &&
|
||||
parseInt($('#tirada').val()) > 0 &&
|
||||
($('#papelFormatoId').select2('data').length > 0 ||
|
||||
(parseInt($('#papelFormatoAncho').val()) > 0 && parseInt($('#papelFormatoAlto').val()) > 0)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function init_comparador() {
|
||||
updatePapelesComparador();
|
||||
const paginasColor = document.getElementById('compCalPaginasColor');
|
||||
if (paginasColor.value.length > 0) {
|
||||
computarPaginasColor(paginasColor.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function computarPaginasColor(string) {
|
||||
@ -346,7 +287,6 @@ function updatePapelesComparador() {
|
||||
Array.from(elements_colorhq).forEach(element => {
|
||||
element.style.display = "none";
|
||||
});
|
||||
clearNegro();
|
||||
break;
|
||||
|
||||
case "negrohq":
|
||||
@ -400,16 +340,10 @@ function updatePapelesComparador() {
|
||||
}
|
||||
}
|
||||
|
||||
function clearNegro() {
|
||||
document.getElementById('compPaginasNegro').value = 0;
|
||||
$('#compGramajeNegro').val('').change();
|
||||
$('#compGramajeNegro').prop('disabled', true);
|
||||
$('#compPapelNegro').val('data', { id: '0' });
|
||||
}
|
||||
|
||||
|
||||
function clearIntLineas(is_color){
|
||||
$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
|
||||
//$("#tableCompIntPlana").DataTable().rows( '.selected' ).deselect();
|
||||
var tabla = $('#tableCompIntPlana').DataTable();
|
||||
tabla
|
||||
.rows( function ( idx, data, node ) {
|
||||
@ -417,6 +351,7 @@ function clearIntLineas(is_color){
|
||||
} )
|
||||
.remove()
|
||||
.draw();
|
||||
//$('#tableCompIntPlana').DataTable().clear().draw();
|
||||
$('#insertarPlanaBtn').css('display', 'none');
|
||||
}
|
||||
|
||||
@ -424,12 +359,15 @@ function clearIntLineas(is_color){
|
||||
function clearCubierta(){
|
||||
|
||||
$('#tableCompCubierta').DataTable().clear().draw();
|
||||
$('#insertarCubiertaBtn').css('display', 'none');
|
||||
}
|
||||
|
||||
|
||||
function clearIntRot(){
|
||||
|
||||
$('#errorComRot').html('');
|
||||
$('#tableCompIntRotativa').DataTable().clear().draw();
|
||||
$('#insertarRotativaBtn').css('display', 'none');
|
||||
}
|
||||
|
||||
|
||||
@ -531,11 +469,19 @@ function getDimensionLibro(){
|
||||
var ancho = 0;
|
||||
var alto = 0;
|
||||
|
||||
|
||||
if($('#papelFormatoId').select2('data').length > 0){
|
||||
if($('#papelFormatoId').select2('data')[0].id.length > 0){
|
||||
ancho = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[0]);
|
||||
alto = parseFloat($('#papelFormatoId').select2('data')[0].text.trim().split(" x ")[1]);
|
||||
}
|
||||
else{
|
||||
else if(document.getElementById('papelFormatoPersonalizado').checked){
|
||||
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
||||
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
||||
}
|
||||
}
|
||||
|
||||
else if(document.getElementById('papelFormatoPersonalizado').checked){
|
||||
ancho = parseFloat(document.getElementById('papelFormatoAncho').value);
|
||||
alto = parseFloat(document.getElementById('papelFormatoAlto').value);
|
||||
}
|
||||
@ -612,3 +558,105 @@ function fillCubierta(data, is_color, is_hq){
|
||||
.draw()
|
||||
})
|
||||
}
|
||||
|
||||
function clearCompTable(){
|
||||
|
||||
$('#insertarPlanaBtn').addClass('d-none')
|
||||
$('#insertarRotativaBtn').addClass('d-none')
|
||||
$('#total_comp_plana').html('0.00')
|
||||
$('#total_comp_rot').html('0.00')
|
||||
}
|
||||
|
||||
function generateCompJSON(){
|
||||
|
||||
data = {}
|
||||
|
||||
if( $('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color')
|
||||
{
|
||||
try{
|
||||
bn_obj = {
|
||||
"bn":{
|
||||
'paginas': $('#compPaginasNegro').val(),
|
||||
'papel_id': $('#compPapelNegro').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeNegro').select2('data')[0].text.trim(),
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
bn_obj = {}
|
||||
}
|
||||
$.extend( data, bn_obj );
|
||||
}
|
||||
|
||||
if( $('#tipoImpresion').select2('data')[0].id == 'negrohq' || $('#tipoImpresion').select2('data')[0].id == 'colorhq')
|
||||
{
|
||||
try{
|
||||
bnhq_obj = {
|
||||
"bnhq":{
|
||||
'paginas': $('#compPaginasNegrohq').val(),
|
||||
'papel_id': $('#compPapelNegrohq').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeNegrohq').select2('data')[0].text.trim(),
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
bnhq_obj = {}
|
||||
}
|
||||
$.extend( data, bnhq_obj );
|
||||
}
|
||||
|
||||
if($('#tipoImpresion').select2('data')[0].id == 'color')
|
||||
{
|
||||
try{
|
||||
color_obj = {
|
||||
"color":{
|
||||
'paginas': $('#compPaginasColor').val(),
|
||||
'papel_id': $('#compPapelColor').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeColor').select2('data')[0].text.trim(),
|
||||
},
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
color_obj = {}
|
||||
}
|
||||
$.extend( data, color_obj );
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($('#tipoImpresion').select2('data')[0].id == 'colorhq')
|
||||
{
|
||||
try{
|
||||
colorhq_obj = {
|
||||
"colorhq":{
|
||||
'paginas': $('#compPaginasColorhq').val(),
|
||||
'papel_id': $('#compPapelColorhq').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeColorhq').select2('data')[0].text.trim(),
|
||||
},
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
colorhq_obj = {}
|
||||
}
|
||||
$.extend( data, colorhq_obj );
|
||||
}
|
||||
|
||||
|
||||
try{
|
||||
cubierta_obj = {
|
||||
"cubierta":{
|
||||
'paginas': $('#compCarasCubierta').select2('data')[0].id,
|
||||
'papel_id': $('#compPapelCubierta').select2('data')[0].id,
|
||||
'gramaje': $('#compGramajeCubierta').select2('data')[0].text.trim(),
|
||||
},
|
||||
}
|
||||
}
|
||||
catch (e){
|
||||
cubierta_obj = {}
|
||||
}
|
||||
|
||||
$.extend( data, cubierta_obj );
|
||||
|
||||
data_str = JSON.stringify(data)
|
||||
$('#comparador_json_data').val(data_str)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@
|
||||
<th><?= lang('Presupuestos.incRei') ?></th>
|
||||
<th><?= lang('Presupuestos.paginas') ?></th>
|
||||
<th><?= lang('Presupuestos.tirada') ?></th>
|
||||
<th><?= lang('Presupuestos.totalPedido') ?></th>
|
||||
<th><?= lang('Presupuestos.totalPresupuesto') ?></th>
|
||||
<th><?= lang('Presupuestos.presupuestoEstado') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
@ -104,8 +104,15 @@
|
||||
{ 'data': 'inc_rei' },
|
||||
{ 'data': 'paginas' },
|
||||
{ 'data': 'tirada' },
|
||||
{ 'data': 'total_pedido' },
|
||||
{ 'data': 'estado' },
|
||||
{ 'data': 'total_presupuesto' },
|
||||
{ 'data': 'estado' ,
|
||||
'render': function ( data, type, row, meta ) {
|
||||
if(data=='borrador')
|
||||
return '<?= lang('Presupuestos.presupuestoEstadoBorrador') ?>';
|
||||
else if(data=='aceptado')
|
||||
return '<?= lang('Presupuestos.presupuestoEstadoAceptado') ?>';
|
||||
}
|
||||
},
|
||||
{ 'data': actionBtns }
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user