예제 #1
0
        public void CustomerEntry(string billNo, decimal sumTotal, CustomerBillData cusBill, CustomerInfoDetails custInfo)
        {
            var database       = new InventoryEntities();
            var billTypeIDList = (from c in database.BillTypes
                                  where c.BillTypeName == "Cash"
                                  select new
            {
                c.BillTypeID
            }).FirstOrDefault();

            var custInfoTable = new CustomerInfo();
            var billInfoTable = new BillInfo();

            custInfoTable.CustomerName    = custInfo.custName;
            custInfoTable.CustomerAddress = custInfo.custAddress;
            custInfoTable.Mobile          = custInfo.custMobile;
            custInfoTable.Email           = custInfo.custEmail;
            database.CustomerInfoes.Add(custInfoTable);


            billInfoTable.BillNumber   = billNo;
            billInfoTable.BillTypeID   = billTypeIDList.BillTypeID;//Cash or Credit Bill
            billInfoTable.TotalAmount  = sumTotal;
            billInfoTable.Discount     = custInfo.custDiscount;
            billInfoTable.BillDate     = custInfo.billDate;
            billInfoTable.UpdatedOn    = DateTime.Now;
            billInfoTable.CustomerInfo = custInfoTable;
            //database.CustomerInfoes.Add(custInfoTable);
            database.BillInfoes.Add(billInfoTable);
            database.SaveChanges();
        }
예제 #2
0
 public void CallBackFromReport(string billno, CustomerBillData cusBill, CustomerInfoDetails custInfo, ProductSale prodSale)
 {
     //MessageBox.Show("Please enter First Name!" + billno);
     customerBillData    = cusBill;
     customerInfoDetails = custInfo;
     ProductFinalSale(billno);
     prodSale.dataGridViewSale.Rows.Clear();
 }
예제 #3
0
        public void showBill(CustomerBillData cusBill, CustomerInfoDetails custInfo)
        {
            customerBillData    = cusBill;
            customerInfoDetails = custInfo;
            rs.Name             = "DataSetCustBillProd";
            rs.Value            = cusBill.billData;
            _billNo             = cusBill.billNo;

            this.reportViewerCustBill.LocalReport.DataSources.Clear();
            this.reportViewerCustBill.LocalReport.DataSources.Add(rs);
            this.reportViewerCustBill.LocalReport.ReportEmbeddedResource = "RawForms.Reports.CustomerBill.rdlc";

            rp.Add(new ReportParameter("gstNumber", cusBill.gstn));
            rp.Add(new ReportParameter("custName", custInfo.custName));
            rp.Add(new ReportParameter("custAddress", custInfo.custAddress));
            rp.Add(new ReportParameter("billDate", custInfo.billDate.ToString("dd-MM-yyyy")));
            rp.Add(new ReportParameter("billNumber", cusBill.billNo));
            rp.Add(new ReportParameter("shopName", cusBill.shopName));
            rp.Add(new ReportParameter("shopAddress", cusBill.shopAddress));
            rp.Add(new ReportParameter("discount", custInfo.custDiscount.ToString()));
            this.reportViewerCustBill.LocalReport.SetParameters(rp);
            this.reportViewerCustBill.RefreshReport();
        }
예제 #4
0
        public void SendProductinfForBill()
        {
            List <CustomerBillProduct> billProdList = new List <CustomerBillProduct>();

            billProdList.Clear();

            //CustomerBillForm cust = new CustomerBillForm();
            CustomerDetails custinfo = new CustomerDetails(this);

            for (int i = 0; i <= dataGridViewSale.RowCount - 2; i++) //count-2 because one header and one grand total at last row
            {
                var custBillProduct = new CustomerBillProduct
                {
                    Productdesc  = Convert.ToString(dataGridViewSale.Rows[i].Cells["Description"].Value),
                    Productprice = Convert.ToDecimal(dataGridViewSale.Rows[i].Cells["SalesPrice"].Value),
                    Productunit  = Convert.ToDecimal(dataGridViewSale.Rows[i].Cells["Quantity"].Value),
                    Totalprice   = Convert.ToDecimal(dataGridViewSale.Rows[i].Cells["Total"].Value)
                };
                billProdList.Add(custBillProduct);
            }
            var database = new InventoryEntities();
            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;

            var customerBillData = new CustomerBillData();

            customerBillData.gstn        = shopInfo.Gstn;
            customerBillData.shopName    = shopInfo.ShopName;
            customerBillData.shopAddress = shopAddress;
            customerBillData.billNo      = _globalBillNo;
            customerBillData.billData    = billProdList;
            custinfo.prodBillInfoPass(customerBillData, _globalBillNo);
            custinfo.ShowDialog(this);
        }
예제 #5
0
 public void prodBillInfoPass(CustomerBillData custBillData, string billno)
 {
     custBillInfoData = custBillData;
     _billnumber      = billno;
 }
예제 #6
0
        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);
        }