This commit is contained in:
Sampanna Rimal 2024-07-12 17:57:29 +05:45
parent 9cd05ef3cb
commit 7ffe31e260
22 changed files with 209 additions and 97 deletions

View File

@ -17,6 +17,12 @@ class Itemcategories extends CI_Controller
switch ($alias) { switch ($alias) {
case 'add': case 'add':
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$title = filter_var($_POST['title']);
$this->db->where('title',$title);
$query = $this->db->get('tbl_itemcategories');
if($query->num_rows() > 0){
echo "Title or code already exists.";die;
}else{
$TableData = array( $TableData = array(
'units_id' => filter_var($_POST['units_id']), 'units_id' => filter_var($_POST['units_id']),
'title' => filter_var($_POST['title']), 'title' => filter_var($_POST['title']),
@ -30,11 +36,22 @@ class Itemcategories extends CI_Controller
$this->db->insert('tbl_itemcategories', $TableData); $this->db->insert('tbl_itemcategories', $TableData);
redirect("inventory/itemcategories/list"); redirect("inventory/itemcategories/list");
} }
}
loadView("inventory/itemcategories/add", $data); loadView("inventory/itemcategories/add", $data);
break; break;
case 'edit': case 'edit':
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$id = $this->uri->segment(4); $id = $this->uri->segment(4);
$title = filter_var($_POST['title']);
$this->db->where('status',1);
$this->db->where('itemcategory_id !=', $id);
$this->db->where('title',$title);
$query = $this->db->get('tbl_itemcategories');
if($query->num_rows() > 0){
echo "Title or description already exists.";die;
}else{
$TableData = array( $TableData = array(
'units_id' => filter_var($_POST['units_id']), 'units_id' => filter_var($_POST['units_id']),
'title' => filter_var($_POST['title']), 'title' => filter_var($_POST['title']),
@ -49,10 +66,11 @@ class Itemcategories extends CI_Controller
$this->db->update('tbl_itemcategories', $TableData); $this->db->update('tbl_itemcategories', $TableData);
redirect("inventory/itemcategories/list"); redirect("inventory/itemcategories/list");
} }
}
$id = $this->uri->segment(4); $id = $this->uri->segment(4);
$this->db->where('itemcategory_id', $id); $this->db->where('itemcategory_id', $id);
$data['itemcategory']=$this->db->get("tbl_itemcategories")->row(); $data['itemcategory']=$this->db->get("tbl_itemcategories")->row();
loadView("inventory/itemcategories/add", $data); loadView("inventory/itemcategories/list", $data);
break; break;
case 'delete': case 'delete':
$id = $this->uri->segment(4); $id = $this->uri->segment(4);

View File

@ -23,6 +23,14 @@ class Items extends CI_Controller
switch ($alias) { switch ($alias) {
case 'add': case 'add':
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$title = filter_var($_POST['title']);
$item_code = filter_var($_POST['item_code']);
$this->db->where('title',$title);
$this->db->or_where('item_code',$item_code);
$query = $this->db->get('tbl_items');
if($query->num_rows() > 0){
echo "Title or code already exists.";die;
}else{
$TableData = array( $TableData = array(
'itemcategories_id' => filter_var($_POST['itemcategories_id']), 'itemcategories_id' => filter_var($_POST['itemcategories_id']),
'item_code' => filter_var($_POST['item_code']), 'item_code' => filter_var($_POST['item_code']),
@ -41,11 +49,24 @@ class Items extends CI_Controller
$this->MStocks->addOpeningStock($id, $qty, $rate); $this->MStocks->addOpeningStock($id, $qty, $rate);
redirect("inventory/items/list"); redirect("inventory/items/list");
} }
}
loadView("inventory/items/add", $data); loadView("inventory/items/add", $data);
break; break;
case 'edit': case 'edit':
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$id = $this->uri->segment(4); $id = $this->uri->segment(4);
$title = filter_var($_POST['title']);
$item_code = filter_var($_POST['item_code']);
$this->db->where('status',1);
$this->db->where('item_id !=', $id);
$this->db->where('title',$title);
$this->db->or_where('item_code',$item_code);
$query = $this->db->get('tbl_items');
if($query->num_rows() > 0){
echo "Title or description already exists.";die;
}else{
$TableData = array( $TableData = array(
'itemcategories_id' => filter_var($_POST['itemcategories_id']), 'itemcategories_id' => filter_var($_POST['itemcategories_id']),
'item_code' => filter_var($_POST['item_code']), 'item_code' => filter_var($_POST['item_code']),
@ -63,6 +84,7 @@ class Items extends CI_Controller
$this->MStocks->updateOpeningStock($id, $qty, $rate); $this->MStocks->updateOpeningStock($id, $qty, $rate);
redirect("inventory/items/list"); redirect("inventory/items/list");
} }
}
$id = $this->uri->segment(4); $id = $this->uri->segment(4);
$this->db->where('item_id', $id); $this->db->where('item_id', $id);
$item = $this->db->get("tbl_items")->row(); $item = $this->db->get("tbl_items")->row();

View File

@ -90,6 +90,7 @@ class Purchases extends CI_Controller
case 'purchase_register': case 'purchase_register':
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords(); $data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
loadView("inventory/purchases/register", $data); loadView("inventory/purchases/register", $data);
break;
default: default:
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords(); $data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
loadView("inventory/purchases/list", $data); loadView("inventory/purchases/list", $data);

View File

@ -9,6 +9,9 @@ class Sales extends CI_Controller
$this->load->model('MSales'); $this->load->model('MSales');
checkLogin(); checkLogin();
} }
public function _remap($alias = "", $params = array()) public function _remap($alias = "", $params = array())
{ {
$data['dataValue'] = $this->session; $data['dataValue'] = $this->session;
@ -100,4 +103,9 @@ class Sales extends CI_Controller
loadView("inventory/sales/list", $data); loadView("inventory/sales/list", $data);
} }
} }
// public function getUnitByItemId($id) {
// $unitName = $this->MStocks->getUnitByItemId($id);
// echo json_encode(['unitName' => $unitName]);
// }
} }

