Skip to content

Commit

Permalink
- Solucionado bug en nueva_compra. Estaba mostrando los descuentos ex…
Browse files Browse the repository at this point in the history
…tra de ventas.

- Añadida optimización de la consulta de artículos sin vender en el informe de artículos.
- Actualizada la versión.
  • Loading branch information
NeoRazorX committed Sep 12, 2017
1 parent f8e54e4 commit 38bb593
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 27 deletions.
18 changes: 12 additions & 6 deletions controller/informe_articulos.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,18 @@ private function sin_vender()
$toplist = $this->cache->get_array('top_articulos_sin_vender');
if (!$toplist) {
$articulo = new articulo();
$sql = "SELECT * FROM articulos WHERE sevende = true"
. " AND bloqueado = false AND stockfis > 0 AND referencia NOT IN "
. "(SELECT DISTINCT(referencia) FROM lineasfacturascli WHERE referencia IS NOT NULL"
. " AND idfactura IN (SELECT idfactura FROM facturascli"
. " WHERE fecha >= " . $articulo->var2str(Date('1-1-Y')) . "))"
. " ORDER BY stockfis DESC";
$sql = "select * from (select a.*"
. " from "
. " articulos a "
. " left join (select lf.referencia"
. " from lineasfacturascli lf, facturascli f"
. " where"
. " lf.idfactura=f.idfactura and"
. " lf.referencia is not null and"
. " f.fecha >= " . $articulo->var2str(Date('1-1-Y'))
. " group by lf.referencia) as f1 on a.referencia=f1.referencia"
. " where"
. " f1.referencia is null order by a.stockfis desc) a";

$lineas = $this->db->select_limit($sql, FS_ITEM_LIMIT, 0);
if ($lineas) {
Expand Down
2 changes: 1 addition & 1 deletion facturascripts.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 128
version = 129
version_url = 'https://raw.githubusercontent.com/NeoRazorX/facturacion_base/master/facturascripts.ini'
update_url = 'https://github.com/NeoRazorX/facturacion_base/archive/master.zip'
wizard = 'base_wizard'
2 changes: 1 addition & 1 deletion view/block/nueva_compra.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h1 style="margin-top: 5px;">
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="lineas">
{include="block/table_lineas_nuevodoc"}
{include="block/table_lineas_nueva_compra"}
</div>
<div role="tabpanel" class="tab-pane" id="detalles">
<div class="container-fluid" style="margin-top: 10px;">
Expand Down
2 changes: 1 addition & 1 deletion view/block/nueva_venta.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ <h1 style="margin-top: 5px; margin-bottom: 0px;">
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="lineas">
{include="block/table_lineas_nuevodoc"}
{include="block/table_lineas_nueva_venta"}
</div>
<div role="tabpanel" class="tab-pane" id="detalles">
<div class="container-fluid" style="margin-top: 10px;">
Expand Down
50 changes: 50 additions & 0 deletions view/block/table_lineas_nueva_compra.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<th class="text-left" width="180">Referencia</th>
<th class="text-left">Descripción</th>
<th class="text-right" width="90">Cantidad</th>
<th width="50"></th>
<th class="text-right" width="110">Precio</th>
<th class="text-right" width="90">Dto. %</th>
<th class="text-right" width="130">Neto</th>
<th class="text-right" width="115">{#FS_IVA#}</th>
<th class="text-right recargo" width="115">RE %</th>
<th class="text-right irpf" width="115">{#FS_IRPF#} %</th>
<th class="text-right" width="140">Total</th>
</tr>
</thead>
<tbody id="lineas_doc"></tbody>
<tbody>
<tr class="info">
<td>
<input id="i_new_line" class="form-control" type="text" placeholder="Buscar para añadir..." autocomplete="off"/>
</td>
<td colspan="3">
<a href="#" class="btn btn-sm btn-default" title="Añadir sin buscar" onclick="return add_linea_libre()">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</a>
</td>
<td colspan="2">
<div class="form-control text-right">Totales</div>
</td>
<td>
<div id="aneto" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td>
<div id="aiva" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td class="recargo">
<div id="are" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td class="irpf">
<div id="airpf" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td>
<input type="text" name="atotal" id="atotal" class="form-control text-right" style="font-weight: bold;" value="0" onchange="recalcular()" autocomplete="off"/>
</td>
</tr>
</tbody>
</table>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</a>
</td>
<td class="recargo">
</td>
<td class="irpf">
</td>
<td class="recargo"></td>
<td class="irpf"></td>
</tr>
</tfoot>
</table>
Expand All @@ -53,38 +51,37 @@
</tr>
<tr class="info">
<td>
<div id="anetosindto" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" disabled>{$fsc->show_numero(0)}</div>
<div id="anetosindto" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td class="dtost">
<input id="adtopor1" name="adtopor1" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"></input>
<input id="adtopor1" name="adtopor1" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"/>
</td>
<td class="dtost">
<input id="adtopor2" name="adtopor2" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"></input>
<input id="adtopor2" name="adtopor2" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"/>
</td>
<td class="dtost">
<input id="adtopor3" name="adtopor3" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"></input>
<input id="adtopor3" name="adtopor3" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"/>
</td>
<td class="dtost">
<input id="adtopor4" name="adtopor4" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"></input>
<input id="adtopor4" name="adtopor4" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"/>
</td>
<td class="dtost">
<input id="adtopor5" name="adtopor5" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"></input>
<input id="adtopor5" name="adtopor5" class="form-control text-right" onkeyup="recalcular()" onclick="this.select()" style="font-weight: bold;" value="{$fsc->show_numero(0)}"/>
</td>
<td class="dtost">
<div id="aneto" class="form-control text-right" style="font-weight: bold;" disabled>{$fsc->show_numero(0)}</div>
<div id="aneto" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td>
<div id="aiva" class="form-control text-right" style="font-weight: bold;" disabled>{$fsc->show_numero(0)}</div>
<div id="aiva" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td class="recargo">
<div id="are" class="form-control text-right" style="font-weight: bold;" disabled>{$fsc->show_numero(0)}</div>
<div id="are" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td class="irpf">
<div id="airpf" class="form-control text-right" style="font-weight: bold;" disabled>{$fsc->show_numero(0)}</div>
<div id="airpf" class="form-control text-right" style="font-weight: bold;">{$fsc->show_numero(0)}</div>
</td>
<td>
<input type="text" name="atotal" id="atotal" class="form-control text-right" style="font-weight: bold;"
value="0" onchange="recalcular()" autocomplete="off"/>
<input type="text" name="atotal" id="atotal" class="form-control text-right" style="font-weight: bold;" value="0" onchange="recalcular()" autocomplete="off"/>
</td>
</tr>
</tfoot>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion view/ventas_albaran.html
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="lineas_a">
{include="ventas_albaran_lineas"}
{include="block/ventas_albaran_lineas"}
</div>
<div role="tabpanel" class="tab-pane" id="detalles">
<div class="container-fluid" style="margin-top: 10px;">
Expand Down
2 changes: 1 addition & 1 deletion view/ventas_factura.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="lineas_f">
{include="ventas_factura_lineas"}
{include="block/ventas_factura_lineas"}
</div>
<div role="tabpanel" class="tab-pane" id="detalles">
<div class="container-fluid" style="margin-top: 10px;">
Expand Down

0 comments on commit 38bb593

Please sign in to comment.