mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en edit
This commit is contained in:
@ -164,6 +164,9 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
$datosPresupuesto->clienteList = $this->getClienteListItems($presupuestoEntity->cliente_id ?? null);
|
||||
|
||||
$this->obtenerTiradas($presupuestoEntity);
|
||||
$this->obtenerDatosPapel($presupuestoEntity);
|
||||
|
||||
$this->viewData['formAction'] = route_to('updateCosidotapablanda', $id);
|
||||
|
||||
$this->viewData['paisList'] = $this->getPaisListItems();
|
||||
@ -1369,8 +1372,10 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
|
||||
if ($linea['tipo_maquina'] == 'inkjet') {
|
||||
$totalImpresion += $linea['precio_tinta'];
|
||||
$totalImpresion += $linea['total_corte'];
|
||||
$sumForFactor += $linea['total_corte'];
|
||||
if(array_key_exists('total_corte', $linea)){
|
||||
$totalImpresion += $linea['total_corte'];
|
||||
$sumForFactor += $linea['total_corte'];
|
||||
}
|
||||
}
|
||||
$margenImpresion += $linea['margen_impresion_horas'];
|
||||
$margenImpresion += $linea['margen_click_pedido'];
|
||||
@ -1521,13 +1526,13 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$color = 'negro';
|
||||
|
||||
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$data = $model->where('presupuestoId', $presupuestoId)->findAll();;
|
||||
$data = $model->where('presupuesto_id', $presupuestoId)->findAll();;
|
||||
foreach($data as $linea){
|
||||
|
||||
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
|
||||
$calidad='premium';
|
||||
}
|
||||
if (strpos($linea->tipo, "hq") !== false) { // $linea->tipo contains the substring "hq"
|
||||
if (strpos($linea->tipo, "color") !== false) { // $linea->tipo contains the substring "color"
|
||||
$color='color';
|
||||
}
|
||||
}
|
||||
@ -1544,5 +1549,58 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController
|
||||
$tapa = 'dura';
|
||||
|
||||
return $tapa;
|
||||
|
||||
}
|
||||
|
||||
protected function obtenerTiradas($presupuestoEntity){
|
||||
|
||||
$tiradas_alternativas = json_decode($presupuestoEntity->tirada_alternativa_json_data, true);
|
||||
$tiradas = array();
|
||||
array_push($tiradas, $presupuestoEntity->tirada);
|
||||
if(!is_null($tiradas_alternativas)){
|
||||
if(count($tiradas_alternativas) > 0){
|
||||
foreach($tiradas_alternativas as $tirada){
|
||||
array_push($tiradas, intval($tirada['tirada']));
|
||||
}
|
||||
}
|
||||
}
|
||||
sort($tiradas);
|
||||
$presupuestoEntity->selected_tirada = $presupuestoEntity->tirada;
|
||||
for($i=0; $i<count($tiradas); $i++){
|
||||
$key = 'tirada' . ($i==0?'':strval($i+1));
|
||||
$presupuestoEntity->$key = $tiradas[$i];
|
||||
}
|
||||
}
|
||||
|
||||
protected function obtenerDatosPapel($presupuestoEntity){
|
||||
|
||||
$id = $presupuestoEntity->id;
|
||||
|
||||
$model = model('App\Models\Presupuestos\PresupuestoLineaModel');
|
||||
$data = $model->where('presupuesto_id', $id)->findAll();
|
||||
if(count($data)>0){
|
||||
foreach($data as $linea){
|
||||
// Se coje el primer papel que se encuentre para el interior
|
||||
// para presupuestos del cliente sólo se escoje un papel para el interior
|
||||
if (strpos($linea->tipo, "bn") !== false || strpos($linea->tipo, "color") !== false) {
|
||||
$presupuestoEntity->papel_interior = $linea->papel_id;
|
||||
$presupuestoEntity->gramaje_interior = $linea->gramaje;
|
||||
}
|
||||
// Si es cubierta
|
||||
else if (strpos($linea->tipo, "cubierta") !== false && strpos($linea->tipo, "sobrecubierta") === false) {
|
||||
$presupuestoEntity->papel_cubierta = $linea->papel_id;
|
||||
$presupuestoEntity->gramaje_cubierta = $linea->gramaje;
|
||||
}
|
||||
// Si es sobrecubierta
|
||||
else if (strpos($linea->tipo, "sobrecubierta") !== false) {
|
||||
$presupuestoEntity->papel_sobrecubierta = $linea->papel_id;
|
||||
$presupuestoEntity->gramaje_sobrecubierta = $linea->gramaje;
|
||||
}
|
||||
// Si es guardas
|
||||
else if (strpos($linea->tipo, "guardas") !== false) {
|
||||
$presupuestoEntity->papel_guardas = $linea->papel_id;;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user