ithinkdone

This commit is contained in:
Sampanna Rimal 2024-07-16 18:43:54 +05:45
parent 7d973eeed5
commit a44570897c
6 changed files with 206 additions and 42 deletions

View File

@ -180,6 +180,28 @@ class Welcome extends CI_Controller
if ($query->num_rows() == 0) {
$this->db->query("ALTER TABLE tbl_purchases ADD COLUMN purchase_ref VARCHAR(50)");
}
$query = $this->db->query("SHOW COLUMNS FROM tbl_accounts LIKE 'account_image'");
// If the column doesn't exist, alter the table to add it
if ($query->num_rows() == 0) {
$this->db->query("ALTER TABLE tbl_accounts ADD COLUMN account_image text");
}
$query = $this->db->query("SHOW COLUMNS FROM tbl_accounts LIKE 'account_number'");
// If the column doesn't exist, alter the table to add it
if ($query->num_rows() == 0) {
$this->db->query("ALTER TABLE tbl_accounts ADD COLUMN account_number VARCHAR(50)");
}
$query = $this->db->query("SHOW COLUMNS FROM tbl_accounts LIKE 'account_branch'");
// If the column doesn't exist, alter the table to add it
if ($query->num_rows() == 0) {
$this->db->query("ALTER TABLE tbl_accounts ADD COLUMN account_branch VARCHAR(50)");
}
$query = $this->db->query("SHOW COLUMNS FROM tbl_branches LIKE 'vat'");
// If the column doesn't exist, alter the table to add it

View File

@ -24,12 +24,14 @@ class Accountheads extends CI_Controller
// 'account_plcategory' => filter_var($_POST['account_plcategory']),
// 'account_currency' => filter_var($_POST['account_currency']),
// 'account_partyname' => filter_var($_POST['account_partyname']),
// 'account_partyaddress' => filter_var($_POST['account_partyaddress']),
// 'account_partypan' => filter_var($_POST['account_partypan']),
// 'account_partycontact' => filter_var($_POST['account_partycontact']),
// 'account_partyemail' => filter_var($_POST['account_partyemail']),
// 'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
// 'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
'account_number' => filter_var($_POST['account_number']),
'account_branch' => filter_var($_POST['account_branch']),
'account_partyaddress' => filter_var($_POST['account_partyaddress']),
'account_partypan' => filter_var($_POST['account_partypan']),
'account_partycontact' => filter_var($_POST['account_partycontact']),
'account_partyemail' => filter_var($_POST['account_partyemail']),
'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
'remarks' => filter_var($_POST['remarks']),
@ -84,6 +86,8 @@ class Accountheads extends CI_Controller
'account_type' => filter_var($_POST['account_type']),
'account_plcategory' => filter_var($_POST['account_plcategory']),
'account_currency' => filter_var($_POST['account_currency']),
'account_number' => filter_var($_POST['account_number']),
'account_branch' => filter_var($_POST['account_branch']),
'account_partyname' => filter_var($_POST['account_partyname']),
'account_partyaddress' => filter_var($_POST['account_partyaddress']),
'account_partypan' => filter_var($_POST['account_partypan']),

View File

@ -76,6 +76,20 @@
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_number">Account Number</label><input type="text" readonly class="form-control" id="account_number" value="<?php echo $Account->account_number; ?>" name="account_number">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_branch">Account Branch</label><input type="text" readonly class="form-control" id="account_branch" value="<?php echo $Account->account_branch; ?>" name="account_branch">
</div>
</div>
<!--COL END-->
</div>
<div class="row">

View File

@ -139,6 +139,32 @@
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_number">Account Number</label><input type="text" class="form-control" id="account_number" value="<?php echo $TableData->account_number; ?>" name="account_number">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_branch">Account Branch</label><input type="text" class="form-control" id="account_branch" value="<?php echo $TableData->account_branch; ?>" name="account_branch">
</div>
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">

View File