View File

@ -17,6 +17,14 @@ class Units extends CI_Controller
switch ($alias) { switch ($alias) {
case 'add': case 'add':
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$title = filter_var($_POST['title']);
$description = filter_var($_POST['description']);
$this->db->where('title',$title);
$this->db->or_where('description',$description);
$query = $this->db->get('tbl_units');
if($query->num_rows() > 0){
echo "Title or code already exists.";die;
}else{
$TableData = array( $TableData = array(
'title' => filter_var($_POST['title']), 'title' => filter_var($_POST['title']),
'alias' => filter_var($_POST['alias']), 'alias' => filter_var($_POST['alias']),
@ -30,11 +38,25 @@ class Units extends CI_Controller
$this->db->insert('tbl_units', $TableData); $this->db->insert('tbl_units', $TableData);
redirect("inventory/units/list"); redirect("inventory/units/list");
} }
}
loadView("inventory/units/add", $data); loadView("inventory/units/add", $data);
break; break;
case 'edit': case 'edit':
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
$id = $this->uri->segment(4); $id = $this->uri->segment(4);
$title = filter_var($_POST['title']);
$description = filter_var($_POST['description']);
$this->db->where('status',1);
$this->db->where('unit_id !=', $id);
$this->db->where('title',$title);
$this->db->or_where('description',$description);
$query = $this->db->get('tbl_units');
if($query->num_rows() > 0){
echo "Title or description already exists.";die;
}else{
$TableData = array( $TableData = array(
'title' => filter_var($_POST['title']), 'title' => filter_var($_POST['title']),
'alias' => filter_var($_POST['alias']), 'alias' => filter_var($_POST['alias']),
@ -49,10 +71,11 @@ class Units extends CI_Controller
$this->db->update('tbl_units', $TableData); $this->db->update('tbl_units', $TableData);
redirect("inventory/units/list"); redirect("inventory/units/list");
} }
}
$id = $this->uri->segment(4); $id = $this->uri->segment(4);
$this->db->where('unit_id', $id); $this->db->where('unit_id', $id);
$data['unit'] = $this->db->get("tbl_units")->row(); $data['unit'] = $this->db->get("tbl_units")->row();
loadView("inventory/units/add", $data); loadView("inventory/units/list", $data);
break; break;
case 'delete': case 'delete':
$id = $this->uri->segment(4); $id = $this->uri->segment(4);

View File

@ -158,7 +158,7 @@ class Accategories extends CI_Controller
loadView("accounts/accategories/list-parents-only", $data); loadView("accounts/accategories/list-parents-only", $data);
break; break;
case 'childs': case 'childs':
$data['pageTitle'] = "Account Groups"; $data['pageTitle'] = "Account Group";
// $data['ACCategories'] = $this->db->query("select *, (select accategory_name from tbl_accategories as a where a.parent_category_id=b.accategory_id) as parent_category, (select acgroup_name from tbl_acgroups where tbl_acgroups.acgroup_id=b.acgroup_id) as acgroup_name from tbl_accategories as b where status=1")->result(); // $data['ACCategories'] = $this->db->query("select *, (select accategory_name from tbl_accategories as a where a.parent_category_id=b.accategory_id) as parent_category, (select acgroup_name from tbl_acgroups where tbl_acgroups.acgroup_id=b.acgroup_id) as acgroup_name from tbl_accategories as b where status=1")->result();
$data['ACCategories'] = $this->myaccounts->getAccountCategories(); $data['ACCategories'] = $this->myaccounts->getAccountCategories();

View File

@ -222,10 +222,10 @@ class myaccounts
<div class=\"modal-body\" id=\"details_container\"> <div class=\"modal-body\" id=\"details_container\">
Ledger Details Goes Here Ledger Details Goes Here
</div> </div>
<div class=\"modal-footer\"> <!--<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button> <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button>
<button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button> <button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button>
</div> </div>-->
</div> </div>
</div> </div>
</div>"; </div>";

View File

@ -208,4 +208,13 @@ class MStocks extends CI_Model
$this->db->insert("tbl_stocks", $TableData); $this->db->insert("tbl_stocks", $TableData);
} }
} }
// public function getUnitByItemId($id)
// {
// $this->db->where('status', 1);
// $Item = $this->db->where("item_id", $id)->get("tbl_items")->row();
// $Unit = $this->db->where("unit_id", $Item->units_id)->get("tbl_units")->row();
// $unitname = $Unit->title;
// return $unitname;
// }
} }

