Beispiel #1
0
 public void GetMaxbillid()
 {
     try
     {
         billid = ProductBill_Master.MaxId() + 1;
     }
     catch (Exception ew) { }
 }
Beispiel #2
0
        protected void btndallbill_Click(object sender, EventArgs e)
        {
            grid();
            decimal totalamt = 0;

            foreach (GridViewRow gv in gdvNotice.Rows)
            {
                totalamt += decimal.Parse(gv.Cells[4].Text.ToString());
            }
            #region
            //string constr = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
            //using (SqlConnection conn = new SqlConnection(constr))
            //{
            //    SqlDataAdapter da = new SqlDataAdapter();
            //    da.InsertCommand = new SqlCommand("Insert Into UserOrderPaymenttbl (Orderid, TrackingId, BankRefNo, OrderStatus,FailureMessage,PaymentMod,CardName,StatusCode,StatusMessage,ResponseCode,PaymentDate,Amount,UserId) Values (@Orderid, @TrackingId, @BankRefNo, @OrderStatus,@FailureMessage,@PaymentMod,@CardName,@StatusCode,@StatusMessage,@ResponseCode,@PaymentDate,@Amount,@UserId)", conn);
            //    da.InsertCommand.Parameters.Add("@Orderid", SqlDbType.Int).Value = 0;
            //    da.InsertCommand.Parameters.Add("@TrackingId", SqlDbType.Text).Value = "";
            //    da.InsertCommand.Parameters.Add("@BankRefNo", SqlDbType.Text).Value = "";
            //    da.InsertCommand.Parameters.Add("@OrderStatus", SqlDbType.Text).Value = "PickUp";

            //    da.InsertCommand.Parameters.Add("@FailureMessage", SqlDbType.Text).Value = "";
            //    da.InsertCommand.Parameters.Add("@PaymentMod", SqlDbType.Text).Value = "Wallet";
            //    da.InsertCommand.Parameters.Add("@CardName", SqlDbType.Text).Value = "";
            //    da.InsertCommand.Parameters.Add("@StatusCode", SqlDbType.Int).Value = 0;

            //    da.InsertCommand.Parameters.Add("@StatusMessage", SqlDbType.Text).Value = "";
            //    da.InsertCommand.Parameters.Add("@ResponseCode", SqlDbType.Int).Value = 0;
            //    da.InsertCommand.Parameters.Add("@PaymentDate", SqlDbType.DateTime).Value = System.DateTime.Now;
            //    da.InsertCommand.Parameters.Add("@Amount", SqlDbType.Decimal).Value = totalamt;
            //    da.InsertCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = ddlUser.SelectedIndex;
            //    conn.Open();

            //    da.InsertCommand.ExecuteNonQuery();

            //    conn.Close();
            //}
            #endregion
            ProductBill_Master bm = new ProductBill_Master();
            bm.BILL_ID       = ProductBill_Master.MaxId() + 1;
            bm.BILLNO        = "OMHRD000" + bm.BILL_ID.ToString();
            bm.TOTAL         = Math.Round(totalamt, 0);
            bm.STATUS        = "Wallet";
            bm.BILLDATE      = DateTime.Today.Date;
            bm.RECEIVER_ID   = ddlUser.SelectedIndex;
            bm.REMARKS       = null;
            bm.LOGIN_ID      = int.Parse(Session["PickupID"].ToString());
            bm.Bil_Stutas    = "Paid";
            bm.Extra_Payment = 0;
            bm.NO_OF_BOXES   = "";
            bm.Save();
            ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<Script>alert('Save Successfully...');</Script>", false);
            PrintBill();
        }
