Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. //funzione che si occupa di prendere $html e spezzarlo in modo da gestire la divisione della fattura
  2. function BreakTabellaProdotti($html)
  3. {
  4.  
  5. //Stringa che concatena tutta la lista degli oggetti
  6. $Prodotti;
  7.  
  8. //INIZIO HTML
  9. //$re = "/<ciaobella>(.*)<\\/ciaobella>/sm";
  10. $re = "/<start>(.*)<\\/start>/sm";
  11. preg_match($re, $html, $matches);
  12. $start = $matches[1];
  13.  
  14. //HEADER
  15. $te = "/<header>(.*)<\\/header>/sm";
  16. preg_match($te, $html, $matchesA);
  17. $head = $matchesA[1];
  18.  
  19. //FOOTER
  20. $xj = "/<footer>(.*)<\\/footer>/sm";
  21. preg_match($xj, $html, $matchesC);
  22. $foot = $matchesC[1];
  23.  
  24. //FINE HTML
  25. $xe = "/<end>(.*)<\\/end>/sm";
  26. preg_match($xe, $html, $matchesB);
  27. $end = $matchesB[1];
  28.  
  29. //break di pagina
  30. $break = '<p style="page-break-after: always">CIAO</p>';
  31.  
  32. //Inizio Tabella prodotti
  33. $tabInizio = '<table width = "1445" border="1" rules = "cols" frame ="box" class = "type16">';
  34.  
  35. //DESCRIZIONE PRODOTTI
  36. $ty = "/<descr>(.*)<\\/descr>/sm";
  37. preg_match($ty, $html, $matchesC);
  38. $descrz = $matchesC[1];
  39.  
  40. //Fine Tabella prodotti
  41. $tabFine = '</table>';
  42.  
  43.  
  44. //PRODOTTI Trovati
  45. $pr = "/<riga>(.*)<\\/riga>/sm";
  46. $v = preg_match($pr, $html, $matchesP);
  47.  
  48.  
  49.  
  50. //righe vuote per fattura IVA dei prodotti
  51. $vuotaIVA = '';
  52.  
  53.  
  54.  
  55.  
  56. // Inizio creazione prima parte della tabella
  57. // $superhtml = $start.$head.$tabInizio.$descrz.$tabFine;
  58.  
  59. for ($i = 1 ; $i < 10 ; $i++)
  60. {
  61. $Prodotti =$Prodotti.$matchesP[$i];
  62. }
  63.  
  64. //numero ci righe vuote da stampare
  65. // $t=20;
  66. //$i = 1;
  67. $pag=1;
  68.  
  69. //funzione per la creazione della tabella dei prodotti , max elementi per pagina : 28
  70. /* do
  71. {
  72. $Prodotti =$Prodotti.$matchesP[$i];
  73.  
  74. // $t--;
  75.  
  76. if( (($pag *20)==$i) )
  77. {
  78. $pag++;
  79. $superhtml = $superhtml.$Prodotti.$tabFine.$foot.$break.$head.$tabInizio.$descrz;
  80. //$Prodotti ='';
  81. //$t = 20;
  82.  
  83. }
  84.  
  85. $i++;
  86.  
  87.  
  88.  
  89.  
  90. while($matchesP[$i] != null);*/
  91.  
  92. /* if($t >0)
  93. {
  94. $superhtml = $superhtml.$Prodotti
  95. }*/
  96.  
  97. // $superhtml = $superhtml.$Prodotti.$tabFine.$foot.$end;
  98.  
  99.  
  100.  
  101.  
  102. //prova
  103. $superhtml = $start.$head.$tabInizio.$descrz.$Prodotti.$tabFine.$v;
  104.  
  105. return $superhtml;
  106.  
  107.  
  108.  
  109.  
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement