<div class="modal fade none-border" id="cash_register_modal" tabindex="-1" role="dialog" aria-labelledby="Cash Register" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close hidden-print" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">Cash Register For - <span><?php echo $this->session->userdata('business');?></span> - <span id="cashRegDate"><?php echo date('d-m-Y'); ?></span> </h4>
                <input type="hidden" id='dbformatdate'>
            </div>
            <div class="modal-body">
                
                <div class="row">
                    
                    <center><strong>Daily Cash Count</strong></center>
                    
                    <br>
                    
                    <div class="col-lg-6 col-sm-6 col-xs-6">
                        <table class="table table-bordered">
                            <tbody>
                                 <tr>
                                    <td colspan="2" style="width: 100px;">Yesterday's Till Amount</td>
                                    
                                    <td style="width: 100px; padding-top: 20px;">
                                        <?php echo CURRENCY_CODE;?>. <span id="yesterday_till">0.00</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="width: 100px; ">Additional Opening Cash (if any)</td>
                                    <td style="width: 100px;text-align: right; ">
                                        <input onblur="addZero($(this)); $('#cash_additionspan').html($(this).val());" onfocus="removeZero($(this));"  onkeyup="updateCashRegister($(this));" class="form-control numeric input-sm autodisable hidden-print" id="cash_addition" value="0.00"/>
                                        <span class='hidden-lg hidden-md hidden-sm' id="cash_additionspan"></span>
                                    </td>
                                    
                                </tr>
                                <tr>
                                    <td colspan="2"><b>Total Opening Balance</b></td>
                                    <td style="text-align: right"><?php echo CURRENCY_CODE;?>. <strong id="totalOpening">0.00</strong></td>
                                </tr>
                                <tr>
                                    <td colspan="2" >Cash Received (from invoices)</td>
                                    <td ><?php echo CURRENCY_CODE;?>. <span id="totalCash1">0.00</span></td>
                                </tr>
                                
                                <tr >
                                    <td colspan="2"><b>You Should Have</b></td>
                                    <td style="text-align: right"><?php echo CURRENCY_CODE;?>. <strong id="totalGrand">0.00</strong></td>
                                </tr>
                                <tr><td colspan="3"></td></tr>
                                <tr>
                                    <td style="width: 100px;"><?php echo CURRENCY_CODE;?>. 5000</td>
                                    <td style="width: 100px;"><input type="text" onblur="addZero($(this)); $('#5000span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="5000" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm " id="5000span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x5000">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 1000</td>
                                    <td><input type="text" onblur="addZero($(this));  $('#1000span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="1000" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm" id="1000span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x1000">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 500</td>
                                    <td><input type="text" onblur="addZero($(this));  $('#500span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="500" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm" id="500span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x500">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 100</td>
                                    <td><input type="text" onblur="addZero($(this)); $('#100span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="100" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm"  id="100span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x100">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 75</td>
                                    <td><input type="text" onblur="addZero($(this)); $('#75span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="75" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm"  id="75span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x75">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 50</td>
                                    <td><input type="text" onblur="addZero($(this)); $('#50span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="50" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm"  id="50span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x50">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 20</td>
                                    <td><input type="text" onblur="addZero($(this)); $('#20span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="20" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm"  id="20span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x20">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 10</td>
                                    <td><input type="text" onblur="addZero($(this)); $('#10span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="10" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm"  id="10span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x10">0.00</span></td>
                                </tr>
                               <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 5</td>
                                    <td><input type="text" onblur="addZero($(this)); $('#5span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="5" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm"  id="5span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x5">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><?php echo CURRENCY_CODE;?>. 1</td>
                                    <td><input type="text" onblur="addZero($(this)); $('#1span').html($(this).val());" onfocus="removeZero($(this));" onkeyup="updateCashRegister($(this));" id="1" value="0" class="form-control numeric input-sm autodisable hidden-print"><span class="hidden-lg hidden-md hidden-sm"  id="1span"></span></td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="x1">0.00</span></td>
                                </tr>
                                
                                
                                <tr>
                                    <td colspan="2"><b>You Have in Till</b></td>
                                    <td style="text-align: right"><?php echo CURRENCY_CODE;?>. <strong id="totalSub">0.00</strong></td>
                                </tr>
                               
                                <tr><td colspan="3"></td></tr>
                                
                                <tr>
                                    <td colspan="2"><strong id="difference">DIFFERENCE</strong></td>
                                    <td style="text-align:right"><strong><span id="totalTillDifference"></span></strong>
                                </tr>
                                <tr>
                                    <td colspan="2"  >Tomorrow's Till Amount</td>
                                    <td style="padding-top: 13px;"><input onblur="$('#today_tillspan').html($(this).val());" style="font-weight: bold;" type="text" id="today_till" class="form-control numeric input-sm autodisable hidden-print" placeholder="<?php echo CURRENCY_CODE;?>. 0">
                                        <span id='today_tillspan' class='hidden-lg hidden-md hidden-sm'></span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        
                        <div class="col-lg-12 m-t-20">
