PageRenderTime 37ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/config/templates/received.php

http://gevion.googlecode.com/
PHP | 262 lines | 220 code | 12 blank | 30 comment | 35 complexity | 6624d809cd1cb12f1f4a47f255e36d8b MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  1. <?php
  2. /* $Id: received.php,v 1.5 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("../../library/include/calsca.inc.php");
  24. require('template.php');
  25. class Received extends Template
  26. {
  27. function setTesDoc()
  28. {
  29. $this->tesdoc = $this->docVars->tesdoc;
  30. $this->giorno = substr($this->tesdoc['datfat'],8,2);
  31. $this->mese = substr($this->tesdoc['datfat'],5,2);
  32. $this->anno = substr($this->tesdoc['datfat'],0,4);
  33. $this->nomemese = ucwords(strftime("%B", mktime (0,0,0,substr($this->tesdoc['datfat'],5,2),1,0)));
  34. $this->sconto = $this->tesdoc['sconto'];
  35. $this->trasporto = $this->tesdoc['traspo'];
  36. $this->tipdoc = 'Ricevuta n.'.$this->tesdoc['numfat'].' del '.$this->giorno.' '.$this->nomemese.' '.$this->anno;
  37. }
  38. function newPage() {
  39. $this->AddPage();
  40. $this->SetFont('freesans','',9);
  41. $this->Cell(105,6,'Descrizione',1,0,'L',1);
  42. $this->Cell(7, 6,'U.m.',1,0,'C',1);
  43. $this->Cell(16,6,'Quantit? ',1,0,'C',1);
  44. $this->Cell(18,6,'Prezzo',1,0,'C',1);
  45. $this->Cell(8, 6,'%Sc.',1,0,'C',1);
  46. $this->Cell(20,6,'Importo',1,0,'C',1);
  47. $this->Cell(12,6,'%IVA',1,1,'C',1);
  48. }
  49. function pageHeader() {
  50. $this->StartPageGroup();
  51. $this->SetFillColor(hexdec(substr($this->colore,0,2)),hexdec(substr($this->colore,2,2)),hexdec(substr($this->colore,4,2)));
  52. $this->newPage();
  53. }
  54. function compose()
  55. {
  56. $this->body();
  57. }
  58. function body()
  59. {
  60. $lines = $this->docVars->getRigo();
  61. while (list($key, $rigo) = each($lines)) {
  62. if ($this->GetY() >= 195) {
  63. $this->Cell(186,6,'','T',1);
  64. $this->SetFont('freesans','',14);
  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(105, 5, $rigo['descri'],1,0,'L');
  74. $this->Cell(7, 5, $rigo['unimis'],1,0,'C');
  75. $this->Cell(16, 5, gaz_format_quantity($rigo['quanti'],1,$this->decimal_quantity),1,0,'R');
  76. $this->Cell(18, 5, number_format($rigo['prelis'],$this->decimal_price,',',''),1,0,'R');
  77. if ($rigo['sconto']>0) {
  78. $this->Cell(8, 5, number_format($rigo['sconto'],1,',',''),1,0,'C');
  79. } else {
  80. $this->Cell(8, 5, '',1,0,'C');
  81. }
  82. $this->Cell(20, 5, gaz_format_number($rigo['importo']),1,0,'R');
  83. $this->Cell(12, 5, gaz_format_number($rigo['pervat']),1,1,'R');
  84. break;
  85. case "1":
  86. $this->Cell(105, 5, $rigo['descri'],1,0,'L');
  87. $this->Cell(49, 5, '',1);
  88. $this->Cell(20, 5, gaz_format_number($rigo['importo']),1,0,'R');
  89. $this->Cell(12, 5, gaz_format_number($rigo['pervat']),1,1,'R');
  90. break;
  91. case "2":
  92. $this->Cell(105,5,$rigo['descri'],'LR',0,'L');
  93. $this->Cell(81,5,'','R',1);
  94. break;
  95. }
  96. }
  97. }
  98. function pageFooter()
  99. {
  100. $y = $this->GetY();
  101. $this->Rect(10,$y,186,212-$y); //questa marca le linee dx e sx del documento
  102. //stampo il castelletto
  103. $this->SetY(212);
  104. $this->Cell(62,6,'Pagamento','LTR',0,'C',1);
  105. $this->Cell(68,6,'Castelletto I.V.A.','LTR',1,'C',1);
  106. $this->SetFont('freesans','',8);
  107. $this->Cell(62,6,$this->pagame['descri'],'LBR',0,'L');
  108. $this->Cell(18,4,'Imponibile','LR',0,'C',1);
  109. $this->Cell(32,4,'Aliquota','LR',0,'C',1);
  110. $this->Cell(18,4,'Imposta','LR',1,'C',1);
  111. $totTrasporto = $this->tottraspo;
  112. $this->docVars->setTotal($totTrasporto);
  113. foreach ($this->docVars->cast as $key => $value) {
  114. if ($this->tesdoc['id_tes'] > 0) {
  115. $this->Cell(62);
  116. $this->Cell(18, 4, gaz_format_number($value['impcast']).' ','LR', 0, 'R');
  117. $this->Cell(32, 4, $value['descriz'],0,0,'C');
  118. $this->Cell(18, 4, gaz_format_number($value['ivacast']).' ','LR',1,'R');
  119. } else {
  120. $this->Cell(62);
  121. $this->Cell(68, 4,'','LR',1);
  122. }
  123. }
  124. //azzero il castelletto
  125. foreach ($this->docVars->castel as $i => $value) {
  126. unset($this->docVars->castel[$i]);
  127. }
  128. //azzero il trasporto
  129. $this->tottraspo = 0.00;
  130. $totimpmer = $this->docVars->totimpmer;
  131. $speseincasso = $this->docVars->speseincasso;
  132. $totimpfat = $this->docVars->totimpfat;
  133. $totivafat = $this->docVars->totivafat;
  134. $vettor = $this->docVars->vettor;
  135. $impbol = $this->docVars->impbol;
  136. $totriport = $this->docVars->totriport;
  137. if ($impbol > 0) {
  138. $this->Cell(62);
  139. $this->Cell(18, 4, gaz_format_number($impbol).' ', 0, 0, 'R');
  140. $this->Cell(32, 4, $this->docVars->iva_bollo['descri'], 'LR', 0, 'C');
  141. $this->Cell(18, 4,gaz_format_number($this->docVars->iva_bollo['aliquo']*$impbol).' ',0,1,'R');
  142. }
  143. //effettuo il calcolo degli importi delle scadenze
  144. $totpag = $totimpfat + $impbol + $totriport + $totivafat;
  145. $ratpag = CalcolaScadenze($totpag, $this->giorno, $this->mese, $this->anno, $this->pagame['tipdec'],$this->pagame['giodec'],$this->pagame['numrat'],$this->pagame['tiprat'],$this->pagame['mesesc'],$this->pagame['giosuc']);
  146. if ($ratpag){
  147. //allungo l'array fino alla 4^ scadenza
  148. $ratpag['import'] = array_pad($ratpag['import'],4,'');
  149. $ratpag['giorno'] = array_pad($ratpag['giorno'],4,'');
  150. $ratpag['mese'] = array_pad($ratpag['mese'],4,'');
  151. $ratpag['anno'] = array_pad($ratpag['anno'],4,'');
  152. } else {
  153. for ($i = 0; $i <= 3; $i++) {
  154. $ratpag['import'][$i] = "";
  155. $ratpag['giorno'][$i] = "";
  156. $ratpag['mese'][$i] = "";
  157. $ratpag['anno'][$i] = "";
  158. }
  159. }
  160. //stampo i totali
  161. $this->SetXY(140,212);
  162. $this->SetFont('freesans', '', 8);
  163. $this->Cell(56, 4,'Spese Incasso','LTR',2,'C',1);
  164. if ($speseincasso > 0) {
  165. $this->Cell(56, 3, gaz_format_number($speseincasso),'LBR',2,'C');
  166. } else {
  167. $this->Cell(56, 3,'','LBR',2);
  168. }
  169. $this->Cell(56, 4,'Tot.Imponibile','LTR',2,'C',1);
  170. if ($totimpfat > 0) {
  171. $this->Cell(56, 3, gaz_format_number($totimpfat),'LBR',2,'C');
  172. } else {
  173. $this->Cell(56, 3,'','LBR',2);
  174. }
  175. $this->Cell(56, 4,'Tot. I.V.A.','LTR',2,'C',1);
  176. if ($totivafat > 0) {
  177. $this->Cell(56, 3, gaz_format_number($totivafat),'LBR',2,'C');
  178. } else {
  179. $this->Cell(56, 3,'','LBR',2);
  180. }
  181. $this->Cell(56, 4,'Bolli','LTR',2,'C',1);
  182. if ($impbol > 0) {
  183. $this->Cell(56, 3, gaz_format_number($impbol),'LBR',1,'C');
  184. } else {
  185. $this->Cell(56, 3,'','LBR',1);
  186. }
  187. $this->SetY(218);
  188. $this->Cell(130);
  189. $totale = $totimpfat + $totivafat + $impbol;
  190. $this->SetY(224);
  191. $this->SetFont('freesans','',9);
  192. if (!empty($this->banapp['descri']) and $this->pagame['tippag'] != 'D') {
  193. $this->Cell(62, 6, 'Banca d\'appoggio','LTR',1,'C',1);
  194. $this->Cell(62, 6, $this->banapp['descri'],'LR',1);
  195. $this->Cell(62, 6, ' ABI '.sprintf("%05d",$this->banapp['codabi']).' CAB '.$this->banapp['codcab'],'LRB',1,'C');
  196. } elseif (!empty($this->banacc['iban'])){
  197. $this->Cell(62, 6, 'Banca d\'accredito','LTR',1,'C',1);
  198. $this->Cell(62, 5, $this->banacc['ragso1'],'LR',1);
  199. $this->Cell(62, 6, 'IBAN '.$this->banacc['iban'],'LRB',1,'C');
  200. } else {
  201. $this->Cell(62, 6, '','LTR',1,'',1);
  202. $this->Cell(62, 6, '','LR',1);
  203. $this->Cell(62, 6, '','LRB',1);
  204. }
  205. $this->Cell(130,6, 'Date di Scadenza e Importo Rate','LTR',0,'C',1);
  206. $this->Cell(56, 6, 'T O T A L E','LTR',1,'C',1);
  207. $this->Cell(32, 6, $ratpag['giorno']['0'].'-'.$ratpag['mese']['0'].'-'.$ratpag['anno']['0'],'LR',0,'C');
  208. $this->Cell(33, 6, $ratpag['giorno']['1'].'-'.$ratpag['mese']['1'].'-'.$ratpag['anno']['1'],'LR',0,'C');
  209. $this->Cell(32, 6, $ratpag['giorno']['2'].'-'.$ratpag['mese']['2'].'-'.$ratpag['anno']['2'],'LR',0,'C');
  210. $this->Cell(33, 6, $ratpag['giorno']['3'].'-'.$ratpag['mese']['3'].'-'.$ratpag['anno']['3'],'LR',0,'C');
  211. $this->SetFont('freesans','B',18);
  212. if ($this->tesdoc['id_tes'] > 0) {
  213. $this->Cell(56, 12, 'â&#x201A;? '.gaz_format_number($totale),'LBR', 1, 'C');
  214. } else {
  215. $this->Cell(56, 12,'','LBR',1);
  216. }
  217. $this->Ln(-6);
  218. $this->SetFont('freesans','',9);
  219. if ($ratpag['import']['0'] != 0) {
  220. $this->Cell(32, 6, gaz_format_number($ratpag['import']['0']),'LBR',0,'C');
  221. } else {
  222. $this->Cell(32, 6,'','LBR');
  223. }
  224. if ($ratpag['import']['1'] != 0) {
  225. $this->Cell(33, 6, gaz_format_number($ratpag['import']['1']),'LBR',0,'C');
  226. } else {
  227. $this->Cell(33, 6,'','LBR');
  228. }
  229. if ($ratpag['import']['2'] != 0) {
  230. $this->Cell(32, 6, gaz_format_number($ratpag['import']['2']),'LBR',0,'C');
  231. } else {
  232. $this->Cell(32, 6,'','LBR');
  233. }
  234. if ($ratpag['import']['3'] != 0) {
  235. $this->Cell(33, 6, gaz_format_number($ratpag['import']['3']),'LBR',0,'C');
  236. } else {
  237. $this->Cell(33, 6,'','LBR');
  238. }
  239. }
  240. function Footer()
  241. {
  242. //Document footer
  243. $this->SetY(-20);
  244. $this->SetFont('freesans','',8);
  245. $this->MultiCell(184,4,$this->intesta1.' '.$this->intesta2.' '.$this->intesta3.' '.$this->intesta4.' ',0,'C',0);
  246. }
  247. }
  248. ?>