<link rel="stylesheet" href="<?php echo base_url();?>assets/js/validationEngine.jquery.css" type="text/css" />
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/cust_paginition.css" type="text/css" />
<div id="addMagezine">
    <div class="modal-dialog">
        <div class="modal-content">
            <!-- Modal heading -->
            <!-- // Modal heading END -->
            <!-- Modal body -->
            <div class="modal-body">

                <div class="innerAll">
                    <div class="innerLR">

                        <div id="print_div">
                            <div class="navbar-header">
                                <a id="logo" href="<?php echo base_url(); ?>" class="pull-left">
                                    <img src="<?php echo base_url(); ?>assets/images/logo/sub-logo.jpg" />
                                    <h4 align="center">Subscription Management System</h4>
                                </a>
                            </div>
                            <a class="btn pull-right mar" href="<?php echo base_url(); ?>index.php/subscriber/preview/?user_id=<?php echo $encSubscriberId; ?>"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> </a>

                            <div style="clear: both"></div>

                            <div class="modal-header">
                                <h4 class="modal-title" align="center">Invoice Voucher</h4>
                            </div>
                            <div style="clear: both"></div>

                            <div>
                                <table class="table table-white table-vertical-center margin-none table-striped footable" >
                                    <thead>
                                    <tr>
                                        <td class="text-center">Name of Subscriber:</td>
                                        <td class="text-center"><?php echo $arrData['sub_name'] ?></td>

                                    </tr>
                                    <tr>
                                        <td class="text-center">Magazine Id:</td>
                                        <td class="text-center"><?php echo $arrData['mag_id'] ?></td>

                                    </tr>
                                    <tr>
                                        <td class="text-center">Transaction Date:</td>
                                        <td class="text-center"><?php echo date("d M Y", strtotime($arrData['date'])) ?></td>

                                    </tr>
                                    <tr>
                                        <td class="text-center">Campaign Code:</td>
                                        <td class="text-center"><?php echo ($arrData['promo_code'])?$arrData['promo_code']: "-"; ?></td>

                                    </tr>
                                    <tr>
                                        <td class="text-center">Start Issue:</td>
                                        <td class="text-center"><?php echo ($arrData['start_Issue'])?$arrData['start_Issue']: "-"; ?></td>

                                    </tr>
                                    <tr>
                                        <td class="text-center">End Issue:</td>
                                        <td class="text-center"><?php echo ($arrData['end_Issue'])?$arrData['end_Issue']: "-"; ?></td>

                                    </tr>
                                    </thead>
                                </table>
                            </div>
                            <div style="clear: both"></div>
                            <hr>
                            <br>
                            <br>
                            <div class="modal-header">
                                <h5 class="modal-title" align="center">Payment details</h5>
                            </div>

                            <div>

                                <table class="table table-white table-vertical-center margin-none table-striped footable" border="1">
                                    <thead>
                                    <tr>

                                        <th  class="text-center">Magazine Name</th>
                                        <th data-hide="phone" class="text-center">No of year</th>
                                        <th data-hide="phone" class="text-center">Campaign Code</th>
                                        <th class="text-center">Total Amount</th>
                                    </tr>
                                    <tr>

                                        <td class="text-center"><?php echo $arrData['mag_name'] ?></td>
                                        <td class="text-center"><?php echo $arrData['year'] ?></td>
                                        <td class="text-center"><?php echo ($arrData['promo_code'])?$arrData['promo_code']: "-"; ?></td>
                                        <td class="text-center"><?php echo $arrData['total_amount']." ".$arrData['currency'];?></td>
                                    </tr>

                                    </thead>
                                </table>
                            </div>
                            <br>
                            <br>



                            <hr>
                            <div class="modal-header">
                                <h5 class="" align="right">Total Amount : <?php echo $arrData['total_amount']; ?></h5>
                            </div>
                        </div>
                        <hr>
                        <br><br>
                        <h5 class="" align="right"><small>Thank you for choosing Subscription Management System<small></small></h5>
                        <div align="center" id="this_msg">

                        </div>

                    <br><br>
                    <div class="form-group">
                        <div class="col-sm-offset-4 col-sm-10" align="left">
                            <?php

                            $arrSend = base64_encode(json_encode($arrData));
                            $strRedirectUrl = base_url()."index.php/subscriber/generate_invoice_pdf/?view=subscriber/invoice&data=".$arrSend; ?>
                            <a href="<?php echo $strRedirectUrl; ?>"><button type="button" class="btn btn-primary" id ="btnSubmit">Download PDF</button></a>
                            <button type="button" class="btn btn-primary" onClick="printDiv()">Print</button>
                            <button type="button" class="btn btn-primary" onClick="fnSendEmail()">Send subscriber Email</button>
                            <input type="hidden" name="vl" id = "vl" value="<?php echo $arrData;?>" >
                            <input type="hidden" name="enc_subscription_id" id = "enc_subscription_id" value="<?php echo $encSubscription_Id;?>" >
                            <a class="btn" href="<?php echo base_url(); ?>index.php/subscriber/preview/?user_id=<?php echo $encSubscriberId; ?>"> <button type="button" class="btn btn-primary">Back</button></a>
                        </div>
                    </div>
                    <br>
                </div>
            </div>

        </div>
    </div>
</div>


<script src="<?php echo base_url();?>assets/js/main.js" type="text/javascript"></script>
<script>
    function printDiv() {

        w = window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=850,height=750');
        w.document.write($('#print_div').html());
        w.print();
        w.close();
        }


    function fnSendEmail() {
        $('#this_msg').empty();
        var arrValues = $("#vl").val();
        var strTransaction_Id = $("#enc_subscription_id").val();
        alert(strTransaction_Id);
        $.ajax({
            url: '<?php echo base_url(); ?>'+"index.php/subscriber/fnSendEmail",
            'data' : {
                'transaction_id' :strTransaction_Id
            },
            type: "POST",
            success: function(data){
                alert(data);
                //$('#this_msg').html(data).show();
                //$('#this_msg').fadeOut(6000);

            }
        });
    }


</script>

