Notes
Notes - notes.io |
@{
ViewData["Title"] = "SMX Services Consulting - Add Expenses";
}
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Expenses</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "formAddExpenses" }))
{
<div class="modal-body">
<div class="add-deducation-outer">
<div class="heading-section">
<h3>
Add Expenses
</h3>
<span>
<i class="fa-solid fa-circle-question"></i>
</span>
</div>
<div class="padilla-outer">
<div>
@Html.HiddenFor(model => model.Id)
<span id="tableId" hidden></span>
@Html.HiddenFor(model => model.EmployeeId)
<span id="employeeId" hidden></span>
@Html.HiddenFor(model => model.StartId)
<span id="startId" hidden></span>
@Html.HiddenFor(model => model.RecId)
<span id="recId" hidden></span>
<h4><span id="employeeName" style="color:black;"></span></h4>
</div>
<div class="job-title">
<label for="">Comapny Name</label>
<h6 id="comapnyName"></h6>
</div>
<div class="job-title">
<span>*</span>
<label for="">Expense Entry Date</label><br>
@Html.HiddenFor(model => model.ExpenseStartDate)
<input type="datetime-local" class="form-control" id="expenseStartDate" placeholder="mm-dd-yyyy">
<span id="expenseStartDateError"></span>
</div>
<div class="job-title">
@Html.HiddenFor(model => model.IsActive)
<div for="status" style="color: #BEBABE;font-weight: 500;">Status</div>
<label class="switch">
<input type="checkbox" value="" id="expenseStatus" checked>
<span class="slider round" style="height: 24px;width: 48px"></span>
</label>
</div>
</div>
<div class="deducation-code">
<div class="row">
<div class="col-lg-6">
<div>
<div>
<label for="">Expense Code</label>
<span>*</span>
</div>
@Html.DropDownListFor(model => model.ExpenseCode, new SelectList(Model.ExpenseCodeList?.Items, "Value", "Text"), new { @class = "form-select", @required = "true" })
</div>
</div>
<div class="col-lg-6">
<div>
<div>
<label for="">Expense Amount</label>
<span>*</span>
</div>
<div class="currency-wrap">
<span class="currency-code" style="color :black;">$</span>
<input class="text-currency" type="text" id="expenseAmount" maxlength="5" name="expenseAmount" value="@Model.ExpenseAmount" placeholder="0.00" />
<span id="expenseAmountError"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<label for="comments">Comments</label>
<div class="form-floating">
@Html.HiddenFor(model => model.Comments)
<textarea class="form-control" placeholder="Leave a comment here" id="expenseComments"></textarea>
<label for="floatingTextarea">Comments</label>
</div>
</div>
</div>
</div>
</div>
</div>
}
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="BtnAddExpense">Save Changes</button>
</div>
</div>
</div>
this is the cshtml file of Add Expense whose button on List of Expense pop up model and this is my JQyery code i.e.
$(document).on("click", "#AddExpenses", function () {
debugger;
var Id = 0;
var currow = $(".getSalariedInvoicetbl").closest('tr');
var startId = currow.find('td:eq(24)').text();
var employeeId = currow.find('td:eq(25)').text();
var recId = currow.find('td:eq(26)').text();
var comapnyName = currow.find('td:eq(0)').text();
var employeeName = currow.find('td:eq(1)').text();
var url = "/Invoice/AddExpenses/?Id=" + Id
$(".openAddExpensePopupForInvoice").load(url, function () {
$(".openAddExpensePopupForInvoice").modal("show");
$('#employeeId').text(employeeId);
$('#startId').text(startId);
$('#recId').text(recId);
$('#employeeName').text(employeeName);
$('#comapnyName').text(comapnyName);
var now = new Date();
var day = now.getUTCDate().toString().padStart(2, '0');
var month = (now.getUTCMonth() + 1).toString().padStart(2, '0')
var year = now.getUTCFullYear();
var today = year + "-" + (month) + "-" + (day);
var hours = now.getHours();
var minuts = now.getMinutes();
if (minuts <= 9) {
var minuts = "0" + now.getMinutes();
}
var time = hours + ":" + minuts;
$('#expenseStartDate').val(today + ' ' + time);
});
});
here is the problem i.e. var currow = $(".getSalariedInvoicetbl").closest('tr'); on this line the currow length is 0 and value of startId, employeeId and recId and so on is empty please resolve this issue
this is jquery of $(document).on("click", "#ListOfExtraExpense", function () {
debugger;
var currow = $(this).closest('tr');
var employeeId = currow.find('td:eq(25)').text();
var startId = currow.find('td:eq(24)').text();
var employeeName = currow.find('td:eq(1)').text();
var url = "/Invoice/ExpensesList/?employeeId=" + employeeId + "&startId=" + startId
$(".openExpenseListPopupForInvoice").load(url, function () {
$(".openExpenseListPopupForInvoice").modal("show");
$('#employeeName').text(employeeName);
});
}); open pop up for List of Expense
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