@ -14,48 +14,129 @@
</h5>
</div>
<div class="card-body">
<form method=POST action="<?php echo site_url("accounts/accountheads/add"); ?>" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group"> <label for="account_name">Account Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="account_name" value="" name="account_name" required> </div>
<form method="POST" action="<?php echo site_url("accounts/accountheads/add"); ?>" enctype="multipart/form-data" name="tbl_accounts">
<div class="row">
<!-- Account Name -->
<div class="col">
<div class="form-group">
<label for="account_name">Account Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="account_name" value="" name="account_name" required>
</div>
</div>
</div>
<!--COL END-->
</div>
<div class="row">
<div class="col-12">
<div class="form-group">
<?php
$this->myaccounts->showAccountsCategoriesWithParentsCombo($fieldName = "accategory_id", $displayName = "Under", $fieldID = "accategory_id", $condition = "status=1", $default = "", $CSSclass = "select2", "required");
?>
</div>
<div class="row">
<!-- Account Category -->
<div class="col-12">
<div class="form-group">
<?php
// Assuming this PHP function shows a dropdown for account categories
$this->myaccounts->showAccountsCategoriesWithParentsCombo("accategory_id", "Under", "accategory_id", "status=1", "", "select2", "required");
?>
</div>
</div>
</div>
<div class="col-8">
<div class="form-group"> <label for="opening_balance">Opening Balance</label><input type="text" class="form-control" id="opening_balance" value="" name="opening_balance"> </div>
</div>
<div class="col-4">
<div class="form-group"> <label for="opening_balance_drcr">Dr/Cr</label>
<select class="form-control" id="opening_balance_drcr" name="opening_balance_drcr" required>
<option value="DR" class="text-left">Dr</option>
<option value="CR" class="text-left">Cr</option>
</select>
</div>
</div>
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group"> <label for="remarks">Remarks</label> <textarea class="form-control" id="remarks" name="remarks"></textarea> </div>
<div class="row" id="additionalFields" style="display: none;">
<!-- Additional Fields for Sundry Debtors or Sundry Creditors -->
<div class="row">
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Address</label>
<input type="text" class="form-control" id="account_partyaddress" name="account_partyaddress">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partypan">PAN No.</label>
<input type="text" class="form-control" id="account_partypan" name="account_partypan">
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="account_partycontact">Phone No.</label>
<input type="text" class="form-control" id="account_partycontact" name="account_partycontact">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partyemail">Email</label>
<input type="email" class="form-control" id="account_partyemail" name="account_partyemail">
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person Name</label>
<input type="text" class="form-control" id="account_partycontactperson" name="account_partycontactperson">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person No.</label>
<input type="text" class="form-control" id="account_partycontactpersoncontact" name="account_partycontactpersoncontact">
</div>
</div>
</div>
</div>
<div class="row" id="bankFields" style="display: none;">
<!-- Additional Fields for Bank Account -->
<div class="col">
<div class="form-group">
<label for="account_number">Account No.</label>
<input type="text" class="form-control" id="account_number" name="account_number">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_branch">Branch</label>
<input type="text" class="form-control" id="account_branch" name="account_branch">
</div>
</div>
</div>
<div class="row">
<!-- Opening Balance and Dr/Cr -->
<div class="col-8">
<div class="form-group">
<label for="opening_balance">Opening Balance</label>
<input type="text" class="form-control" id="opening_balance" value="" name="opening_balance">
</div>
</div>
<div class="col-4">
<div class="form-group">
<label for="opening_balance_drcr">Dr/Cr</label>
<select class="form-control" id="opening_balance_drcr" name="opening_balance_drcr" required>
<option value="DR">Dr</option>
<option value="CR">Cr</option>
</select>
</div>
</div>
</div>
<div class="row">
<!-- Remarks -->
<div class="col">
<div class="form-group">
<label for="remarks">Remarks</label>
<textarea class="form-control" id="remarks" name="remarks"></textarea>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="row">
<div class="col">
<button class="btn btn-primary btn-sm float-right mt-2" type="submit" name="submit">Save</button>
</div>
</div>
<!--COL END-->
</div>
<!-- <button type="reset" class="btn btn-default btn-sm">Reset</button> -->
<button class="btn btn-primary btn-sm float-right mt-2" type="submit" name="submit">Save</button>
</form>
</div>
</div>
</div>
@ -168,6 +249,23 @@
}
});
}
$(document).ready(function() {
$('#accategory_id').change(function() {
var selectedOption = $(this).val();
// Reset form and hide all additional fields
$('#additionalFields').hide();
$('#bankFields').hide();
$('.required-field').prop('required', false);
// Show additional fields based on selected option
if (selectedOption == 4 || selectedOption == 30) {
$('#additionalFields').show();
$('.required-field').prop('required', true);
} else if (selectedOption == 2) {
$('#bankFields').show();
$('.required-field').prop('required', true);
}
});
});
</script>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB