-
Notifications
You must be signed in to change notification settings - Fork 3
/
edit_fact.php
executable file
·189 lines (189 loc) · 7.21 KB
/
edit_fact.php
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
/*
* Factux le facturier libre
* Copyright (C) 2003-2005 Guy Hendrickx, 2017 Thomas Ingles
*
* Licensed under the terms of the GNU General Public License:
* http://opensource.org/licenses/GPL-3.0
*
* For further information visit:
* http://factux.free.fr
*
* File Name: edit_fact.php
* Permet l'edition des factures.
*
* * * Version: 5.0.0
* * * * Modified: 07/10/2016
*
* File Authors:
* Guy Hendrickx
*.
*/
include_once("include/headers.php");
?><script type="text/javascript" src="javascripts/confdel.js"></script><?php
include_once("include/finhead.php");
$num_fact=isset($_GET['num_fact'])?$_GET['num_fact']:"";
?>
<table width="760" border="0" class="page" align="center">
<tr>
<td class="page" align="center">
<?php
include_once("include/head.php");
if ($user_fact == 'n') {
echo "<h1>$lang_facture_droit</h1>";
include_once("include/bas.php");
exit;
}
$sql = "
SELECT list_num,nom,client
FROM " . $tblpref ."facture
LEFT JOIN " . $tblpref ."client on " . $tblpref ."facture.client = num_client
WHERE num = $num_fact
";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$data = mysql_fetch_array($req);
$list_num = unserialize($data['list_num']);
$num_client= $data['client'];
$nom = $data['nom'];
$nom_html = htmlentities(urlencode ($nom));
?>
<center>
<table class='page boiteaction'>
<caption><?php echo "$lang_edit_fact_n $num_fact $lang_de $nom"; ?></caption>
<tr>
<th><?php echo $lang_num_bon_ab; ?></th>
<th><?php echo $lang_date; ?></th>
<th><?php echo $lang_montant_ttc; ?></th>
<th colspan="3"><?php echo $lang_action; ?></th>
</tr>
<?php
$totttc=0;
$c=0;
foreach ($list_num as $num_bon){
$sql="
SELECT DATE_FORMAT(date,'%d/%m/%Y') AS date, tot_htva, tot_tva from " . $tblpref ."bon_comm
WHERE num_bon = '$num_bon'
";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$data = mysql_fetch_array($req);
$date = $data['date'];
$tot_htva = $data['tot_htva'];
$tot_tva = $data['tot_tva'];
$ttc = ($tot_htva + $tot_tva);
$totttc += $ttc;
$line=($c++ & 1)?0:1;
?>
<tr class="texte<?php echo $line; ?>" onmouseover="this.className='highlight'" onmouseout="this.className='texte<?php echo $line; ?>'">
<td class='<?php echo couleur_alternee (); ?>'><?php echo $num_bon;?></td>
<td class='<?php echo couleur_alternee (FALSE); ?>'><?php echo $date; ?></td>
<td class='<?php echo couleur_alternee (FALSE, "nombre"); ?>'><?php echo montant_financier($ttc); ?></td>
<td class='<?php echo couleur_alternee (FALSE); ?>'><img src="image/spacer.gif" width="15px"></td>
<td class='<?php echo couleur_alternee (FALSE, "c texte"); ?>'>
<form action="fpdf/bon_pdf.php" method="post" enctype="multipart/form-data" target="_blank">
<input type="hidden" name="num_bon" value="<?php echo $num_bon; ?>" />
<input type="hidden" name="user" value="adm">
<input type="image" src="image/printer.gif" alt="<?php echo $lang_imprimer; ?>" />
</form>
</td>
<td class='<?php echo couleur_alternee (FALSE, "c texte"); ?>'>
<form action="edit_fact_suite.php" method="post" enctype="multipart/form-data"
onclick='return confirmDelete("<?php echo $lang_retirer; ?>?")'>
<input type="hidden" name="retirer" value="<?php echo $num_bon; ?>" >
<input type="hidden" name="num_fact" value="<?php echo $num_fact; ?>" >
<input type="image" src="image/non.gif" alt="<?php echo $lang_retirer; ?>">
</form>
</td>
</tr>
<?php } ?>
<tr>
<td class="totaltexte" colspan="2"><?php echo $lang_total_ttc; ?></td>
<td class="totalmontant"><?php echo montant_financier($totttc); ?></td>
<td class="totaltexte" colspan="3">
<center>
<form action="fpdf/fact_pdf.php" method="post" target="_blank">
<input type="hidden" name="client" value="<?php echo $num_client; ?>" />
<input type="hidden" name="num" value="<?php echo $num_fact; ?>" />
<input type="hidden" name="user" value="adm" />
<input type="image" src="image/prinfer.gif" style="border:none;margin:0 0 0 -1em;" alt="<?php echo "$lang_imprimer $lang_facture $lang_numero $num_fact"; ?>" />
</form>
</center>
</td>
</tr>
</table>
</center>";
<?php
$sql = "SELECT num_bon, tot_htva, tot_tva, nom, num_client, DATE_FORMAT(date,'%d/%m/%Y') AS date
FROM " . $tblpref ."bon_comm
LEFT JOIN " . $tblpref ."client on " . $tblpref ."bon_comm.client_num = num_client
WHERE fact='0' AND client_num = '$num_client'
ORDER BY " . $tblpref ."bon_comm.`num_bon` DESC";
?>
<center>
<table class='page boiteaction'>
<caption><?php echo "$lang_ajou_fact_n $num_fact"; ?></caption>
<tr>
<th><?php echo $lang_num_bon_ab; ?></th>
<th><?php echo $lang_date; ?></th>
<th><?php echo $lang_montant_ttc; ?></th>
<th colspan="3"><?php echo $lang_action; ?></th>
</tr>
<?php
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$totttc = 0;
while($data = mysql_fetch_array($req)){
$num_bon = $data['num_bon'];
$num_client = $data['num_client'];
$date =$data['date'];
$tot_htva =$data['tot_htva'];
$tot_tva =$data['tot_tva'];
$ttc =($tot_htva + $tot_tva);
$totttc += $ttc;
$line=($c++ & 1)?0:1;
?>
<tr class="texte<?php echo $line; ?>" onmouseover="this.className='highlight'" onmouseout="this.className='texte<?php echo $line; ?>'">
<td class='<?php echo couleur_alternee (); ?>'><?php echo $num_bon; ?></td>
<td class='<?php echo couleur_alternee (FALSE); ?>'><?php echo $date; ?></td>
<td class='<?php echo couleur_alternee (FALSE, "nombre"); ?>'><?php echo montant_financier($ttc); ?></td>
<td class='<?php echo couleur_alternee (FALSE, "c texte"); ?>'>
<a href='edit_bon.php?num_bon=<?php echo "$num_bon"; ?>&nom=<?php echo $nom_html; ?>'>
<img border="0" src="image/edit.gif" alt="<?php echo $lang_editer; ?>">
</a>
</td>
<td class='<?php echo couleur_alternee (FALSE, "c texte"); ?>'>
<form action="fpdf/bon_pdf.php" method="post" enctype="multipart/form-data" target="_blank">
<input type="hidden" name="num_bon" value="<?php echo $num_bon; ?>" />
<input type="hidden" name="user" value="adm">
<input type="image" src="image/printer.gif" alt="imprimer" />
</form>
</td>
<td class='<?php echo couleur_alternee (FALSE, "c texte"); ?>'>
<form action="edit_fact_suite.php" method="post" enctype="multipart/form-data"
onclick='return confirmDelete("<?php echo $lang_ajouter; ?>?")'>
<input type="hidden" name="ajouter" value="<?php echo $num_bon; ?>" onselect="submit">
<input type="hidden" name="num_fact" value="<?php echo $num_fact; ?>" >
<input type="image" src="image/oui.gif" alt="ajouter">
</form>
</td>
</tr>
<?php } ?>
<tr>
<td class="totaltexte" colspan="2"><?php echo $lang_total_ttc; ?></td>
<td class="totalmontant"><?php echo montant_financier($totttc); ?></td>
<td class="totalmontant" colspan="3"></td>
</tr>
</table>
</center>
</td>
</tr>
<tr>
<td>
<?php
$aide="factures";
include("help.php");
include("include/bas.php");
?>
</td>
</tr>
</table>
</body>
</html>