Esempio n. 1
0
        public void BindProductAddToCart()
        {
            int userId = int.Parse(ddlUser.SelectedValue);

            gdvNotice.DataSource = ProductAddtoCartMasterCollection.GetAll().FindAll(x => x.User_id == userId);
            gdvNotice.DataBind();
        }
Esempio n. 2
0
        public void MakePayment()
        {
            decimal totalamt    = 0;
            int     UserId      = int.Parse(ddlUser.SelectedValue);
            var     products    = ProductAddtoCartMasterCollection.GetAll().FindAll(x => x.User_id == UserId);
            var     paymentBill = new ProductBill_Master();

            paymentBill.BILL_ID = ProductBill_Master.MaxId() + 1;
            paymentBill.BILLNO  = DateTime.Now.ToString("yyyyMMddHHmmssffff");
            foreach (GridViewRow gv in gdvNotice.Rows)
            {
                totalamt += decimal.Parse(gv.Cells[4].Text.ToString());
            }
            paymentBill.TOTAL         = totalamt;
            paymentBill.STATUS        = "Wallet";
            paymentBill.BILLDATE      = DateTime.Today.Date;
            paymentBill.RECEIVER_ID   = UserId;
            paymentBill.REMARKS       = null;
            paymentBill.LOGIN_ID      = int.Parse(Session["PickupID"].ToString());
            paymentBill.Bil_Stutas    = "Paid";
            paymentBill.Extra_Payment = 0;
            paymentBill.NO_OF_BOXES   = "";
            paymentBill.Save();
            #region
            foreach (var x in products)
            {
                ProductInvoice_Master invoiceItem = new ProductInvoice_Master();
                {
                    invoiceItem.INVOICE_ID = ProductInvoice_Master.MaxId() + 1;
                    invoiceItem.ITEM_ID    = x.Product_id;
                    invoiceItem.ITEMNAME   = PickUpItemMaster.GetByOrderId(x.Product_id).ITEMNAME;
                    invoiceItem.HSNCODE    = PickUpItemMaster.GetByOrderId(x.Product_id).HSNCODE;
                    invoiceItem.QUANTITY   = x.Quantity;
                    invoiceItem.RATE_PER   = PickUpItemMaster.GetByOrderId(x.Product_id).RATE_PER;
                    invoiceItem.TOTAL      = x.Total;
                    if (paymentBill.RECEIVER_ID == paymentBill.LOGIN_ID)
                    {
                        invoiceItem.CGST_RATE = decimal.Parse(PickUpItemMaster.GetByOrderId(x.Product_id).CGST.ToString());
                        invoiceItem.SGST_RATE = decimal.Parse(PickUpItemMaster.GetByOrderId(x.Product_id).SGST.ToString());
                        invoiceItem.IGST_RATE = 0;
                        invoiceItem.CGST_AMT  = (invoiceItem.TOTAL * invoiceItem.CGST_RATE) / 100;
                        invoiceItem.SGST_AMT  = (invoiceItem.TOTAL * invoiceItem.SGST_RATE) / 100;
                        invoiceItem.IGST_AMT  = (invoiceItem.TOTAL * invoiceItem.IGST_RATE) / 100;
                    }
                    else
                    {
                        invoiceItem.CGST_RATE = 0;
                        invoiceItem.SGST_RATE = 0;
                        invoiceItem.IGST_RATE = decimal.Parse(PickUpItemMaster.GetByOrderId(x.Product_id).IGST.ToString());
                        invoiceItem.CGST_AMT  = (invoiceItem.TOTAL * invoiceItem.CGST_RATE) / 100;
                        invoiceItem.SGST_AMT  = (invoiceItem.TOTAL * invoiceItem.SGST_RATE) / 100;
                        invoiceItem.IGST_AMT  = (invoiceItem.TOTAL * invoiceItem.IGST_RATE) / 100;
                    }
                    invoiceItem.BILL_ID      = paymentBill.BILL_ID;
                    invoiceItem.REMARKS      = "";
                    invoiceItem.INVOICE_DATE = System.DateTime.Today;
                    invoiceItem.Bil_Stutas   = "Waiting";
                    invoiceItem.RECEIVER_ID  = paymentBill.RECEIVER_ID;
                    invoiceItem.UnitCode     = x.UnitCode;
                    invoiceItem.Color_Code   = x.Color_Code;
                }
                invoiceItem.Save();
                #endregion
                ProductAddtoCartMaster dm = new ProductAddtoCartMaster();
                dm.UserDelete(UserId);
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Save Successfully...');</Script>", false);
                PrintBill();
            }
        }