<?php

/* 
 * Author       : Jai K
 * Purpose      : View for Print Format 5 (Archanai purposes)
 * Created On   : 2016-09-23 12:14
 */


$items      = $data['items'];
$is_tamil   = $data['is_tamil'];
$with_god   = $items[0]['god_name'] == "1" ? TRUE : FALSE;
$with_name  = $items[0]['receipt'] == "1" ? TRUE : FALSE;
$with_footer= $items[0]['is_enable_footer'] == "1" ? TRUE : FALSE;
$amount     = $items[0]['total_price'];
$gst_lbl    = $gst > 0 ? '<span style="font-size: 10px; font-weight: normal; padding-right: 5px;">(Inclusive of GST)</span>' : '';

$box2  = array();
$names = !empty( $items[0]['with_names'] ) ? $items[0]['with_names'] : $data['name'];

if( $is_group ) :
    // Multiple
    $box1 = $items[0]['cat'];
   
else :
    // Single
    $item = $items[0];
   
    if( $with_god ) :
        $box1 = $item;
        $items = $item['gods'];
    else :
        $box1 = $item;
        $items = array();
    endif;
    
    if( $box1['cat']['grouping'] == "1" && $is_category == 1) :
        // Category is grouping, But Separate Receipt is checked
        $box2 = $item;
        $box1 = $item['cat'];
    endif;
    
endif;
	
    if( !$incl_footer ) :
        
        $bg = '';//$is_group ? 'background: #666;' : '';
?>
        <?php #if($is_category == 1) {?>
        <tr>
            <td colspan="4">
			<?php // echo empty( $box1['cat'] ) ?  :  
             
			 if(empty( $box1['cat'] )){ $bc = 'border: 0px dashed #000; border-radius: 0px; padding: 0px; min-height: 0px; background: #e3e3e3; color: #000;'; }
             else { if(($box1['name'] == "Coconut Archanai") or ($box1['name'] == "Aathmasanthi Archanai") or ($box1['name'] == "Sri Bairavar Poojai") or ($box1['name'] == "Sankadahara Chathurthi Archanai") or ($box1['name'] == "Vehicle Poojai")){ $bc = 'border: 1px dashed #000; border-radius: 10px; padding: 10px; min-height: 40px; background: #ccc; color: #000;'; } else { $bc = 'border: 1px dashed #000; border-radius: 10px; padding: 10px; min-height: 40px; background: #fff; color: #000;'; } }
			?>
			  
                
