necestio que me sume el total de los precios de entrada y de salida
Publicado por felipe (23 intervenciones) el 22/12/2020 18:29:45
hola tengo este codigo y necestio que me sume el total de los precios de entrada y de salida de antemani muchas gracias nose nada de progrtamacion solo cambiar textos y colores este es el cofigo que tengo
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
<div class="row">
<div class="col-md-12">
<div class="btn-group pull-right">
<a href="index.php?view=newproduct" class="btn btn-default">Agregar Producto</a>
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-download"></i> Descargar <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="report/products-word.php">Word 2007 (.docx)</a></li>
</ul>
</div>
</div>
<h1>Lista de Productos</h1>
<div class="clearfix"></div>
<?php
$page = 1;
if(isset($_GET["page"])){
$page=$_GET["page"];
}
$limit=1000;
if(isset($_GET["limit"]) && $_GET["limit"]!="" && $_GET["limit"]!=$limit){
$limit=$_GET["limit"];
}
$products = ProductData::getAll();
if(count($products)>0){
if($page==1){
$curr_products = ProductData::getAllByPage($products[0]->id,$limit);
}else{
$curr_products = ProductData::getAllByPage($products[($page-1)*$limit]->id,$limit);
}
$npaginas = floor(count($products)/$limit);
$spaginas = count($products)%$limit;
if($spaginas>0){ $npaginas++;}
?>
<h3>Pagina <?php echo $page." de ".$npaginas; ?></h3>
<div class="btn-group pull-right">
<?php
$px=$page-1;
if($px>0):
?>
<a class="btn btn-sm btn-default" href="<?php echo "index.php?view=products&limit=$limit&page=".($px); ?>"><i class="glyphicon glyphicon-chevron-left"></i> Atras </a>
<?php endif; ?>
<?php
$px=$page+1;
if($px<=$npaginas):
?>
<a class="btn btn-sm btn-default" href="<?php echo "index.php?view=products&limit=$limit&page=".($px); ?>">Adelante <i class="glyphicon glyphicon-chevron-right"></i></a>
<?php endif; ?>
</div>
<div class="clearfix"></div>
<br><table class="table table-bordered table-hover">
<thead>
<th>Codigo</th>
<th>Imagen</th>
<th>Nombre</th>
<th>Precio Entrada</th>
<th>Precio Salida</th>
<th>Categoria</th>
<th>Minima</th>
<th>Activo</th>
<th></th>
</thead>
<?php foreach($curr_products as $product):?>
<tr>
<td><?php echo $product->barcode; ?></td>
<td>
<?php if($product->image!=""):?>
<img src="storage/products/<?php echo $product->image;?>" style="width:64px;">
<?php endif;?>
</td>
<td><?php echo $product->name; ?></td>
<td>$ <?php echo number_format($product->price_in,2,'.',','); ?></td>
<td>$ <?php echo number_format($product->price_out,2,'.',','); ?></td>
<td><?php if($product->category_id!=null){echo $product->getCategory()->name;}else{ echo "<center>----</center>"; } ?></td>
<td><?php echo $product->inventary_min; ?></td>
<td><?php if($product->is_active): ?><i class="fa fa-check"></i><?php endif;?></td>
<td style="width:70px;">
<a href="index.php?view=editproduct&id=<?php echo $product->id; ?>" class="btn btn-xs btn-warning"><i class="glyphicon glyphicon-pencil"></i></a>
<a href="index.php?view=delproduct&id=<?php echo $product->id; ?>" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php endforeach;?>
</table>
<div class="btn-group pull-right">
<?php
for($i=0;$i<$npaginas;$i++){
echo "<a href='index.php?view=products&limit=$limit&page=".($i+1)."' class='btn btn-default btn-sm'>".($i+1)."</a> ";
}
?>
</div>
<form class="form-inline">
<label for="limit">Limite</label>
<input type="hidden" name="view" value="products">
<input type="number" value=<?php echo $limit?> name="limit" style="width:60px;" class="form-control">
</form>
<div class="clearfix"></div>
<?php
}else{
?>
<div class="jumbotron">
<h2>No hay productos</h2>
<p>No se han agregado productos a la base de datos, puedes agregar uno dando click en el boton <b>"Agregar Producto"</b>.</p>
</div>
<?php
}
?>
<br><br><br><br><br><br><br><br><br><br>
</div>
</div>
Valora esta pregunta
0