PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/magazz/stampa_listin.php

http://gevion.googlecode.com/
PHP | 137 lines | 106 code | 8 blank | 23 comment | 6 complexity | a5d4383a925284d8170c123c1ee13795 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  1. <?php
  2. /* $Id: stampa_listin.php,v 1.22 2010/10/11 12:36:58 devincen Exp $
  3. --------------------------------------------------------------------------
  4. Gazie - Gestione Azienda
  5. Copyright (C) 2004-2010 - Antonio De Vincentiis Montesilvano (PE)
  6. (www.devincentiis.it)
  7. <http://gazie.sourceforge.net>
  8. --------------------------------------------------------------------------
  9. Questo programma e` free software; e` lecito redistribuirlo e/o
  10. modificarlo secondo i termini della Licenza Pubblica Generica GNU
  11. come e` pubblicata dalla Free Software Foundation; o la versione 2
  12. della licenza o (a propria scelta) una versione successiva.
  13. Questo programma e` distribuito nella speranza che sia utile, ma
  14. SENZA ALCUNA GARANZIA; senza neppure la garanzia implicita di
  15. NEGOZIABILITA` o di APPLICABILITA` PER UN PARTICOLARE SCOPO. Si
  16. veda la Licenza Pubblica Generica GNU per avere maggiori dettagli.
  17. Ognuno dovrebbe avere ricevuto una copia della Licenza Pubblica
  18. Generica GNU insieme a questo programma; in caso contrario, si
  19. scriva alla Free Software Foundation, Inc., 59
  20. Temple Place, Suite 330, Boston, MA 02111-1307 USA Stati Uniti.
  21. --------------------------------------------------------------------------
  22. */
  23. require("../../library/include/datlib.inc.php");
  24. $admin_aziend=checkAdmin();
  25. if (!isset($_GET['li']) or
  26. !isset($_GET['ci']) or
  27. !isset($_GET['cf']) or
  28. !isset($_GET['ai']) or
  29. !isset($_GET['af'])) {
  30. header("Location: select_listin.php");
  31. exit;
  32. }
  33. if (empty ($_GET['af'])) {
  34. $_GET['af'] = 'zzzzzzzzzzzzzzz';
  35. }
  36. $luogo_data=$admin_aziend['citspe'].", l?? ";
  37. if (isset($_GET['ds'])) {
  38. $giosta = substr($_GET['ds'],0,2);
  39. $messta = substr($_GET['ds'],2,2);
  40. $annsta = substr($_GET['ds'],4,4);
  41. $utssta= mktime(0,0,0,$messta,$giosta,$annsta);
  42. $luogo_data .= ucwords(strftime("%d %B %Y",$utssta));
  43. } else {
  44. $luogo_data .=ucwords(strftime("%d %B %Y", mktime (0,0,0,date("m"),date("d"),date("Y"))));
  45. }
  46. require("../../config/templates/report_template.php");
  47. $what = $gTables['catmer'].".codice AS codcat , ".$gTables['catmer'].".descri AS descat , ".
  48. $gTables['artico'].".codice AS codart,".$gTables['artico'].".descri AS desart,".$gTables['artico'].".* , ".
  49. $gTables['aliiva'].".codice AS codiva, ".$gTables['aliiva'].".aliquo ";
  50. $table = $gTables['artico']." LEFT JOIN ".$gTables['catmer']." ON (".$gTables['artico'].".catmer = ".$gTables['catmer'].".codice)
  51. LEFT JOIN ".$gTables['aliiva']." ON (".$gTables['artico'].".aliiva = ".$gTables['aliiva'].".codice)";
  52. $where = "catmer BETWEEN '".intval($_GET['ci']).
  53. "' AND '".intval($_GET['cf']).
  54. "' AND ".$gTables['artico'].".codice BETWEEN '".substr($_GET['ai'],0,15).
  55. "' AND '".substr($_GET['af'],0,15)."'";
  56. $result = gaz_dbi_dyn_query ($what, $table,$where,"catmer ASC,".$gTables['artico'].".codice ASC");
  57. switch($_GET['li']) {
  58. case '0':
  59. $descrlis = 'd\'acquisto';
  60. break;
  61. case '1':
  62. $descrlis = 'di vendita n.1';
  63. break;
  64. case '2':
  65. $descrlis = 'di vendita n.2';
  66. break;
  67. case '3':
  68. $descrlis = 'di vendita n.3';
  69. break;
  70. case 'web':
  71. $descrlis = 'di vendita online';
  72. break;
  73. }
  74. $title=array('luogo_data'=>$luogo_data,
  75. 'title'=>"Listino ".$descrlis,
  76. 'hile'=>array(array('lun' => 35,'nam'=>'Codice'),
  77. array('lun' => 85,'nam'=>'Descrizione'),
  78. array('lun' => 15,'nam'=>'U.M.'),
  79. array('lun' => 25,'nam'=>'Prezzo'),
  80. array('lun' => 25,'nam'=>'Esistenza'),
  81. array('lun' => 15,'nam'=>'% I.V.A.'),
  82. array('lun' => 70,'nam'=>'Annotazioni')
  83. )
  84. );
  85. $pdf = new Report_template();
  86. $pdf->setVars($admin_aziend,$title,'L');
  87. $config = new Config;
  88. $pdf->SetPageFormat($config->getValue('page_format'));
  89. $pdf->setAuthor($admin_aziend['ragso1'].' '.$_SESSION['Login']);
  90. $pdf->setTitle($title['title']);
  91. $pdf->SetTopMargin(39);
  92. $pdf->StartPageGroup();
  93. $pdf->AddPage('L');
  94. $ctrlcatmer=0;
  95. while ($row = gaz_dbi_fetch_array($result)) {
  96. $pdf->SetFont('freesans','',10);
  97. switch($_GET['li']) {
  98. case '0':
  99. $price = $row['preacq'];
  100. break;
  101. case '1':
  102. $price = $row['preve1'];
  103. break;
  104. case '2':
  105. $price = $row['preve2'];
  106. break;
  107. case '3':
  108. $price = $row['preve3'];
  109. break;
  110. case 'web':
  111. $price = $row['web_price'];
  112. break;
  113. }
  114. if ($row["catmer"] <> $ctrlcatmer) {
  115. $pdf->Cell(120,5,'Categoria Merceologica n.'.$row['codcat'].' = '.$row['descat'],1,1,'L',1);
  116. }
  117. $pdf->Cell(35,5,$row['codart'],1);
  118. $pdf->Cell(85,5,$row['desart'],1);
  119. $pdf->Cell(15,5,$row['unimis'],1,0,'C');
  120. $pdf->Cell(25,5,number_format($price,$admin_aziend['decimal_price'],',','.'),1,0,'R');
  121. $pdf->Cell(25,5,gaz_format_quantity($row['esiste'],$admin_aziend['decimal_quantity']),1,0,'R');
  122. $pdf->Cell(15,5,$row['aliquo'],1,0,'C');
  123. $pdf->Cell(70,5,$row['annota'],1,1,'C');
  124. $ctrlcatmer=$row["catmer"];
  125. }
  126. $pdf->Output();
  127. ?>