indent testype purchase vat

This commit is contained in:
Sampanna Rimal 2024-08-08 12:16:46 +05:45
parent 52f9c0dd15
commit 9f5ba32db2
17 changed files with 255 additions and 143 deletions

View File

@ -234,5 +234,12 @@ class Welcome extends CI_Controller
if ($query->num_rows() == 0) {
$this->db->query("ALTER TABLE tbl_sales ADD COLUMN vatToggle INT(11)");
}
$query = $this->db->query("SHOW COLUMNS FROM tbl_accounts LIKE 'account_bank'");
// 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_bank VARCHAR(50)");
}
}
}

View File

@ -26,6 +26,7 @@ class Accountheads extends CI_Controller
// 'account_partyname' => filter_var($_POST['account_partyname']),
'account_number' => filter_var($_POST['account_number']),
'account_branch' => filter_var($_POST['account_branch']),
'account_bank' => filter_var($_POST['account_bank']),
'account_partyaddress' => filter_var($_POST['account_partyaddress']),
'account_partypan' => filter_var($_POST['account_partypan']),
'account_partycontact' => filter_var($_POST['account_partycontact']),
@ -88,6 +89,7 @@ class Accountheads extends CI_Controller
'account_currency' => filter_var($_POST['account_currency']),
'account_number' => filter_var($_POST['account_number']),
'account_branch' => filter_var($_POST['account_branch']),
'account_bank' => filter_var($_POST['account_bank']),
'account_partyname' => filter_var($_POST['account_partyname']),
'account_partyaddress' => filter_var($_POST['account_partyaddress']),
'account_partypan' => filter_var($_POST['account_partypan']),

View File

@ -32,6 +32,7 @@ class Sales extends CI_Controller
'accounts_id' => filter_var($_POST['accounts_id']),
'sales_date' => filter_var($_POST['salesDate']),
'discount' => filter_var($_POST['discountpercentage']),
'vatToggle' => filter_var($_POST['vatToggleValue']),
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
'remarks' => '',

View File

@ -608,10 +608,16 @@ class bibaccounts
<?php } ?>
<tbody>
<?php foreach ($accountCategories as $accountCategory) : ?>
<?php //print_r($accountCategory);die; ?>
<?php if ($ReportOptions['showZeroBalances'] && $accountCategory->isZero == true) continue; ?>
<tr class="<?php echo ($accountCategory->isParent) ? ' parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>">
<td class="group-name"><b><?php echo $accountCategory->accategory_name; ?></b></td>
<td class="group-name">
<?php if($accountCategory->parent_category_id): ?>
<?php echo "&nbsp;&nbsp;". $accountCategory->accategory_name; ?>
<?php else: ?>
<b><?php echo $accountCategory->accategory_name; ?></b>
<?php endif; ?>
</td>
<?php if ($ReportOptions['showOB']) : ?>
<td class="group-total text-bold underline" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'DR') ? $accountCategory->opening_balance : 0); ?></td>
<td class="group-total text-bold underline" width="<?php echo $ReportOptions['AmountColWidth']; ?>"><?php echo myCurrency(($accountCategory->posting_side == 'CR') ? $accountCategory->opening_balance : 0); ?></td>

View File

