-
Notifications
You must be signed in to change notification settings - Fork 0
/
detail_facture_achat.php
executable file
·175 lines (158 loc) · 7.29 KB
/
detail_facture_achat.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
<?php
include('includes/db_connexion.php');
$id = $_GET['id'];//echo $id;
$query ="SELECT t.num_facture, t.client_fournisseur, t.montant, t.remise,t.montant_paye, t.transaction_date, d.Detail_com, d.Detail_ref, d.Detail_qte, p.id_produit, p.nom_produit, p.code_produit, p.prix_vente, f.ref_fournisseur, f.societe FROM transaction t, fournisseur f, detail d, produit p WHERE t.client_fournisseur = f.ref_fournisseur AND t.num_facture = d.Detail_com AND d.Detail_ref = p.id_produit AND t.num_facture= '".$id."'";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
$total_row = $statement->rowCount();
$query2 ="SELECT t.id_transaction, t.num_facture, t.client_fournisseur, t.montant, t.montant_paye, t.type, t.transaction_date, f.ref_fournisseur, f.societe, f.adresse, f.telephone FROM transaction t, fournisseur f WHERE t.client_fournisseur = f.ref_fournisseur AND t.num_facture= '".$id."'";
$statement2 = $connect->prepare($query2);
$statement2->execute();
$result2 = $statement2->fetchAll();
$total_row2 = $statement2->rowCount();
$totalht = 0.00;
//var_dump($total_row);
include('includes/header.php');
?>
<div class="col-12">
<!-- Main content -->
<div class="invoice p-3 mb-3">
<!-- title row -->
<?php if ($total_row2 > 0){ foreach ($result2 as $row2){?>
<div class="row">
<div class="col-12">
<h4>
<!--<i class="fas fa-globe"></i>--><img src="dist/img/icon_stock.png" alt="AdminLTE Logo" class="brand-image elevation-3"> D&S Inventeur.
<small class="float-right">Date: <?php echo $row2['transaction_date'];?></small>
</h4>
</div>
<!-- /.col -->
</div>
<!-- info row -->
<div class="row invoice-info">
<div class="col-sm-4 invoice-col">
From
<address>
<strong>D&S, Inventeur.</strong><br>
Bamako, ACI 2000 <br>
Phone: (223) 91-93-60-13 / 78-62-85-87<br>
Email: [email protected]
</address>
</div>
<!-- /.col -->
<div class="col-sm-4 invoice-col">
To
<address>
<strong><?php echo $row2['societe'];?></strong><br>
<?php echo $row2['adresse'];?><br>
Telephone: <?php echo $row2['telephone'];?><br>
<!--Email: [email protected]>
</address>
</div>
<!-- /.col -->
<div class="col-sm-4 invoice-col">
<b>Facture #<?php echo $row2['num_facture']?></b><br>
<br>
<b>Commande ID:</b> <?php echo $row2['num_facture']?><br>
<b>Date de paiement:</b> <?php echo $row2['transaction_date']?><br>
<!--<b>Account:</b> 968-34567-->
</div>
<?php }}?>
<!-- /.col -->
</div>
<!-- /.row -->
<!-- Table row -->
<div class="row">
<div class="col-12 table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#Code produit</th>
<th>Produit</th>
<th>Qty</th>
<th>Prix UHT</th>
<th>Montant HT</th>
</tr>
</thead>
<tbody>
<?php if ($total_row > 0){ foreach ($result as $row){ ?>
<tr>
<td><?php echo $row['code_produit']?></td>
<td><?php echo $row['nom_produit']?></td>
<td><?php echo $row['Detail_qte']?></td>
<td><?php echo number_format($row['prix_vente'], 2, ',', ' ')?></td>
<td><?php $mth = $row['Detail_qte'] * $row['prix_vente']; echo number_format($mth, 2, ',', ' ');?></td>
</tr>
<?php $totalht = $totalht + $mth; $remise = $row['remise'];}}?>
</tbody>
</table>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<!-- accepted payments column -->
<div class="col-6">
<!--<p class="lead">Payment Methods:</p>
<p class="text-muted well well-sm shadow-none" style="margin-top: 10px;">
Cash
</p>-->
</div>
<!-- /.col -->
<div class="col-6">
<!--<p class="lead">Amount Due 2/22/2014</p>-->
<div class="table-responsive">
<table class="table">
<tr>
<th style="width:54%">Montant HT:</th>
<td><?php echo number_format($totalht, 2, ',', ' ');?></td>
</tr>
<tr>
<th>Remise:</th>
<td><?php echo number_format($remise, 2, ',', ' ');?></td>
</tr>
<tr>
<th>Total(Montant HT - Remise):</th>
<td><?php $mtotalht = $totalht - $remise; echo number_format($mtotalht, 2, ',', ' ')?></td>
</tr>
</table>
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<!-- this row will not appear when printing -->
<div class="row no-print">
<div class="col-12">
<a type="button" id="printInvoice" class="btn btn-default"><i class="fas fa-print"></i> Imprimer</a>
<button type="button" class="btn btn-success float-right"><i class="far fa-credit-card"></i> Envoie paiement
</button>
<!--<button type="button" class="btn btn-primary float-right" style="margin-right: 5px;">
<i class="fas fa-arrow-left"></i> Generate PDF
</button>-->
<button type="button" id="retour" class="btn btn-primary float-right" style="margin-right: 5px;">
<i class="fas fa-arrow-left"></i> Arrière
</button>
</div>
</div>
</div>
<!-- /.invoice -->
</div><!-- /.col -->
<?php include('includes/footer.php');?>
<script>
$(document).ready(function() {
$('#retour').click(function(){
//alert("retour");
document.location.href="http://localhost/stock_final/liste_achat.php";
});
$('#printInvoice').click(function(){
Popup($('.invoice')[0].outerHTML);
function Popup(data)
{
window.print();
return true;
}
});
});
</script>