Value calculation between dates for input fields

0

People do not know anything about java and I believe that's what I'm going to need. Next situation:

Below is the script to generate the amount with interest and fine of the value between due date and payment date and their respective fields:

<input name="form_fatura_datapag" type="text" value="<?php if ($coluna[fatura_datapag]=='0') echo date('d/m/Y'); else echo inteirodata(@mysql_result($sql,0,fatura_datapag));?>" size="15"/>

<input name="form_fatura_valor" type="text" value="<?= number_format($valorDocComJuros,2,",",".");?>" size="15"/>


<?php
$sql = mysql_query("SELECT * FROM faturas WHERE id_fatura=$_GET[id]");
while ($coluna = @mysql_fetch_array($sql)) {

$dat_venc = inteirodata($coluna[fatura_data]);
if ($coluna[fatura_datapag]=='0') $dat_novo_venc = date('d/m/Y'); else $dat_novo_venc = inteirodata($coluna[fatura_datapag]); //CALCULO DE JUROS E MULTA DEIXA DE SER CALCULADO QDO SE COLOCA DATA DE PAGAMENTO
$valor_doc = "$coluna[fatura_parcela]";

$juros =  (((($valor_doc*1)/100)/30 * (diasEntreData($dat_venc,$dat_novo_venc ))));

if(diasEntreData($dat_venc,$dat_novo_venc)==0)
{$multa = 0;}
else
{$multa = ((2 * $valor_doc) / 100);}//Moeda(($valor_doc * 2) / 100);

$valorDocComJuros = $valor_doc + ($juros + $multa);
?>

In case it will have to make calculation between two dates, date 1 = due date and date 2 = payment and generate the automatic invoice amount in the input with interest of the difference of this date.

Example invoice 10,00 maturity 30/01/2016

Today the invoice is in 10,15 putting the date of payment of yesterday 02/02/2016 it registers value in the database of 10,15 and not 10,10 as it should be paid yesterday.     

asked by anonymous 04.02.2016 / 03:53

0 answers