$total_credito += $item[$n]['precio_credito']; $total_contado += $item[$n]['precio_venta']; $n--; } if ($total_credito and $cliente_id) { $total_iva_credito = $total_credito * 0.16; $disponible = $credito - $saldo - $total_credito - $total_iva_credito; $saldo_total = $saldo + $total_credito + $total_iva_credito; // echo "<tr><td colspan=4 style=\"border-bottom:1px dotted black\"> </td></tr><tr><td></td><td style='text-align:right'>Total</td><td style='text-align:right;boarder-top:2px solid;'>$". dinero($total_credito+$total_iva_credito)."</td></tr>"; // echo "<tr><td></td><td style='text-align:right'> Incluye IVA(16%) por</td><td style='text-align:right;border-bottom:2px solid;'>".dinero($total_iva_credito)."</td></tr>"; echo "<tr><td rowspan=2 style='background:#4EF84E;color:black;text-align:center;vertical-align:center'><h2>Articulos<br>{$items}</h2></td><td style='text-align:right'> <font size=+2>Total</font></td>\n\t\t\t\t\t\t\t\t<td width=180 style='text-align:right;border-top:1px solid black;background:white;color:black'><font size=+3><b>\$ " . dinero($total_iva_credito + $total_credito) . "</strong></td></tr>"; echo "<tr><td> </td></tr>"; echo "<tr><td></td><td style='text-align:right'>Saldo Actual</td><td style='text-align:right'>+ \$ " . dinero($saldo) . "</td></tr>"; echo "<tr><td></td><td style='text-align:right;'>Saldo Total</td><td style='text-align:right;background:yellow;color:black;text-align:right;border:2px solid;'><font size=+2>\$ " . dinero($saldo_total) . "</font></td></tr>"; echo "<tr><td></td><td style='text-align:right'>Abono</td>"; $abono = get_abono($saldo_total); echo "<td style='text-align:right;'>\$" . dinero($abono) . "</td>"; echo "</tr>"; //echo "<tr><td colspan=3><br><br>Credito Actual Disponible: $ ".dinero($disponible)."</td></tr>"; echo "<tr><td colspan=4>"; echo "<div >"; if ($_SESSION['cliente_id']) { $disponible = $credito - $saldo - $total_credito * 1.16; if ($disponible <= 0 and $total_credito > 0 and $cliente_id) { echo "<div style='text-align:center;padding:10px;background:red;border:1px solid red;color:white;'>\n\t\t\t\t\t\t\t\t\t\t<strong>Credito Excedido por: \$ " . dinero($disponible * -1) . "</strong> <br>Quite uno o mas productos.\n\t\t\t\t\t\t\t\t\t\t</div>"; } } echo "</div> </td></tr>"; } else { if ($total_contado) { $total_iva_contado = $total_contado * 0.16;
$total_contado += $item[$n]['precio_venta']; $n--; } if ($total_credito and $cliente_id) { $total_iva_credito = $total_credito * 0.16; $disponible = $credito - $saldo - $total_credito - $total_iva_credito; $saldo_total = $saldo + $total_credito + $total_iva_credito; // echo "<tr><td colspan=4 style=\"border-bottom:1px dotted black\"> </td></tr><tr><td></td><td style='text-align:right'>Total</td><td style='text-align:right;boarder-top:2px solid;'>$". dinero($total_credito+$total_iva_credito)."</td></tr>"; // echo "<tr><td></td><td style='text-align:right'> Incluye IVA(16%) por</td><td style='text-align:right;border-bottom:2px solid;'>".dinero($total_iva_credito)."</td></tr>"; echo "<tr><td> </td></tr>"; echo "<tr><td rowspan=2 style='background:#4EF84E;color:black;text-align:center;'>Articulos<br>" . $items . "</td>\n\t\t\t\t\t\t\t\t<td style='text-align:right'> <font size=+2>Total</font></td>\n\t\t\t\t\t\t\t\t<td width=180 style='text-align:right;border:1px solid black;background:white;color:black;background:yellow;'><font size=+2><b>\$ " . dinero($total_iva_credito + $total_credito) . "</strong></td></tr>"; echo "<tr><td> </td></tr>"; echo "<tr><td></td><td style='text-align:right'>Saldo Actual</td><td style='text-align:right'>+ \$ " . dinero($saldo) . "</td></tr>"; echo "<tr><td></td><td style='text-align:right;'>Saldo Total</td><td style='text-align:right;color:black;text-align:right;border-top:2px solid;'><font size=+1>\$ " . dinero($saldo_total) . "</font></td></tr>"; echo "<tr><td></td><td style='text-align:right'>Abono</td>"; $abono = get_abono(dinero($saldo_total)); echo "<td style='text-align:right;'>\$" . dinero($abono) . "</td>"; echo "</tr>"; //echo "<tr><td colspan=3><br><br>Credito Actual Disponible: $ ".dinero($disponible)."</td></tr>"; echo "<tr><td colspan=4>"; echo "<div style='text-align:center' classe=\"form-actions\">"; if ($_SESSION['cliente_id']) { $disponible = $credito - $saldo - $total_credito * 1.16; if ($disponible <= 0 and $total_credito > 0 and $cliente_id) { echo "<div style='text-align:center;padding:10px;background:#800000;border:1px solid red;color:white;'>\n\t\t\t\t\t\t\t\t\t\t<strong>Credito Excedido por: \$ " . dinero($disponible * -1) . "</strong> <br>Quite uno o mas productos.\n\t\t\t\t\t\t\t\t\t\t</div>"; } else { echo "<div style='text-align:center;padding:10px;background:#dddddd;border:1px solid #bbbbbb;color:white;'>\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"#\" class=\"btn btn-info blue btn-setting\">Cerrar Venta a Credito</a>\n\t\t\t\t\t\t\t\t\t\t\t</div>"; } //echo "<div style='text-align:center;padding:10px;background:#336699;border:1px solid blue;color:white;'> //<strong>Cerrar Venta</div>"; }
} if ($tipomov_id == 14) { $total = dinero($total_contado); } echo "<br>tipomov_id: " . $tipomov_id; echo "<br>total: " . $total; $saldo = $saldo_anterior - $total; //Fields and values to update $update = array('total' => $total, 'saldo' => $saldo); //Add the WHERE clauses $where_clause = array('devolucion_id' => $devolucion_id); $updated = $database->update('devolucion', $update, $where_clause, 1); //The fields and values to insert $names = array('cliente_id' => $cliente_id, 'fecha_actual' => $fecha_hoy, 'fecha' => $fecha_hoy, 'admin_id' => $admin_id, 'tipomov_id' => 2, 'factura_id' => $devolucion_id, 'cantidad' => $total); $add_query = $database->insert('movimiento', $names); $abono = get_abono($saldo); echo "<br>abono" . $abono; // if ($saldo>0) // { // $notaventa=$saldo*-1; // $saldo=0; // $abono=0; // } //Fields and values to update $update = array('total_ultimo' => $saldo, 'fecha_total_inicio' => $fecha_hoy, 'abono' => $abono, 'saldo' => $saldo); //Add the WHERE clauses $where_clause = array('cliente_id' => $cliente_id); $updated = $database->update('cliente', $update, $where_clause, 1); if ($saldo < 0) { $vale = $saldo * -1; $saldo = $saldo + $vale;