PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/config/templates/ordine_cliente.php

http://gevion.googlecode.com/
PHP | 204 lines | 169 code | 8 blank | 27 comment | 7 complexity | 0a8a366a6723f3106d49bca9803725ba MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  1. <?php
  2. /* $Id: ordine_cliente.php,v 1.13 2010/01/01 14:15:18 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('template.php');
  24. class OrdineCliente extends Template
  25. {
  26. function setTesDoc()
  27. {
  28. $this->tesdoc = $this->docVars->tesdoc;
  29. $this->giorno = substr($this->tesdoc['datemi'],8,2);
  30. $this->mese = substr($this->tesdoc['datemi'],5,2);
  31. $this->anno = substr($this->tesdoc['datemi'],0,4);
  32. $this->nomemese = ucwords(strftime("%B", mktime (0,0,0,substr($this->tesdoc['datemi'],5,2),1,0)));
  33. $this->sconto = $this->tesdoc['sconto'];
  34. $this->trasporto = $this->tesdoc['traspo'];
  35. $this->tipdoc = 'Conferma d\'Ordine da Cliente n.'.$this->tesdoc['numdoc'].'/'.$this->tesdoc['seziva'].' del '.$this->giorno.' '.$this->nomemese.' '.$this->anno;
  36. }
  37. function newPage() {
  38. $this->AddPage();
  39. $this->SetFillColor(hexdec(substr($this->colore,0,2)),hexdec(substr($this->colore,2,2)),hexdec(substr($this->colore,4,2)));
  40. $this->SetFont('freesans','',9);
  41. $this->SetY(100);
  42. $this->Cell(25,6,'Codice',1,0,'L',1);
  43. $this->Cell(80,6,'Descrizione',1,0,'L',1);
  44. $this->Cell(7, 6,'U.m.',1,0,'C',1);
  45. $this->Cell(14,6,'Quantit? ',1,0,'R',1);
  46. $this->Cell(17,6,'Prezzo',1,0,'R',1);
  47. $this->Cell(8, 6,'%Sc.',1,0,'C',1);
  48. $this->Cell(8, 6,'%Sc.',1,0,'C',1);
  49. $this->Cell(15,6,'Importo',1,0,'R',1);
  50. $this->Cell(12,6,'%IVA',1,1,'R',1);
  51. }
  52. function pageHeader()
  53. {
  54. $this->setTesDoc();
  55. $this->StartPageGroup();
  56. $this->newPage();
  57. }
  58. function body()
  59. {
  60. $lines = $this->docVars->getRigo();
  61. while (list($key, $rigo) = each($lines)) {
  62. if ($this->GetY() >= 185) {
  63. $this->Cell(186,6,'','T',1);
  64. $this->SetFont('freesans', '', 20);
  65. $this->SetY(225);
  66. $this->Cell(186,12,'>>> --- SEGUE SU PAGINA SUCCESSIVA --- >>> ',1,1,'R');
  67. $this->SetFont('freesans', '', 9);
  68. $this->newPage();
  69. $this->Cell(186,5,'<<< --- SEGUE DA PAGINA PRECEDENTE --- <<< ',0,1);
  70. }
  71. switch($rigo['tiprig']) {
  72. case "0":
  73. $this->Cell(25, 6, $rigo['codart'],1,0,'L');
  74. $this->Cell(80, 6, $rigo['descri'],1,0,'L');
  75. $this->Cell(7, 6, $rigo['unimis'],1,0,'C');
  76. $this->Cell(14, 6, gaz_format_quantity($rigo['quanti'],1,$this->decimal_quantity),1,0,'R');
  77. $this->Cell(17, 6, number_format($rigo['prelis'],$this->decimal_price,',',''),1,0,'R');
  78. if ($rigo['sconto']>0) {
  79. $this->Cell(8, 6, number_format($rigo['sconto'],1,',',''),1,0,'C');
  80. } else {
  81. $this->Cell(8, 6, '',1,0,'C');
  82. }
  83. //=== [PERSONALIZZAZIONE] inserimento doppio sconto ===//
  84. if ($rigo['sconto_2']>0) {
  85. $this->Cell(8, 6, number_format($rigo['sconto_2'],1,',',''),1,0,'C');
  86. } else {
  87. $this->Cell(8, 6, '',1,0,'C');
  88. }
  89. $this->Cell(15, 6, gaz_format_number($rigo['importo']),1,0,'R');
  90. $this->Cell(12, 6, gaz_format_number($rigo['pervat']),1,1,'R');
  91. break;
  92. case "1":
  93. $this->Cell(25, 6, $rigo['codart'],1,0,'L');
  94. $this->Cell(80, 6, $rigo['descri'],1,0,'L');
  95. $this->Cell(49, 6, '',1);
  96. $this->Cell(20, 6, gaz_format_number($rigo['importo']),1,0,'R');
  97. $this->Cell(12, 6, gaz_format_number($rigo['pervat']),1,1,'R');
  98. break;
  99. case "2":
  100. $this->Cell(105,6,$rigo['descri'],'LR',0,'L');
  101. $this->Cell(81,6,'','R',1);
  102. break;
  103. case "3":
  104. $this->Cell(25,6,'',1,0,'L');
  105. $this->Cell(80,6,$rigo['descri'],'B',0,'L');
  106. $this->Cell(49,6,'','B',0,'L');
  107. $this->Cell(20,6,gaz_format_number($rigo['prelis']),1,0,'R');
  108. $this->Cell(12,6,'',1,1,'R');
  109. break;
  110. case "6":
  111. $this->writeHtmlCell(186,6,10,$this->GetY(),$rigo['descri'],1,1);
  112. break;
  113. }
  114. }
  115. }
  116. function compose()
  117. {
  118. $this->body();
  119. }
  120. function pageFooter()
  121. {
  122. $y = $this->GetY();
  123. $this->Rect(10,$y,186,212-$y); //questa marca le linee dx e sx del documento
  124. //stampo il castelletto
  125. $this->SetY(212);
  126. $this->SetFillColor(hexdec(substr($this->colore,0,2)),hexdec(substr($this->colore,2,2)),hexdec(substr($this->colore,4,2)));
  127. $this->Cell(62,6, 'Pagamento',1,0,'C',1);
  128. $this->Cell(68,6, 'Castelletto I.V.A.',1,0,'C',1);
  129. $this->Cell(56,6, 'T O T A L E',1,1,'C',1);
  130. $this->SetFont('freesans', '', 8);
  131. $this->Cell(62,6, $this->pagame['descri'],1,0,'C');
  132. $this->Cell(25,4, 'Imponibile',1,0,'C',1);
  133. $this->Cell(18,4, 'Aliquota',1,0,'C',1);
  134. $this->Cell(25,4, 'Imposta',1,1,'C',1);
  135. $this->docVars->setTotal($this->tesdoc['traspo']);
  136. foreach ($this->docVars->cast as $key => $value) {
  137. $this->Cell(62);
  138. $this->Cell(18, 4, gaz_format_number($value['impcast']).' ', 0, 0, 'R');
  139. $this->Cell(32, 4, $value['descriz'],0,0,'C');
  140. $this->Cell(18, 4, gaz_format_number($value['ivacast']).' ',0,1,'R');
  141. }
  142. $totimpmer = $this->docVars->totimpmer;
  143. $speseincasso = $this->docVars->speseincasso;
  144. $totimpfat = $this->docVars->totimpfat;
  145. $totivafat = $this->docVars->totivafat;
  146. $vettor = $this->docVars->vettor;
  147. $impbol = $this->docVars->impbol;
  148. if ($impbol > 0) {
  149. $this->Cell(62);
  150. $this->Cell(18, 4, gaz_format_number($impbol).' ', 0, 0, 'R');
  151. $this->Cell(32, 4, $this->docVars->iva_bollo['descri'], 'LR', 0, 'C');
  152. $this->Cell(18, 4,gaz_format_number($this->docVars->iva_bollo['aliquo']*$impbol).' ',0,1,'R');
  153. }
  154. //stampo i totali
  155. $this->SetY(200);
  156. $this->SetFont('freesans','',9);
  157. $this->Cell(36, 6,'Tot. Corpo',1,0,'C',1);
  158. $this->Cell(16, 6,'% Sconto',1,0,'C',1);
  159. $this->Cell(24, 6,'Spese Incasso',1,0,'C',1);
  160. $this->Cell(26, 6,'Trasporto',1,0,'C',1);
  161. $this->Cell(36, 6,'Tot.Imponibile',1,0,'C',1);
  162. $this->Cell(26, 6,'Tot. I.V.A.',1,0,'C',1);
  163. $this->Cell(22, 6,'Peso in kg',1,1,'C',1);
  164. $this->Cell(36, 6, gaz_format_number($totimpmer),1,0,'C');
  165. $this->Cell(16, 6, gaz_format_number($this->tesdoc['sconto']),1,0,'C');
  166. $this->Cell(24, 6, gaz_format_number($speseincasso),1,0,'C');
  167. $this->Cell(26, 6, gaz_format_number($this->tesdoc['traspo']),1,0,'C');
  168. $this->Cell(36, 6, gaz_format_number($totimpfat),1,0,'C');
  169. $this->Cell(26, 6, gaz_format_number($totivafat),1,0,'C');
  170. $this->Cell(22, 6, '',1,0,'C');
  171. $this->SetY(218);
  172. $this->Cell(130);
  173. $this->SetFont('freesans','B',18);
  174. $this->Cell(56, 24, 'â&#x201A;? '.gaz_format_number($totimpfat + $totivafat + $impbol), 1, 1, 'C');
  175. $this->SetY(224);
  176. $this->SetFont('freesans','',9);
  177. $this->Cell(62, 6,'Spedizione',1,1,'C',1);
  178. $this->Cell(62, 6,$this->tesdoc['spediz'],1,1,'C');
  179. $this->Cell(62, 6,'Vettore',1,1,'C',1);
  180. $this->Cell(186,6,$vettor['descri'],1,1,'L');
  181. $this->Cell(36, 6);
  182. $this->Cell(150,6,'Firma del cliente per approvazione:',0,1,'L');
  183. $this->Cell(86, 6);
  184. $this->Cell(100,6,'','B',1,'L');
  185. }
  186. function Footer()
  187. {
  188. //Page footer
  189. $this->SetY(-20);
  190. $this->SetFont('freesans', '', 8);
  191. $this->MultiCell(186, 4, $this->intesta1.' '.$this->intesta2.' '.$this->intesta3.' '.$this->intesta4.' ', 0, 'C', 0);
  192. }
  193. }
  194. ?>