edit
This commit is contained in:
@ -38,7 +38,7 @@
|
||||
<!--COL START-->
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<?php fillComboWithValue("units_id", "Units <span class='text-danger'>*</span>", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '',); ?>
|
||||
<?php fillComboWithValue("units_id", "Units <span class='text-danger'>*</span>", "units_id", "tbl_units", "title", "unit_id", isset($item) ? $item->units_id : '', "", false, "", true); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!--COL END-->
|
||||
@ -47,7 +47,7 @@
|
||||
<!--COL START-->
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<?php fillComboWithValue("itemcategories_id", "Group <span class='text-danger'>*</span>", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : ''); ?>
|
||||
<?php fillComboWithValue("itemcategories_id", "Group <span class='text-danger'>*</span>", "itemcategories_id", "tbl_itemcategories", "title", "itemcategory_id", isset($item) ? $item->itemcategories_id : '', "", false, "", true); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!--COL END-->
|
||||
|
@ -441,10 +441,8 @@
|
||||
});
|
||||
|
||||
if(type=='amount'){
|
||||
alert("amount");
|
||||
discountamount = parseFloat($("input[name='discount']").val());
|
||||
discountpercent = (discountamount * 100) / subtotal;
|
||||
alert(discountamount);
|
||||
$("#discountpercentage").val(discountpercent.toFixed(2));
|
||||
}else{
|
||||
discountpercent = parseFloat($("input[name='discountpercentage']").val());
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
|
||||
<!-- <button class="btn btn-primary btn-xs float-right" style="margin-left: 2px;" onclick="printDiv('printableArea')"><i class="fas fa-print"></i></button> -->
|
||||
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add","Create New ".$pageTitle); ?></h5>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="printableArea">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row bill-header">
|
||||
@ -88,11 +88,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function printDiv(divName) {
|
||||
var printContents = document.getElementById(divName).innerHTML;
|
||||
var originalContents = document.body.innerHTML;
|
||||
|
||||
document.body.innerHTML = printContents;
|
||||
|
||||
window.print();
|
||||
|
||||
document.body.innerHTML = originalContents;
|
||||
}
|
||||
</script>
|
||||
|
@ -240,10 +240,8 @@
|
||||
var discountamount = 0;
|
||||
var discountpercent = 0;
|
||||
if(type=='amount'){
|
||||
alert("amount");
|
||||
discountamount = parseFloat($("input[name='discount']").val());
|
||||
discountpercent = (discountamount * 100) / subtotal;
|
||||
alert(discountamount);
|
||||
$("#discountpercentage").val(discountpercent.toFixed(2));
|
||||
}else{
|
||||
discountpercent = parseFloat($("input[name='discountpercentage']").val());
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-header">
|
||||
|
||||
<!-- <button class="btn btn-primary btn-xs float-right" style="margin-left: 2px;" onclick="printDiv('printableArea')"><i class="fas fa-print"></i></button> -->
|
||||
<h5 class="m-0"><?php echo $pageTitle; ?> <a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a></h5>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="printableArea">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row bill-header">
|
||||
@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -94,69 +94,85 @@
|
||||
?></a> -->
|
||||
</h5>
|
||||
<div class="card-tools">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
Filters
|
||||
</button>
|
||||
<div class="dropdown-menu" role="menu">
|
||||
<div class="form-group p-2 pb-0">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
|
||||
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
|
||||
<form method="post" action="" id="FilterForm">
|
||||
<!-- button with a dropdown -->
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
|
||||
Filters
|
||||
</button>
|
||||
<div class="dropdown-menu" role="menu">
|
||||
<div class="form-group p-2 pb-0">
|
||||
<div class="col">
|
||||
<div class="form-group">
|
||||
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
|
||||
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="toDate"><?php myLang("Ending Period"); ?></label>
|
||||
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="toDate"><?php myLang("Ending Period"); ?></label>
|
||||
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
|
||||
<div class="dropdown-divider"></div>
|
||||
<!-- <div class="form-check">
|
||||
<input class="form-check-input" type="checkbox">
|
||||
<label class="form-check-label">Select
|
||||
All</label>
|
||||
</div> -->
|
||||
<div class="form-check">
|
||||
<!-- <input type="hidden" name="showOB" value="not"> -->
|
||||
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
|
||||
<!-- <input class="form-check-input" type="checkbox"> -->
|
||||
<label class="form-check-label" for="showOB">Opening</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<!-- <input class="form-check-input" type="checkbox"> -->
|
||||
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
|
||||
<label class="form-check-label" for="showClosing">Closing</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<!-- <input class="form-check-input" type="checkbox" checked> -->
|
||||
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
|
||||
<label class="form-check-label" for="showPeriod">Period</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-divider"></div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox">
|
||||
<label class="form-check-label">Select
|
||||
All</label>
|
||||
<div class="form-group p-2 pb-0 text-right">
|
||||
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
|
||||
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
|
||||
<!-- <input class="form-check-input" type="checkbox"> -->
|
||||
<label class="form-check-label">Opening</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<!-- <input class="form-check-input" type="checkbox"> -->
|
||||
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
|
||||
<label class="form-check-label">Closing</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<!-- <input class="form-check-input" type="checkbox" checked> -->
|
||||
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
|
||||
<label class="form-check-label">Period</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-divider"></div>
|
||||
<div class="form-group p-2 pb-0">
|
||||
<button type="submit" class="btn btn-primary btn-sm mr-2 text-center">Search Now</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
|
||||
Export
|
||||
</button>
|
||||
<!-- <div class="dropdown-menu" role="menu">
|
||||
<a href="#" class="dropdown-item">Export</a>
|
||||
<a href="#" class="dropdown-item">Pdf</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="#" class="dropdown-item">View calendar</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
|
||||
</form>
|
||||
<script>
|
||||
function resetForm() {
|
||||
document.getElementById("fromDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>";
|
||||
document.getElementById("toDate").value = "<?php echo NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>";
|
||||
document.getElementById("showOB").checked = <?php echo "false"; ?>;
|
||||
document.getElementById("showClosing").checked = <?php echo "false"; ?>;
|
||||
document.getElementById("FilterForm").submit();
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table class="table table-bordered table-striped dataTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" width="40" style="vertical-align: middle;"><?php myLang('S.No.'); ?></th>
|
||||
<th rowspan="2" width="40" style="vertical-align: middle;"><?php myLang('S.No.'); ?></th>
|
||||
<th rowspan="2" style="vertical-align: middle;"> <?php myLang('Item'); ?></th>
|
||||
<th rowspan="2" width="80" style="vertical-align: middle;"><?php myLang('Units'); ?></th>
|
||||
<th colspan="3" class="text-center"><?php myLang('Opening'); ?></th>
|
||||
@ -180,12 +196,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $Total = 0;$PTotal=0;$STotal=0;$CTotal=0;
|
||||
foreach ($StockRecords as $TableRow) : ?>
|
||||
<?php $Total = 0;
|
||||
$PTotal = 0;
|
||||
$STotal = 0;
|
||||
$CTotal = 0;
|
||||
foreach ($StockRecords as $index => $TableRow) : ?>
|
||||
<tr>
|
||||
|
||||
<td></td>
|
||||
<td><?php echo ($TableRow->Item)?$TableRow->Item->title:"N/A"; ?></td>
|
||||
<td><?php echo $index + 1; ?></td>
|
||||
<td><?php echo ($TableRow->Item) ? $TableRow->Item->title : "N/A"; ?></td>
|
||||
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Item->units_id); ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td>
|
||||
<td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td>
|
||||
@ -226,4 +244,85 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php function footerFunctions()
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Prevent the dropdown from closing when clicking inside
|
||||
$('.dropdown-menu').on('click', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// var exportButton = document.getElementById("exportButton");
|
||||
// exportButton.addEventListener("click", function() {
|
||||
// exportTableToCSV("table.csv");
|
||||
// });
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Trigger click event on page load
|
||||
document.getElementById("toggleShowAll").click();
|
||||
});
|
||||
document.getElementById("toggleShowAll").addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
var nestedRows = document.getElementsByClassName("collapse");
|
||||
for (var i = 0; i < nestedRows.length; i++) {
|
||||
if (nestedRows[i].classList.contains("show")) {
|
||||
nestedRows[i].classList.remove("show");
|
||||
} else {
|
||||
nestedRows[i].classList.add("show");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function exportTableToCSV(filename) {
|
||||
var csv = [];
|
||||
var rows = document.querySelectorAll("table tr:not(.hide)");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = [];
|
||||
var cols = rows[i].querySelectorAll("td:not(.hide), th:not(.hide)");
|
||||
// Check if the parent row is collapsed or hidden
|
||||
var parentRow = rows[i].closest(".collapse");
|
||||
var isParentCollapsed = parentRow && (!parentRow.classList.contains("show"));
|
||||
if (isParentCollapsed) {
|
||||
continue; // Skip child table rows if parent is collapsed
|
||||
}
|
||||
for (var j = 0; j < cols.length; j++) {
|
||||
var cellValue = cols[j].innerText.replace(/,/g, ""); // Remove commas from the cell value
|
||||
row.push(cellValue);
|
||||
}
|
||||
csv.push(row.join(","));
|
||||
}
|
||||
// Create a CSV file
|
||||
var csvContent = "data:text/csv;charset=utf-8," + csv.join("\n");
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", encodedUri);
|
||||
link.setAttribute("download", filename);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$("#fromDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#fromDate').data('start'),
|
||||
maxDate: $('#fromDate').data('end'),
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$("#toDate").nepaliDatePicker({
|
||||
dateFormat: "%y-%m-%d",
|
||||
closeOnDateSelect: true,
|
||||
minDate: $('#toDate').data('start'),
|
||||
maxDate: $('#toDate').data('end'),
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user