从组合框中选择产品时,我正在尝试为数据库中的单位设置值。我要填充单位文本字段“比率”,然后将比率和数量相乘以在MVC项目中使用ext.net在totalamount文本字段中设置值
<-这是我的产品类别--->
public class ProductDto
{
[Field(FieldType = typeof(Ext.Net.Hidden))]
public int productId { get; set; }
[PresenceValidator]
public string productCode { get; set; }
[PresenceValidator]
public string productName { get; set; }
[PresenceValidator]
public int? groupId { get; set; }
[PresenceValidator]
public int? brandId { get; set; }
[PresenceValidator]
public int? unitId { get; set; }
[PresenceValidator]
public int? sizeId { get; set; }
[PresenceValidator]
public int? modelNoId { get; set; }
[PresenceValidator]
public int? taxId { get; set; }
[PresenceValidator]
public string taxapplicableOn { get; set; }
[PresenceValidator]
public decimal? purchaseRate { get; set; }
[PresenceValidator]
public decimal? salesRate { get; set; }
[PresenceValidator]
public decimal? mrp { get; set; }
[PresenceValidator]
public decimal? minimumStock { get; set; }
[PresenceValidator]
public decimal? maximumStock { get; set; }
[PresenceValidator]
public decimal? reorderLevel { get; set; }
[PresenceValidator]
public int? godownId { get; set; }
[PresenceValidator]
public int? rackId { get; set; }
[PresenceValidator]
public bool? isallowBatch { get; set; }
[PresenceValidator]
public bool? ismultipleunit { get; set; }
[PresenceValidator]
public bool? isBom { get; set; }
[PresenceValidator]
public bool? isopeningstock { get; set; }
[PresenceValidator]
public string narration { get; set; }
[PresenceValidator]
public bool? isActive { get; set; }
[PresenceValidator]
public bool? isshowRemember { get; set; }
[PresenceValidator]
public string extra1 { get; set; }
[PresenceValidator]
public string extra2 { get; set; }
[PresenceValidator]
public DateTime? extraDate { get; set; }
[PresenceValidator]
public string partNo { get; set; }
}
<-这是在包含productId的视图中传递的模型->
public partial class PurchaseDto
{
[Field(FieldType = typeof(Ext.Net.Hidden))]
public int purchaseDetailsId { get; set; }
public int? purchaseMasterId { get; set; }
[PresenceValidator]
public int? receiptDetailsId { get; set; }
[PresenceValidator]
public int? orderDetailsId { get; set; }
[PresenceValidator]
public int? productId { get; set; }
[PresenceValidator]
public int? qty { get; set; }
[PresenceValidator]
public int? rate { get; set; }
[PresenceValidator]
public int? unitId { get; set; }
[PresenceValidator]
public int? unitConversionId { get; set; }
[PresenceValidator]
public decimal? discount { get; set; }
[PresenceValidator]
public int? taxId { get; set; }
[PresenceValidator]
public int? batchId { get; set; }
[PresenceValidator]
public int? godownId { get; set; }
[PresenceValidator]
public int? rackId { get; set; }
[PresenceValidator]
public decimal? taxAmount { get; set; }
[PresenceValidator]
public decimal? grossAmount { get; set; }
[PresenceValidator]
public decimal? netAmount { get; set; }
[PresenceValidator]
public decimal? amount { get; set; }
[PresenceValidator]
public int? slNo { get; set; }
[PresenceValidator]
public DateTime? extraDate { get; set; }
[PresenceValidator]
public string extra1 { get; set; }
[PresenceValidator]
public string extra2 { get; set; }
[PresenceValidator]
public string voucherNo { get; set; }
[PresenceValidator]
public string invoiceNo { get; set; }
[PresenceValidator]
public int? suffixPrefixId { get; set; }
[PresenceValidator]
public int? voucherTypeId { get; set; }
[PresenceValidator]
public DateTime? date { get; set; }
[PresenceValidator]
public int? ledgerId { get; set; }
[PresenceValidator]
public string vendorInvoiceNo { get; set; }
[PresenceValidator]
public DateTime? vendorInvoiceDate { get; set; }
public string creditPeriod { get; set; }
[PresenceValidator]
public int? exchangeRateId { get; set; }
[PresenceValidator]
public string narration { get; set; }
[PresenceValidator]
public int? purchaseAccount { get; set; }
[PresenceValidator]
public int? purchaseOrderMasterId { get; set; }
[PresenceValidator]
public int? materialReceiptMasterId { get; set; }
[PresenceValidator]
public decimal? additionalCost { get; set; }
[PresenceValidator]
public decimal? totalTax { get; set; }
[PresenceValidator]
public decimal? billDiscount { get; set; }
[PresenceValidator]
public decimal? grandTotal { get; set; }
[PresenceValidator]
public decimal? totalAmount { get; set; }
[PresenceValidator]
public int? userId { get; set; }
[PresenceValidator]
public string lrNo { get; set; }
[PresenceValidator]
public string transportationCompany { get; set; }
[PresenceValidator]
public int? financialYearId { get; set; }
}
<-这是我在视图中的字段集->
@model IEnumerable<Nmicros.Accounts.Web.Data.Dtos.Others.PurchaseDto>
@{
ViewBag.Title = "Purchase";
Layout = "~/Views/Shared/_Layout.cshtml";
var X = Html.X();
}
X.FieldSet()
.ColumnWidth(0.4)
.ID("purch")
.Title("Purchase Details")
.MarginSpec("0 0 0 10")
.Defaults(d =>
{ d.Add(new Parameter("LabelWidth", "130"));})
.Items(
X.TextField().Name("purchaseDetailsId").FieldLabel("Id").Hidden(true),
X.ComboBox().Name("purchaseAccount").FieldLabel("Account").ForceSelection(true).EmptyText("-- choose--").EmptyValue(0).Items(ViewBag.Ledger).Editable(false),
X.TextField().Name("purchaseMasterId").FieldLabel("Master"),
X.ComboBox().Name("productId").FieldLabel("Product").ForceSelection(true).EmptyText("-- choose--").EmptyValue(0).Items(ViewBag.Product).Editable(false),
X.TextField().Name("qty").FieldLabel("Quantity"),
X.TextField().Name("SalesRate").FieldLabel("Rate").ReadOnly(true),
X.TextField().Name("unitId").FieldLabel("Unit").ReadOnly(true).ID("unit"),
X.TextField().Name("discount").FieldLabel("Discount"),
X.ComboBox().Name("taxId").FieldLabel("Tax"),
X.ComboBox().Name("ledgerId").FieldLabel("Suspence Account").ForceSelection(true).EmptyText("-- choose--").EmptyValue(0).Items(ViewBag.Ledger).Editable(false),
X.TextField().Name("taxAmount").FieldLabel("Tax Amount"),
X.TextField().Name("amount").FieldLabel("Amount"),
X.TextField().Name("slNo").FieldLabel("Serial No"),
X.TextField().Name("voucherNo").FieldLabel("Voucher"),
X.TextField().Name("invoiceNo").FieldLabel("Invoice"),
X.TextField().Name("creditPeriod").FieldLabel("Credit Period"),
X.TextField().Name("exchangeRateId").FieldLabel("Exchange Rate"),
X.TextField().Name("narration").FieldLabel("Narration"),
X.ComboBox().Name("purchaseOrderMasterId").FieldLabel("PurchaseOrderMaster").ForceSelection(true).EmptyText("-- choose--").EmptyValue(0).Items(ViewBag.Order).Editable(false),
X.TextField().Name("totalAmount").FieldLabel("Total Amount").ReadOnly(true),
X.ComboBox().Name("financialYearId").FieldLabel("Financial Year"),
X.DateField().Name("date").FieldLabel("Date")
)
)
我希望从组合框中选择一种产品时,应该自动填充unitId和salesRate的文本字段,以从数据库中的产品表中获取值。然后也是totalAmount =数量* saleRate