704 lines
18 KiB
PHP
Executable File
704 lines
18 KiB
PHP
Executable File
<?php
|
|
foreach ($financialyear as $item) {
|
|
$finyear = $item->financial_year;
|
|
}
|
|
?>
|
|
|
|
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
|
|
<style>
|
|
.dataTables_filter input {
|
|
padding: 4px;
|
|
}
|
|
|
|
.dataTables_filter {
|
|
width: 50%;
|
|
float: right;
|
|
text-align: right;
|
|
}
|
|
|
|
.dataTables_paginate {
|
|
width: 50%;
|
|
float: right;
|
|
text-align: right;
|
|
}
|
|
|
|
div.dt-buttons {
|
|
position: relative;
|
|
float: right;
|
|
|
|
}
|
|
</style>
|
|
|
|
|
|
<div class="content-wrapper">
|
|
<section class="content">
|
|
<div class="row">
|
|
|
|
<!-- Left col -->
|
|
<div class="col-md-12">
|
|
<!-- TABLE: LATEST. ORDERS -->
|
|
<div class="box box-info" id="content">
|
|
<br>
|
|
<div class="col-md-1 col-md-offset-11">
|
|
<a href="<?php base_url() ?>Bankingstatement" class="btn btn-success" value="Back" />Back</a>
|
|
</div>
|
|
<br>
|
|
|
|
<form method="post" action="<?php echo base_url($this->uri->uri_string()); ?>">
|
|
|
|
<center>
|
|
<h3 class="box-title">
|
|
<p style="color: #00d976;"><b>View Invoice</b></p>
|
|
</h3>
|
|
</center>
|
|
|
|
<div class="box-body">
|
|
<table class="table table-bordered table-hover" style="table-layout:auto;">
|
|
<thead>
|
|
<tr>
|
|
|
|
<th>Payment ID</th>
|
|
<th>Payment Mode</th>
|
|
<th>Payment Amount (₹)</th>
|
|
<th>Payment date </th>
|
|
<th>Naration </th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
<p style="margin-left:25px;" id="bid"></p>
|
|
</td>
|
|
<td>Bank</td>
|
|
<td>
|
|
<p style="margin-left:25px;" id="bamount"></p>
|
|
</td>
|
|
<td>
|
|
<p style="margin-left:25px;" id="bdate"></p>
|
|
</td>
|
|
<td>
|
|
<p style="margin-left:25px;" id="narration"></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<br>
|
|
<br>
|
|
|
|
<div class="row">
|
|
<!-- <div class="col-md-3" style=" border: 2px solid black;font-size:14px;background-color:#ccc;"> -->
|
|
|
|
<input type="hidden" id="debitamount" value="<?php echo $cash; ?>" placeholder="Debit Amount" readonly>
|
|
|
|
<input type="hidden" id="bankid" value="<?php echo $bankid; ?>" placeholder="Bank Id" readonly>
|
|
|
|
|
|
|
|
<!-- <div style=" border: 2px solid black;margin-left:0%;margin-top: -55px;font-size:14px;background-color:#ccc;"> -->
|
|
<!-- <p style="margin-left:25px;" id="bid" value=""</b>>Payment ID: </p>
|
|
<p style="margin-left:25px;">Payment Mode: Bank</p>
|
|
<p style="margin-left:25px;" id="bamount" value="">Payment Amount: </p>
|
|
<p style="margin-left:25px;" id="bdate" value="">Payment Amount Date: </p> -->
|
|
|
|
<!-- </div> -->
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label for="from_date"> <?php echo 'From Date'; ?></label>
|
|
<div class="input-group">
|
|
<input name="from_date" id="max-date" class="form-control datepicker">
|
|
<span class="input-group-addon">
|
|
<i class="fa fa-calendar fa-fw"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-3">
|
|
<label for="to_date">
|
|
<?php echo 'To Date'; ?>
|
|
</label>
|
|
<div class="input-group">
|
|
<input name="to_date" id="min-date" class="form-control datepicker">
|
|
<span class="input-group-addon">
|
|
<i class="fa fa-calendar fa-fw"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<label for="customer">
|
|
<?php echo 'Customer'; ?>
|
|
</label>
|
|
<select class="form-control" id="Customer" name="Customer">
|
|
<option value="">Select Customer</option>
|
|
<?php
|
|
foreach ($getcustomer as $gc): { ?>
|
|
<option value="<?php echo $gc->client_id; ?>"><?php echo $gc->client_name; ?></option>
|
|
|
|
<?php }
|
|
endforeach; ?>
|
|
|
|
</select>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-3" style="margin-top:20px;">
|
|
<input type="submit" class="btn btn-success" name="btn_submit"
|
|
value="View Invoice">
|
|
|
|
|
|
|
|
</div><!--/ inside 1st .row closed -->
|
|
</div>
|
|
|
|
<br>
|
|
<br>
|
|
<div class="row">
|
|
|
|
|
|
</div>
|
|
</form>
|
|
<br>
|
|
<br>
|
|
<input type="hidden" name="Rowid" id="Rowid" placeholder="Row Id" readonly>
|
|
<table class="table table-bordered table-hover" id="req" style="table-layout:auto;">
|
|
<thead>
|
|
<tr>
|
|
<th>Select</th>
|
|
<th>Date</th>
|
|
<th>Invoice Number</th>
|
|
<th>Customer Name</th>
|
|
<th style="display:none;">Customer ID</th>
|
|
<th>Invoice Amount (₹)</th>
|
|
<th> Balance Receivable</th>
|
|
<th> Amount Received</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$i = 1;
|
|
$ti = 0.00;
|
|
$tvt = 0.00;
|
|
if (!empty($bankinvoicedata)) {
|
|
foreach ($bankinvoicedata as $t) {
|
|
//print_r($bankinvoicedata);
|
|
$status = $t->Paymentstatus;
|
|
$balancetopay = $t->Balancetopay;
|
|
if ($status != 'ST057') {
|
|
?>
|
|
<tr>
|
|
|
|
<td data-name="sell"><input type="checkbox" onchange="GetPayment(<?php echo $i ?>) " id="checkboxcheckbox<?php echo $i ?>" name="checkbox<?php echo $i ?>" ;></td>
|
|
<td align="left" id="invoicedate<?php echo $i ?>"><span><?php echo format_date($t->invoice_date_created, 0, 'd-m-Y'); ?></span></td>
|
|
<td align="left" id="invoice_id<?php echo $i ?>"><a href="<?= base_url() ?>cashbook/mappingcredit?sid=<?php echo $t->invoice_number; ?>"><span><?php echo $t->invoice_number ?></span></td>
|
|
<td align="left" id="client_name<?php echo $i ?>"><span><?php echo $t->client_name ?></span></td>
|
|
<td style="display:none;" align="left" id="clientid<?php echo $i ?>"><span><?php echo $t->client_id ?></span></td>
|
|
<td align="left" id="invoice_paid<?php echo $i ?>"><span><?php echo $t->invoice_total ?></span></td>
|
|
<td align="left" id="invoice_balance<?php echo $i ?>"><span><?php echo ($t->invoice_total) - ($t->amountreceived) ?></span></td>
|
|
<td data-name="sel"><input type="text" onkeypress="return isNumberKey(event)" onchange="GetAmount(<?php echo $i ?>)" id="invoicereceived<?php echo $i ?>"></td>
|
|
|
|
</tr>
|
|
<?php
|
|
$i++;
|
|
}
|
|
}
|
|
?>
|
|
</tbody>
|
|
<tfoot width="100%">
|
|
<tr>
|
|
<td style="text-align:left;"><strong>Total</strong></td>
|
|
<td> </td>
|
|
<td> </td>
|
|
<td> </td>
|
|
<td> </td>
|
|
<td> </td>
|
|
<td class="amount"><strong>
|
|
|
|
<input type="text" id="addvalue" name="addvalue">
|
|
|
|
</strong>
|
|
</td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
<?php } ?>
|
|
</table>
|
|
|
|
<div class="col-md-2 col-md-offset-10" style="margin-top:24px;">
|
|
<a style="float:right;" class="btn btn-success ajax-loader" ID="Save" onclick="Save()"> <span class="bold">Save</span></a>
|
|
</div>
|
|
|
|
</div><!-- / .box-body closed -->
|
|
</div><!-- /.box box-info closed-->
|
|
|
|
</div><!--/ .col (col-md-12)-->
|
|
|
|
</div><!-- /. 1st row closed -->
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12" id="HideInvoiceDateDiv"></div>
|
|
|
|
<div class="col-md-12" id="HideInvoiceIdDiv"></div>
|
|
|
|
<div class="col-md-12" id="HideCustomerNameDiv"></div>
|
|
|
|
<div class="col-md-12" id="HideCustomeridDiv"></div>
|
|
|
|
<div class="col-md-12" id="HideInvoiceAmtDiv"></div>
|
|
|
|
<div class="col-md-12" id="HideInvoiceRecdDiv"></div>
|
|
|
|
<input type="hidden" name="Recid" id="Recid" value="" placeholder="Rec Id" readonly>
|
|
|
|
</div><!-- /. 2nd row closed -->
|
|
|
|
</section>
|
|
</div>
|
|
|
|
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
|
|
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
|
|
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
var res = localStorage.getItem('test2');
|
|
$('#debitamount').val(localStorage.getItem('tes'));
|
|
var amount = localStorage.getItem('tes');
|
|
var cashdate = localStorage.getItem('ccdate');
|
|
|
|
var narration = localStorage.getItem('narr')
|
|
document.getElementById("bamount").innerHTML = amount;
|
|
document.getElementById("bdate").innerHTML = cashdate;
|
|
document.getElementById("narration").innerHTML = narration;
|
|
var res1 = res.split(',');
|
|
var i;
|
|
$.each(res1, function(index, value) {
|
|
var res2 = value.split('-');
|
|
var bid = res2[0];
|
|
var bam = res2[1];
|
|
|
|
$('#bankid').val(bid);
|
|
|
|
document.getElementById("bid").innerHTML = bid;
|
|
}); /** foreach closed */
|
|
|
|
table = $('#req').DataTable({
|
|
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
|
|
"<'row'<'col-md-6'><'col-md-6'>>" +
|
|
"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
|
|
buttons: [{
|
|
extend: 'excelHtml5',
|
|
footer: 'true',
|
|
messageTop: $('h3').text(),
|
|
title: 'cashbook Overall Report',
|
|
exportOptions: {
|
|
columns: ':visible'
|
|
|
|
}
|
|
},
|
|
|
|
'colvis'
|
|
]
|
|
}); /** datatable closed */
|
|
}); /** ready closed */
|
|
|
|
var tempinvoice = []; // tempinvoice - This array for Invoice no with its value and its checkbox select number('checkbox_select_number'-'id'-'value').
|
|
var tempTotal = []; // tempTotal - This array for get value from "tempinvoice" to calculate grandtotal
|
|
var row = 0;
|
|
var intex = 1;
|
|
|
|
function GetPayment(i) {
|
|
var x = document.getElementById('checkboxcheckbox' + i).checked;
|
|
|
|
|
|
var amount = parseFloat($('#invoicereceived' + i).val() == '' ? '0.00' : $('#invoicereceived' + i).val())
|
|
//alert(amount);
|
|
var negative = 0;
|
|
// if(amount<0)
|
|
// {
|
|
// negative=1;
|
|
// alert("Invalid Amount")
|
|
// $('#invoicereceived'+i).val('');
|
|
|
|
// }
|
|
temp = intex;
|
|
if (x == true) {
|
|
|
|
row = parseInt(row) + 1;
|
|
$('#Rowid').val(row);
|
|
var date = document.getElementById("invoicedate" + i).innerText;
|
|
var invid1 = document.getElementById("invoice_id" + i).innerText;
|
|
var invid = invid1.trim();
|
|
|
|
var cusname = document.getElementById("client_name" + i).innerText;
|
|
var cusid = document.getElementById("clientid" + i).innerText;
|
|
|
|
var invoiceamount = document.getElementById("invoice_paid" + i).innerText;
|
|
var invoicereceived1 = document.getElementById("invoice_balance" + i).innerText;
|
|
var invoicereceived = invoicereceived1.trim();
|
|
//alert(invoicereceived+'inv');
|
|
$('#invoicereceived' + i).val(invoicereceived);
|
|
|
|
$('<input>').attr({
|
|
type: 'hidden',
|
|
name: 'hideinvoicedate' + i,
|
|
id: 'hideinvoicedate' + i,
|
|
value: date
|
|
}).appendTo('#HideInvoiceDateDiv');
|
|
|
|
$('<input>').attr({
|
|
type: 'hidden',
|
|
name: 'hideinvoiceid' + i,
|
|
id: 'hideinvoiceid' + i,
|
|
value: invid
|
|
}).appendTo('#HideInvoiceIdDiv');
|
|
|
|
$('<input>').attr({
|
|
type: 'hidden',
|
|
name: 'hidecustomername' + i,
|
|
id: 'hidecustomername' + i,
|
|
value: cusname
|
|
}).appendTo('#HideCustomerNameDiv');
|
|
|
|
$('<input>').attr({
|
|
type: 'hidden',
|
|
name: 'hidecustomerid' + i,
|
|
id: 'hidecustomerid' + i,
|
|
value: cusid
|
|
}).appendTo('#HideCustomeridDiv');
|
|
|
|
$('<input>').attr({
|
|
type: 'hidden',
|
|
name: 'hideinvoiceamount' + i,
|
|
id: 'hideinvoiceamount' + i,
|
|
value: invoiceamount
|
|
}).appendTo('#HideInvoiceAmtDiv');
|
|
|
|
$('<input>').attr({
|
|
type: 'hidden',
|
|
name: 'hideinvoicerecd' + i,
|
|
id: 'hideinvoicerecd' + i,
|
|
value: invoicereceived
|
|
}).appendTo('#HideInvoiceRecdDiv');
|
|
|
|
if (negative == 1) {
|
|
|
|
|
|
for (o = 1; o < i; o++) //need to ask
|
|
{
|
|
$('#invoice_balance1' + o).val('')
|
|
|
|
}
|
|
}
|
|
|
|
//alert(invid+'iv');
|
|
|
|
var invoicevalue = i + ',' + invid + ',' + invoicereceived;
|
|
|
|
tempinvoice.push(invoicevalue);
|
|
|
|
calculategrandtotal();
|
|
|
|
intex = parseInt(intex) + 1;
|
|
|
|
|
|
} else {
|
|
|
|
var rr = $('#Rowid').val();
|
|
row = parseInt(rr) - 1;
|
|
|
|
var Payment = parseFloat($('#invoicereceived' + i).val() == '' ? '0.00' : $('#invoicereceived' + i).val());
|
|
var Inid1 = document.getElementById('invoice_id' + i).innerText
|
|
var Inid = Inid1.trim();
|
|
var invoicevalue = i + ',' + Inid + ',' + Payment;
|
|
//alert(invoicevalue);
|
|
|
|
var a = tempinvoice.indexOf(invoicevalue);
|
|
var b = tempTotal.indexOf(Payment);
|
|
|
|
if (a != -1) {
|
|
tempinvoice.splice(a, 1);
|
|
//console.log(tempinvoice);
|
|
}
|
|
if (b != -1) {
|
|
tempTotal.splice(a, 1);
|
|
//console.log(tempTotal);
|
|
}
|
|
calculategrandtotal();
|
|
|
|
$('#invoicereceived' + i).val('');
|
|
|
|
$('#Rowid').val(row);
|
|
|
|
$('#invoicereceived' + i).val('');
|
|
$('#hideinvoicedate' + i).val('');
|
|
$('#hideinvoiceid' + i).val('');
|
|
$('#hidecustomername' + i).val('');
|
|
$('#hidecustomerid' + i).val('');
|
|
$('#hideinvoiceamount' + i).val('');
|
|
$('#hideinvoicerecd' + i).val('');
|
|
|
|
$('#hideinvoicedate' + i).remove();
|
|
$('#hideinvoiceid' + i).remove();
|
|
$('#hidecustomername' + i).remove();
|
|
$('#hidecustomerid' + i).remove();
|
|
$('#hideinvoiceamount' + i).remove();
|
|
$('#hideinvoicerecd' + i).remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function isNumberKey(evt) {
|
|
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
|
// Added to allow decimal, period, or delete
|
|
if (charCode == 110 || charCode == 190 || charCode == 46)
|
|
return true;
|
|
|
|
if (charCode > 31 && (charCode < 48 || charCode > 57))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
function GetAmount(i) {
|
|
|
|
var amount = parseFloat($('#invoicereceived' + i).val() == '' ? '0.00' : $('#invoicereceived' + i).val());
|
|
|
|
|
|
var x = document.getElementById('checkboxcheckbox' + i).checked;
|
|
if (x == true) {
|
|
|
|
var date = document.getElementById("invoicedate" + i).innerText;
|
|
var invid1 = document.getElementById("invoice_id" + i).innerText;
|
|
var invid = invid1.trim();
|
|
var cusname = document.getElementById("client_name" + i).innerText;
|
|
|
|
var cusid = document.getElementById("clientid" + i).innerText;
|
|
var invoiceamount = document.getElementById("invoice_paid" + i).innerText;
|
|
|
|
var invoicereceived = document.getElementById("invoice_balance" + i).innerText;
|
|
|
|
for (k = 1; k <= i; k++) {
|
|
var idcheck = $('#hideinvoiceid' + k).val();
|
|
if (invid == idcheck) {
|
|
var cid = k;
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#hideinvoicedate').val(date);
|
|
$('#hideinvoiceid' + cid).val(invid);
|
|
$('#hidecustomername' + cid).val(cusname);
|
|
$('#hidecustomerid' + cid).val(cusid);
|
|
$('#hideinvoiceamount' + cid).val(invoiceamount);
|
|
$('#hideinvoicerecd' + cid).val(amount);
|
|
var totalvalue = $('#addvalue').val();
|
|
//alert(totalvalue);
|
|
var bid = $('#bankid').val();
|
|
|
|
|
|
|
|
$.each(tempinvoice, function(index, value) {
|
|
|
|
|
|
var res2 = value.split(',')
|
|
|
|
var as = res2[1];
|
|
var sa = res2[2];
|
|
var concat = as.concat(sa);
|
|
var res3 = concat.replace('2018', '2018-');
|
|
|
|
|
|
if (res3 == invid) {
|
|
|
|
tempinvoice[index] = i + ',' + invid + ',' + amount;
|
|
|
|
} else if (as == invid) {
|
|
|
|
|
|
tempinvoice[index] = i + ',' + invid + ',' + amount;
|
|
}
|
|
});
|
|
calculategrandtotal();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function calculategrandtotal() {
|
|
|
|
$.each(tempinvoice, function(index, value) {
|
|
|
|
var res2 = value.split(',');
|
|
|
|
var a = res2.length;
|
|
|
|
|
|
if (res2.length == 3) {
|
|
|
|
tempTotal[index] = parseFloat(res2[2]);
|
|
|
|
|
|
} else {
|
|
tempTotal[index] = parseFloat(res2[3]);
|
|
}
|
|
});
|
|
//console.log(tempTotal);
|
|
var sum = 0;
|
|
|
|
for (var i = 0; i < tempTotal.length; i++) {
|
|
// alert(tempTotal);
|
|
// if(tempTotal < 0)
|
|
// {
|
|
// alert('minusvalue');
|
|
// }
|
|
// else
|
|
// {
|
|
// alert('plus');
|
|
// }
|
|
sum += tempTotal[i];
|
|
|
|
}
|
|
|
|
$('#addvalue').val(parseFloat(sum).toFixed(2));
|
|
|
|
}
|
|
|
|
function Save() {
|
|
|
|
var totalamount = $('#addvalue').val();
|
|
var bankamount = $('#debitamount').val();
|
|
if (parseFloat(bankamount) >= parseFloat(totalamount)) {
|
|
$('#loader').show();
|
|
var totalvalue = $('#addvalue').val();
|
|
|
|
var rowCount = $('#Rowid').val();
|
|
|
|
var check = 0;
|
|
var rw = 0;
|
|
for (i = 1; i <= rowCount; i++) {
|
|
|
|
var arrval = tempinvoice[i - 1];
|
|
var number = arrval.split(',');
|
|
number = number[0];
|
|
|
|
//alert('rowcount'+i+'selectedcheckboxnumber'+number+'tempinvoice'+arrval);
|
|
rw = parseFloat(rw) + 1;
|
|
check = parseFloat(check) + 1;
|
|
var bankdebitamount = $('#debitamount').val();
|
|
var bankdate = localStorage.getItem('ccdate')
|
|
|
|
var bid = $('#bankid').val();
|
|
|
|
var date = $('#hideinvoicedate' + number).val();
|
|
|
|
var invid = $('#hideinvoiceid' + number).val();
|
|
|
|
var customername = $('#hidecustomername' + number).val();
|
|
|
|
var customerid = $('#hidecustomerid' + number).val();
|
|
|
|
|
|
var invoiceamount1 = $('#hideinvoiceamount' + number).val();
|
|
var invoiceamount = invoiceamount1.trim();
|
|
//alert()
|
|
var amountreceived = $('#hideinvoicerecd' + number).val();
|
|
|
|
var invoicereceived = $('#invoicereceived' + number).val();
|
|
|
|
//var payment = parseFloat(invoiceamount);
|
|
|
|
$.ajax({
|
|
data: {
|
|
bankdate: bankdate,
|
|
date: date,
|
|
invid: invid,
|
|
cname: customername,
|
|
cid: customerid,
|
|
invamount: invoiceamount,
|
|
ar: amountreceived,
|
|
rc: rowCount,
|
|
tpv: totalvalue,
|
|
bda: bankdebitamount,
|
|
bi: bid,
|
|
check: check,
|
|
rw: rw,
|
|
invrec: invoicereceived
|
|
},
|
|
type: "POST",
|
|
url: "<?php echo base_url() ?>cashbook/invoiceamount1",
|
|
success: function(data) {
|
|
$('#loader').hide();
|
|
if (data) {
|
|
//alert('Saved Successfully');
|
|
window.location.href = "Bankingstatement";
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
// j=j+1;
|
|
}
|
|
} else {
|
|
alert('Your Amount Is Not Match');
|
|
location.reload();
|
|
}
|
|
}
|
|
</script>
|
|
<script>
|
|
$(function() {
|
|
//var dateFormat = "mm/dd/yy",
|
|
from = $("#min-date")
|
|
.datepicker({
|
|
dateFormat: "dd-mm-yy",
|
|
defaultDate: "+0d",
|
|
changeMonth: true,
|
|
//numberOfMonths: 1
|
|
|
|
})
|
|
.on("change", function() {
|
|
to.datepicker("option", "minDate", getDate(this));
|
|
}),
|
|
to = $("#max-date").datepicker({
|
|
dateFormat: "dd-mm-yy",
|
|
defaultDate: "+0d",
|
|
changeMonth: true,
|
|
//numberOfMonths: 1
|
|
|
|
})
|
|
.on("change", function() {
|
|
from.datepicker("option", "maxDate", getDate(this));
|
|
});
|
|
|
|
function getDate(element) {
|
|
var date;
|
|
|
|
try {
|
|
date = $.datepicker.parseDate(dateFormat, element.value);
|
|
|
|
} catch (error) {
|
|
date = null;
|
|
}
|
|
|
|
return date;
|
|
}
|
|
});
|
|
</script>
|