<!--                            <div style="text-align: center;">
                              <b>Denominations - (Yesterday Till + Additional cash + Cash in Hand): <?php echo CURRENCY_CODE;?>. <span id="totalTillDifference"></span></b>
                              
                            </div>-->
<!--                             <div style="text-align: center;">
                                 <b>Difference:</b> <?php echo CURRENCY_CODE;?>. <strong id="totalDifference"></strong> &nbsp &nbsp &nbsp &nbsp &nbsp
                               <b>Including Yesterday's Till: <?php echo CURRENCY_CODE;?>. <span id="totalTillDifference"></span></b>
                            </div>-->
                            <div class="form-group">
                                <label>Remarks</label>
                                <textarea class="form-control autodisable" id="cashRemarks"></textarea>
                            </div>
                        </div>
                        
                    </div>
                    
                    <div class="col-lg-6 col-sm-6 col-xs-6">
                        <table class="table table-bordered">
                            <tbody>
                                <tr>
                                    <td>Services</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="totalService">0.00</span></td>
                                </tr>
                                <tr >
                                    <td >Products</td>
                                    <td ><?php echo CURRENCY_CODE;?>. <span id="totalRetail">0.00</span></td>
                                </tr>
                                <tr >
                                    <td >Vouchers</td>
                                    <td ><?php echo CURRENCY_CODE;?>. <span id="totalVoucherSold">0.00</span></td>
                                </tr>
                                <tr >
                                    <td >Training</td>
                                    <td ><?php echo CURRENCY_CODE;?>. <span id="totalTrainings">0.00</span></td>
                                </tr>
                                <tr>
                                    <td>Advance for Services</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="totalAdvance">0.00</span></td>
                                </tr>
                                <tr>
                                    <td>Retained Amount</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="totalRetained">0.00</span></td>
                                </tr> 
                                <tr>
                                    <td><b>Today's Gross Sale</b></td>
                                    <td style="text-align: right"><b><?php echo CURRENCY_CODE;?>. <span id="totalSale">0.00</span></b></td>
                                </tr>
                               <tr>
                                    <td>(Less) Balances Generated</td>
                                    <td>- <?php echo CURRENCY_CODE;?>. <span id="totalBalance">0.00</span></td>
                                </tr>
                                <tr >
                                    <td>(Less) Advance Adjusted</td>
                                    <td>- <?php echo CURRENCY_CODE;?>. <span id="totalAdvanceAdjusted">0.00</span></td>
                                </tr>
                                <tr>
                                <td>(Add) Recovery Received</td>
                                    <td>+ <?php echo CURRENCY_CODE;?>. <span id="totalRecovery">0.00</span></td>
                                </tr>

                                
                                <tr id="trcctips">
                                    <td>(Add) CC Tips</td>
                                    <td>+ <?php echo CURRENCY_CODE;?>. <span id="totalCCTips">0.00</span></td>
                                </tr> 
                                <tr id="trccfee">
                                    <td>(Add) CC Fee</td>
                                    <td>+ <?php echo CURRENCY_CODE;?>. <span id="totalCCFee">0.00</span></td>
                                </tr> 
                               
                                <tr>
                                    <td><b>Today's Net Sale</b></td>
                                    <td style="text-align: right"><b><?php echo CURRENCY_CODE;?>. <span id="totalTransaction">0.00</span></b></td>
                                </tr>
                                 <tr class='hidden' id="trextra">
                                    <td>Extra Charges</td>
                                    <td ><?php echo CURRENCY_CODE;?>. <span id="totalExtra">0.00</span></td>
                                </tr> 
                                <tr class='hidden' id="trtax">
                                    <td>Tax</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="totalTax">0.00</span></td>
                                </tr> 
                                <tr>
                                    <td>Adv. Amount Retained </td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="totalRetained">0.00</span></td>
                                </tr>
                                <tr>
                                    <td colspan="2"></td>
                                </tr>
                                <tr>
                                    <td colspan="2"><b>Break up of Payments Received:</b></td>
                                </tr>

                                <tr>
                                    <td>Card</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="Card">0.00</span></td>
                                </tr>
                               <tr>
                                    <td>Check / Online</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="Checks">0.00</span></td>
                                </tr>
                                <tr>
                                    <td>Voucher</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="totalVoucher">0.00</span></td>
                                </tr>
                                <tr>
                                    <td>Cash</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="Cash">0.00</span></td>
                                </tr>
                                <tr>
                                    <td><b>Total Payments</b></td>
                                    <td style="text-align: right"><b><?php echo CURRENCY_CODE;?>. <span id="totalpayments">0.00</span></b></td>
                                </tr>
                                <tr>
                                    <td colspan="2"></td>
                                </tr>
                                <tr>
                                    <td colspan="2"><b>Cash Reconciliation:</b></td>
                                </tr>                                
                                <tr>
                                    <td>Cash</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="Cash1">0.00</span></td>
                                </tr>
                                <tr>
                                    <td>Cash Returned</td>
                                    <td><?php echo CURRENCY_CODE;?>. <span id="CashReturn">0.00</span></td>
                                </tr>
                                 <tr>
                                    <td style="border-top:1px solid #000" ><i>Final Cash </i></td>
                                    <td style="border-top:1px solid #000" ><i><?php echo CURRENCY_CODE;?>. <span id="CashFinal">0.00</span></i></td>
                                </tr>
                                <tr>
                                    <td>Less: Petty Cash Expense</td>
                                    <td>-<?php echo CURRENCY_CODE;?>. <span id="totalExpenses1">0.00</span></td>
                                </tr>
                                <tr>
                                    <td>Less: CC Tips</td>
                                    <td>-<?php echo CURRENCY_CODE;?>. <span id="totalCCTips1">0.00</span></td>
                                </tr>
                                <tr>
                                    <td ><b>Cash Received</b></td>
                                    <td style="text-align: right"><b><?php echo CURRENCY_CODE;?>. <strong id="totalCash">0.00</strong></b></td>
                                </tr>
                               
                                
                            </tbody>
                        </table>
                    </div>
                    
                    
                    
                    <div class="col-lg-12 col-sm-12 col-xs-12 hidden-print">
                        <div style="text-align: right; margin-top: 10px;">
                            <?php if($this->session->userdata('role')=='Super User'){?>
                                <form style="display: inline-block" method="post" action="<?php echo base_url()?>superuser_controller/reopencashregister">
                                    <input id="mycashregisterid" name="id_cash_register" type="hidden" value="0">
                                    <button type="submit"  class="btn btn-danger waves-effect waves-light">Re Open</button>
                                </form>
                            <?php } ?>
                            <button onclick="cashregisterprint('cash_register_modal');" id="" class="btn btn-inverse waves-effect waves-light"><i class="fa fa-print"></i> Print</button>
                            
                            <button type="button" onclick="saveCashRegister();" class="btn btn-primary waves-effect waves-light">Save Changes</button>
                        </div>
                    </div>
                    
                </div>
                
            </div>
        </div>
    </div>
</div>
<script>
    function cashregisterprint(elem){
        var mywindow = window.open('', 'PRINT', 'height=900,width=750');
        
        
        mywindow.document.write('<html><head><title>' + document.title  + '</title>');
        mywindow.document.write('<html><head><title>' + document.title  + '</title>');
        mywindow.document.write('</head><body >');
        mywindow.document.write('<link href="<?php echo base_url(); ?>assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />');
        mywindow.document.write(document.getElementById(elem).innerHTML);
        
        
        mywindow.document.write('</body></html>');
        
        var delayInMilliseconds = 1000; //1 second
        setTimeout(function() {
            mywindow.document.close(); // necessary for IE >= 10
            mywindow.focus(); // necessary for IE >= 10*/


            mywindow.print();
            mywindow.close();

            return true;

        }, delayInMilliseconds);
        
    }
</script>