我正在创建一个具有销售报告页面的POS系统,在销售报告页面中,我需要能够选择介于两者之间的日期,但是我尝试过的所有内容都不适用于HTML表格。
protected void Page_Load(object sender, EventArgs e)
{
List<Receipt> saleReport = Receipt.GetReceipts();
List<Product> products = Product.GetProducts();
List<OrderLine> orderLines = OrderLine.GetOrderLines();
List<Inventory> inventories = Inventory.GetInventorys();
List<ServiceOrder> serviceOrders = ServiceOrder.GetServiceOrders();
List<Service> services = Service.GetServices();
foreach (Receipt saleRep in saleReport)
{
HtmlTableRow row = new HtmlTableRow();
//OrdNum Data
HtmlTableCell cellOrder = new HtmlTableCell();
cellOrder.InnerText = saleRep.ordNumber.ToString();
row.Cells.Add(cellOrder);
//Cust Data
HtmlTableCell cellCustomer = new HtmlTableCell();
cellCustomer.InnerText = saleRep.custID.ToString();
row.Cells.Add(cellCustomer);
//emp Data
HtmlTableCell cellEmp = new HtmlTableCell();
cellEmp.InnerText = saleRep.empID.ToString();
row.Cells.Add(cellEmp);
//Date Data
HtmlTableCell cellDate = new HtmlTableCell();
cellDate.InnerText = saleRep.ordDate.ToString();
row.Cells.Add(cellDate);
//Product Data
HtmlTableCell cellProduct = new HtmlTableCell();
foreach (OrderLine order in orderLines)
{
if (order.receiptID == saleRep.ID)
{
foreach (Inventory inventory in inventories)
{
if (inventory.ID == order.inventoryID)
{
foreach (Product product in products)
{
if (product.ID == inventory.productID)
{
cellProduct.InnerText = product.prodName;
}
}
}
}
}
}
row.Cells.Add(cellProduct);
//Service Data
HtmlTableCell cellService = new HtmlTableCell();
foreach (ServiceOrder serviceOrder in serviceOrders)
{
if (serviceOrder.receiptID == saleRep.ID)
{
foreach (Service service in services)
{
if (service.ID == serviceOrder.serviceID)
{
cellService.InnerText = service.serName;
}
}
}
}
row.Cells.Add(cellService);
//Warranty Data
HtmlTableCell cellWarranty = new HtmlTableCell();
foreach (ServiceOrder serviceOrder in serviceOrders)
{
if (serviceOrder.receiptID == saleRep.ID)
{
cellWarranty.InnerText = serviceOrder.serOrdWarranty.ToString();
}
}
row.Cells.Add(cellWarranty);
//Payment Data
HtmlTableCell cellPayment = new HtmlTableCell();
cellPayment.InnerText = Payment.GetPayments().Where(x => x.ID == saleRep.paymentID).FirstOrDefault().payType.ToString();
row.Cells.Add(cellPayment);
//ProductCost Data
HtmlTableCell cellProductCost = new HtmlTableCell();
foreach (OrderLine order in orderLines)
{
if (order.receiptID == saleRep.ID)
{
cellProductCost.InnerText = order.ordLinePrice.ToString();
}
}
row.Cells.Add(cellProductCost);
//ServiceCost Data
HtmlTableCell cellServiceCost = new HtmlTableCell();
foreach (ServiceOrder serviceOrder in serviceOrders)
{
if (serviceOrder.receiptID == saleRep.ID)
{
foreach (Service service in services)
{
if (service.ID == serviceOrder.serviceID)
{
cellServiceCost.InnerText = service.serPrice.ToString();
}
}
}
}
row.Cells.Add(cellServiceCost);
tblSaleRep.Rows.Add(row);
}
HTML
<div class="form-group row" runat="server" id="ddlDate" visible="false">
<div class="col-md-12">
<h3>Date</h3>
</div>
<div class="col-md-6">
<label for="date-from">From:</label>
<input type="date" class="form-control" id="date-from">
</div>
<div class="col-md-6">
<label for="date-to">To:</label>
<input type="date" class="form-control" id="date-to">
</div>
</div>
<table class="table table-bordered" border="1" id="tblSaleRep" runat="server" visible="false">
<thead>
<tr>
<th>SO#</th>
<th>Customer#</th>
<th>Employee</th>
<th>Order Date</th>
<th>Product</th>
<th>Service</th>
<th>Warrenty</th>
<th>Paytype</th>
<th>Product Price</th>
<th>Service Price</th>
</tr>
</thead>
<tbody id="tbbSales"></tbody>
</table>