Hi Everybody ,
I am Working on Perches project as a study Project ,
Here i Am trying show Unpaid Perches bill which data in is Perchestransation Table and from Suppler Table there is all details of suppler
here i select suppler id from Perches table and trying to get a partial view for this same suppler perches bills where balance amount is less than total amount ,
in Controller on breakpoints he show selected records but partial view not shown in main View
or here is any option please give me an idea or tutorial
need help for this
What I have tried:
html for main View and jQuery
@model WorkingPlace.Models.Supplyer
@{
ViewBag.Title = "PerPAYment";
}
<h2 style="color:maroon;background-color:aliceblue;background-origin:border-box;width:100% ">PERCHES PAYMENTS </h2>
<html>
<head>
<style>
.inv1 {
display: none;
}
</style>
</head>
<body>
<div class="PaymentDiv">
<div class="dataDiv">
<h3 style="color:red ;background-origin:padding-box">First Select Suppler And Then Pay The Bills as per list Selection </h3>
<br />
<p>
@Html.ActionLink("Return to perches", "Index")
</p>
<div>
<table>
<tr>
<td style="width:40%">
Select Supplyer <br />
@Html.DropDownListFor(m => m.SupplyerID, new SelectList(Model.GetSupplyers_S, "SupplyerID", "Sypplyer_name"), "-- Select Supplyer --", new { @class = "sid form-control" })
</td>
<td>
<hr />
</td>
<td >
Select Payment OPtion <br />
@{
var domainsList = new SelectList(new[]
{
new SelectListItem { Text = "BANK", Value = "BANK", Selected = true },
new SelectListItem { Text = "CASH", Value = "CASH"},
}, "Value", "Text");
@Html.DropDownList("PAymrntType", domainsList, "-- SELECT PAYMENT TYPE --", new { @class = "PAymrntType", @id = "PAymrntType", @width = "100px" })
</td>
<td>
<input type="hidden" id="supid" class="supid1" value="@TempData["SupId"]"/>
</td>
</tr>
</table>
<div id="inv" class="inv1">
@*@Html.Partial("MyNonpaindIVN")*@
</div>
</div>
</div>
</div>
</body>
</html>
@section scripts{
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
<script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
<script src="~/Scripts/chosen.jquery.min.js"></script>
<script src="~/Scripts/notify.min.js"></script>
<script>
$(function () {
$("#SupplyerID").chosen({
});
});
</script>
<script>
$("#PAymrntType").chosen({
});
</script>
<script>
var myname;
var myid
$(document).on('change', '.sid', function () {
var url = "/Perchus/Suplyerdata";
var SupplyerID = $('#SupplyerID').val().trim();
$.post(url, { SupplyerID: SupplyerID }, function (data) {
myname = data.Sypplyer_name;
myid = data.SupplyerID;
$.notify("You selected " + " " + myname + " " + "To Convert challan", "success");
});
});
</script>
<script>
$(document).ready(function () {
$(document).on('change', '.PAymrntType', function () {
var typeOF = $("#PAymrntType").val().trim();
$.notify("You Selected a Payment Type " + typeOF, "Info")
var supid = $('#SupplyerID').val();
$.get("/Perchus/GetUNPAID", { SupplyerID: supid }, function (responce) {
$('.inv1').show();
$("#inv").html(respnse);
@*$("#inv").load('@Url.Action("MyNonpaindIVN")');*@
return false
});
});
});
</script>
}
Partial View
@model IEnumerable<WorkingPlace.Models.PerchesTransaction>
@{
Layout = null;
}
<div>
<div class="panel-heading">
<h3 class="panel-title">Search Results</h3>
</div>
<table>
<tr>
<td>Invoice No :</td>
<td>Invoice Date : </td>
<td>Invoice Amount : </td>
<td>Balance Amount : </td>
<td></td>
<td></td>
</tr>
@foreach (var item in Model)
{
<tr>
<td id="InvoiceNo">
@Html.DisplayFor(modelItem => item.InvoiceNo )
</td>
<td id="InvoiceDate">
@Html.DisplayFor(modelItem =>item.InvoiceDate)
</td>
<td id="TotalAmount">
@Html.DisplayFor(modelItem=>item.TotalAmount)
</td>
<td id="BalAmount">
@Html.DisplayFor(modelItem=>item.BalAmount)
</td>
<td id="Pay">
<input type="submit" id="Pay" class="pay1" value="Pay Bill"/>
</td>
<td>
<input type="submit" id="cancel"class="cancel1"value="Cancel Payment"/>
</td>
</tr>
}
</table>
<table>
<tr class="pull-right">
<td class="pull-right">
Total payment
</td>
</tr>
</table>
</div>
controller
public ActionResult PerPAYment(Supplyer ssp)
{
Supplyer model = new Supplyer
{
SupplyerID = ssp.SupplyerID,
GetSupplyers_S = dc.Supplyers.ToList(),
InfoMenu = dc.PerchesTransactions.ToList()
};
return View(model);
}
public PartialViewResult GetUNPAID(int SupplyerID)
{
var z = 0.00m;
Supplyer ptr = new Supplyer
{
InfoMenu=dc.PerchesTransactions.Where(p => p.SupplyerId == SupplyerID && p.TotalAmount >= z).ToList()
};
ViewData["MyNonpaindIVN"]= "MyNonpaindIVN";
return PartialView("MyNonpaindIVN" , ptr );
}