<?php 
    $this->load->view('templates/header');
    $role = $this->session->userdata('user_role_id');
    // echo $role;
?>
<script>
     var link = "voucher";
        
    <?php
        if($voucher_type == 'PAYMENT'):
    ?>
            var sub_link = "voucher_payment";
    <?php
        elseif($voucher_type == 'RECEIPT'):
    ?>
            var sub_link = "voucher_receipt";
    <?php
        endif;
    ?>
</script>

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1 class="content_top">
        <?php
            if($voucher_type == 'PAYMENT')
                echo "Add New Payment Voucher";
            elseif($voucher_type == 'RECEIPT')
                echo "Add New Receipt Voucher";
            else
                echo "Add New Opening Voucher";
        ?>
    </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">
                <?php
                    if($voucher_type == 'PAYMENT')
                        echo "Add New Payment Voucher";
                    elseif($voucher_type == 'RECEIPT')
                        echo "Add New Receipt Voucher";
                    else
                        echo "Add New Opening Voucher";
                ?>                    
            </li>
        </ol>
</section>


<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box box-primary">
				<div class="box-body">
					<div class="alert_msg"></div>
					<form class="form-horizontal" id="receipt_voucher_form">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">Voucher Details</h3>
                            </div>
                            <div class="panel-body remove-bottom">
        						<!-- <div class="box-body "> -->

        							<div class="form-group floating-form">
        								<div class="col-md-1 floating-label">
        									<input type="text" class="form-control floating-input" id="vc_entry_no" name="vc_entry_no" value="<?php echo (empty($voucher_data)?$entry_no:$voucher_data[0]['vc_entry_no'])?>" placeholder=" " autocomplete="off" readonly />
                                            <label>Voucher No.</label>
        								</div>
        								<div class="col-md-1 floating-label">
        									<?php $readonly = ($role == 1) ? 'tabindex=1' : 'readonly'; ?>
        									<input type="text" class="form-control floating-input" id="vc_entry_date" name="vc_entry_date" value="<?php echo (empty($voucher_data) ? date("d-m-Y") : date('d-m-Y',strtotime($voucher_data[0]['vc_entry_date'])))?>" placeholder=" " autocomplete="off" <?php echo $readonly ?> />
                                            <label>Voucher Date</label>                                        
                                        </div>
                                        <div class="col-md-2 floating-label">
                                            <?Php
                                                if($voucher_type == 'PAYMENT'):
                                            ?>
                                            <input type="hidden" name="vc_voucher_type" id="vc_voucher_type" value="1" />
                                            <?Php
                                                else:
                                            ?>
                                            <input type="hidden" name="vc_voucher_type" id="vc_voucher_type" value="2" />
                                            <?php
                                                endif;
                                            ?>
        									<?php echo form_dropdown('', $account_data, (isset($voucher_data))?$voucher_data[0]['vc_cash_acc_id']:'','id="vc_cash_acc_id" name="vc_cash_acc_id" class="form-control floating-select" tabindex="2" onchange="set_chq_field(this.value)"');?> 
                                            <label>Cash Account</label>                                        
                                        </div>
                                        <div class="col-md-2 floating-label">
                                            <?php echo form_dropdown('', $group_data, (isset($voucher_data))?$voucher_data[0]['vc_grp_id']:'','id="vc_grp_id" name="vc_grp_id" class="form-control floating-select" onChange="get_party_list();" tabindex="3" ');?>
                                            <label>Group</label>                                        
                                        </div>
                                        <div class="col-md-2 floating-label">
                                            <?php echo form_dropdown('', $party_data, (isset($voucher_data))?$voucher_data[0]['vc_party_id']:'','id="vc_party_id" name="vc_party_id" class="form-control floating-select" onChange="get_party_receipt_status();" tabindex="4" ');?> 
                                            <label>Party Name</label>                                        
                                        </div>
                                        <div class="col-md-1 floating-label">
                                            <input type="text" name="vc_cheque_no" class="form-control floating-input" id="vc_cheque_no"  placeholder=" " autocomplete="off" value="" style="display: none;" />
                                            <label id="vc_cheque_no_label" style="display: none;">Cheque no</label>
                                        </div>
                                        <div class="col-md-1 floating-label">
                                            <input type="text" name="vc_cheque_date" class="form-control floating-input" id="vc_cheque_date"  placeholder=" " autocomplete="off" value="" style="display: none;" />
                                            <label id="vc_cheque_date_label" style="display: none;">Cheque Date</label>
                                        </div>
                                         <div class="col-md-1">
                                             <button type="button" class="btn btn-primary" id="sbt_btn" onClick="add_receipt_voucher(0)" ><?php echo (empty($voucher_data)?"Submit":"Update")?></button>
                                        </div>
                                        <div class="col-md-1">
                                            <a href="<?php echo base_url('voucher/voucherctrl/voucher_master?action=view');?>" type="button" class="btn btn-danger" >Cancel</a>
                                        </div>
                                    </div>
                                    <div class="form-group floating-form">
                                        <div class="col-md-2 floating-label">
                                            <input type="text" name="" class="form-control floating-input" id="vc_payment_status"  placeholder=" " value="" readonly />
                                            <label>Balance</label>                                        
                                        </div>
                                        <div class="col-md-2 floating-label">
                                            <?Php
                                                if($voucher_type == 'PAYMENT'):
                                            ?>
                                            <input type="hidden" name="op_trans_type" class="form-control" id="op_trans_type" value="DR" />
                                            <?php
                                                else:
                                            ?>
                                            <input type="hidden" name="op_trans_type" class="form-control" id="op_trans_type" value="CR" />
                                            <?php
                                                endif;
                                            ?>
                                            <input type="number" name="vc_amount" class="form-control floating-input" id="vc_amount" value="<?php echo (empty($voucher_data)?0:$voucher_data[0]['vc_amount'])?>" placeholder=" " oninput="this.value = Math.abs(this.value)"  />
                                            <label>Receipt Amount</label>                                        
                                        </div>
                                        <div class="col-md-2 floating-label">
                                            <input type="number" name="vc_round_off" class="form-control floating-input" id="vc_round_off" value="<?php echo (empty($voucher_data)?0:$voucher_data[0]['vc_round_off'])?>" onkeyup="check_round_off_amt();" placeholder=" " oninput="this.value = Math.abs(this.value)"  />
                                            <label>Round off</label>                                        
                                        </div>
                                        <div class="col-md-2 floating-label">                                            
                                            <textarea name="vc_notes" class="form-control floating-input" id="vc_notes"  placeholder=" "rows="3"><?php echo (empty($voucher_data)?"":$voucher_data[0]['vc_notes'])?></textarea>
                                            <label>Notes</label>
                                        </div>
                                        
        							</div>
        						<!-- </div> -->
                            </div>
                        </div>
                        <div id="bal_purchase_details">
                        </div>
					</form>
				</div>
			</div>
		</div>
	</div>
</section>
<!-- Main content -->


<?php 
    $this->load->view('templates/footer');
?>
<script src="<?php echo assets('js/voucher/voucher.js')?>"></script>

</body>
</html>