View File

@ -52,7 +52,7 @@
<div class="col-9"> <div class="col-9">
<div class="card card-primary card-outline"> <div class="card card-primary card-outline">
<div class="card-header"> <div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <h5 class="m-0"><?php echo $pageTitle . 's'; ?>
<!-- <a href="<?php //echo site_url("master/accategories/add_child"); <!-- <a href="<?php //echo site_url("master/accategories/add_child");
?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle; ?>" class="btn btn-sm btn-primary float-right">Create New <?php //echo $pageTitle;
?></a> --> ?></a> -->

View File

@ -23,7 +23,7 @@
</form> </form>
<div id="dataTable_Commands"></div> <div id="dataTable_Commands"></div>
<?php <?php
$fromDate = isset($_GET['from_date']) ? NepaliToEnglishDate($_GET['from_date']) : NepaliToEnglishDate(firstDayOfNepaliMonth()); $fromDate = isset($_GET['from_date']) ? NepaliToEnglishDate($_GET['from_date']) : Today();
$toDate = isset($_GET['to_date']) ? NepaliToEnglishDate($_GET['to_date']) : Today(); $toDate = isset($_GET['to_date']) ? NepaliToEnglishDate($_GET['to_date']) : Today();
// echo $toDate; // echo $toDate;
$account_id = isset($_GET['account_id']) ? $_GET['account_id'] : ''; $account_id = isset($_GET['account_id']) ? $_GET['account_id'] : '';

View File

@ -36,10 +36,10 @@
<div class="modal-body" id="details_container"> <div class="modal-body" id="details_container">
Ledger Details Goes Here Ledger Details Goes Here
</div> </div>
<div class="modal-footer"> <!-- <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal">Print</button> <button type="button" class="btn btn-success" data-dismiss="modal">Print</button>
</div> </div> -->
</div> </div>
</div> </div>
</div> </div>

View File

