<?php

/* 
 * Author       : Jai K
 * Purpose      : View for Print Format 3 (Hall Booking, Wedding Hall Booking)
 * Created On   : 2016-09-20 18:14
 */
//$name = explode(',', is_array( $name ) ? $name[0] : $name);

$is_wedding = (isset($data['proof']) && is_array($data['proof']) && count($data['proof']) == 3) ? TRUE : FALSE;
$name = $data['name'];
?>                             <?php if ($is_wedding) : ?> <tr height="20"></tr> <?php endif;?>
                                <tr>
                                    <td width="18%" style="font-size: 16px;" class="lbl">Contact Person<div class="sub-lbl">தொடர்பு நபர்</div></td>
                                    <td width="1%">:</td>
                                    <td width="36%" style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $name[0]; ?></td>
                                    <td width="18%" style="font-size: 16px;" class="lbl">Contact Number<div class="sub-lbl">தொடர்பு எண்</div></td>
                                    <td width="1%">:</td>
                                    <td width="26%" style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['contact_no']; ?></td>
                                </tr>
                                
                                <?php if( $is_wedding ) : ?>
                                    <tr height="1"></tr>
                                    <tr>
                                        <td style="font-size: 16px;" class="lbl">Groom's Name<div class="sub-lbl">மணமகன்  பெயர்</div></td>
                                        <td>:</td>
                                        <td style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $name[1]; ?></td>
                                        <td style="font-size: 16px;" class="lbl">Bride's Name<div class="sub-lbl">மணப்பெண்  பெயர்</div></td>
                                        <td>:</td>
                                        <td style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $name[2]; ?></td>
                                    </tr>
                                <?php endif; ?>
                                    
                                <?php echo ($is_wedding) ?  '<tr height="1"></tr>' : '<tr height="1"></tr>';?>
                                <tr>
                                    <td class="lbl" style="font-size: 16px;"><?php echo $is_wedding ? 'Wedding' : 'Event'; ?> Date<div class="sub-lbl"><?php echo $is_wedding ? 'திருமண' : 'நிகழ்ச்சி'; ?>  தேதி</div></td>
                                    <td>:</td>
                                    <td style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['date']; ?></td>
                                    <td class="lbl" style="font-size: 16px;"><?php echo $is_wedding ? 'Wedding' : 'Event'; ?> Time<div class="sub-lbl"><?php echo $is_wedding ? 'திருமண' : 'நிகழ்ச்சி'; ?>  நேரம்</div></div></td>
                                    <td>:</td>
                                    <td style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['time']; ?></td>
                                </tr>
                                <?php echo ($is_wedding) ?  '<tr height="1"></tr>' : '<tr height="1"></tr>';?>
                                <tr>
                                    <td class="lbl" style="font-size: 16px;" >Email ID<div class="sub-lbl">மின்னஞ்சல்</div></td>
                                    <td>:</td>
                                    <td style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['email']; ?></td>
                                    <td class="lbl" style="font-size: 16px;">Period<div class="sub-lbl">காலம்</div></td>
                                    <td>:</td>
                                    <td style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['period']; ?></td>
                                </tr>
                                
                                <?php if( !$is_wedding ) : ?>
                                    <tr height="1"></tr>
                                    <tr>
                                        <td class="lbl" style="font-size: 16px;" >Event Type<div class="sub-lbl">நிகழ்ச்சி வகை</div></td>
                                        <td>:</td>
                                        <td colspan="4" style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['event_type']; ?></td>
                                    </tr>
                                <?php endif; ?>
                                    
                                <?php echo ($is_wedding) ?  '<tr height="1"></tr>' : '<tr height="1"></tr>';?>
                                <tr>
                                    <td class="lbl" style="font-size: 16px;">Address<div class="sub-lbl">முகவரி</div></td>
                                    <td>:</td>
                                    <td colspan="4" style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['address']; ?></td>
                                </tr>
                                <?php echo ($is_wedding) ?  '<tr height="1"></tr>' : '<tr height="1"></tr>';?>
                                <tr>
                                    <td class="lbl" style="font-size: 16px;">Description<div class="sub-lbl">விவரம்</div></td>
                                    <td>:</td>
                                    <td colspan="4" style="border-bottom:2px dotted #000; font-size: 16px;"><?php echo $data['desc']; ?></td>
                                </tr>
                                <?php echo ($is_wedding) ?  '<tr height="1"></tr>' : '<tr height="1"></tr>';?>
                            </table>
                        </td>
                    </tr>
                </table>
                
                <?php if( $is_wedding ) : ?>
                    <table width="<?php echo WIDTH; ?>" border="1" style="border-collapse:collapse;" cellpadding="2">
                        <tr>
                            <th colspan="8" style="border:0px;" align="left">Documents Verified<span class="linear-lbl"> / சரிபார்க்கப்பட்ட ஆவணங்கள் </span></th>
                        </tr>
                        <tr>
                            <td colspan="8" height="15" style="border:0px;"></td>
                        </tr>
                        <tr>
                            <td width="5%" style="border:0px;" align="center"><input type="checkbox" <?php echo !empty( $data['proof'][0] ) ? 'checked' : ''; ?>/></td>
                            <td width="20%" style="border:0px; font-weight:bold;" align="left">Groom ID Proof<div class="sub-lbl">மணமகன் அடையாள அட்டை</div></td>
                            
                            <td width="10%" style="border:0px;">&nbsp;</td>
                            <td width="5%" style="border:0px;" align="center"><input type="checkbox" <?php echo !empty( $data['proof'][1] ) ? 'checked' : ''; ?>/></td>
                            <td width="20%" style="border:0px; font-weight:bold;">Bride ID Proof<div class="sub-lbl">மணப்பெண்  அடையாள அட்டை</div></td>
                            
                            <td width="10%" style="border:0px;">&nbsp;</td>
                            <td width="5%" style="border:0px;" align="center"><input type="checkbox" <?php echo !empty( $data['proof'][2] ) ? 'checked' : ''; ?>/></td>
                            <td width="20%" style="border:0px; font-weight:bold;" align="left">Wedding Invitation<div class="sub-lbl">திருமண அழைப்பிதழ்</div></td>
                            
                        </tr>
                        <tr>
                            <td colspan="8" height="20" style="border:0px;"></td>
                        </tr>
                    </table>
                <?php endif; ?>
                
                <?php
					if($data['addData']){
				?>
                	<table width="<?php echo WIDTH; ?>" style="border-collapse:collapse;" cellpadding="2" border="0">
                <?php
						foreach($data['addData'] as $val){
							if(!empty($val['desc']) && ($val['amuont'] > 0)){
				?>
                 	<tr height="1"></tr>
                    <tr>
                        <td class="lbl" style="font-size: 16px;font-size: 16px;width: 39%;"><?php echo $val['desc']; ?></td>
                        <td style="width: 2%;">:</td>
                        <td colspan="4" style="border-bottom:2px dotted #000; font-size: 16px;"> $<?php echo number_format($val['amuont'],2,'.',''); ?></td>                        
                    </tr>
                <?php 
							}
						} 
				?>
                 	</table>
                <?php
					} 
				?>
                
                <table width="<?php echo WIDTH; ?>" border="0">
                    <tr>
                    	<?php echo ($is_wedding) ?  '<td colspan="5" height="1"></td>' : '<td colspan="5" height="1"></td>';?>
                    </tr>
                    <?php if (empty($add_amount)){ ?>
                    <tr>
                        <td style="font-weight:bold; font-size: 15px;" width="40%">Total Amount / <span class="sub-lbl">மொத்த தொகை</span></td>
                        <td width="10%" style="font-size: 15px;">: $<?php echo number_format($amount[0],2,'.',''); ?></td>
                        <td width="10%" style="font-size: 15px;"></td>
                        <td style="font-weight:bold; font-size: 15px;" width="30%">Paid Amount / <span class="sub-lbl">செலுத்திய தொகை</span></td>
                        <td style="font-size: 15px;">: $<?php echo number_format($amount[1],2,'.',''); ?></td>
                    </tr>
                    <tr>
                    	<?php echo ($is_wedding) ?  '<td colspan="5" height="1" style="border:0px;"></td>' : '<td colspan="4" height="1" style="border:0px;"></td>';?>
                    </tr>
                    <tr>
                        <td style="font-weight:bold; font-size: 15px;" width="40%">Balance to be pay / <span class="sub-lbl">மீதமுள்ள தொகை</span></td>
                        <td width="10%" style="font-size: 15px;">: $<?php echo !empty( $amount[3] ) ? number_format($amount[3],2,'.','') : number_format(($amount[0]-$amount[1]), 2, '.', ''); ?></td>
                        <td width="10%"></td>
                        <!--<td style="font-weight:bold;" width="30%">Paid Amount / <span class="sub-lbl">செலுத்திய தொகை</span></td>
                        <td >: $<?php #echo $amount[2]; ?></td>-->
                        <td style="font-weight:bold;" width="30%"></td>
                        <td ></td>
                    </tr>
                    <?php }else{ ?>
                    <tr>
                        <td style="font-weight:bold;" width="10%">Amount </td>
                        <td width="10%">: $<?php echo number_format($add_amount, 2, '.', ''); ?></td>
                        <td width="10%"></td>
                    </tr>
                    <tr>
                        <td style="font-weight:bold;">Description</td>
                        <td colspan="4" style="border-bottom:2px dotted #000; font-size: 16px;">: <?php echo $add_desc; ?></td>
                    </tr>
                    <?php } ?>
                    <tr >
                        <?php echo ($is_wedding) ?  '<td colspan="5" height="1" style="border:0px;"></td>' : '<td colspan="5" height="1" style="border:0px;"></td>';?>
                    </tr>
                </table>
                <table width="<?php echo WIDTH; ?>">
                    <tr>
                        <td>
                            <table border="0" width="100%">
                            	 <?php if ( empty($add_amount)){ ?>
                                <tr>
                                    <td colspan="2" style="font-weight:bold; font-size: 14px;">S$ <?php echo number_format($amount[2],2,'.',''); ?>/- <?php echo ($gst == 1 ? '<span style="font-size: 12px; color: #999;">(Inclusive of GST)</span>' : '')  . $pay_mode_str; ?></td>
                                </tr>
                                <?php echo ($is_wedding) ?  '<tr height="1"></tr>' : '<tr height="1"></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[2] ); ?></td>
                                </tr>
                                <?php }else{ ?>
                                <tr>
                                    <td colspan="2" style="font-weight:bold;font-size:18px;">S$ <?php echo number_format($add_amount, 2, '.', ''); ?>/- <?php echo ($gst == 1 ? '<span style="font-size: 12px; color: #999;">(Inclusive of GST)</span>' : '') . $pay_mode_str; ?></td>
                                </tr>
                                <?php // echo ($is_wedding) ?  '<tr height="20"></tr>' : '<tr height="5"></tr>';   ?>
                                <tr>
                                    <td style="font-weight:bold;" width="20%">Amount in Words (S$)</td>
                                    <td width="80%">: <?php echo convert_amount_to_word($add_amount); ?></td>
                                </tr>
                                <?php } ?>
                                <tr height="1"></tr>
                                <tr>
                                    <td colspan="5" ><span style="font-weight:bold; font-style:italic; font-size:11px;">***Issued receipts are not exchangeable or refundable</span></td>
                                </tr>
                                <?php echo ($is_wedding) ?  '<tr height="3"></tr>' : '<tr height="3"></tr>';?>