Beispiel #3
0
        public void PrintBill()
        {
            try
            {
                int UserId = 0;
                Int32.TryParse(ddlUser.SelectedValue, out UserId);
                List <ProductInvoice_Master> _Pro = ProductInvoice_MasterCollection.GetAll().FindAll(x => x.BILL_ID == billid);
                #region Company
                string CompanyName    = USERPROFILEMASTER.GetByUser_Name("OMHRD").First_Name;
                string CompanyAddress = USERPROFILEMASTER.GetByUser_Name("OMHRD").Address;
                string CompanyState   = USERPROFILEMASTER.GetByUser_Name("OMHRD").StateName;
                string CompanyCity    = USERPROFILEMASTER.GetByUser_Name("OMHRD").CityName;
                string ZipCode        = USERPROFILEMASTER.GetByUser_Name("OMHRD").ZipCode;
                string CompanyGST     = USERPROFILEMASTER.GetByUser_Name("OMHRD").GstinVerified;
                string CompanyContact = USERPROFILEMASTER.GetByUser_Name("OMHRD").ContactNumber;
                #endregion
                #region Seller
                string ShipName  = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name;
                string ShipAdd1  = USERPROFILEMASTER.GetByRegistration_ID(UserId).Address;
                string ShipAdd2  = USERPROFILEMASTER.GetByRegistration_ID(UserId).AddressLine2;
                string ShipState = USERPROFILEMASTER.GetByRegistration_ID(UserId).StateName;
                string ShipCity  = USERPROFILEMASTER.GetByRegistration_ID(UserId).CityName;
                string ShipZip   = USERPROFILEMASTER.GetByRegistration_ID(UserId).ZipCode;
                string Contry    = USERPROFILEMASTER.GetByRegistration_ID(UserId).COUNTRY;

                string BillName       = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name;
                string PermanentAdd1  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddress;
                string PermanentAdd2  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddressLine2;
                string PermanentState = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippStateName;
                string PermanentCity  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShipCityName;
                string PermanentZip   = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingZip;
                string Gstin          = USERPROFILEMASTER.GetByRegistration_ID(UserId).GstinVerified;
                #endregion
                #region PickUp
                int    PicupId       = int.Parse(Session["PickupID"].ToString());
                string PickUpName    = PickupMaster.GetByPickupID(PicupId).FirstName + " " + PickupMaster.GetByPickupID(PicupId).LastName;
                string PickUpAddress = PickupMaster.GetByPickupID(PicupId).Address;
                string PickUpContact = PickupMaster.GetByPickupID(PicupId).ContactNo;
                string CenterName    = PickupMaster.GetByPickupID(PicupId).CenterName;
                string CenterCode    = PickupMaster.GetByPickupID(PicupId).CenterCode;
                #endregion
                #region BillDetail
                System.Guid guid      = System.Guid.NewGuid();
                String      id        = guid.ToString();
                string      OrderId   = id;
                DateTime    dt        = System.DateTime.Today;
                string      InvoiNo   = ProductBill_Master.GetByBILL_ID(billid).BILLNO;
                string      InvoiDate = dt.ToString();
                string      Phone     = USERPROFILEMASTER.GetByRegistration_ID(UserId).ContactNumber;
                string      Email     = USERPROFILEMASTER.GetByRegistration_ID(UserId).Email;

                #endregion
                decimal totamt = Math.Round(ProductBill_Master.GetByBILL_ID(billid).TOTAL, 0);
                var     values = totamt.ToString(CultureInfo.InvariantCulture).Split('.');
                Int64   rup    = Convert.ToInt64(values[0]);
                Int64   paise  = 0;
                if (values.Length == 2)
                {
                    paise = Convert.ToInt64(values[1]);
                }
                string rupee = string.Empty;
                string pa    = string.Empty;
                if (paise != 0)
                {
                    pa    = Rupees(paise) + "Paise Only";
                    rupee = Rupees(rup) + "Rupees and " + pa;
                }
                else
                {
                    rupee = Rupees(rup) + "Rupees Only";
                }
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                this.ReportViewer1.LocalReport.EnableExternalImages = true;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("/Report/PickUpSale.rdlc");
                ReportDataSource  datasource = new ReportDataSource("BillGenrate", _Pro);
                ReportParameter[] rpt        = new ReportParameter[33];
                rpt[0]  = new ReportParameter("CompanyName", CompanyName);
                rpt[1]  = new ReportParameter("CompanyAddress", CompanyAddress);
                rpt[2]  = new ReportParameter("CompanyState", CompanyState);
                rpt[3]  = new ReportParameter("CompanyCity", CompanyCity);
                rpt[4]  = new ReportParameter("ZipCode", ZipCode);
                rpt[5]  = new ReportParameter("CompanyGST", CompanyGST);
                rpt[6]  = new ReportParameter("CompanyContact", CompanyContact);
                rpt[7]  = new ReportParameter("ShipName", ShipName);
                rpt[8]  = new ReportParameter("ShipAdd1", ShipAdd1);
                rpt[9]  = new ReportParameter("ShipAdd2", ShipAdd2);
                rpt[10] = new ReportParameter("ShipCity", ShipCity);
                rpt[11] = new ReportParameter("ShipState", ShipState);
                rpt[12] = new ReportParameter("ShipZip", ShipZip);
                rpt[13] = new ReportParameter("Contry", Contry);
                rpt[14] = new ReportParameter("BillName", BillName);
                rpt[15] = new ReportParameter("PermanentAdd1", PermanentAdd1);
                rpt[16] = new ReportParameter("PermanentAdd2", PermanentAdd2);
                rpt[17] = new ReportParameter("PermanentCity", PermanentCity);
                rpt[18] = new ReportParameter("PermanentState", PermanentState);
                rpt[19] = new ReportParameter("PermanentZip", PermanentZip);
                rpt[20] = new ReportParameter("Gstin", Gstin);
                rpt[21] = new ReportParameter("OrderId", OrderId);
                rpt[22] = new ReportParameter("InvoiNo", InvoiNo);
                rpt[23] = new ReportParameter("InvoiDate", InvoiDate);
                rpt[24] = new ReportParameter("Phone", Phone);
                rpt[25] = new ReportParameter("Email", Email);
                rpt[26] = new ReportParameter("TotalAmountWord", rupee);

                rpt[27] = new ReportParameter("PaymentMod", PaymentMod);
                rpt[28] = new ReportParameter("PickUpName", PickUpName);
                rpt[29] = new ReportParameter("PickUpAddress", PickUpAddress);
                rpt[30] = new ReportParameter("PickUpContact", PickUpContact);
                rpt[31] = new ReportParameter("CenterName", CenterName);
                rpt[32] = new ReportParameter("CenterCode", CenterCode);
                this.ReportViewer1.LocalReport.SetParameters(rpt);
                this.ReportViewer1.LocalReport.DataSources.Clear();
                this.ReportViewer1.LocalReport.DataSources.Add(datasource);
                this.ReportViewer1.LocalReport.Refresh();
            }
            catch (Exception ex)
            { }
        }
Beispiel #4
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();
            }
        }