@ -63,17 +63,25 @@
<img class="profile-user-img img-fluid " src="<?php echo isset($Account->account_image) && $Account->account_image ? base_url('uploads/' . $Account->account_image) : base_url('/dist/img/user4-128x128.jpg'); ?>" alt="User profile picture">
</div>
</div>
<div class="col">
<!-- <div class="col">
<div class="form-group">
<label for="account_code">Account Category</label><input type="text" readonly class="form-control" id="account_code" value="<?php echo getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $Account->accategory_id); ?>" name="account_code">
</div>
</div>
</div> -->
<!--COL END-->
<!--COL START-->
<div class="col">
<!-- <div class="col">
<div class="form-group">
<label for="account_code">Account Code</label><input type="text" readonly class="form-control" id="account_code" value="<?php echo $Account->account_code; ?>" name="account_code">
</div>
</div> -->
<!--COL END-->
<!--COL START-->
<?php if (getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $Account->accategory_id) == "Bank Account"): ?>
<div class="col">
<div class="form-group">
<label for="account_bank">Account Bank</label><input type="text" readonly class="form-control" id="account_bank" value="<?php echo $Account->account_bank; ?>" name="account_bank">
</div>
</div>
<!--COL END-->
<!--COL START-->
@ -89,36 +97,53 @@
<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>
<?php endif; ?>
<!--COL END-->
</div>
<?php $category_name = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $Account->accategory_id);?>
<?php if ($category_name == "Sundry Creditors" || $category_name == "Sundry Debtors"): ?>
<div class="row">
<!--COL START-->
<div class="col">
<!-- <div class="col">
<div class="form-group">
<label for="account_partyname">Party Name</label><input type="text" readonly class="form-control" id="account_partyname" value="<?php echo $Account->account_partyname; ?>" name="account_partyname">
</div>
</div>
</div> -->
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="col-4">
<div class="form-group">
<label for="account_partyaddress">Party Address</label><input type="text" readonly class="form-control" id="account_partyaddress" value="<?php echo $Account->account_partyaddress; ?>" name="account_partyaddress">
</div>
</div>
<div class="col-2">
<div class="col-4">
<div class="form-group">
<label for="account_partypan">PAN</label><input type="text" readonly class="form-control" id="account_partypan" value="<?php echo $Account->account_partypan; ?>" name="account_partypan">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col-2">
<div class="col-4">
<div class="form-group">
<label for="account_partycontact">Party Contact</label><input type="text" readonly class="form-control" id="account_partycontact" value="<?php echo $Account->account_partycontact; ?>" name="account_partycontact">
</div>
</div>
<!--COL END-->
<!--COL START-->
<!-- <div class="col">
<div class="form-group">
<label for="account_partyemail">Party Email</label><input type="email" readonly class="form-control" id="account_partyemail" value="<?php echo $Account->account_partyemail; ?>" name="account_partyemail">
</div>
</div> -->
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
@ -126,8 +151,6 @@
</div>
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
@ -143,12 +166,13 @@
</div>
<!--COL END-->
</div>
<?php endif; ?>
<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" readonly></textarea>
<textarea class="form-control" id="remarks" name="remarks" readonly><?php echo htmlspecialchars($Account->remarks); ?></textarea>
</div>
</div>
<!--COL END-->

View File

