data: { productid: productid,mydate1: mydate1, mydate2: mydate2 },
public ActionResult bindpurchasereport(string productid, string dealerid, DateTime? mydate1, DateTime? mydate2)
{
var model = new CartSummary1();
ViewBag.FromDate = "From Date : " + mydate1.Value.ToShortDateString() + "";
ViewBag.ToDate = "To Date :" + mydate2.Value.ToShortDateString() + "";
var DistributorId = "";
if (Session["userid"] != null)
{
DistributorId = Session["userid"].ToString();
}
ViewBag.Name = Session["username"];
var DistributorName = Session["username"].ToString();
int IntProductId = 0;
if (productid != "All")
{
IntProductId = Convert.ToInt32(productid);
}
if (productid == "All")
{
List<Invoice1> proli = new List<Invoice1>();
model.GetInvoiceData = (from c in db.invoice.ToList()
where c.DistributorId == "Admin"
&& ( c.DistributorName == DistributorName)
&& (c.saledate >= mydate1 && c.saledate <= mydate2)
select new Invoice1
{
id = c.id,
saledate = c.saledate,
saleno = c.saleno,
AdminSaleno = c.AdminSaleno,
customerName = c.customerName,
DistributorName = c.DistributorName,
dispercent = c.dispercent,
paymentmode = c.paymentmode,
dealername = GetDealerName(c.dealerid),
NetAmount = c.NetAmount,
TaxAmount = c.TaxAmount,
}).ToList();
model.GetCartData = (from p in db.cartsummary.ToList()
where p.DistributorId == "Admin"
&& (p.DistributorName == DistributorName)
&& (p.saledate >= mydate1 && p.saledate <= mydate2)
select new CartSummary1
{
id = p.id,
productname = GetProductNameList(p.productid),
AdminSaleno = p.AdminSaleno,
saleno = p.saleno,
DistributorName = p.DistributorName,
customer = p.customer,
productid = p.productid,
Rate = p.Rate,
amount = p.amount,
Quantity = p.Quantity,
}).ToList();
return PartialView("bindpurchasereport", model);
}