<?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" style="font-size: 17px;"><?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; font-size: 17px;"><?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%" style="font-size: 17px;" class="lbl">Date<span class="linear-lbl"> / தேதி</span></td>
                                    <td width="1%">:</td>
                                    <td width="20%" style="border-bottom:2px dotted #000; font-size: 17px;"><?php echo $data['date'][0]; ?></td>
                                    <?php if( !empty( $data['date'][1] ) ) :?>
                                        <td width="5%" style="border-bottom:2px dotted #000; font-size: 17px;">to</td>
                                        <td width="20%" style="border-bottom:2px dotted #000; font-size: 17px;"><?php echo $data['date'][1]; ?></td>
                                        <td width="1%" style="border-bottom:2px dotted #000; font-size: 17px;"></td>
                                        <td width="35%" style="border-bottom:2px dotted #000; font-size: 17px;"></td>
                                    <?php endif; ?>
                                </tr>
                                <tr height="5"></tr>
                                <tr>
                                    <td width="18%" class="lbl" style="font-size: 17px;">Day<span class="linear-lbl"> / நாள் </span></td>
                                    <td width="1%">:</td>
                                    <td width="20%" style="border-bottom:2px dotted #000; font-size: 17px;"><?php echo !empty( $data['day'] ) ? $data['day'] : '-'; ?></td>
                                    <td width="5%" style="border-bottom:2px dotted #000; font-size: 17px;"></td>
                                    <td width="20%" align="center" class="lbl" style="font-size: 17px;">Total Weeks :<div class="sub-lbl">மொத்த வாரம்</div></td>
                                    <td width="1%" style="border-bottom:2px dotted #000; font-size: 17px;"><?php echo !empty( $data['day'] ) ? $data['days'] : '-'; //$data['weeks']; ?></td>
                                    <td width="35%" style="border-bottom:2px dotted #000; font-size: 17px;"></td>
                                </tr>
                                <tr height="5"></tr>
                                <tr>
                                    <td width="18%" class="lbl" style="font-size: 17px;">Total Days<div class="sub-lbl">மொத்த நாட்கள்</div></td>
                                    <td width="1%">:</td>
                                    <td width="20%" style="border-bottom:2px dotted #000; font-size: 17px;"><?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" style="font-size: 16px;"> / வரிசை எண்</span></th>
                        <th>God Name<span class="linear-lbl" style="font-size: 16px;"> / கடவுள்  பெயர்</span></th>
                    </tr>
                    <?php 
                    
                    //echo "<pre>Data: "; print_r($data['items']); die;
                    //for($i = 0 ; $i< 4; $i++) :
                        if(count($data['items']) > 0) :
                            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" style="font-size: 16px;"><?php echo $k+1; ?></td>
                                    <td align="left" style="font-size: 16px;"><?php echo $str; ?></td>
                                </tr>
                        <?php endforeach;// endfor;
                            else : ?>
                                <tr>
                                    <td colspan="2" align="center">No Records Found!</td>
                                </tr>
                        <?php endif;
                        ?>
                </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: 14px;">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; font-size: 14px;" width="20%">Amount in Words (S$):</td>
                                    <td width="80%"><?php echo convert_amount_to_word( $amount );  ?></td>
                                </tr>
                                <tr height="5" class="auto-adj"></tr>
                                <tr>
                                    <td colspan="2" ><span style="font-weight:bold; font-style:italic; font-size:11px;">***Issued receipts are not exchangeable or refundable</span></td>
                                </tr>
                                <tr height="5"></tr>