function view_devoluciones($fid) { $database = new DB(); $fecha = fechaplusweek($fecha); if ($abono) { $total_pagos = ceil($total / $abono); } echo "\n\t\t\t\t\t<div class=\"box-header\">\n\t\t\t\t\t\t<h2><i class=\"halflings-icon align-justify\"></i><span class=\"break\"></span>Devoluciones</h2>\n\t\t\t\t\t\t<div class=\"box-icon\">\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-setting\"><i class=\"halflings-icon wrench\"></i></a>\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-minimize\"><i class=\"halflings-icon chevron-up\"></i></a>\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-close\"><i class=\"halflings-icon remove\"></i></a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<table class=\"table table-condensed striped\">\n\t\t\t\t\t\t\t <thead>\n\t\t\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t\t\t\t <th>Ref</th>\n\t\t\t\t\t\t\t\t\t <th>Producto</th>\n\t\t\t\t\t\t\t\t\t <th>sku</th>\n\t\t\t\t\t\t\t\t\t <th>Precio</th>\n\t\t\t\t\t\t\t\t\t <th></th> \n\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t </thead> \n\t\t\t\t\t\t\t <tbody>"; $query = "SELECT total,fecha,devoluciondet.facturadet_id,facturadet.sku,precio_credito,iva_credito,precio_contado,iva_contado FROM devolucion,devoluciondet,facturadet\n\t\t\t\tWHERE devolucion.devolucion_id=devoluciondet.devolucion_id AND devoluciondet.facturadet_id=facturadet.facturadet_id AND devolucion.factura_id=" . $fid; $results = $database->get_results($query); $n = 0; $total = 0; foreach ($results as $item) { echo "<tr ><td>" . $item['facturadet_id'] . "</td><td align=right> " . fechamysqltous(fechaplusweek($item['fecha']), 1) . "</td><td align=right>" . $item['sku'] . "</td>\n\t\t\t<td class=\"right\">" . dinero($item['precio_credito'] + $item['iva_credito']) . "</td><td align=right><font color=gray> " . dinero($ultimo) . " </td></tr>"; } echo " </tbody>\n\t\t</table> "; echo "</div>"; }
function plandepagos($total, $fecha, $abono, $saldo) { //$fecha=fechaplusweek($fecha); $total_pagos = ceil($total / $abono); echo "\n\t\t\t\t\t<div class=\"box-header\">\n\t\t\t\t\t\t<h2></span>Plan de Pagos</h2>\n\t\t\t\t\t\t<div class=\"box-icon\">\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-setting\"><i class=\"halflings-icon wrench\"></i></a>\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-minimize\"><i class=\"halflings-icon chevron-up\"></i></a>\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-close\"><i class=\"halflings-icon remove\"></i></a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<table class=\"table table-condensed striped\" width=100%>\n\t\t\t\t\t\t\t <thead>\n\t\t\t\t\t\t\t\t <tr>\n\t\t\t\t\t\t\t\t\t <th style='text-align:right'>Num</th>\n\t\t\t\t\t\t\t\t\t <th style='text-align:center'>Vence</th>\n\t\t\t\t\t\t\t\t\t <th style='text-align:right'>Abono</th>\n\t\t\t\t\t\t\t\t\t <th style='text-align:right'>Saldo</th>\n\t\t\t\t\t\t\t\t\t <th></th> \n\t\t\t\t\t\t\t\t </tr>\n\t\t\t\t\t\t\t </thead> \n\t\t\t\t\t\t\t <tbody>"; $c = isset($c) ? $c : '0'; echo "<tr ><td style='text-align:right'>" . $c . "</td>\n\t\t\t<td style='text-align:center'> " . fechamysqltomx($fecha, 1) . "</td>\n\t\t\t<td style='text-align:right'>----</td>\n\t\t\t<td style='text-align:right'>" . dinero($total) . "</td>\n\t\t\t<td style='text-align:right'><font color=gray> </td></tr>"; $c = 1; $pagos_atrazados = 0; //$total-=$abono; $saldo_temp = $total - $saldo; for ($i = 1; $i < $total_pagos; $i++) { $fecha = fechaplusweek($fecha); if ($saldo_temp > $abono) { $ultimo = $abono; } else { $ultimo = $saldo_temp; } if ($total >= $saldo + $abono) { $atributo_begin = "<s>"; $atributo_end = "</s>"; } else { $atributo_begin = $atributo_end = ""; if ($ultimo < $saldo && $fecha < date("Y-m-d")) { $atributo_begin = "<font color=red><b><i>"; $atributo_end = "</i></b></font>"; $pagos_atrazados += 1; } else { $atributo_begin = $atributo_end = ""; } } echo "<tr><td style='text-align:right'>" . $c . "</td>\n\t\t\t<td style='text-align:center'>{$atributo_begin}" . fechamysqltomx($fecha, 1) . "{$atributo_end}</td>\n\t\t\t<td style='text-align:right'> {$atributo_begin}" . dinero($abono) . "{$atributo_end} </td>\n\t\t\t<td style='text-align:right'>" . dinero($total - $abono) . "</td>\n\t\t\t<td style='text-align:right'><font color=gray>{$atributo_begin}" . dinero($ultimo) . "{$atributo_end}</font> </td></tr>"; $total = $total - $abono; $c++; if ($saldo_temp <= $abono) { $saldo_temp = 0; } if ($saldo_temp > $abono) { $saldo_temp = $saldo_temp - $abono; } } if ($total) { $abono = $total; $total = 0; echo "<tr ><td style='text-align:right'>" . $c . "</td>\n\t\t\t<td style='text-align:center'> " . fechamysqltomx(fechaplusweek($fecha), 1) . "</td>\n\t\t\t<td style='text-align:right'>" . dinero($abono) . "</td>\n\t\t\t<td style='text-align:right'>" . dinero($total) . "</td>\n\t\t\t<td style='text-align:right'><font color=gray> " . dinero($ultimo) . " </td></tr>"; } echo " </tbody>\n\t\t</table> "; //echo "Pagos Atrazados: ".$pagos_atrazados; echo "</div>"; }