private void btnOK_Click(object sender, EventArgs e) { decimal discount; if (txtDiscount.Text.Trim() == "") { discount = 0; } else { discount = Convert.ToDecimal(txtDiscount.Text.Trim()); } if (txtCustomerName.Text.Trim() == "" || ControlValidation.IsReserveWord(txtCustomerName.Text.Trim().ToLower())) { lblError.Text = "Please Enter Customer Name"; lblError.ForeColor = Color.Red; } else { var custDetails = new CustomerInfoDetails(); if (txtAddress.Text == "" || ControlValidation.IsReserveWord(txtAddress.Text.Trim().ToLower())) { custDetails.custAddress = "XXXX"; } else { custDetails.custAddress = txtAddress.Text; } custDetails.custName = txtCustomerName.Text; custDetails.custMobile = "9999999999"; custDetails.custEmail = "*****@*****.**"; custDetails.billDate = dateTimeBillDate.Value.Date; custDetails.custDiscount = discount; this.Hide(); if (sellerEntry == 1) { this.Hide(); var stockEntry = new StockEntry(); stockEntry.CalllbackFromCustDetails(_glStockEntry, custDetails, _billnumber); this.Close(); } else { CustomerBillForm cust = new CustomerBillForm(productSale); cust.showBill(custBillInfoData, custDetails); cust.ShowDialog(this); this.Close(); } } }
public void ReportBuilder(string lclbillNo) { List <CustomerBillProduct> billProdList = new List <CustomerBillProduct>(); billProdList.Clear(); var billedItems = (from c in database.TransactionDetails join d in database.ProductInfoes on c.ProductID equals d.ProductID where c.BillNumber == lclbillNo select new { c.Quantity, c.UnitPrice, c.TotalPrice, d.Description }); var billingInfo = (from c in database.BillInfoes join d in database.CustomerInfoes on c.CustomerID equals d.CustomerID where c.BillNumber == lclbillNo select new { c.BillDate, c.Discount, c.TotalAmount, d.CustomerName, d.CustomerAddress, d.Mobile, d.Email, }).FirstOrDefault(); var shopInfo = (from c in database.ShopInfoes select c).FirstOrDefault(); string shopAddress = shopInfo.ShopAddress + " " + shopInfo.City + " " + shopInfo.Dist + " " + shopInfo.State + " " + shopInfo.ZIP + " Tel :" + shopInfo.PhoneNo; foreach (var row in billedItems) { var custBillProduct = new CustomerBillProduct { Productdesc = Convert.ToString(row.Description), Productprice = Convert.ToDecimal(row.UnitPrice), Productunit = Convert.ToDecimal(row.Quantity), Totalprice = Convert.ToDecimal(row.TotalPrice), }; billProdList.Add(custBillProduct); } var customerBillData = new CustomerBillData(); customerBillData.gstn = shopInfo.Gstn; customerBillData.shopName = shopInfo.ShopName; customerBillData.shopAddress = shopAddress; customerBillData.billNo = lclbillNo; customerBillData.billData = billProdList; var custDetails = new CustomerInfoDetails(); custDetails.custAddress = billingInfo.CustomerAddress; custDetails.custName = billingInfo.CustomerName; custDetails.custMobile = billingInfo.Mobile; custDetails.custEmail = billingInfo.Email; custDetails.billDate = (DateTime)billingInfo.BillDate; custDetails.custDiscount = Convert.ToDecimal(billingInfo.Discount); int printonlyBill = 1; var printBill = new CustomerBillForm(printonlyBill); printBill.showBill(customerBillData, custDetails); printBill.ShowDialog(this); }