daterange

This commit is contained in:
Sampanna Rimal 2024-07-26 12:50:15 +05:45
parent 873e48f7e9
commit c16163bf01
8 changed files with 52 additions and 7 deletions

View File

@ -206,6 +206,8 @@ class Vouchers extends CI_Controller
{ {
$data['pageTitle'] = $VoucherType->voucher_name; $data['pageTitle'] = $VoucherType->voucher_name;
$data['VoucherType'] = $VoucherType; $data['VoucherType'] = $VoucherType;
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$command = $this->uri->segment(4); $command = $this->uri->segment(4);
switch ($command) { switch ($command) {
case 'create': case 'create':
@ -263,6 +265,7 @@ class Vouchers extends CI_Controller
echo json_encode(['status' => 'success']); echo json_encode(['status' => 'success']);
loadview("accounts/vouchers/create", $data);
break; break;
} }

View File

@ -62,6 +62,8 @@ class Purchases extends CI_Controller
break; break;
case 'add': case 'add':
// //
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$TableData = array( $TableData = array(
'transaction_type' => filter_var($_POST['transaction_type']), 'transaction_type' => filter_var($_POST['transaction_type']),

View File

@ -19,6 +19,8 @@ class Sales extends CI_Controller
switch ($alias) { switch ($alias) {
case 'create': case 'create':
$data['items'] = $this->MStocks->getSellableItems(); $data['items'] = $this->MStocks->getSellableItems();
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
loadView("inventory/sales/create", $data); loadView("inventory/sales/create", $data);
break; break;
case 'store': case 'store':

View File

@ -95,7 +95,7 @@ button:hover {
<div class="col-2"> <div class="col-2">
<fieldset> <fieldset>
<legend>Transaction Date <span class="text-danger">*</span></legend> <legend>Transaction Date <span class="text-danger">*</span></legend>
<input type="text" class="form-control2 nepaliDatePicker" id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date" required> <input type="text" class="form-control2 " id="voucher_date" value="<?php echo NepaliDate(); ?>" name="voucher_date" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" required>
</fieldset> </fieldset>
</div> </div>
<div class="col-8"> <div class="col-8">
@ -499,4 +499,15 @@ button:hover {
} }
$("#saveButton").prop("disabled", true); $("#saveButton").prop("disabled", true);
</script> </script>
<?php function footerFunctions()
{ ?>
<script>
$("#voucher_date").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#voucher_date').data('start'),
maxDate: $('#voucher_date').data('end'),
});
</script>
<?php } ?>

View File

@ -72,6 +72,7 @@
border: 0px; border: 0px;
} }
</style> </style>
<div class="content-wrapper"> <div class="content-wrapper">
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
@ -89,7 +90,7 @@
<div class="row mb-2"> <div class="row mb-2">
<div class="col-2"> <div class="col-2">
<fieldset> <fieldset>
<legend>Transaction Date</legend><input type="text" class="form-control2 nepaliDatePicker" id="purchase_date" value="<?php echo NepaliDate(); ?>" name="purchase_date"> <legend>Transaction Date</legend><input type="text" class="form-control2" id="purchase_date" value="<?php echo NepaliDate(); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" name="purchase_date">
</fieldset> </fieldset>
</div> </div>
<div class="col-8"> <div class="col-8">
@ -429,3 +430,16 @@
} }
}); });
</script> </script>
<?php function footerFunctions()
{ ?>
<script>
$("#purchase_date").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#purchase_date').data('start'),
maxDate: $('#purchase_date').data('end'),
});
</script>
<?php } ?>

View File

@ -22,7 +22,7 @@
<div class="row bill-details"> <div class="row bill-details">
<div class="col"> <div class="col">
<p><strong>Bill Number:</strong> <?php echo $Purchase->purchase_id; ?></p> <p><strong>Bill Number:</strong> <?php echo $Purchase->purchase_id; ?></p>
<p><strong>Date:</strong> <?php echo myDate($Purchase->purchase_date); ?></p> <p><strong>Date:</strong> <?php echo dbDate($Purchase->purchase_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name; ?></p> <p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name; ?></p>
</div> </div>

View File

@ -12,7 +12,7 @@
<div class="col-2"> <div class="col-2">
<fieldset> <fieldset>
<legend>Transaction Date <span class="text-danger">*</span></legend> <legend>Transaction Date <span class="text-danger">*</span></legend>
<input type="text" class="form-control2 nepaliDatePicker" id="salesDate" value="<?php echo NepaliDate(); ?>" name="salesDate" required> <input type="text" class="form-control2" id="salesDate" value="<?php echo NepaliDate(); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" name="salesDate" required>
</fieldset> </fieldset>
</div> </div>
<div class="col-8"> <div class="col-8">
@ -261,3 +261,16 @@
$('#grandtotal').val(grandTotal.toFixed(2)); $('#grandtotal').val(grandTotal.toFixed(2));
} }
</script> </script>
<?php function footerFunctions()
{ ?>
<script>
$("#salesDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#salesDate').data('start'),
maxDate: $('#salesDate').data('end'),
});
</script>
<?php } ?>

View File

@ -22,7 +22,7 @@
<div class="row bill-details"> <div class="row bill-details">
<div class="col"> <div class="col">
<p><strong>Bill Number:</strong> <?php echo $Sales->sales_id; ?></p> <p><strong>Bill Number:</strong> <?php echo $Sales->sales_id; ?></p>
<p><strong>Date:</strong> <?php echo myDate($Sales->sales_date); ?></p> <p><strong>Date:</strong> <?php echo dbDate($Sales->sales_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name; ?></p> <p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name; ?></p>
</div> </div>