<?

function FormatarData($Data) 
{ 
    $date_array = explode("/",$Data);
  
    $var_day   = $date_array[0]; 
    $var_month = $date_array[1]; 
    $var_year  = $date_array[2]; 

    $format_data = date("Y-m-d H:i:s", mktime(0,0,0,$var_month,$var_day,$var_year)); 
    return($format_data);  
} 

function FormatarDataHora($Data,$Hora,$Min) 
{ 
    $date_array = explode("/",$Data);
  
    $var_day   = $date_array[0]; 
    $var_month = $date_array[1]; 
    $var_year  = $date_array[2]; 

    $format_data = date("Y-m-d H:i:s", mktime($Hora,$Min,0,$var_month,$var_day,$var_year)); 
    return($format_data);  
} 

function traduzir_dia_de($dia_ingles)
{
    $dia_pt = "";

    if ($dia_ingles=="Monday")
        $dia_pt = "Montag";

    if ($dia_ingles=="Tuesday")
        $dia_pt = "Dienstag";

    if ($dia_ingles=="Wednesday")
        $dia_pt = "Mittwoch";

    if ($dia_ingles=="Thursday")
        $dia_pt = "Donnerstag";

    if ($dia_ingles=="Friday")
        $dia_pt = "Freitag";

    if ($dia_ingles=="Saturday")
        $dia_pt = "Samstag";

    if ($dia_ingles=="Sunday")
        $dia_pt = "Sonntag";
    return($dia_pt);
}

function diff_days($start_date, $end_date)
{
    return floor((strtotime($end_date) - strtotime($start_date))/86400);
}

function draw_header_extras_included()
{   
    echo '<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH=550>';        
    echo '<TR class="header_room">';    
    echo '<TD HEIGHT=25 WIDTH=550 STYLE="background-color: rgb(255,255,255); padding-left: 4pt;"><P><B>Extras inklusive</B></P></TD>';
    echo '</TR>';

}

function draw_foot_extras_included()
{
    echo '</TABLE>';
}


function draw_body_extras_included($desc_extra)
{   
    echo '<TR class="text_extras">';
    echo '<TD HEIGHT=25 style="padding-left:4pt; background-color:rgb(255,255,255);"><P><IMG HEIGHT=15 WIDTH=22 ALIGN="TOP" SRC="../assets/images/arrowazulgif.gif" BORDER=0 ALT="">&nbsp;'.$desc_extra.'</P></TD>';
    echo '</TR>';
}


function draw_header_extras()
{   
    echo '<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH=550>';        
    echo '<TR class="header_room">';
    echo '<TD HEIGHT=25 width=50 STYLE="background-color: rgb(215,220,232); padding-left: 4pt;"><P><B>Anzahl</B></P></TD>';
    echo '<TD width=314 STYLE="background-color: rgb(215,220,232); padding-left: 4pt;"><P><B>Extras</B></P></TD>';
    echo '<TD width=90 STYLE="background-color: rgb(215,220,232); padding-left: 4pt;"><P><B>Preis</B></P></TD>';
    echo '<TD width=90 STYLE="background-color: rgb(215,220,232); padding-left: 4pt;"><P><B>Gesamtpreis</B></P></TD>';
    echo '</TR>';

}

function draw_foot_extras()
{
    echo '</TABLE>';
}


function draw_body_extras($indice, $cod_extra, $desc_extra, $preco, $preco_por_dia, $nro_dias, $preco_total)
{   
    $var  = "qty_extra".$indice;
    $var1 = "price_total_extra".$indice;    

    echo '<TR class="text_extras">';

    if ($cod_extra == 'SCDW' or $cod_extra == 'CROSS')
    {
         echo '<TD HEIGHT=25 STYLE="padding-left: 4pt; background-color: rgb(215,220,232);">
         <P>
            <SELECT NAME='.$var.' class="text_objects" onchange="javascript:calcular_total_extra('.$indice.',this.value,'.$preco.','.$preco_por_dia.','.$nro_dias.','.$preco_total.');">
               <OPTION VALUE="0" SELECTED>0</OPTION>
               <OPTION VALUE="1">1</OPTION>
            </SELECT>
         </P>
         </TD>';	
    }
    else
   {
         echo '<TD HEIGHT=25 STYLE="padding-left: 4pt; background-color: rgb(215,220,232);">
         <P>
            <SELECT NAME='.$var.' class="text_objects" onchange="javascript:calcular_total_extra('.$indice.',this.value,'.$preco.','.$preco_por_dia.','.$nro_dias.','.$preco_total.');">
              <OPTION VALUE="0" SELECTED>0</OPTION>
              <OPTION VALUE="1">1</OPTION>
              <OPTION VALUE="2">2</OPTION>
              <OPTION VALUE="3">3</OPTION>
            </SELECT>
         </P>
        </TD>';
    }
    echo '<TD style="padding-left:4pt; background-color:rgb(215,220,232);"><P>'.$desc_extra.'</P></TD>';
    echo '<TD align=right style="padding-right: 4pt; background-color:rgb(215,220,232);"><P>'.$preco.' EUR</P></TD>';
    echo '<TD style="background-color:rgb(215,220,232);">
              <P><input name='.$var1.' type="text" class="text_extras" style="border-width:0px; background-color:rgb(215,220,232); width=90px; text-align: right; font-weight: bold; padding-right: 4pt;" readonly="readOnly" value ="0.00 EUR"></P></TD>';
    echo '</TR>';
}


function draw_header_extras_out_hours()
{   
    echo '<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 WIDTH=550>';        
    echo '<TR class="header_room">';
    echo '<TD HEIGHT=25 width=454 STYLE="background-color: rgb(215,220,232); padding-left: 4pt;"><P><B>Zuschlag für Übernahme / Rückgabe</B></P></TD>';
    echo '<TD width=90 STYLE="background-color: rgb(215,220,232); padding-left: 4pt;"><P><B>Preis</B></P></TD>';
    echo '</TR>';

}

function draw_foot_extras_out_hours()
{
    echo '</TABLE>';
}


function draw_body_extras_out_hours($desc_extra, $preco)
{   
    echo '<TR class="text_extras">';
    echo '<TD HEIGHT=25 style="padding-left:4pt; background-color:rgb(255,251,236);"><P>'.$desc_extra.'</P></TD>';
    echo '<TD align=right style="padding-right: 8pt; background-color:rgb(255,251,236);"><P><B>'.$preco.' </B></P></TD>';    
    echo '</TR>';
}

?>
