Test Foro de elhacker.net SMF 2.1

Programación => Desarrollo Web => PHP => Mensaje iniciado por: MellaSystems en 18 Enero 2016, 14:39 PM

Título: Alguien me orienta
Publicado por: MellaSystems en 18 Enero 2016, 14:39 PM
Tengo este codigo:

Código (php) [Seleccionar]

public function CalcPrestamo($monto, $interes, $tiempo){
                $this->monpre = $monto;
                $this->intpre = $interes;
                $this->timepre = $tiempo;
               
                $interes /=100;
               
                $int = $monto * $interes;
                $pagCap = $monto / $tiempo;
                $cuotas = $int + $pagCap;
                $amort = $cuotas - $pagCap;
                $vf = $monto + $int;
               
                echo "<HR />";
                echo "<h3><strong>Calculos del Prestamo</strong></h3>";
               
                echo '<table width="361" border="0" cellspacing="2" cellpadding="1">';
                echo "<tr>";
                echo "<td width='295'><div align='right' class='style2'>MONTO: </div></td>";
                echo '<td width="56"><div align="right" class="style2">'.$monto.'</div></td>';
                echo '</tr>';
                echo '<tr>';
                echo '<td width="295"><div align="right" class="style2">INTERES:</div></td>';
                echo '<td width="56"><div align="right" class="style2">'. $int .'</div></td>';
                echo '</tr>';
                echo '<tr>';
                echo '<td width="295"><div align="right" class="style2">TIEMPO DE PAGO:</div></td>';
                echo '<td width="56"><div align="right" class="style2">'.$tiempo.'</div></td>';
                echo '</tr>';
                echo "<tr>";
                echo '<td width="295"><div align="right" class="style2">CUOTA</div></td>';
                echo '<td width="56"><div align="right" class="style2">'.$cuotas.'</div></td>';
                echo "</tr>";
                echo "</table>";
                echo "<br />";

                echo "<table class='tableloans' align='center'>";
                            echo "<tr>";
                                echo "<th align='center'>TIEMPO</th>";
                                echo "<th align='center'>CUOTA</th>";
                                echo "<th align='center'>INTERES</th>";
                                echo "<th align='center'>AMORTIZACION</th>";
                                echo "<th align='center'>T AMORTIZADO</th>";
                            echo "</tr>";
                       
                        for($i = 1; i <= $tiempo; $i++){
                            echo "<tr>";
                                echo "<td align='left'>".$tiempo . "</td>";
                                echo "<td align='left'>".$cuotas . "</td>";
                                echo "<td align='left'>".$int . "</td>";
                                echo "<td align='left'>".$amort . "</td>";
                                echo "<td align='left'>".$vf . "</td>";
                            echo "</tr>";
                        }
                        echo "<table>";
//aqui no me imprime nada
            }


Gracias de ante mano!!!
Título: Re: Alguien me orienta
Publicado por: engel lex en 18 Enero 2016, 16:57 PM
eso es un código y muestra unos datos... si quieres más ayuda, deberías decir en que necesitas ayuda
Título: Re: Alguien me orienta
Publicado por: MellaSystems en 18 Enero 2016, 19:59 PM
Gracias brother pero errores tras errores pude lograr que me imprima la tabla de amortizacion que hacia llamaba en el ciclo for.
Código (php) [Seleccionar]
public function CalcPrestamo($monto, $interes, $tiempo){
                $this->monpre = $monto;
                $this->intpre = $interes;
                $this->timepre = $tiempo;
               
                $interes /=100;
               
                $int = $monto * $interes;
                $intCuo = $int / $tiempo;
                $pagCap = $monto / $tiempo;
                $cuotas = $intCuo + $pagCap;
                $amort = $cuotas - $int;
                $vf = $monto + $int;
               
                echo "<HR />";
                echo "<h3><strong>Calculos del Prestamo</strong></h3>";
               
                echo '<table align="center" width="40%" border="0" cellspacing="1" cellpadding="1">';
                echo "<tr>";
                echo "<td align='left'>MONTO: </td>";
                echo '<td colspan="2"><div align="left" >'.$monto.'</div></td>';
                echo '<td align="left">INTERES:</td>';
                echo '<td colspan="2"><div align="left" >'. $int .'</div></td>';
                echo '</tr>';
                echo "<tr>";
                echo "<td align='left'>TIEMPO: </td>";
                echo '<td colspan="2"><div align="left" >'.$tiempo.'</div></td>';
                echo '<td align="left">CUOTA:</td>';
                echo '<td colspan="2"><div align="left" >'. round($cuotas,2) .'</div></td>';
                echo '</tr>';
                echo "</table>";
                echo "<br />";

                            echo "<table class='tableloans' cellspacing='1' align='center' border='1'>";
                            echo "<tr>";
                                echo "<th align='center'>Periodo</th>";
                                echo "<th align='center'>Cuota</th>";
                                echo "<th align='center'>Inter&eacute;s</th>";
                                echo "<th align='center'>Amortz</th>";
                                echo "<th align='center'>T Amortizado</th>";
                            echo "</tr>";
               
                        $tar = 0;
               
                        for($valor = 1; $valor <= $tiempo; $valor++){
                            $tar = $tar+$amort;
                           
                            echo "<tr>";
                                echo "<td align='center'>".$valor. "</td>";
                                echo "<td align='center'>".round($cuotas,2) . "</td>";
                                echo "<td align='center'>".$int . "</td>";
                                echo "<td align='center'>".round($amort,2). "</td>";
                                echo "<td align='right'>". round($tar,2) ."</td>";
                            echo "</tr>";
                        }
                        echo "<table>";
            }
Esa fue la solucion a mi problema Gracias
Título: Re: Alguien me orienta
Publicado por: eLank0 en 19 Enero 2016, 14:47 PM
Si una etiqueta <table> no la cierras correctamente, es normal que no te funcione.

Salu2