@ -18,7 +18,7 @@
<div class="row"> <div class="row">
<div class="col"><?php createNepaliDateInput("from_date", "", "from_date", isset($fromDate_Nepali) ? $fromDate_Nepali : firstDayOfNepaliMonth()); ?></div> <div class="col"><?php createNepaliDateInput("from_date", "", "from_date", isset($fromDate_Nepali) ? $fromDate_Nepali : firstDayOfNepaliMonth()); ?></div>
<div class="col"><?php createNepaliDateInput("to_date", "", "to_date", isset($toDate_Nepali) ? $toDate_Nepali : ''); ?></div> <div class="col"><?php createNepaliDateInput("to_date", "", "to_date", isset($toDate_Nepali) ? $toDate_Nepali : ''); ?></div>
<div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : '', $CSSclass = ""); ?> </div> <div class="col"><?php $this->myaccounts->showAccountsCombo("account_id", "", "account_id", "status=1", isset($_GET['account_id']) ? $_GET['account_id'] : 1, $CSSclass = ""); ?> </div>
<div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger","Submit", "btn btn-primary"); ?></div> <div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger","Submit", "btn btn-primary"); ?></div>
</div> </div>
</form> </form>
@ -31,7 +31,11 @@
<div id="dataTable_Commands"> <div id="dataTable_Commands">
</div> </div>
<?php
if(!isset($account_id)){
$account_id = 1;
}
?>
<?php if (isset($account_id) && $account_id != "") { <?php if (isset($account_id) && $account_id != "") {
$fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth()); $fromDate = NepaliToEnglishDate(isset($_GET['from_date']) ? $_GET['from_date'] : firstDayOfNepaliMonth());

View File

@ -60,10 +60,10 @@
<div class=\"modal-body\" id=\"details_container\"> <div class=\"modal-body\" id=\"details_container\">
Ledger Details Goes Here Ledger Details Goes Here
</div> </div>
<div class=\"modal-footer\"> <!--<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button> <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button>
<button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button> <button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button>
</div> </div>-->
</div> </div>
</div> </div>
</div>"; </div>";

View File

@ -61,10 +61,10 @@
<div class=\"modal-body\" id=\"details_container\"> <div class=\"modal-body\" id=\"details_container\">
Ledger Details Goes Here Ledger Details Goes Here
</div> </div>
<div class=\"modal-footer\"> <!--<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button> <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button>
<button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button> <button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button>
</div> </div>-->
</div> </div>
</div> </div>
</div>"; </div>";

View File

@ -43,7 +43,7 @@
<!--COL START--> <!--COL START-->
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="description"><?php myLang('Description'); ?></label> <label for="description"><?php myLang('Remarks'); ?></label>
<textarea class="form-control" id="description" name="description"><?php echo isset($itemcategory) ? $itemcategory->description : ''; ?></textarea> <textarea class="form-control" id="description" name="description"><?php echo isset($itemcategory) ? $itemcategory->description : ''; ?></textarea>
</div> </div>
</div> </div>
@ -84,13 +84,13 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_itemcategories where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_itemcategories where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th width="5%"><?php myLang('S.N'); ?></th> <th width="5%"><?php myLang('S.N'); ?></th>
<th width="30%"><?php myLang('Inventory Group'); ?></th> <th width="30%"><?php myLang('Inventory Group'); ?></th>
<!-- <th width="5%"><?php //myLang('Unit'); ?></th> --> <!-- <th width="5%"><?php //myLang('Unit'); ?></th> -->
<th width="57%"><?php myLang('Description'); ?></th> <th width="57%"><?php myLang('Remarks'); ?></th>
<td width="8%"><?php myLang("Action"); ?></th> <td width="8%"><?php myLang("Action"); ?></th>
</tr> </tr>
</thead> </thead>

View File

@ -114,7 +114,7 @@
</h5> </h5>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th width="5%"><?php myLang('S.N'); ?></th> <th width="5%"><?php myLang('S.N'); ?></th>

View File

@ -174,6 +174,33 @@
// newRow.find('.select2').select2(); // newRow.find('.select2').select2();
// calculateTotals(); // calculateTotals();
}); });
// $(document).on('change', '.select_item', function(){
// var selectedOption = $(this).find(':selected');
// var selectedValue = selectedOption.val();
// alert(selectedValue);
// var unitInput = $(this).closest('.sales-detail-duplicator').find('.item_unit');
// if (selectedValue) {
// $.ajax({
// url: '<?php //echo base_url(); ?>application/controllers/inventory/Sales/getUnitByItemId/' + selectedValue,
// method: 'POST',
// success: function(response) {
// console.log(response);
// unitInput.val(unitName);
// alert("Selected Item Value: " + selectedValue + "\nUnit: " + unitName);
// },
// error: function() {
// alert("Error retrieving unit data.");
// }
// });
// } else {
// unitInput.val('');
// alert("No item selected.");
// }
// });
// $(document).on("click", ".remove-sales-detail", function() { // $(document).on("click", ".remove-sales-detail", function() {
// $(this).closest(".sales-detail").remove(); // $(this).closest(".sales-detail").remove();
// calculateTotals(); // calculateTotals();

View File

@ -34,7 +34,7 @@
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="description"><?php myLang('Unit Code'); ?></label> <label for="description"><?php myLang('Unit Code'); ?></label>
<input class="form-control" id="description" name="description"><?php echo isset($unit) ? $unit->description : ''; ?> <input class="form-control" id="description" name="description" value="<?php echo isset($unit) ? $unit->description : ''; ?>" name="description" >
</div> </div>
</div> </div>
<!--COL END--> <!--COL END-->
@ -65,7 +65,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_units where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_units where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th class="table-col col-1"><?php myLang('S.N'); ?></th> <th class="table-col col-1"><?php myLang('S.N'); ?></th>

View File

@ -15,7 +15,7 @@
<div class="card-body "> <div class="card-body ">
<?php $TableData = $this->db->query("select * from tbl_translations where status=1")->result(); ?> <?php $TableData = $this->db->query("select * from tbl_translations where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable"> <table class="table table-bordered table-striped longdataTable">
<thead> <thead>
<tr> <tr>
<th class="text-center col-1"><?php myLang('Translation Id'); ?></th> <th class="text-center col-1"><?php myLang('Translation Id'); ?></th>

Binary file not shown.

Binary file not shown.

Binary file not shown.