<?php

/* 
 * Author       : Jai K
 * Purpose      : View for Print Format 2 (Kattalai Archanai)
 * Created On   : 2016-09-20 18:14
 */
 
                            $names = $data['name'];
                            $amount = is_array($amount) ? $amount[0] : $amount;
                            foreach( $names as $k => $name ) :
                                $e = explode(',', $name);
                            ?>

                                <tr>
                                    <td width="18%" class="lbl"><?php echo $k == 0 ? 'Name / Star<div class="sub-lbl">பெயர்  / நட்சத்திரம்</div>' : '&nbsp;'; ?></td>
                                    <td width="1%">:</td>
                                    <td width="80%" colspan="5" style="border-bottom:2px dotted #000;"><?php echo $e[0] . ( !empty( $e[1] ) ? $sepr . $e[1] : '') . ( !empty( $e[2] ) ? ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="font-family: amudham;font-weight: bolder;font-size: 24px;">' . $e[2] . '</span>' . ( !empty($e[3]) ? $sepr . '<span style="color: #999;">'.$e[3].'</span>' : '' ) : ''  ); ?></td>
                                </tr>
                                <tr height="5" class="auto-adj"></tr>
                            <?php endforeach; ?>    
                                
                                <tr>
                                    <td width="18%" class="lbl">Date<span class="linear-lbl"> / தேதி</span></td>
                                    <td width="1%">:</td>
                                    <td width="20%" style="border-bottom:2px dotted #000;"><?php echo $data['date'][0]; ?></td>
                                    <?php if( !empty( $data['date'][1] ) ) :?>
                                        <td width="5%" style="border-bottom:2px dotted #000;">to</td>
                                        <td width="20%" style="border-bottom:2px dotted #000;"><?php echo $data['date'][1]; ?></td>
                                        <td width="1%" style="border-bottom:2px dotted #000;"></td>
                                        <td width="35%" style="border-bottom:2px dotted #000;"></td>
                                    <?php endif; ?>
                                </tr>
                                <tr height="5"></tr>
                                <tr>
                                    <td width="18%" class="lbl">Day<span class="linear-lbl"> / நாள் </span></td>
                                    <td width="1%">:</td>
                                    <td width="20%" style="border-bottom:2px dotted #000;"><?php echo !empty( $data['day'] ) ? $data['day'] : '-'; ?></td>
                                    <td width="5%" style="border-bottom:2px dotted #000;"></td>
                                    <td width="20%" align="center" class="lbl">Total Weeks :<div class="sub-lbl">மொத்த வாரம்</div></td>
                                    <td width="1%" style="border-bottom:2px dotted #000;"><?php echo !empty( $data['day'] ) ? $data['days'] : '-'; //$data['weeks']; ?></td>
                                    <td width="35%" style="border-bottom:2px dotted #000;"></td>
                                </tr>
                                <tr height="5"></tr>
                                <tr>
                                    <td width="18%" class="lbl">Total Days<div class="sub-lbl">மொத்த நாட்கள்</div></td>
                                    <td width="1%">:</td>
                                    <td width="20%" style="border-bottom:2px dotted #000;"><?php echo $data['days']; ?></td>
                                    <td width="5%"></td>
                                    <td width="20%"></td>
                                    <td width="1%"></td>
                                    <td width="35%"></td>
                                </tr>
                                <tr height="5"></tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <table width="<?php echo WIDTH; ?>" border="1" style="border-collapse:collapse;" cellpadding="5">
                    <tr>
                    	<th>SI.No<span class="linear-lbl"> / வரிசை எண்</span></th>
                        <th>God Name<span class="linear-lbl"> / கடவுள்  பெயர்</span></th>
                    </tr>
                    <?php 
                    
                    //echo "<pre>Data: "; print_r($data['items']); die;
                    //for($i = 0 ; $i< 4; $i++) :
                        foreach( $data['items'] as $k => $itm ) :
                            
                            //foreach( $item as $kk => $itm ) :
                                $str = $itm['name'] . (!empty($itm['tamil_name']) ? $sepr . '<span class="linear-lbl">'. tamil($itm['tamil_name']) .'</span>' : '');
                            //endforeach;
                    ?>
                            <tr>
                                <td align="center"><?php echo $k+1; ?></td>
                                <td align="left"><?php echo $str; ?></td>
                            </tr>
                    <?php endforeach;// endfor;?>
                </table>
                <table width="<?php echo WIDTH; ?>">
                    <tr>
                        <td>
                            <table border="0" width="100%" cellpadding="5">
                                <tr height="5" class="auto-adj"></tr>
                                <tr>
                                    <td colspan="2" style="font-weight:bold;font-size:18px;">S$ <?php echo number_format($amount,2,'.',''); ?>/- <?php echo ($gst == 1 ? '(Inclusive of GST)' : '') . $pay_mode_str;?></td>
                                </tr>
                                <tr height="5" class="auto-adj"></tr>
                                <tr>
                                    <td style="font-weight:bold;" width="20%">Amount in Words (S$):</td>
                                    <td width="80%"><?php echo convert_amount_to_word( $amount );  ?></td>
                                </tr>
                                <tr height="5"></tr>