@ -1,5 +1,5 @@
<div class="content-wrapper">
<div class="content">
<div class="container-fluid">
<div class="row">
@ -15,154 +15,174 @@
<!--COL START-->
<div class="col-10">
<div class="form-group">
<label for="account_name">Account Name</label><input type="text" class="form-control" id="account_name" value="<?php echo $TableData->account_name; ?>" name="account_name">
<label for="account_name">Account Name</label><input type="text" class="form-control" id="account_name" value="<?php echo $TableData->account_name; ?>" name="account_name">
</div>
</div>
<div class="col-2">
<div class="form-group">
<label for="exampleInputFile">Upload Image</label>
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" id="exampleInputFile" name="account_image" value="<?php echo $TableData->account_image; ?>" onchange="previewImage(event)">
<label class="custom-file-label" for="exampleInputFile">Choose file</label>
<div class="form-group">
<label for="exampleInputFile">Upload Image</label>
<div class="input-group">
<div class="custom-file">
<input type="file" class="custom-file-input" id="exampleInputFile" name="account_image" value="<?php echo $TableData->account_image; ?>" onchange="previewImage(event)">
<label class="custom-file-label" for="exampleInputFile">Choose file</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-7">
<div class="form-group">
<?php fillComboWithValue("accategory_id", "Under", "accategory_id", "tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id, "", false, "status=1"); ?>
</div>
</div>
<!--COL END-->
<!--COL START-->
<!-- <div class="col-2">
<div class="form-group">
<label for="account_code">Account Code</label><input type="text" readonly class="form-control" id="account_code" value="<?php //echo $TableData->account_code; ?>" name="account_code">
<label for="account_code">Account Code</label><input type="text" readonly class="form-control" id="account_code" value="<?php //echo $TableData->account_code;
?>" name="account_code">
</div>
</div> -->
<!--COL END-->
<!--COL START-->
<div class="col-2">
<div class="form-group"> <label for="opening_balance">Opening Balance</label><input type="text" class="form-control" id="opening_balance"
value="<?php echo ($TableData->OpeningEntry)?((($TableData->OpeningEntry->dr)>0)?$TableData->OpeningEntry->dr:$TableData->OpeningEntry->cr):""; ?>" name="opening_balance"> </div>
<div class="form-group"> <label for="opening_balance">Opening Balance</label><input type="text" class="form-control" id="opening_balance" value="<?php echo ($TableData->OpeningEntry) ? ((($TableData->OpeningEntry->dr) > 0) ? $TableData->OpeningEntry->dr : $TableData->OpeningEntry->cr) : ""; ?>" name="opening_balance"> </div>
</div>
<div class="col-1">
<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"
<?php echo ($TableData->OpeningEntry)?((($TableData->OpeningEntry->dr)!=0)?"SELECTED":""):""; ?>>Dr</option>
<option value="CR"
<?php echo ($TableData->OpeningEntry)?((($TableData->OpeningEntry->cr)!=0)?"SELECTED":""):""; ?>>Cr</option>
</select>
<select class="form-control" id="opening_balance_drcr" name="opening_balance_drcr" required>
<option value="DR" <?php echo ($TableData->OpeningEntry) ? ((($TableData->OpeningEntry->dr) != 0) ? "SELECTED" : "") : ""; ?>>Dr</option>
<option value="CR" <?php echo ($TableData->OpeningEntry) ? ((($TableData->OpeningEntry->cr) != 0) ? "SELECTED" : "") : ""; ?>>Cr</option>
</select>
</div>
</div>
<!--image display-->
<div class="col-2">
<img id="imagePreview" class="profile-user-img img-fluid " src="<?php echo isset($TableData->account_image) && $TableData->account_image ? base_url('uploads/' . $TableData->account_image) : base_url('/dist/img/user4-128x128.jpg'); ?>" alt="Account Image" >
<img id="imagePreview" class="profile-user-img img-fluid " src="<?php echo isset($TableData->account_image) && $TableData->account_image ? base_url('uploads/' . $TableData->account_image) : base_url('/dist/img/user4-128x128.jpg'); ?>" alt="Account Image">
</div>
<!--image display end-->
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyname">Party Name</label><input type="text" class="form-control" id="account_partyname" value="<?php echo $TableData->account_partyname; ?>" name="account_partyname">
<?php
// Get the account category name
$category_name = getFieldfromValue("tbl_accategories", "accategory_name", "accategory_id", $TableData->accategory_id);
?>
<div id="creditorFields" style="display: none;">
<!-- <?php //if ($category_name == "Sundry Creditors" || $category_name == "Sundry Debtors") : ?> -->
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyname">Party Name</label><input type="text" class="form-control" id="account_partyname" value="<?php echo $TableData->account_partyname; ?>" name="account_partyname">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Party Address</label><input type="text" class="form-control" id="account_partyaddress" value="<?php echo $TableData->account_partyaddress; ?>" name="account_partyaddress">
</div>
</div>
<div class="col">
<div class="form-group">
<label for="account_partypan">PAN</label><input type="text" class="form-control" id="account_partypan" value="<?php echo $TableData->account_partypan; ?>" name="account_partypan">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyemail">Party Email</label><input type="email" class="form-control" id="account_partyemail" value="<?php echo $TableData->account_partyemail; ?>" name="account_partyemail">
</div>
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontact">Party Contact</label><input type="text" class="form-control" id="account_partycontact" value="<?php echo $TableData->account_partycontact; ?>" name="account_partycontact">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person</label><input type="text" class="form-control" id="account_partycontactperson" value="<?php echo $TableData->account_partycontactperson; ?>" name="account_partycontactperson">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person Phone</label><input type="text" class="form-control" id="account_partycontactpersoncontact" value="<?php echo $TableData->account_partycontactpersoncontact; ?>" name="account_partycontactpersoncontact">
</div>
</div>
<!--COL END-->
</div>
<!-- <?php //endif; ?> -->
</div>
<div class="row" id="bankFields" >
<!-- <?php //if ($category_name == "Bank Account") : ?> -->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_bank">Account Bank</label><input type="text" class="form-control" id="account_bank" value="<?php echo $TableData->account_bank; ?>" name="account_bank">
</div>
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyaddress">Party Address</label><input type="text" class="form-control" id="account_partyaddress" value="<?php echo $TableData->account_partyaddress; ?>" name="account_partyaddress">
<!--COL END-->
<!--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>
</div>
<div class="col">
<div class="form-group">
<label for="account_partypan">PAN</label><input type="text" class="form-control" id="account_partypan" value="<?php echo $TableData->account_partypan; ?>" name="account_partypan">
<!--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-->
<!-- <?php //endif; ?> -->
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontact">Party Contact</label><input type="text" class="form-control" id="account_partycontact" value="<?php echo $TableData->account_partycontact; ?>" name="account_partycontact">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partyemail">Party Email</label><input type="email" class="form-control" id="account_partyemail" value="<?php echo $TableData->account_partyemail; ?>" name="account_partyemail">
</div>
</div>
<!--COL END-->
</div>
<div class="row">
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactperson">Contact Person</label><input type="text" class="form-control" id="account_partycontactperson" value="<?php echo $TableData->account_partycontactperson; ?>" name="account_partycontactperson">
</div>
</div>
<!--COL END-->
<!--COL START-->
<div class="col">
<div class="form-group">
<label for="account_partycontactpersoncontact">Contact Person Phone</label><input type="text" class="form-control" id="account_partycontactpersoncontact" value="<?php echo $TableData->account_partycontactpersoncontact; ?>" name="account_partycontactpersoncontact">
</div>
</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">
@ -181,7 +201,7 @@
<!--COL END-->
</div>
<p align="right">
<button style="padding: 6px 24px; border-radius: 2px; border: 1px solid DodgerBlue" class="btn btn-default btn-sm">Reset</button> <button style="padding: 6px 24px; border-radius: 2px;" class="btn btn-primary btn-sm" type="submit" name="submit">Save</button>
<button style="padding: 6px 24px; border-radius: 2px; border: 1px solid DodgerBlue" class="btn btn-default btn-sm">Reset</button> <button style="padding: 6px 24px; border-radius: 2px;" class="btn btn-primary btn-sm" type="submit" name="submit">Save</button>
</p>
</form>
</div>
@ -193,12 +213,39 @@
</div>
<script>
function previewImage(event) {
var reader = new FileReader();
reader.onload = function() {
var output = document.getElementById('imagePreview');
output.src = reader.result;
function previewImage(event) {
var reader = new FileReader();
reader.onload = function() {
var output = document.getElementById('imagePreview');
output.src = reader.result;
}
reader.readAsDataURL(event.target.files[0]);
}
reader.readAsDataURL(event.target.files[0]);
}
</script>
<script>
$(document).ready(function() {
function updateFields() {
var category = $('#accategory_id').val(); // Assuming the category select field has this ID
if (category == 2) {
$('#bankFields').show();
$('#creditorFields').hide();
} else if (category == 4 || category == 30) {
$('#bankFields').hide();
$('#creditorFields').show();
} else {
$('#bankFields').hide();
$('#creditorFields').hide();
}
}
// On page load
updateFields();
// On category change
$('#accategory_id').change(function() {
updateFields();
});
});
</script>

View File

@ -71,6 +71,10 @@
<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 Bank</label>
<input type="text" class="form-control" id="account_bank" name="account_bank">
</div>
<div class="form-group">
<label for="account_number">Account No.</label>
<input type="text" class="form-control" id="account_number" name="account_number">

View File

@ -128,11 +128,11 @@
</div>
</fieldset>
<div class="mt-3">
<!-- <div class="mt-3">
<label for="vatToggle">VAT</label>
<input type="checkbox" id="vatToggle" checked>
</div>
<input type="hidden" id="vatToggleValue" name="vatToggleValue" value="0">
<input type="hidden" id="vatToggleValue" name="vatToggleValue" value="1"> -->
<!-- Purchase Details Section -->
<div class="col-12 table-responsive p-0 mt-3">
<table class="table table-striped">
@ -167,7 +167,17 @@
</tbody>
<tfoot>
<tr>
<td colspan="4" rowspan="5">In words: </td>
<td colspan="3" rowspan="5">In words: </td>
<td class="text-right" colspan="1" rowspan="5">
<br>
<br>
<br>
<br>
<label for="vatToggle">VAT</label>
<input type="checkbox" id="vatToggle" checked>
<input type="hidden" id="vatToggleValue" name="vatToggleValue" value="1">
</td>
<td class="text-right "><b>Total Amount</b></td>
<td class="text-right">
<b><input type="text" class="form-control" name="subtotal" id="subtotal" /></b>
@ -342,10 +352,14 @@
if (this.checked) {
$('#vatToggleValue').val('0');
$("tfoot tr:nth-child(4)").show();
$("tfoot tr:nth-child(3)").show();
} else {
//1 because i will use this for conditions so that it does not alter previously entered vouchers
//1 because it will be applied for conditions where past data may be altered by this
$('#vatToggleValue').val('1');
$("tfoot tr:nth-child(4)").hide();
$("tfoot tr:nth-child(3)").hide();
}
calculateTotals();
});

