File: stampafattura.php

package info (click to toggle)
odontolinux 0.6.1-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,128 kB
  • ctags: 566
  • sloc: php: 4,137; sh: 262; makefile: 46
file content (140 lines) | stat: -rw-r--r-- 5,888 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML LANG="it">
<HEAD>
<TITLE>OdontoLinux!</TITLE>
</HEAD>

<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0"
      BGCOLOR="#FFFFFF" TEXT="#000000" 
      LINK="#FF0033" VLINK="#FF0033" ALINK="#FF0033">

<TABLE>
 <TR>
  <TD width="450">
	<? require("intestazione");?>
  </TD>
  <TD>
	<? 
   $conn = pg_Connect ("host=127.0.0.1 port=5432 dbname=odontolinux");
   if (!$conn) {
                echo "Si &egrave; verificato un errore.\n";
               } else {
                       $esito = pg_Exec($conn, "SELECT * FROM anagrafica where id='$idpz';");
                       if (!$esito) {
                                     echo "Si &egrave; verificato un errore.\n";
                                     exit;
                                     } // Errore interrogazione database

                       $num = pg_NumRows($esito); //inizia l'output tabelare della query
                       $i = 0;
                       while ($i < $num) {
                                           echo "<table><tr><TD>&nbsp;</TD><td ALIGN=\"LEFT\"><FONT FACE=Lucida,Verdana,Helvetica,Arial><B>";
                                           echo pg_Result($esito, $i, cognome);
                                           echo " ";
                                           echo pg_Result($esito, $i, nome);
                                           echo "</B><BR>";
                                           echo pg_Result($esito, $i, via);
                                           echo "<BR>";
                                           echo pg_Result($esito, $i, cap);
                                           echo "&nbsp;-&nbsp;";
                                           echo pg_Result($esito, $i, citta);
if ($langua == 'it_IT')
		{
                                           echo "</font>";
		           echo "<BR>";
		           echo gettext ("Fiscal ID:");
 		           echo ":&nbsp;";
                                            echo "<FONT FACE=Lucida,Verdana,Helvetica,Arial>";
                                           echo pg_Result($esito, $i, codicefiscale);
		}
                                           echo "</font><BR>";
echo gettext ("Born: ");
		           echo "<FONT FACE=Lucida,Verdana,Helvetica,Arial>";
                                           echo pg_Result($esito, $i, luogonascita);
                                           echo "</font>,&nbsp; <FONT FACE=Lucida,Verdana,Helvetica,Arial>";
                                           echo pg_Result($esito, $i, datanascita);
                                           echo "</font></td></tr></table>";
                                           $i++;
                                          }
                       echo ("<P>");
                      }
   pg_FreeResult($esito); //liberazione memoria
?>

  </TD>
 </TR>
 <TR>
<TD  width="100%" COLSPAN="2"><hr noshade></TD>
 </TR>

</TABLE>

<TABLE>
<TR><TD width=550><? print (date ("d.m.Y")); ?> </TD></TR>
</TABLE>


<? 
                                           echo "<b><FONT FACE=Lucida,Verdana,Helvetica,Arial>";
			echo gettext ("Invoice n.");
			echo "</font></b> $idfattu";
?>





<TABLE Border="0">
 <TR>
  <TD COLSPAN=4><HR NOSHADE></TD>
 </TR>

<?
                       $esito = pg_Exec($conn, "SELECT * FROM fattura where idfattura = '$idfattu';");
                       if (!$esito) {
                                     echo "Si &egrave; verificato un errore.\n";
                                     exit;
                                    } // Errore interrogazione database

                       $nume = pg_NumRows($esito); //inizia l'output tabelare della query
                       $i = 0;
                       while ($i < $nume) {
                                           echo "<TR><TD width=450 colspan=2 align=left>";
                                           echo pg_Result($esito, $i, "prestazione");
                                           echo "</TD><TD colspan=2 align=right><b>";
                                           echo number_format(pg_Result($esito, $i, "prezzomoltiplicato"),2,',','.');
                                           echo "</b></TD></TR>";
                                           $i++;
                                          } // Estrazione delle righe dell'interrogazione
                       pg_FreeResult($esito);

                       $esito2 = pg_Exec($conn, "SELECT sum(prezzomoltiplicato) from fattura where fattura.idfattura = '$idfattu';");
                       $riga = pg_fetch_row ($esito2, 0);
                       $totale= $riga[0];
                       pg_FreeResult($esito2); //liberazione memoria
                       pg_Close($conn); //chiusura connessione db

                       echo ("<tr><td height=290><p></td><td></td><td></td><td></td><td></td></tr>");
                       echo ("<tr><td colspan=4><hr noshade size=3></td></tr>");
                       echo ("<tr><td rowspan=4 align=center><FONT FACE=Lucida,Verdana,Helvetica,Arial size=-2>");
		echo gettext ("Official stamp");
	       echo ("</font><td rowspan=4 width=300 align=center valign=top><FONT FACE=Lucida,Verdana,Helvetica,Arial>");
echo gettext ("Signature");
	       echo ("</font> <td width=200>");
echo gettext ("Total treatments");
	       echo ("<td width=80 align=right>" . number_format($totale,2,',','.'));
                       echo ("<tr><td>");
echo gettext ("Official stamp amount");
	       echo ("<td align=right>1,29");
                       echo ("<tr><td><b>");
echo gettext ("Invoice total");
	       echo ("</b> <td align=right><b>" . number_format(($totale + '1.29'),2,',','.'));
                       echo ("<tr><td><tr><td>"); 
                       echo ("</b>");
                       echo ("</table>");
?>

 <P>

</BODY>
</HTML>