Mr.Combet Webshell
Your IP :
216.73.216.136
Server IP :
103.233.58.157
Server :
Windows NT WIN-4PGF72KEHKB 10.0 build 17763 (Windows Server 2016) AMD64
Server Software :
Microsoft-IIS/10.0
PHP Version :
7.3.25
Add File :
Submit
Add Directory :
Submit
Dir :
C:
/
inetpub
/
wwwroot
/
mapqa_bak
/
mapqa
/
Views
/
Baseline
/
View File Name :
_IncomeTab.cshtml
@model RER_Project.DataAccess.ViewModels.Baseline.BaselineViewModel @using RER_Project.Core.Helpers; @using RER_Project.BusinessLayer.BusinessService @{ var meta = AppUserService.GetCurrent(); } @if (Model.MemberDetailView.IsActive) { <form id="CreateIncome"> @*<input type="hidden" class="form-control " name="CollectionDate" id="collectionDate" /> <input type="hidden" class="form-control" name="CollectionDateNepali" id="collectionDateNepali" />*@ <input type="hidden" name="Id" id="IncomeId" /> <input type="hidden" id="HiddenCategoryId" name="HiddenCategoryId" /> <div id="eror_msg"></div> <div class="row"> <div class="form-group col-md-3"> <label><strong>Enterprise </strong></label> @*<select type="text" class="form-control required" id="CommodityIncome" onchange="commodityChangeCalled()">*@ <select type="text" class="form-control required" id="CommodityIncome" onchange="commodityChangeCalled()" data-api="/commodity/by/memberid/@Model.MemberDetailView.Id"> @* <option value="@Model.MemberDetailView.Commodity">@Model.MemberDetailView.CommodityName</option>*@ <option value="23">Others</option> </select> <label for="Commodity" generated="true" class="CommodityError error">This field is required.</label> </div> <div class="form-group col-md-3"> <label><strong>Commodity</strong></label> <select type="text" class="form-control" name="CategoryId" id="CategoryIdIncome"> <option value="0">Select </option> <option value="23">All Types</option> </select> <label for="Product Name" generated="true" class="CategoryError error">This field is required.</label> </div> <div class="form-group col-md-3 income_show_hide"> <label><strong>Total Income (MVR)</strong></label> <div class="inputWithIcon"> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="10" name="Investment" id="Investment"> <span><strong>MVR</strong></span> </div> </div> <div class="form-group col-md-3 div_hide_show"> <label><strong>Production Qty</strong></label> <div> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="6" name="HarvestingProductionQuantity" id="HarvestingProductionQuantity"> @* <span><strong>Rs</strong></span>*@ </div> @*<input type="text" onkeypress="return isNumberKey(this,event)" maxlength="8" class="form-control required" name="HarvestingProductionQuantity" id="HarvestingProductionQuantity" />*@ </div> <div class="form-group col-md-3 div_hide_show"> <label><strong>Consumption Qty</strong></label> <div> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="6" name="ConsumptionQuantity" id="ConsumptionQuantity"> @* <span><strong>Rs</strong></span>*@ </div> @* <input type="text" onkeypress="return isNumberKey(this,event)" maxlength="8" class="form-control required" name="ConsumptionQuantity" id="ConsumptionQuantity" />*@ </div> </div> <div class="row"> <div class="form-group col-md-3 div_hide_show"> <div> <label><strong>Loss Qty</strong></label> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" @*oninput="onInputLossQty()"*@ maxlength="5" name="LossQuantity" id="LossQuantity"> </div> @*<label><strong>Loss Qty</strong></label> <input type="text" onkeypress="return isNumberKey(this,event)" maxlength="8" class="form-control required" name="LossQuantity" id="LossQuantity" />*@ </div> <div class="form-group col-md-3 div_hide_show"> <label><strong>Sales Qty</strong></label> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="6" name="SalesQuantity" id="SalesQuantity"> @* <input type="text" onkeypress="return isNumberKey(this,event)" maxlength="8" min="0" class="form-control required" name="SalesQuantity" id="SalesQuantity" />*@ </div> <div class="form-group col-md-3 div_hide_show"> <label><strong>Qty Unit</strong></label> <select type="text" class="form-control required" name="IncomeQuantityUnit" id="IncomeUnit" ></select> </div> <div class="form-group col-md-3 div_hide_show"> <label><strong>Total Sales Amount (MVR)</strong></label> <div class="inputWithIcon"> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="15" name="TotalSalesAmount" id="TotalSalesAmount"> <span><strong>MVR</strong></span> </div> </div> </div> <div class="row"> <div class="form-group col-md-3 div_hide_show"> <label><strong>Sales Price Rate ( Avg. ) </strong></label> <div class="inputWithIcon"> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="8" name="SalesPricePerUnit" id="SalesPricePerUnit" disabled> <span><strong>MVR</strong></span> </div> @* <input type="text" onkeypress="return isNumberKey(this,event)" maxlength="5" class="form-control required" name="SalesPricePerUnit" id="SalesPricePerUnit" />*@ </div> <!--<div class="form-group col-md-3 div_hide_show"> <label><strong>Point Of Selling--> @*( बेचेको ठाउँ )*@<!--</strong></label> <input type="text" class="form-control required" name="PointOfSelling" onkeypress="return /[a-z]/i.test(event.key)" id="PointOfSelling" /> </div>--> <div class="form-group col-md-3 div_hide_show"> <label id="area-type"> <strong> @* @if (Model.MemberDetailView.Commodity == (int)EnumCommodityHelper.Commodity.MILK) { <span> Area of Grass Production</span> } else if (Model.MemberDetailView.Commodity == (int)EnumCommodityHelper.Commodity.FISH) { <span>Area of Ponds</span> } else if (Model.MemberDetailView.Commodity == (int)EnumCommodityHelper.Commodity.MAPS) { <span>Area of MAPS Production</span> } else if (Model.MemberDetailView.Commodity == (int)EnumCommodityHelper.Commodity.VEGETABLES) { <span>Area of Vegetable Production</span> } else if (Model.MemberDetailView.Commodity == (int)EnumCommodityHelper.Commodity.GOAT) { <span>Area of Grass Production</span> }*@ <span> Area of Production</span> </strong> </label> <input type="text" onkeypress="return isNumberKey(this,event)" maxlength="7" class="form-control required " name="ProductionArea" id="ProductionArea" /> </div> <div class="form-group col-md-3 div_hide_show"> <label><strong> Area Unit</strong></label> <select type="text" class="form-control required" name="ProductionAreaUnit" id="ProductionAreaUnit" data-api="/land/unit/select"></select> </div> </div> @*<div class="form-group col-md-2"> <label class="align-label-btm"> </label> <a class="btn btn-primary btn-xl" id="btnAssets" onclick="addIncome()" title="Add"> <i class="fa fa-plus"></i> </a> </div>*@ <div class="row"> @*<div class="form-group col-md-3 div_hide_show"> <label><strong>Traders Name</strong></label><br /> <select type="text" class="form-control " id="TradersName" style="width: 100%" data-api="/traders/select"></select> </div>*@ <div style="padding-top:5px" class="form-group col-md-6"> @if (Model.MemberDetailView.IsActive) { if (meta.RoleId == (int)EnumRoleHelper.Roles.Admin || meta.RoleId == (int)EnumRoleHelper.Roles.ProjectDirector || meta.RoleId == (int)EnumRoleHelper.Roles.BDS || meta.RoleId == (int)EnumRoleHelper.Roles.Specialist || meta.RoleId == (int)EnumRoleHelper.Roles.ProjectOfficer || meta.RoleId == (int)EnumRoleHelper.Roles.MnE || meta.RoleId == (int)EnumRoleHelper.Roles.MnEOfficer) { <input type="button" value="Save" class="btn btn-primary" id="SubmitIncome" /> } } @if (@Model.MemberDetailView.GroupId == 0) { <a href="/individualfarmers" class="btn btn-default"><i class="fa fa-arrow-circle-o-left" aria-hidden="true"></i> Back </a> } else { <a href="/group-members?groupId=@Model.MemberDetailView.GroupId" class="btn btn-default"><i class="fa fa-arrow-circle-o-left" aria-hidden="true"></i> Back </a> } </div> </div> </form> } <div class="row"> <div class="form-group col-md-12"> <div class="pull-left"> <a class="btn btn-primary btnPrevious"><i class="fa fa-arrow-circle-o-left" aria-hidden="true"></i> Previous</a> <a class="btn btn-primary btnNext">Next <i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i></a> </div> </div> </div> @*<h3><u><span id="mainCommodityName">@Model.MemberDetailView.CommodityName Commodity</span></u></h3>*@ <h3><u><span id="mainCommodityName">Enterprise Income</span></u></h3> <div class="table-responsive" style="margin-top: 16px;"> <table class="table table-bordered table-hover display " name="tblIncome" id="tblIncomeForMainCommodity" style="width:100%"> <thead> <tr> <th rowspan="2">SN</th> <th rowspan="2" style="text-align:center;padding-top:20px;">Enterprise</th> <th rowspan="2" style="text-align:center;padding-top:20px;">Commodity</th> <th colspan="2" style="text-align:center">Area</th> <th rowspan="2" style="text-align:center;padding-top:20px;">Gender</th> <th colspan="5" scope="colgroup" style="text-align:center">Quantity</th> @* <th rowspan="2" style="padding-top:20px;text-align:center">Price Rate (MVR)</th>*@ <th rowspan="2" style="text-align:center;padding-top:20px;">Total Sales (MVR)</th> @* <th rowspan="2" style="text-align:center;padding-top:20px;">Trader</th>*@ <th rowspan="2" style="text-align:center;padding-top:20px;">Average Sales Price</th> @if (Model.MemberDetailView.IsActive) { <th rowspan="2" style="text-align:center;padding-top:20px;">Action</th> } </tr> <tr> <th style="text-align:center">Production</th> <th style="text-align:center">Unit </th> <th style="text-align:center">Production </th> <th style="text-align:center">Consumption </th> <th style="text-align:center">Loss </th> <th style="text-align:center">Sales </th> <th style="text-align:center"> Unit</th> @*<th style="text-align:center">Sales (Rs)</th> <th style="text-align:center">Income (Rs)</th>*@ </tr> </thead> <tbody id="tblBaselineIncomeBody"> </tbody> <tfoot style="line-height:30px;background-color:#edf0ee;color:black" id="tblBaselineIncomeFooter"> </tfoot> </table> </div> @*<h3><u><span>Other Commodity</span></u></h3>*@ <h3><u><span>Other HH Income</span></u></h3> <div class="table-responsive"> <table class="table table-bordered table-hover " name="tblIncomeForOtherCommodity" id="tblIncomeForOtherCommodity"> <thead> <tr> <th style="text-align:center;">Product</th> <th style="text-align:center;">Total Income</th> @if (Model.MemberDetailView.IsActive) { <th style="text-align:center;">Action</th> } </tr> </thead> <tbody id="tblBaselineIncomeForOtherCommodityBody"> </tbody> <tfoot style="line-height:30px;background-color:#edf0ee;color:black" id="tblBaselineIncomeForOtherCommodityFooter"> </tfoot> </table> </div> <script> debugger; function loadIncomeList() { @* var op = data; console.log("fiscalyear", op);*@ $('#CommodityIncome').trigger("change"); $('.CommodityError').hide(); $('.CategoryError').hide(); $('.income_show_hide').hide(); const ajax = request(); function request() { const url = '/baseline/income/member/' + @Model.MemberDetailView.Id; return window.getAjaxRequest(url, "Get", @Model.MemberDetailView.Id); } ajax.done(function (response) { addIncomeToTable(response); var status = '@Model.MemberDetailView.IsActive'; if (status === 'False') { $('.hideshow').hide(); } }); ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } $("#SubmitIncome").off("click").on("click", function () { var commodity = $('#CommodityIncome').val(); var category = $('#CategoryIdIncome').val(); if (commodity === "0") { $('#CommodityIncome').addClass('error'); $('.CommodityError').show(); if (category === "0") { $('#CategoryIdIncome').addClass('error'); $('.CategoryError').show(); } return; } const form = $("#CreateIncome"); $.validator.unobtrusive.parse(form); if (!form.valid()) { return false; }; if (!window.confirmAction()) { return; }; WorkForce.loader.show(); function request(model) { const url = "/baseline/income/create"; const data = JSON.stringify(model); return window.getAjaxRequest(url, "POST", data); } function getModel() { return ({ BaselineIncome: getBaselineIncomes() }); } function getBaselineIncomes() { var incomeModel = {}; incomeModel.CommodityId = $("#CommodityIncome").val(); incomeModel.Id = $('#IncomeId').val(); incomeModel.BaselineId = $('#baselineId').val(); incomeModel.GroupId = '@Model.MemberDetailView.GroupId'; incomeModel.MemberId = '@Model.MemberDetailView.Id'; incomeModel.DistrictId = '@Model.MemberDetailView.DistrictId'; incomeModel.CollectionDate = $("#collectionDate").val(); incomeModel.CategoryId = $("#CategoryIdIncome").val(); if (incomeModel.CommodityId == 23) { clearMainCommodityData(); } else { clearOtherCommodityData(); } incomeModel.ProductionAreaUnit = $("#ProductionAreaUnit option:selected").val(); incomeModel.HarvestingProductionQuantity = removeCommaFromString($("#HarvestingProductionQuantity").val()); incomeModel.ConsumptionQuantity = removeCommaFromString($("#ConsumptionQuantity").val()); incomeModel.LossQuantity = removeCommaFromString($("#LossQuantity").val()); incomeModel.SalesQuantity = removeCommaFromString($("#SalesQuantity").val()); incomeModel.Investment = removeCommaFromString($("#Investment").val()); debugger; incomeModel.TotalSalesAmount = removeCommaFromString($("#TotalSalesAmount").val()); incomeModel.PointOfSelling = $("#PointOfSelling").val(); //incomeModel.TraderId =$("#TradersName").val(); incomeModel.IncomeQuantityUnit = $("#IncomeUnit").val(); incomeModel.DistrictId = $("#DistrictId option:selected").val(); incomeModel.SalesPricePerUnit =removeCommaFromString($("#SalesPricePerUnit").val()); incomeModel.ProductionArea = $("#ProductionArea").val(); return incomeModel; } const model = getModel(); const ajax = request(model); ajax.done(function (response) { WorkForce.loader.hide(); showNotification("success"); clearIncomeData(); loadIncomeList(); }); ajax.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("error", xhr.responseText); }); }); function clearIncomeData() { $('#CommodityIncome').val('0'); $('#CategoryIdIncome').val(''); $('#HarvestingProductionQuantity').val(''); $('#ConsumptionQuantity').val(''); $('#LossQuantity').val(''); $('#SalesQuantity').val(''); $('#Investment').val(''); $('#PointOfSelling').val(''); //$('#TradersName').val(null).trigger('change'); $('#FiscalYearIncome').val(''); $('#collectionDateNepali').val(''); $('#IncomeUnit').val(''); $('#ProductionArea').val(''); $('#ProductionAreaUnit').val(''); $('#TotalSalesAmount').val(''); $('#SalesPricePerUnit').val(''); } function clearMainCommodityData() { $('#HarvestingProductionQuantity').val(''); $('#ConsumptionQuantity').val(''); $('#LossQuantity').val(''); $('#SalesQuantity').val(''); $('#PointOfSelling').val(''); //$('#TradersName').val(null).trigger('change'); $('#FiscalYearIncome').val(''); $('#collectionDateNepali').val(''); $('#IncomeUnit').val(''); $('#ProductionArea').val(''); $('#ProductionAreaUnit').val(''); $('#TotalSalesAmount').val(''); $('#SalesPricePerUnit').val(''); } function clearOtherCommodityData() { $('#Investment').val(''); } $("#HarvestingProductionQuantity").bind("change paste keyup", function() { var val = removeCommaFromString($("#HarvestingProductionQuantity").val()); if (val > 1) { $("#SalesQuantity").prop('disabled', false); $("#ConsumptionQuantity").prop('disabled', false); $("#LossQuantity").prop('disabled',false); } else { $("#SalesQuantity").prop('disabled', true); $("#ConsumptionQuantity").prop('disabled', true); $("#LossQuantity").prop('disabled',true); } }); $('#HarvestingProductionQuantity').bind("cut copy paste",function(e) { e.preventDefault(); }); $('#ConsumptionQuantity').bind("cut copy paste",function(e) { e.preventDefault(); }); $('#LossQuantity').bind("cut copy paste",function(e) { e.preventDefault(); }); $('#SalesQuantity').bind("cut copy paste",function(e) { e.preventDefault(); }); //function onInputLossQty() { // var salesQuantity = removeCommaFromString($("#SalesQuantity").val()); // var salesPricePerUnit = removeCommaFromString($("#SalesPricePerUnit").val()); // var sum = parseFloat(salesQuantity) * parseFloat(salesPricePerUnit); // $('#TotalSalesAmount').val(getNumberWithComma(sum)); //} $("#ConsumptionQuantity").bind("change paste keyup", function () { var consumptionQuantity = removeCommaFromString($("#ConsumptionQuantity").val()); var lossQuantity = removeCommaFromString($("#LossQuantity").val()); var productionQuantity = removeCommaFromString($("#HarvestingProductionQuantity").val()); var salesQty = removeCommaFromString($("#SalesQuantity").val()); if (consumptionQuantity >= (productionQuantity - lossQuantity - salesQty)) { ShowMessage("error", `Consumption Qty must be less than ${Math.abs(parseFloat(productionQuantity - lossQuantity - salesQty))}`); } //var totalSalesQty = parseFloat(productionQuantity) - parseFloat(consumptionQuantity) - parseFloat(lossQuantity); //$('#SalesQuantity').val(getNumberWithComma(totalSalesQty)); }); $("#LossQuantity").bind("change paste keyup", function() { var productionQuantity =removeCommaFromString($("#HarvestingProductionQuantity").val()); var consumptionQuantity = removeCommaFromString($("#ConsumptionQuantity").val()); var lossQuantity = removeCommaFromString($("#LossQuantity").val()); var salesQuantity = removeCommaFromString($("#SalesQuantity").val()); var totalSalesAmount = removeCommaFromString($("#TotalSalesAmount").val()); if (lossQuantity >= (productionQuantity - consumptionQuantity)) { ShowMessage("error", `Loss Qty must be less than ${Math.abs(parseFloat(productionQuantity - consumptionQuantity))}`); return; } var totalSalesQty = parseFloat(productionQuantity) - parseFloat(consumptionQuantity) - parseFloat(lossQuantity); $('#SalesQuantity').val(getNumberWithComma(totalSalesQty)); var perUnitSalesPrice = parseFloat(totalSalesAmount) / parseFloat(totalSalesQty); $('#SalesPricePerUnit').val(getNumberWithComma(perUnitSalesPrice)); }); $("#TotalSalesAmount").bind("change paste keyup", function() { var salesQuantity = removeCommaFromString($("#SalesQuantity").val()); var totalSalesAmount = removeCommaFromString($("#TotalSalesAmount").val()); var result = parseFloat(totalSalesAmount) / parseFloat(salesQuantity); debugger; $('#SalesPricePerUnit').val(getNumberWithComma(result)); }); $("#SalesQuantity").bind("change paste keyup", function() { var salesQuantity = removeCommaFromString($("#SalesQuantity").val()); var totalSalesAmount = removeCommaFromString($("#TotalSalesAmount").val()); var result = parseFloat(totalSalesAmount) / parseFloat(salesQuantity); $('#SalesPricePerUnit').val(getNumberWithComma(result)); }); function addIncomeToTable(response) { $('#tblIncomeForMainCommodity tbody > tr').remove(); $('#tblIncomeForMainCommodity tfoot > tr').remove(); var tableForMainCommodity = $("#tblIncomeForMainCommodity tbody"); $('#tblIncomeForOtherCommodity tbody > tr').remove(); $('#tblIncomeForOtherCommodity tfoot > tr').remove(); var tableForOtherCommodity = $("#tblIncomeForOtherCommodity tbody"); var totalSalesAmount = 0; var totalIncomeForOtherCommodity = 0; var sn = 0; var status = '@Model.MemberDetailView.IsActive'; var i = 0; response.forEach(function (x) { if (x.commodity_name !== "Others") { console.log(response); var row = "<tr>"; row += "<td>" + ++i + "</td>"; row += "<td>" + x.commodity_name + "</td>"; row += "<td>" + x.category_name + "</td>"; row += "<td>" + x.production_area || 0 + "</td>"; row += "<td>" + x.production_area_unit + "</td>"; row += "<td>"+x.gender_name +"</td>"; row += "<td>" + getNumberWithComma(x.harvesting_production_quantity) + "</td>"; row += "<td>" + getNumberWithComma(x.consumption_quantity) + "</td>"; row += "<td>" + getNumberWithComma(x.loss_quantity) + "</td>"; row += "<td>" + Number(parseFloat(x.sales_quantity||0).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 0 }) + "</td>"; row += "<td>" + x.income_quantity_unit + "</td>"; /* row += "<td><center>" + getNumberWithComma(x.sales_price_per_unit||0) + "</center></td>";*/ row += "<td><center>" + Number(parseFloat(x.total_sales_amount||0).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 2 }) + "</center></td>"; //row += "<td>" + x.trader + "</td>"; row += "<td>" + x.sales_price_per_unit + "</td>"; row += "<td><center>" + "<a class='btn btn-default btn-xs income_edit_delete' style='color:dodgerblue' onclick=editIncomeFormByIncomeId(" + x.id + ") ><i style='cursor:pointer;' class='fa fa-edit'></i ></a>" + " <a class='btn btn-default btn-xs income_edit_delete' style='color:dodgerblue income_edit_delete' onclick=deleteBaselineIncomeByIncomeId(" + x.id + ") ><i class='fa fa-trash'></i ></a> " //+ //" <span style='cursor:pointer' onclick=showRecommendIncomePopUp(" + x.id + ") class='badge'>Recommend</span> </center></td > " ; totalSalesAmount += parseFloat(x.total_sales_amount||0); tableForMainCommodity.append(row); } else { var row = "<tr>"; row += "<td>" + x.category_name + "</td>"; row += "<td><center>" + Number(parseFloat(x.investment).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 2 }) + "</center></td>"; row += "<td><center>" + "<a class='btn btn-default btn-xs income_edit_delete' style='color:dodgerblue' onclick=editIncomeFormByIncomeId(" + x.id + ") ><i style='cursor:pointer;' class='fa fa-edit'></i ></a>" + " <a class='btn btn-default btn-xs income_edit_delete' style='color:dodgerblue' onclick=deleteBaselineIncomeByIncomeId(" + x.id + ") ><i class='fa fa-trash'></i ></a>" //+ // " c<span onclick=showRecommendIncomePopUp(" + x.id + ") class='badge'>Recommend</span> </center></td > " ; totalIncomeForOtherCommodity += parseFloat(x.investment||0); tableForOtherCommodity.append(row); } }) var role = '@meta.RoleId'; if (role == 1 || role == 4 || role == 28) { $('.income_edit_delete').show(); } else { $('.income_edit_delete').hide(); } var tblFooterForMainCommodity = $("#tblIncomeForMainCommodity tfoot"); var footerRow = `<tr> <td ><strong>Total :</strong></td> <td colspan="6"></td> <td colspan="4"></td> <td><strong><center> MVR. ${Number(parseFloat(totalSalesAmount).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 2 })}</center></strong></td> <td colspan="2"></td> </tr>` tblFooterForMainCommodity.append(footerRow); var tblFooterForOtherCommodity = $("#tblIncomeForOtherCommodity tfoot"); var footerForOtherCommodityRow = `<tr> <td ><strong>Total :</strong></td> <td><strong><center> MVR. ${Number(parseFloat(totalIncomeForOtherCommodity).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 2 }) }</center></strong></td><td></td></tr>` tblFooterForOtherCommodity.append(footerForOtherCommodityRow); } function editIncomeFormByIncomeId(id) { WorkForce.loader.show(); const ajax = request(id); function request(id) { const url = '/baseline/income/' + id; return window.getAjaxRequest(url, "Get", id); } ajax.done(function (response) { console.log(response); debugger; setTimeout( function() { $('#IncomeUnit').val(response.IncomeQuantityUnit); $("#CategoryIdIncome").val(response.CategoryId); }, 300); $('#IncomeId').val(response.Id); $('#CommodityIncome').val(response.CommodityId); //OnChange Commodity $('#CommodityIncome').trigger("change"); // alert(response.CategoryId); $('#HarvestingProductionQuantity').val(getNumberWithComma(response.HarvestingProductionQuantity)); $('#ConsumptionQuantity').val(getNumberWithComma(response.ConsumptionQuantity)); $('#LossQuantity').val(getNumberWithComma(response.LossQuantity)); $('#SalesQuantity').val(getNumberWithComma(response.SalesQuantity)); $('#SalesPricePerUnit').val(getNumberWithComma(response.SalesPricePerUnit)); $('#TotalSalesAmount').val(getNumberWithComma(response.TotalSalesAmount)); $('#Investment').val(getNumberWithComma(response.Investment)); $('#PointOfSelling').val(response.PointOfSelling); $("#TradersName").select2("val", response.TraderId); //$('#TradersName').val(response.TraderId); $('#ProductionArea').val(response.ProductionArea); $('#ProductionAreaUnit').val(response.ProductionAreaUnit); $('#ProductionAreaUnit').val(response.ProductionAreaUnit); window.scrollTo(0, 0); if (response.CommodityId != 23) { $('.div_hide_show').show(); $('.income_show_hide').hide(); } else { $('.div_hide_show').hide(); $('.income_show_hide').show(); } WorkForce.loader.hide(); }); ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } function deleteBaselineIncomeByIncomeId(incomeId) { let conf = confirm(`Are you sure you want to delete this Baseline Income ?`); if (!conf) { return; } else { const ajaxResponse = requestBaselineIncomeToDelete(incomeId); ajaxResponse.done(function (response) { WorkForce.loader.hide(); if (response) { loadIncomeList(); ShowMessage("success", "Successfully Deleted this Baseline Income"); } WorkForce.loader.hide(); }); ajaxResponse.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("Error", xhr.responseText); }); WorkForce.loader.hide(); } } function requestBaselineIncomeToDelete(incomeId) { const url = "/baseline/income/delete/"; const data = JSON.stringify({ "Id": incomeId}); return window.getAjaxRequest(url, "POST", data); } function getIncomeByMemberId(id) { const ajax = request(); function request() { const url = '/baseline/income/' + id; return window.getAjaxRequest(url, "Get",id); } ajax.done(function (response) { $('#popUpCollectionDateNepali').html(response.CollectionDateNepali); $('#popUpHarvestingProductionQuantity').html(response.HarvestingProductionQuantity); $('#popUpConsumptionQuantity').html(response.ConsumptionQuantity); $('#popUpLossQuantity').html(response.LossQuantity); $('#popUpSalesQuantity').html(response.SalesQuantity); $('#popUpInvestment').html(response.Investment); $('#popUpTotalSalesAmount').html(response.TotalSalesAmount); $('#popUpPointOfSelling').html(response.PointOfSelling); $('#popUpMember').html('@Model.MemberDetailView.FirstName @Model.MemberDetailView.LastName' ); $('#popUpTraderName').val(response.TraderId); $('#ViewIncome').modal('show'); }) } function commodityChangeCalled() { const commodityId = $('#CommodityIncome').val(); if (commodityId != 23) { //clearIncomeData(); $('.div_hide_show').show(); $('.income_show_hide').hide(); $("#HarvestingProductionQuantity").addClass("required"); $("#ConsumptionQuantity").addClass("required"); $("#LossQuantity").addClass("required"); $("#SalesQuantity").addClass("required"); $("#IncomeUnit").addClass("required"); $("#SalesPricePerUnit").addClass("required"); $("#TotalSalesAmount").addClass("required"); $("#PointOfSelling").addClass("required"); $("#TradersName").addClass("required"); $("#ProductionArea").addClass("required"); $("#ProductionAreaUnit").addClass("required"); $("#Investment").removeClass("required"); } else { //clearIncomeData(); $('.div_hide_show').hide(); $('.income_show_hide').show(); $("#HarvestingProductionQuantity").removeClass("required"); $("#ConsumptionQuantity").removeClass("required"); $("#LossQuantity").removeClass("required"); $("#SalesQuantity").removeClass("required"); $("#IncomeUnit").removeClass("required"); $("#SalesPricePerUnit").removeClass("required"); $("#TotalSalesAmount").removeClass("required"); $("#PointOfSelling").removeClass("required"); $("#TradersName").removeClass("required"); $("#ProductionArea").removeClass("required"); $("#ProductionAreaUnit").removeClass("required"); $("#Investment").addClass("required"); } } function isNumberKey(element,evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57) && !(charCode == 46 || charCode == 8)) return false; else { var len = $(element).val().length; var index = $(element).val().indexOf('.'); if (index > 0 && charCode == 46) { return false; } if (index > 0) { var CharAfterdot = (len + 1) - index; if (CharAfterdot > 3) { return false; } } } return true; } /* function getNumberWithComma(value) { value = value || 0; return Number(parseFloat(value).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 0 }) } function removeCommaFromString(value) { var result = parseFloat(value.replace(/,/g, '')); if (isNaN(result)) { return 0; } else { return result; } }*/ function showRecommendIncomePopUp(id) { $('#recommendModel').modal('show'); $('#RowIdInPopUp').val(id); $('#TableName').val('Income'); } /* function convertToHectare(unitId, value) { // 4 Kattha //11 Ropani if (unitId === "4") { return (0.033863159390965 * value).toFixed(3); } else if (unitId === "11") { return (value * 0.050873706673504).toFixed(3); } }*/ </script> <style> .select2-selection__rendered { line-height: 29px !important; } .select2-container .select2-selection--single { height: 33px !important; } .select2-selection__arrow { height: 32px !important; } </style>