View File

@ -37,10 +37,10 @@
<div class="col">
<p><strong>Quantity</strong></p>
</div>
<div class="col">
<div class="col text-right">
<p><strong>Price</strong></p>
</div>
<div class="col">
<div class="col text-right">
<p><strong>Total</strong></p>
</div>
</div>
@ -69,12 +69,19 @@
<div class="row bill-footer">
<div class="col text-right">
<p><strong>Subtotal:</strong> <?php echo myCurrency($total,true); ?></p>
<p><strong>Discount percent:</strong> <?php echo myCurrency($discount,true); ?></p>
<?php $discounted = ($total*$discount/100) ?>
<p><strong>Discount amount:</strong> <?php echo myCurrency($discounted,true); ?></p>
<?php $discounted = 0; ?>
<?php if($discount > 0): ?>
<p><strong>Discount percent:</strong> <?php echo myCurrency($discount,true); ?></p>
<?php $discounted = ($total*$discount/100) ?>
<p><strong>Discount amount:</strong> <?php echo myCurrency($discounted,true); ?></p>
<?php endif; ?>
<?php $taxable = $total - $discounted ?>
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p>
<?php $tax = 0; ?>
<?php //print_r($Purchase->vatToggle);die; ?>
<!-- <?php //if($Sales->vatToggle != 1): ?> -->
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p>
<!-- <?php //endif; ?> -->
<p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p>
</div>
</div>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.