Programación Web y Scripting > PHP
agradeceria una mano, para modificar la creacion de un pdf
pacorubio77:
Hola , amigos estoy modificanco código, pero mi gran problema es que no se de donde viene, ya que no lo he echo yo, la cuestion es que me han encargado que cuando se imprime un pdf (para mayoristas) , una columna no le interesa "al jefe" que salga.
Preguntaba como me podeis ayudar..os enseño parte del código que yo creo que sería el encargado de crear dicho pdf?
necesito ayuda..urgente..
En cuanto me digan algo, pongo código para me ayuden.
muchas gracias, espero respuesta.
F_Tanori:
pues necesitamos, saber que quieres hacer...
Saludos
pacorubio77:
Lo que me han dicho que tengo que hacer es que tengo un formulario
Catalogo para mayorista
Catalago..et.ect
Catalogo para clientes
es decir según seas, se imprime de una forma el pdf (que contiene una serie de productos) con unas caracteristicas diferentes, por ejemplo el pdf para clientes tiene
Modelo Caracteristicas preciounidades oferta
es decir cuatro columnas y me han dicho que no les interesa que salga la columna de preciounidades, es decir sería eliminarla.
Os puedo enseñar código que os haga falta...y explicando como lo interpreta, en los siguientes post, os lo muestro para que me ayudeis.
pacorubio77:
El codigo entero de todo es muy extenso, intentaré seleccionar las zonas de atencion y las partes que no se lo que hace, porque repito, yo estoy modificando código que me han dado y de anteriores trabajadores.
Decir en que consiste, existe un formulario, donde me salen una serie de productos, y segun si yo soy cliente mayorista o cliente minorista (vereis opciones), tiene que imprimirse el pdf de una forma u otra.
El pdf del cliente , no quiero que salga las cantidades.
En el siguiente post, pongo código
mirar este seria el fichero opciones.php, en dicho fichero es como si tuvieramos los formularios
--- Código: PHP --- if(@mysql_num_rows($categories)>0) {?> <tr> <td valign="top" class="formAreaTitle"> </td> <td class="main"> <input name="box_opciones" type="radio" value="1" <?php if($opcion==1) { echo "checked"; } ?>>Catalogo para Mayorista<br> <input name="box_opciones" type="radio" value="2" <?php if($opcion==2) { echo "checked"; } ?>>Catalogo para Mayorista con fotos<br> <input name="box_opciones" type="radio" value="3" <?php if($opcion==3) { echo "checked"; } ?>>Catalogo para Clientes<br> <input name="box_opciones" type="radio" value="4" <?php if($opcion==4) { echo "checked"; } ?>>Catalogo para Clientes con fotos<br> <input type="hidden" name="opcion" value="<?php echo $opcion; ?>"> </td> <td class="main" valign="top"> <table width="100%" border="0"> <tr> <td> <input type="button" name="bot_generarHTML" value="Generar HTML" onClick="javascript:generarHTML();"> <input type="button" name="bot_generarCSV" value="Generar CSV" onClick="javascript:generarCSV();"> <input type="button" name="bot_generarPDF" value="Generar PDF" onClick="javascript:generarPDF();"> </td> </tr> <tr> <td> <input type="button" name="bot_modPrecios" value="Modificar todos los precios seleccionados" onClick="javascript:modTodosPrecios();"> </td> </tr> <tr> <td> <input type="button" name="bot_guardarMarcados" value="Guardar Productos Seleccionados" onClick="javascript:guardarProdSelec();"> <input type="hidden" name="guardarMarcados" value="<?php echo $guardarMarcados ?>"> </td> </tr> </table> </td> </tr> <tr> <td valign="top" class="formAreaTitle"></td> <td colspan="2"> <a class="infoBoxNoticeContents" href="javascript:act_products()">Actualizar productos</a> <?php if(@mysql_num_rows($products)>0) { ?> | <a class="infoBoxNoticeContents" href="javascript:seleccionar_todo()">Marcar todos</a> | <a class="infoBoxNoticeContents" href="javascript:deseleccionar_todo()">Marcar ninguno</a>
Como veis aqui se hace una llamada a onClick="javascript:generarPDF();">
eso se encuentra en un fichero javascript que es el siguiente
function generarHTML() { generarGenerico('HTML'); }
function generarCSV() { generarGenerico('CSV'); }
function generarPDF() { generarGenerico('PDF'); }
--- Código: PHP --- function generarGenerico(tipo) { var f = window.document.opciones; var comp_products = false; if(f && f.valor_products && f.box_products){ f.valor_products.value = "0"; var max = f.box_products.length; for (var idx = 0; idx < max; idx++) { if (eval("f.box_products[" + idx + "].checked") == true) { f.valor_products.value=f.valor_products.value+","+eval("f.box_products[" + idx + "].value"); comp_products = true; } } } if (comp_products==true) { f.action = "formato"+tipo+".php"; f.submit(); }else{ alert("Debe marcar algún producto para generar "+tipo); }}
y ahi tengo una pregunta
var f = window.document.opciones;
en esta sentencia f que guarda? cuanto vale f?
tengo tambien un fichero llamado conexion.php, que me hace la comunicacion con mysql, este seria el fichero
--- Código: PHP --- <?php//Conexion con la basemysql_connect('emma-express.de', 'web90', 'LmT1950!');//selección de la base de datos con la que vamos a trabajarmysql_select_db('usr_web90_2'); //1=test 2=producción function f_gurdarMarcados($vc,$vp){ $sql = " UPDATE products B, products_to_categories A SET B.marcarCatalogo =0 WHERE A.products_id = B.products_id AND A.categories_id IN (".$vc.") "; //echo $upd."<br>"; mysql_query($sql); $a = $vp; $a = explode(",", $a); $n = count($a); $i = 1; while ($n>$i) { $sql = " Update products Set marcarCatalogo = 1 Where products_id = ".$a[$i]." "; //echo $upd."<br>"; mysql_query($sql); $i=$i+1; }} function f_cargarProductos($op,$sl,$vc,$vp=false){ $products=false; if ($op==1 or $op==2) { $sql = "SELECT p.products_id, p.products_model, p.products_price, pd.products_name, p.products_image, p.products_ve, p2.precio AS precio2, p3.precio AS precio3, cd.categories_id, cd.categories_name, tr.tax_rate, p.marcarCatalogoFROM languages l inner join products_description pd on (l.languages_id = pd.language_id) inner join categories_description cd on (l.languages_id = cd.language_id) inner join products p on (p.products_id = pd.products_id) inner join categories c on (c.categories_id = cd.categories_id) inner join products_to_categories pc on (pc.categories_id = c.categories_id and pc.products_id = p.products_id) left outer join (SELECT products_id AS pid, customers_group_price AS precio FROM products_groups WHERE customers_group_id=4) p2 on (p2.pid = p.products_id) inner join (SELECT products_id AS pid, customers_group_price AS precio FROM products_groups WHERE customers_group_id=3) p3 on (p3.pid = p.products_id) inner join tax_class tc on (tc.tax_class_id = p.products_tax_class_id) inner join tax_rates tr on (tr.tax_class_id = tc.tax_class_id) WHERE l.languages_id = ".$sl." and c.parent_id = 0 and cd.categories_id in (".$vc.") ".($vp?" and p.products_id in (".$vp.") ":'')."ORDER BY c.sort_order, pd.products_name "; // and p.products_status = '1' }else{ $sql = "SELECT p.products_id, p.products_model, p.products_price, pd.products_name, p.products_image, p.products_ve, tr.tax_rate, IF(s.status, s.specials_new_products_price, NULL) as specials_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, cd.categories_id, cd.categories_name, p.marcarCatalogoFROM languages l inner join products_description pd on (l.languages_id = pd.language_id) inner join categories_description cd on (l.languages_id = cd.language_id) inner join products p on (p.products_id = pd.products_id) inner join categories c on (c.categories_id = cd.categories_id) inner join products_to_categories pc on (pc.categories_id = c.categories_id and pc.products_id = p.products_id) left outer join specials s on (s.products_id = p.products_id) inner join tax_class tc on (tc.tax_class_id = p.products_tax_class_id) inner join tax_rates tr on (tr.tax_class_id = tc.tax_class_id) WHERE l.languages_id = ".$sl." and c.parent_id = 0 and cd.categories_id in (".$vc.") ".($vp?" and p.products_id in (".$vp.") ":'')."ORDER BY c.sort_order, pd.products_name "; // and p.products_status = '1' } $products=mysql_query($sql); return $products;} function f_cargarCategorias($sl){ $categorias=mysql_query("SELECT d.categories_id, d.categories_nameFROM categories c, categories_description dWHERE c.categories_id = d.categories_id AND d.language_id = ".$sl." AND c.parent_id = 0 ORDER BY c.sort_order "); return $categorias;} ?>
pacorubio77:
Existe otro fichero llamado funciones.php, que la parte de éste que valdría sería (valdria para entender el código)
--- Código: PHP --- function f_cabecera_productos(){ $r=''; //$r.='<!-- Cabecera -->'; $r=''; $r.='<table border="0" cellpadding="5" cellspacing="0"><tr>'; $r.='<td>'.'<img src="logo-mate-tee-delicatino.jpg" border="0" />'.'</td>'; $r.='<td valign="bottom">'; $r.='<b>Delicatino GmbH</b><br />'; $r.='Neidenburger Str. 8<br />'; $r.='28207 Bremen<br />'; $r.='Deutschland<br />'; $r.='Tel: 0049 421 43 77 361<br />'; $r.='Fax: 0049 421 43 77 362<br />'; $r.='</td>'; $r.='</tr></table>'; return $r;} function f_cabecera_tabla_productos(){ $r=''; $r.='<br>'."n"; //$r.='<!-- Cuerpo -->'."n"; $r.='<table border="1" cellpadding="5" cellspacing="0">'."n"; return $r;} function f_pie_tabla_productos(){ $r=''; $r.='</table>'."n"; return $r;} function f_tag_imagen(){ global $g_tipo_exportacion; global $opcion,$row,$products,$letzte_categories,$cabecera,$select_languages; $r=''; $s=$row["products_image"]; if(strpos($s,'.jpg')>0){ if(false && $g_tipo_exportacion=='PDF' && strpos($s,'+')!==FALSE){ $s=''; }else{ $s='../../../catalog/images/'.$s; if(!file_exists($s)){ $s=str_replace('100.jpg','400.jpg',$s); if(!file_exists($s)){ $s=''; } } $s=str_replace('+','%2B',$s); } }else{ $s=''; } if($s>''){ $r.='<img src="'.$s.'" border="0" alt="'.f_noc2($row["products_name"]).'" title="'.f_noc2($row["products_name"]).'" width="100" height="80" />'; }else{ $r.=' '; } return $r;} function f_fila_producto(){ global $opcion,$row,$products,$letzte_categories,$cabecera,$select_languages; $r=''; if($opcion==1) { if ($row["categories_name"]!=$letzte_categories) { $r.='<tr bgcolor="#C4C4C4">'; $r.='<td colspan="4"><font size="+2"><b>'.$row["categories_name"].'</b></font></td>'; $r.='</tr>'; $r.='<tr>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["modelo"].'</i></b></font></td>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["nombre"].'</i></b></font></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["unidad"].'</i></b></td>'; //$r.='<td><b><i>'.$cabecera[$select_languages]["precio1"].'</i></b></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["precio2"].'</i></b></td>'; //$r.='<td><b><i>'.$cabecera[$select_languages]["precio3"].'</i></b></td>'; $r.='</tr>'; } $r.='<tr>'; $r.='<td><font size="+1">'.$row["products_model"].'</font></td>'; $r.='<td><font size="+1">'.$row["products_name"].'</font></td>'; $r.='<td align="right">'.f_guion($row["products_ve"]).'</td>'; //$r.='<td align="right">'.numeros::zeigenPrice($row['products_price'], $row['tax_rate']).'</td>'; $r.='<td align="right">'.numeros::formatear($row["precio2"],2,"").'</td>'; //$r.='<td align="right">'.numeros::formatear($row["precio3"],2,"").'</td>'; $r.='</tr>'; $letzte_categories=$row["categories_name"]; }elseif($opcion==2) { if ($row["categories_name"]!=$letzte_categories) { $r.='<tr bgcolor="#C4C4C4">'; $r.='<td colspan="5"><font size="+2"><b>'.$row["categories_name"].'</b></font></td>'; $r.='</tr>'; $r.='<tr>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["foto"].'</i></b></font></td>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["modelo"].'</i></b></font></td>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["nombre"].'</i></b></font></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["unidad"].'</i></b></td>'; //$r.='<td><b><i>'.$cabecera[$select_languages]["precio1"].'</i></b></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["precio2"].'</i></b></td>'; //$r.='<td><b><i>'.$cabecera[$select_languages]["precio3"].'</i></b></td>'; $r.='</tr>'; } $r.='<tr>'; $r.='<td>'; $r.=f_tag_imagen(); $r.='</td>'; $r.='<td><font size="+1">'.$row["products_model"].'</font></td>'; $r.='<td><font size="+1">'.$row["products_name"].'</font></td>'; $r.='<td align="right">'.f_guion($row["products_ve"]).'</td>'; //$r.='<td align="right">'.numeros::zeigenPrice($row['products_price'], $row['tax_rate']).'</td>'; $r.='<td align="right">'.numeros::formatear($row["precio2"],2,"").'</td>'; //$r.='<td align="right">'.numeros::formatear($row["precio3"],2,"").'</td>'; $r.='</tr>'; $letzte_categories=$row["categories_name"]; }elseif($opcion==3) { if ($row["categories_name"]!=$letzte_categories) { $r.='<tr bgcolor="#C4C4C4">'; $r.='<td colspan="5"><font size="+2"><b>'.$row["categories_name"].'</b></font></td>'; $r.='</tr>'; $r.='<tr>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["modelo"].'</i></b></font></td>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["nombre"].'</i></b></font></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["unidad"].'</i></b></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["precio1"].'</i></b></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["precio_especial"].'</i></b></td>'; $r.='</tr>'; } $r.='<tr>'; $r.='<td>'.$row["products_model"].'</td>'; $r.='<td>'.$row["products_name"].'</td>'; $r.='<td align="right">'.f_guion($row["products_ve"]).'</td>'; $r.='<td align="right">'.(($row['specials_price']==NULL)?numeros::zeigenPrice($row['products_price'], $row['tax_rate']):"<s>".numeros::zeigenPrice($row['products_price'], $row['tax_rate'])."</s>").'</td>'; $s=numeros::zeigenPrice($row['specials_price'], $row['tax_rate']); if($s=='') $s='---'; $r.='<td align="right">'.$s.'</td>'; $r.='</tr>'; $letzte_categories=$row["categories_name"]; }elseif($opcion==4) { if ($row["categories_name"]!=$letzte_categories) { $r.='<tr bgcolor="#C4C4C4">'; $r.='<td colspan="6"><font size="+2"><b>'.$row["categories_name"].'</b></font></td>'; $r.='</tr>'; $r.='<tr>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["foto"].'</i></b></font></td>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["modelo"].'</i></b></font></td>'; $r.='<td><font size="+1"><b><i>'.$cabecera[$select_languages]["nombre"].'</i></b></font></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["unidad"].'</i></b></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["precio1"].'</i></b></td>'; $r.='<td><b><i>'.$cabecera[$select_languages]["precio_especial"].'</i></b></td>'; $r.='</tr>'; } $r.='<tr>'; $r.='<td>'; $r.=f_tag_imagen(); $r.='</td>'; $r.='<td><font size="+1">'.$row["products_model"].'</font></td>'; $r.='<td><font size="+1">'.$row["products_name"].'</font></td>'; $r.='<td align="right">'.f_guion($row["products_ve"]).'</td>'; $r.='<td align="right">'.(($row['specials_price']==NULL)?numeros::zeigenPrice($row['products_price'], $row['tax_rate']):"<s>".numeros::zeigenPrice($row['products_price'], $row['tax_rate'])."</s>").'</td>'; $s=numeros::zeigenPrice($row['specials_price'], $row['tax_rate']); if($s=='') $s='---'; $r.='<td align="right">'.$s.'</td>'; $r.='</tr>'; $letzte_categories=$row["categories_name"]; } return $r;} ?>
Navegación
[#] Página Siguiente
Ir a la versión completa