예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int id         = Convert.ToInt32(Request.QueryString["id"]);
                int locationId = Convert.ToInt32(Request.QueryString["location"]);
                if (Request.QueryString["id"] != null && Request.QueryString["location"] != null)
                {
                    string invoicetype = "";
                    try
                    {
                        invoicetype = Request.QueryString["invoicetype"].ToString();
                    }
                    catch (Exception)
                    {
                    }
                    Entities.Register.SalesEstimate sr = new Entities.Register.SalesEstimate();
                    sr = Entities.Register.SalesEstimate.GetDetails(id, locationId);
                    dynamic setting = Entities.Application.Settings.GetFeaturedSettings();
                    lblCurrency.Text = Convert.ToString(setting.CurrencySymbol);
                    Entities.Master.Company c = new Entities.Master.Company();
                    c = Entities.Master.Company.GetDetailsByLocation(locationId);
                    lblCompRegNo.Text = c.RegId1;
                    imgLogo.ImageUrl  = "data:image/jpeg;base64, " + c.LogoBase64;
                    //lblCustName.Text = sr.Customer;
                    lblCustomer.Text         = sr.CustomerName;
                    lblCustomerAddress1.Text = sr.BillingAddress[0].Address1;
                    lblCustomerAddress2.Text = sr.BillingAddress[0].Address2;
                    lblCustPh.Text           = sr.BillingAddress[0].Phone1;
                    lblCustEmail.Text        = sr.BillingAddress[0].Email;
                    lblCustTRN.Text          = sr.CustomerTaxNo;
                    lblComp.Text             = sr.Company;
                    lblTerms.Text            = sr.TermsandConditon;
                    lblJob.Text          = sr.JobName;
                    lblCompAddr1.Text    = c.Address1;
                    lblCompAddr2.Text    = c.Address2;
                    lblCompPh.Text       = c.MobileNo1;
                    lblCompEmail.Text    = c.Email;
                    lblCustPhone.Text    = sr.BillingAddress[0].Phone1;
                    lblCompanyEmail.Text = c.Email;
                    lblLocName.Text      = sr.Location;
                    lblLocAddr1.Text     = sr.LocationAddress1;
                    lblLocAddr2.Text     = sr.LocationAddress2;
                    lblWords.Text        = NumberToWords(Convert.ToDouble(sr.NetAmount));
                    //lblCustName.Text = sr.Customer;
                    //lblDiscount.Text = Convert.ToString(sr.Discount);
                    //lblFreight.Text = Convert.ToString(sr.FreightAmount);
                    lblLocPhone.Text  = sr.LocationPhone;
                    lblDate.Text      = sr.EntryDateString;
                    lblInvoiceNo.Text = sr.EstimateNumber;
                    lblTax.Text       = Convert.ToString(sr.TaxAmount);
                    lblGross.Text     = Convert.ToString(sr.Gross);
                    lblroundOff.Text  = Convert.ToString(sr.RoundOff);
                    //lblNet.Text = Convert.ToString(sr.NetAmount);
                    lblAmountinWords.Text = Convert.ToString(sr.NetAmount);
                    lblComp.Text          = sr.Company;
                    //lblDuedate.Text = sr.EntryDateString;
                    lblCompanyPhone.Text = c.OfficeNo;
                    //lblAddress.Text = sr.CustomerAddress;
                    //lblCustName.Text = sr.Customer;
                    lblCustPhone.Text = sr.BillingAddress[0].Phone1;
                    //lblTfn.Text = sr.CustomerTaxNo;
                    lblProjectName.Text = sr.JobName;
                    lblDeduction.Text   = Convert.ToString(sr.Discount);
                    lblMainHead.Text    = "Sales Estimate";

                    tAndC.Text = sr.TermsandConditon; //Entities.Application.Settings.GetSetting(148);

                    if (invoicetype == "delivery")
                    {
                        thRate.Visible  = false;
                        thTotal.Visible = false;

                        for (int i = 0; i < sr.Products.Count; i++)
                        {
                            TableRow  r  = new TableRow();
                            TableCell t1 = new TableCell();
                            t1.Text = (i + 1).ToString();
                            r.Cells.Add(t1);
                            //TableCell t2 = new TableCell();
                            //t2.Text = sr.Products[i].ItemCode;
                            //r.Cells.Add(t2);
                            if (setting.EnableDescription)//Enabled Description
                            {
                                TableCell t3 = new TableCell();
                                t3.Width = 500;
                                string itemName = "<b>";
                                itemName += sr.Products[i].Name;
                                itemName += "</b><br/>";
                                itemName += sr.Products[i].Description;
                                t3.Text   = itemName;
                                r.Cells.Add(t3);
                            }
                            else
                            {
                                TableCell t3 = new TableCell();
                                t3.Text = sr.Products[i].Name;
                                r.Cells.Add(t3);
                            }

                            TableCell t4 = new TableCell();
                            t4.Text = sr.Products[i].Quantity.ToString();
                            t4.Style.Add("text-align", "right");
                            r.Cells.Add(t4);

                            TableCell t5 = new TableCell();
                            t5.Text = sr.Products[i].Unit.ToString();
                            t5.Style.Add("text-align", "right");
                            r.Cells.Add(t5);
                            //TableCell t5 = new TableCell();
                            //t5.Text = sr.Products[i].MRP.ToString();
                            //r.Cells.Add(t5);
                            //TableCell t6 = new TableCell();
                            //t6.Text = sr.Products[i].SellingPrice.ToString();
                            //r.Cells.Add(t6);
                            //TableCell t7 = new TableCell();
                            //t7.Text = sr.Products[i].TaxPercentage.ToString();
                            //r.Cells.Add(t7);
                            //TableCell t8 = new TableCell();
                            //t8.Text = sr.Products[i].Gross.ToString();
                            //r.Cells.Add(t8);
                            //TableCell t9 = new TableCell();
                            //t9.Text = sr.Products[i].TaxAmount.ToString();
                            //r.Cells.Add(t9);
                            //TableCell t10 = new TableCell();
                            //t10.Text = sr.Products[i].NetAmount.ToString();
                            //r.Cells.Add(t10);
                            listTable.Rows.Add(r);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < sr.Products.Count; i++)
                        {
                            TableRow  r  = new TableRow();
                            TableCell t1 = new TableCell();
                            t1.Text = (i + 1).ToString();
                            r.Cells.Add(t1);
                            //TableCell t2 = new TableCell();
                            //t2.Text = sr.Products[i].ItemCode;
                            //r.Cells.Add(t2);
                            if (setting.EnableDescription)//Enabled Description
                            {
                                TableCell t3 = new TableCell();
                                t3.Width = 500;
                                string itemName = "<b>";
                                itemName += sr.Products[i].Name;
                                itemName += "</b><br/>";
                                itemName += sr.Products[i].Description;
                                t3.Text   = itemName;
                                r.Cells.Add(t3);
                            }
                            else
                            {
                                TableCell t3 = new TableCell();
                                t3.Text = sr.Products[i].Name;
                                r.Cells.Add(t3);
                            }

                            TableCell t4 = new TableCell();
                            t4.Text = sr.Products[i].Quantity.ToString();
                            t4.Style.Add("text-align", "right");
                            r.Cells.Add(t4);

                            TableCell t5 = new TableCell();
                            t5.Text = sr.Products[i].Unit.ToString();
                            t5.Style.Add("text-align", "right");
                            r.Cells.Add(t5);
                            //TableCell t5 = new TableCell();
                            //t5.Text = sr.Products[i].MRP.ToString();
                            //r.Cells.Add(t5);
                            TableCell t6 = new TableCell();
                            t6.Text = sr.Products[i].SellingPrice.ToString();
                            t6.Style.Add("text-align", "right");
                            r.Cells.Add(t6);
                            //TableCell t7 = new TableCell();
                            //t7.Text = sr.Products[i].TaxPercentage.ToString();
                            //r.Cells.Add(t7);
                            //TableCell t8 = new TableCell();
                            //t8.Text = sr.Products[i].Gross.ToString();
                            //r.Cells.Add(t8);
                            //TableCell t9 = new TableCell();
                            //t9.Text = sr.Products[i].TaxAmount.ToString();
                            //r.Cells.Add(t9);
                            TableCell t10 = new TableCell();
                            t10.Text = sr.Products[i].Gross.ToString();
                            t10.Style.Add("text-align", "right");
                            r.Cells.Add(t10);
                            listTable.Rows.Add(r);
                        }

                        TableFooterRow tf            = new TableFooterRow();
                        TableFooterRow TaxAmountcell = new TableFooterRow();
                        TableFooterRow SubTotal      = new TableFooterRow();
                        tf.CssClass            = "inv-footer beige";
                        TaxAmountcell.CssClass = "inv-footer beige";
                        SubTotal.CssClass      = "inv-footer ";

                        TableCell tfc1 = new TableCell();
                        tfc1.Text = "<b>VAT AMOUNT</b>";

                        tfc1.ColumnSpan      = 5;
                        tfc1.HorizontalAlign = HorizontalAlign.Right;
                        TaxAmountcell.Cells.Add(tfc1);
                        TableCell tfc2 = new TableCell();
                        tfc2.Text            = "<b>" + Convert.ToString(sr.TaxAmount) + "</b>";
                        tfc2.HorizontalAlign = HorizontalAlign.Right;
                        TaxAmountcell.Cells.Add(tfc2);
                        listTable.Rows.Add(TaxAmountcell);

                        TableCell tfc3 = new TableCell();
                        tfc3.Text            = "<b>SUB TOTAL</b>";
                        tfc3.ColumnSpan      = 5;
                        tfc3.HorizontalAlign = HorizontalAlign.Right;
                        SubTotal.Cells.Add(tfc3);
                        TableCell tfc4 = new TableCell();
                        tfc4.Text            = "<b>" + Convert.ToString(sr.Gross) + "</b>";
                        tfc4.HorizontalAlign = HorizontalAlign.Right;
                        SubTotal.Cells.Add(tfc4);
                        listTable.Rows.Add(SubTotal);



                        TableCell tfc5 = new TableCell();
                        tfc5.Text            = "<b>GRAND TOTAL ( " + setting.CurrencySymbol + " )</b>";
                        tfc5.ColumnSpan      = 5;
                        tfc5.HorizontalAlign = HorizontalAlign.Right;
                        tf.Cells.Add(tfc5);
                        TableCell tfc6 = new TableCell();
                        tfc6.Text            = "<b>" + Convert.ToString(sr.NetAmount) + "</b>";
                        tfc6.HorizontalAlign = HorizontalAlign.Right;
                        tf.Cells.Add(tfc6);
                        listTable.Rows.Add(tf);
                    }
                }
            }
            catch (Exception ex)
            {
                Entities.Application.Helper.LogException(ex, "Quote | Page_Load(object sender, EventArgs e)");
                Response.Write("<script> alert('" + ex.Message + "') </script>");
            }
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int id         = Convert.ToInt32(Request.QueryString["id"]);
         int locationId = Convert.ToInt32(Request.QueryString["location"]);
         if (Request.QueryString["id"] != null && Request.QueryString["location"] != null)
         {
             Entities.Register.SalesEstimate sq = new Entities.Register.SalesEstimate();
             sq = Entities.Register.SalesEstimate.GetDetails(id, locationId);
             dynamic setting = Entities.Application.Settings.GetFeaturedSettings();
             lblCurrency.Text = Convert.ToString(setting.CurrencySymbol);
             Entities.Master.Company c = new Entities.Master.Company();
             c = Entities.Master.Company.GetDetailsByLocation(locationId);
             imgLogo.ImageUrl      = "data:image/jpeg;base64, " + c.LogoBase64;
             lblCustName.Text      = sq.CustomerName;
             lblComp.Text          = sq.Company;
             lblCompAddr1.Text     = c.Address1;
             lblCompAddr2.Text     = c.Address2;
             lblCompPh.Text        = c.MobileNo1;
             lblCompGst.Text       = c.RegId1;
             lblCompEmail.Text     = sq.CompanyEmail;
             lblCustPhone.Text     = sq.BillingAddress[0].Phone1;
             lblLocName.Text       = sq.Location;
             lblLocAddr1.Text      = sq.LocationAddress1;
             lblLocAddr2.Text      = sq.LocationAddress2;
             lblLocPhone.Text      = sq.LocationPhone;
             lblDate.Text          = sq.EntryDateString;
             lblCompName.Text      = sq.Company;
             lblInvoiceNo.Text     = sq.EstimateNumber;
             lblTax.Text           = Convert.ToString(sq.TaxAmount);
             lblGross.Text         = Convert.ToString(sq.Gross);
             lblroundOff.Text      = Convert.ToString(sq.RoundOff);
             lblNet.Text           = Convert.ToString(sq.NetAmount);
             lblAmountinWords.Text = NumberToWords(Convert.ToDouble(sq.NetAmount));
             tAndC.Text            = sq.TermsandConditon;//Entities.Application.Settings.GetSetting(149);
             lblProjectName.Text   = sq.JobName;
             for (int i = 0; i < sq.Products.Count; i++)
             {
                 TableRow  r  = new TableRow();
                 TableCell t1 = new TableCell();
                 t1.Text = (i + 1).ToString();
                 r.Cells.Add(t1);
                 //TableCell t2 = new TableCell();
                 //t2.Text = sq.Products[i].ItemCode;
                 //r.Cells.Add(t2);
                 //TableCell t3 = new TableCell();
                 //t3.Text = sq.Products[i].Name;
                 //r.Cells.Add(t3);
                 if (setting.EnableDescription)//Enabled Description
                 {
                     TableCell t3 = new TableCell();
                     t3.Width = 500;
                     string itemName = "<b>";
                     itemName += sq.Products[i].Name;
                     itemName += "</b><br/>";
                     itemName += sq.Products[i].Description;
                     t3.Text   = itemName;
                     r.Cells.Add(t3);
                 }
                 else
                 {
                     TableCell t3 = new TableCell();
                     t3.Text = sq.Products[i].Name;
                     r.Cells.Add(t3);
                 }
                 TableCell t4 = new TableCell();
                 t4.Text = sq.Products[i].Quantity.ToString();
                 r.Cells.Add(t4);
                 //TableCell t5 = new TableCell();
                 //t5.Text = sq.Products[i].MRP.ToString();
                 //r.Cells.Add(t5);
                 TableCell t6 = new TableCell();
                 t6.Text = sq.Products[i].SellingPrice.ToString();
                 r.Cells.Add(t6);
                 //TableCell t7 = new TableCell();
                 //t7.Text = sq.Products[i].TaxPercentage.ToString();
                 //r.Cells.Add(t7);
                 TableCell t8 = new TableCell();
                 t8.Text = sq.Products[i].Gross.ToString();
                 r.Cells.Add(t8);
                 //TableCell t9 = new TableCell();
                 //t9.Text = sq.Products[i].TaxAmount.ToString();
                 //r.Cells.Add(t9);
                 TableCell t10 = new TableCell();
                 t10.Text = sq.Products[i].NetAmount.ToString();
                 r.Cells.Add(t10);
                 listTable.Rows.Add(r);
             }
         }
     }
     catch (Exception ex)
     {
         Entities.Application.Helper.LogException(ex, "Estimate | Page_Load(object sender, EventArgs e)");
         Response.Write("<script> alert('" + ex.Message + "') </script>");
     }
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int id         = Convert.ToInt32(Request.QueryString["Id"]);
         int locationid = Convert.ToInt32(Request.QueryString["location"]);
         if (Request.QueryString["Id"] != null && Request.QueryString["location"] != null)
         {
             Entities.Register.SalesEstimate sq = new Entities.Register.SalesEstimate();
             sq = Entities.Register.SalesEstimate.GetDetails(id, locationid);
             dynamic setting = Entities.Application.Settings.GetFeaturedSettings();
             lblCurrency.Text = Convert.ToString(setting.CurrencySymbol);
             Entities.Master.Company c = new Entities.Master.Company();
             c = Entities.Master.Company.GetDetailsByLocation(locationid);
             imgLogo.ImageUrl    = "data:image/jpeg;base64, " + c.LogoBase64;
             lblCustName.Text    = sq.CustomerName;
             lblCompRegId.Text   = sq.CompanyRegId;
             lblLocRegId.Text    = sq.LocationRegId;
             lblCity.Text        = c.City;
             lblCompState.Text   = c.State;
             lblCompCountry.Text = c.Country;
             lblCustState.Text   = sq.BillingAddress[0].State;
             lblCustCountry.Text = sq.BillingAddress[0].Country;
             lblCustTaxNo.Text   = sq.CustomerTaxNo;
             lblCustAddr1.Text   = sq.BillingAddress[0].Address1;
             lblCustAddr2.Text   = sq.BillingAddress[0].Address2;
             lblComp.Text        = sq.Company;
             lblCompAddr1.Text   = c.Address1;
             lblCompAddr2.Text   = c.Address2;
             lblCompPh.Text      = c.MobileNo1;
             lblCompRegId.Text   = c.RegId1;
             lblCustPhone.Text   = sq.BillingAddress[0].Phone1;
             lblLocName.Text     = sq.Location;
             lblLocAddr1.Text    = sq.LocationAddress1;
             lblLocAddr2.Text    = sq.LocationAddress2;
             lblLocPhone.Text    = sq.LocationPhone;
             lblDate.Text        = sq.EntryDateString;
             lblInvoiceNo.Text   = sq.EstimateNumber;
             lblTotal.Text       = Convert.ToString(sq.Gross);
             lblTax.Text         = Convert.ToString(sq.TaxAmount);
             lblNet.Text         = Convert.ToString(sq.NetAmount);
             lblroundOff.Text    = Convert.ToString(sq.RoundOff);
             tAndC.Text          = Entities.Application.Settings.GetSetting(115);
             for (int i = 0; i < sq.Products.Count; i++)
             {
                 TableRow  r  = new TableRow();
                 TableCell t1 = new TableCell();
                 t1.Text = (i + 1).ToString();
                 r.Cells.Add(t1);
                 TableCell t2 = new TableCell();
                 t2.Text = sq.Products[i].ItemCode;
                 r.Cells.Add(t2);
                 TableCell t3 = new TableCell();
                 t3.Text = sq.Products[i].Name;
                 r.Cells.Add(t3);
                 TableCell t4 = new TableCell();
                 t4.Text = sq.Products[i].MRP.ToString();
                 r.Cells.Add(t4);
                 TableCell t5 = new TableCell();
                 t5.Text = sq.Products[i].SellingPrice.ToString();
                 r.Cells.Add(t5);
                 TableCell t6 = new TableCell();
                 t6.Text = sq.Products[i].Quantity.ToString();
                 r.Cells.Add(t6);
                 TableCell t7 = new TableCell();
                 t7.Text = sq.Products[i].Gross.ToString();
                 r.Cells.Add(t7);
                 TableCell t8 = new TableCell();
                 t8.Text = sq.Products[i].TaxPercentage.ToString();
                 r.Cells.Add(t8);
                 if (c.StateId == sq.BillingAddress[0].StateID)
                 {
                     TableCell t9 = new TableCell();
                     t9.Text = (Convert.ToDecimal(sq.Products[i].TaxAmount) / 2).ToString();
                     r.Cells.Add(t9);
                     TableCell t10 = new TableCell();
                     t10.Text = (Convert.ToDecimal(sq.Products[i].TaxAmount) / 2).ToString();
                     r.Cells.Add(t10);
                     TableCell t11 = new TableCell();
                     t11.Text = "0.00";
                     r.Cells.Add(t11);
                 }
                 else
                 {
                     TableCell t9 = new TableCell();
                     t9.Text = "0.00";
                     r.Cells.Add(t9);
                     TableCell t10 = new TableCell();
                     t10.Text = "0.00";
                     r.Cells.Add(t10);
                     TableCell t11 = new TableCell();
                     t11.Text = sq.Products[i].TaxAmount.ToString();
                     r.Cells.Add(t11);
                 }
                 TableCell t12 = new TableCell();
                 t12.Text = sq.Products[i].NetAmount.ToString();
                 r.Cells.Add(t12);
                 listTable.Rows.Add(r);
             }
         }
     }
     catch (Exception ex)
     {
         Entities.Application.Helper.LogException(ex, "Estimate | Page_Load(object sender, EventArgs e)");
         Response.Write("<script> alert('" + ex.Message + "') </script>");
     }
 }