<?php if(($box2['name']!='Gold Locket') and ($box1['name']!='Gold Locket')) : ?>
			   <div style="<?php echo $bc; ?> " >
                    <?php if( file_exists( $box1['image'] ) ) : ?>
                        <div style="width: 30%; display: inline-block; text-align: center; float: left;">
                            <img style="width: 60px; height: 40px;" src="<?php echo BASE_URL.$box1['image']; ?>" />
                        </div>
                    
                        <div style="width: 60%; display: inline-block; text-align: center;">
                    <?php else : ?>
                        <div style="width: 100%; display: inline-block; text-align: center;">
                    <?php endif; ?>
                          <div style="font-family: amudham; border: none; text-align: center; width: 100%; font-weight: bolder; font-size: 18px;"><?php echo $box1['tamil_name']; ?></div>
                            <div><?php echo $box1['name']; ?></div> 
                        </div>
                </div>  
                
               <?php endif; ?>
            </td>
        </tr>
        
		
		
		
		
		
		
		
		 <?php if($box1['name']=='Gold Locket'): ?>
              <div style="<?php echo $bc; ?>;height:70px;" >
                    <?php if( file_exists( $box1['image'] ) ) : ?>
                 <div style="width: 30%; display: inline-block; text-align: center; float: left;">
             <img style="width: 60px; height: 40px;" src="<?php echo BASE_URL.$box1['image']; ?>" />
                        </div>
                    
                        <div style="width: 60%; display: inline-block; text-align: center;">
                    <?php else : ?>
                        <div style="width: 100%; display: inline-block; text-align: center;">
                    <?php endif; ?>
                            <div style="font-weight:bold;font-family: amudham; border: none; text-align: center; width: 100%; font-weight: bolder; font-size: 25px;"><?php echo $box1['tamil_name']; ?></div>
                            <div style="font-weight:bold;font-size:25px"><?php echo $box1['name']; ?></div>
                        </div>
                </div>
                <p style="text-align:center;font-size:20px;padding:0px;margin:0px;margin-top:10px">Please collect after</p>
                <p style="text-align:center;font-size:18px;margin:0px"> 18th Apr 2018</p>
                <div class="clear" style="clear:both;height:5em"></div>
              
                <?php endif; ?>
               
         
        
        
		
		
		
		
		
        <?php 
       if( !empty( $box2 ) ) :
            ?>
            <tr>
                <td colspan="4">
                    <div style="border: 1px dashed #000; border-radius: 10px; padding: 10px; min-height: 40px;">

                        <?php if( file_exists( $box2['image'] ) ) : ?>
                            <div style="width: 30%; display: inline-block; text-align: center; float: left;">
                                <img style="width: 60px; height: 40px;" src="<?php echo BASE_URL.$box2['image']; ?>" />
                            </div>
                        
                            <div style="width: 65%; display: inline-block; text-align: center; float: left;">
                        <?php else : ?>
                            <div style="width: 100%; display: inline-block; text-align: center; float: left;">
                        <?php endif; ?>
                        
                                <div style="font-family: amudham; border: none; text-align: center; width: 100%; font-weight: bolder; font-size: 18px;"><?php echo $box2['tamil_name']; ?></div>
                                <div><?php echo $box2['name']; ?></div>
                            </div>
                        
                    </div>
                </td>
                
                
            </tr> 
        <?php
            endif; // Box 2
            
            if( !empty( $items ) ) :
                foreach( $items as $k => $item ) :
                    /*if( empty($item['name']) ) :
                        continue;
                    endif;*/
                ?>
                    <tr>
                        <td colspan="2"><?php echo $item['name']; ?></td>
                        <td colspan="2" rowspan="2" style="font-weight:bold; font-size:20px;" valign="bottom" align="right"><?php echo $item['qty']; ?></td>
                    </tr>
                    <tr>
                        <td colspan="2" style="border-bottom:1px dotted #000;"><?php echo tamil( $item['tamil_name'], 'border: none; font-weight: bolder; font-size: 18px; width: 100%;' ); ?></td>
                    </tr>
                    <tr height="3"></tr>    
                <?php 
                endforeach; 
            endif;
        ?>
            
        <tr height="10"></tr>    
        <?php
            if( $with_name ) :
        ?>
            <tr>
                    <td  colspan="4">
                        <div style="float: left; width: 95px; ">பெயர் / Name</div>
                        
                        <div style="text-align: right; float: right;">நட்சத்திரம் / Star</div>
                    </td>    
            </tr>
            <tr height="5"></tr>
        <?php 
            foreach( $names as $k => $name ) :
            ?>
			<?php if($name[0]=="" or $name[1]==""){ ?>
			<tr height="25"></tr>
			<?php } ?>
                <tr>
                    <td colspan="4" style="font-size:18px;"><?php echo $is_tamil || substr($name[0], 0, 3) == 'TAM' ? tamil( substr( $name[0], 3 ) ) : substr( $name[0], 3 ); ?></td>
                </tr>
                <tr>
                    <td colspan="4" style="border-bottom:2px dotted #000;font-size:16px;"><?php echo $name[1]; ?></td>
                </tr>
				
                <tr height="5"></tr>
            <?php
            endforeach;
        endif; ?>
        
        <tr>
        	<td colspan="4" style="font-weight:bold; font-size:16px; border-bottom:1px dashed #000;" align="right"><?php echo $gst_lbl .' S$'. number_format( $amount, 2 ); ?></td>
        </tr>
        <?php if(($box1['name'] == "Coconut Archanai") or ($box1['name'] == "Aathmasanthi Archanai") or ($box1['name'] == "Sri Bairavar Poojai") or ($box1['name'] == "Sankadahara Chathurthi Archanai") or ($box1['name'] == "Vehicle Poojai")){ ?> <tr height="65"></tr> <?php }  ?>
    </table>
    <?php
        if( strlen($data['rec_msg'] ) > 3 ) :
            $rec_msg = substr( $data['rec_msg'], 3);
            ?>
            <div style="width: 100%; margin: 5px 0px; min-height: 10px; text-align: center;">
                <div style="padding: 10px; border-bottom: 1px solid #999; <?php echo substr($data['rec_msg'], 0, 3) == "TAM" ? 'font-family: amudham; font-weight: bold; letter-spacing: 1px; font-size: 14px;' : ''; ?>" ><?php echo $rec_msg; ?></div>
            </div>
            <?php
        endif;
    ?>
    
    <table width="247" border="0" style="font-family:Verdana; font-size:12px;">
        
        <?php 
           // else : 
                // With Footer
            ?>
                
           <!-- <tr>
                <td colspan="2">
                    <table border="0" width="100%" style="border-collapse:collapse;">
                        <tr>
                            <td align="left" valign="top" style="width:10px; border:none; display:block; padding:0; margin:0;"><img src="<?php echo BASE_URL; ?>assets/billing/images/lft_top_stroke.jpg" /></td>
                            <td style="width:260px; border-top:2px solid #000;"></td>
                            <td align="left" style="width:10px; border:none; display:block; padding:0; margin:0;"><img src="<?php echo BASE_URL; ?>assets/billing/images/rt_top_stroke.jpg" /></td>
                        </tr>
                            <tr>
                            <td style="border-left:2px solid #000;">&nbsp;</td>
                            <td align="center" style="color:#000;">அர்ச்சனை முடிந்ததும் இப்பகுதியை அர்ச்சகரிடம் காட்டி உங்கள் காளாஞிசியைப் பெற்றுக்கொள்ளவும்</td>
                            <td style="border-right:2px solid #000;">&nbsp;</td>
                        </tr>
                        <tr>
                            <td height="3" colspan="3" style="border-left:2px solid #000; border-right:2px solid #000;"></td>
                        </tr>
                        <tr>
                            <td style="border-left:2px solid #000;">&nbsp;</td>
                            <td align="center"style="color:#000;">Please retain this portion to collect Archana</td>
                            <td style="border-right:2px solid #000;">&nbsp;</td>
                        </tr>
                        <tr>
                            <td align="left" style="width:10px; border:none; display:block; padding:0; margin:0;"><img src="<?php echo BASE_URL; ?>assets/billing/images/lft_bt_stroke.jpg" /></td>
                            <td style="border-bottom:2px solid #000;"></td>
                            <td align="left" style="width:10px; border:none; display:block; padding:0; margin:0;"><img src="<?php echo BASE_URL; ?>assets/billing/images/rt_bt_stroke.jpg" /></td>
                            </tr>
                    </table>
                </td>
            </tr>
            <tr height="3"></tr>
            <tr>
                    <td colspan="2" style="font-weight:bold; font-size:16px;" align="center"><?php echo $gst_lbl . ' S$' .(is_array( $amount ) ? number_format( $amount[0], 2 ) : number_format( $amount, 2 )); ?></td>
            </tr>-->
        <?php 
        endif;
        
        
        ?>

            