Exemplo n.º 1
0
 void ddlCompany_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         int CompanyId = ddlCompany.SelectedValue.ToInt();
         if (CompanyId > 0)
         {
             Gen_Company obj = General.GetObject <Gen_Company>(c => c.Id == CompanyId);
             if (obj.AccountTypeId == Enums.ACCOUNT_TYPE.ACCOUNT)
             {
                 ddlPaymentType.SelectedValue = null;
             }
         }
         else
         {
             var item = ddlPaymentType.Items.FirstOrDefault(c => c.Value.ToInt() == 9);
             if (item != null)
             {
                 item.Enabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         ENUtils.ShowMessage(ex.Message);
     }
 }
        private void ddlCompany_SelectedValueChanged(object sender, EventArgs e)
        {
            if (grdLister.Columns.Count == 0)
            {
                return;
            }

            int?companyId = ddlCompany.SelectedValue.ToIntorNull();


            if (companyId == null)
            {
                SetOrderNoColumn(false);
                SetPupilNoColumn(false);
                SetBookedByColumn(false);
                ClearDepartment();
                ClearCostCenter();
                ClearOrderNo();
            }
            else
            {
                Gen_Company obj = General.GetObject <Gen_Company>(c => c.Id == companyId);
                if (obj != null)
                {
                    this.companyEmail = obj.Email.ToStr().Trim();
                    FillDepartmentCombo(obj.Id);
                    FillCostCenterCombo(obj.Id);
                    bool orderNo = obj.HasOrderNo.ToBool();
                    bool pupilNo = obj.HasPupilNo.ToBool();

                    bool HasBookedBy = obj.HasBookedBy.ToBool();
                    SetOrderNoColumn(orderNo);
                    SetPupilNoColumn(pupilNo);
                    SetBookedByColumn(HasBookedBy);


                    if (orderNo)
                    {
                        var list = General.GetQueryable <Booking>(c => c.CompanyId == obj.Id && (c.OrderNo != null && c.OrderNo != ""))
                                   .Select(args => new { Id = args.OrderNo, OrderNo = args.OrderNo }).Distinct().ToList();

                        ComboFunctions.FillCombo(list, ddlOrderNo, "OrderNo", "Id");

                        ddlOrderNo.Visible = true;
                        label5.Visible     = true;
                    }
                    else
                    {
                        ddlOrderNo.Visible = false;
                        label5.Visible     = false;
                    }
                }
            }
        }
        void Check()
        {
            string      Code = txtAccountCode.Text.ToString();
            Gen_Company obj  = General.GetObject <Gen_Company>(c => c.CompanyCode == Code);

            if (obj != null)
            {
                string CompanyName = obj.CompanyName.ToString();
                //      accountAddress = obj.Address.ToStr().Trim();
                int CompanyId = obj.Id.ToInt();
                ID = CompanyId;
                this.Close();
            }
            else
            {
                ENUtils.ShowMessage("Enter Valid Company Code..");
            }
        }
Exemplo n.º 4
0
        private void ddlCompany_SelectedValueChanged(object sender, EventArgs e)
        {
            if (grdLister.Columns.Count == 0)
            {
                return;
            }

            int?companyId = ddlCompany.SelectedValue.ToIntorNull();


            if (companyId == null)
            {
                SetOrderNoColumn(false);
                SetPupilNoColumn(false);
                SetBookedByColumn(false);
                ClearDepartment();
                ClearCostCenter();
            }
            else
            {
                Gen_Company obj = General.GetObject <Gen_Company>(c => c.Id == companyId);
                if (obj != null)
                {
                    this.companyEmail = obj.Email.ToStr().Trim();
                    FillDepartmentCombo(obj.Id);
                    FillCostCenterCombo(obj.Id);
                    bool orderNo = obj.HasOrderNo.ToBool();
                    bool pupilNo = obj.HasPupilNo.ToBool();

                    bool HasBookedBy = obj.HasBookedBy.ToBool();
                    SetOrderNoColumn(orderNo);
                    SetPupilNoColumn(pupilNo);
                    SetBookedByColumn(HasBookedBy);
                }
            }
        }
        public void GenerateReport()
        {
            try
            {
                if (ddlCompany.SelectedValue == null)
                {
                    pnlCriteria.Visible = false;
                }

                reportViewer1.LocalReport.EnableExternalImages = true;

                int minRows = 8;


                Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[22];

                string address = AppVars.objSubCompany.Address;
                string telNo   = string.Empty;



                string sortCode     = AppVars.objSubCompany.SortCode.ToStr();
                string accountNo    = AppVars.objSubCompany.AccountNo.ToStr();
                string accountTitle = AppVars.objSubCompany.AccountTitle.ToStr();
                string bank         = AppVars.objSubCompany.BankName.ToStr();

                string hasBankDetails = "1";
                if (string.IsNullOrEmpty(sortCode) && string.IsNullOrEmpty(accountNo) && string.IsNullOrEmpty(accountTitle) &&
                    string.IsNullOrEmpty(bank))
                {
                    hasBankDetails = "0";
                }

                if (!string.IsNullOrEmpty(sortCode))
                {
                    sortCode = "Sort Code : " + sortCode;
                }


                if (!string.IsNullOrEmpty(bank))
                {
                    bank = "Bank : " + bank;
                }


                if (!string.IsNullOrEmpty(accountTitle))
                {
                    accountTitle = "Account Title : " + accountTitle;
                }

                //   if (!string.IsNullOrEmpty(bank))
                //       bank = "Bank : " + bank;



                string website = AppVars.objSubCompany.WebsiteUrl.ToStr();
                if (!string.IsNullOrEmpty(website))
                {
                    website += " , ";
                }

                website += "Email:" + AppVars.objSubCompany.EmailAddress.ToStr();


                string companyNumber = AppVars.objSubCompany.CompanyNumber.ToStr();
                if (!string.IsNullOrEmpty(companyNumber))
                {
                    companyNumber = "Company Number: " + companyNumber;
                }

                string vatNumber = AppVars.objSubCompany.CompanyVatNumber.ToStr();
                if (!string.IsNullOrEmpty(vatNumber))
                {
                    vatNumber = "VAT Number: " + vatNumber;
                }



                param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address);

                param[18] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Footer", AppVars.objSubCompany.WebsiteUrl.ToStr());

                param[14] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_MobileNo", "Mobile: " + AppVars.objSubCompany.EmergencyNo.ToStr());
                param[15] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Website", website);
                param[16] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Email", "Email: " + AppVars.objSubCompany.EmailAddress.ToStr());

                param[20] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyNumber", companyNumber);
                param[21] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VATNumber", vatNumber);


                param[7]  = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_SortCode", sortCode);
                param[9]  = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountTitle", accountTitle);
                param[10] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Bank", bank);



                List <ClsLogo> objLogo = new List <ClsLogo>();
                objLogo.Add(new ClsLogo {
                    ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null
                });
                ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo);
                this.reportViewer1.LocalReport.DataSources.Add(imageDataSource);

                string path = @"File:";
                param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Path", path);
                param[6] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeader", AppVars.objSubCompany.CompanyName.ToStr());



                int?companyId = this.DataSource.FirstOrDefault().DefaultIfEmpty().CompanyId;

                //decimal invoiceGrandTotal = this.DataSource.FirstOrDefault().DefaultIfEmpty().InvoiceTotal.ToDecimal() + this.DataSource.FirstOrDefault().DefaultIfEmpty().AdminFees.ToDecimal();
                var data = this.DataSource.FirstOrDefault().DefaultIfEmpty();



                telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo;



                if (!string.IsNullOrEmpty(accountNo))
                {
                    accountNo = "Account No : " + accountNo;
                }



                UM_Form_Template objTemplate = General.GetObject <UM_Form_Template>(c => c.UM_Form.FormName == this.Name && c.IsDefault == true);

                if (objTemplate.TemplateName.ToStr() == "Template3")
                {
                    minRows = 4;
                }

                string className = "Taxi_AppMain.ReportDesigns." + objTemplate.TemplateName.ToStr() + "_";

                if (objTemplate.TemplateName.ToStr() == "Template4")
                {
                    this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptCompanyInvoice3.rdlc";
                }
                else if (objTemplate.TemplateName.ToStr() == "Template5")
                {
                    this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptCompanyInvoice.rdlc";
                }
                else if (objTemplate.TemplateName.ToStr() == "Template6")
                {
                    this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptCompanyInvoice.rdlc";
                    telNo += Environment.NewLine + "Fax No. " + AppVars.objSubCompany.Fax + Environment.NewLine + "Email. " + AppVars.objSubCompany.EmailAddress;
                }
                else
                {
                    if (data.HasOrderNo.ToBool() && data.HasBookedBy.ToBool())
                    {
                        this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptCompanyInvoice.rdlc";
                    }
                    else if (data.HasOrderNo.ToBool() == false && data.HasBookedBy.ToBool())
                    {
                        this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptCompanyInvoice2.rdlc";
                    }
                    else if (data.HasOrderNo.ToBool() == false && data.HasBookedBy.ToBool() == false)
                    {
                        this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptCompanyInvoice3.rdlc";
                    }
                    else if (data.HasOrderNo.ToBool() == true && data.HasBookedBy.ToBool() == false)
                    {
                        this.reportViewer1.LocalReport.ReportEmbeddedResource = className + "rptCompanyInvoice4.rdlc";
                    }
                }

                param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo);


                param[8] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountNo", accountNo);

                decimal netAmount         = this.DataSource.Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.MeetAndGreetCharges.ToDecimal() + c.CongtionCharges.ToDecimal());
                decimal invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal();


                string  vat            = "0";
                decimal discountAmount = 0.00m;
                decimal valueAddedTax  = 0.0m;
                if (companyId != null)
                {
                    Gen_Company objCompany = General.GetObject <Gen_Company>(c => c.Id == companyId);

                    if (objCompany != null)
                    {
                        if (objCompany.HasVat.ToBool())
                        {
                            valueAddedTax = (invoiceGrandTotal * 20) / 100;
                            vat           = "1";
                        }

                        if (objCompany.DiscountPercentage.ToDecimal() > 0)
                        {
                            discountAmount = (invoiceGrandTotal * objCompany.DiscountPercentage.ToDecimal()) / 100;
                        }
                    }
                }

                invoiceGrandTotal = (invoiceGrandTotal + valueAddedTax) - discountAmount;



                bool departmentwise = this.DataSource.FirstOrDefault().DefaultIfEmpty().DepartmentWise.ToBool();
                bool costCenterWise = this.DataSource.FirstOrDefault().DefaultIfEmpty().CostCenterWise.ToBool();

                string grandTotal = string.Format("{0:c}", invoiceGrandTotal);
                grandTotal = grandTotal.Substring(1);

                string net = string.Format("{0:c}", netAmount);
                net = net.Substring(1);


                string discount = string.Format("{0:c}", discountAmount);
                discount = discount.Substring(1);



                param[17] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Discount", discount);


                param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_InvoiceTotal", grandTotal);

                param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasVat", vat);

                param[5]  = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VAT", valueAddedTax.ToStr());
                param[11] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasDepartment", departmentwise ? "1" : "0");

                param[12] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Net", net);

                param[13] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasCostCenter", costCenterWise ? "1" : "0");

                param[19] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasBankDetails", hasBankDetails);


                reportViewer1.LocalReport.SetParameters(param);


                int cnt = this.DataSource.Count;

                //  int minRows = 8;

                if (cnt < minRows)
                {
                    for (int i = 0; i < minRows - cnt; i++)
                    {
                        this.DataSource.Add(new vu_Invoice {
                            Id = data.Id, BookingId = data.BookingId, HasBookedBy = data.HasBookedBy, HasOrderNo = data.HasOrderNo, HasPupilNo = data.HasPupilNo
                        });
                    }
                }



                this.vuInvoiceBindingSource.DataSource = this.DataSource;

                this.reportViewer1.ZoomPercent = 100;
                this.reportViewer1.ZoomMode    = Microsoft.Reporting.WinForms.ZoomMode.Percent;
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Exemplo n.º 6
0
        private void ViewInfo()
        {
            try
            {
                GridViewRowInfo row = grdLister.CurrentRow;

                if (row != null && row is GridViewDataRowInfo)
                {
                    int Id                 = row.Cells["Id"].Value.ToInt();
                    int companyId          = row.Cells[COLS.CompanyId].Value.ToInt();
                    List <vu_Invoice> list = null;

                    using (TaxiDataContext db = new TaxiDataContext())
                    {
                        list = db.vu_Invoices.Where(c => c.Id == Id).ToList();


                        if (TemplateName == "0")
                        {
                            TemplateName = db.UM_Form_Templates.FirstOrDefault(c => c.UM_Form.FormName == "frmInvoiceReport" && c.IsDefault == true).DefaultIfEmpty().TemplateName.ToStr();
                        }



                        if (list.Count > 0)
                        {
                            var data = list.FirstOrDefault().DefaultIfEmpty();



                            decimal netAmount = 0.00m;

                            decimal invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal();

                            //NC
                            //Changes Area for VAT start here.
                            decimal invoiceGrandTotal2 = 0.00m;//= (netAmount + data.AdminFees.ToDecimal());
                            decimal NetCharges         = 0.0m;



                            decimal DriverCostNonVAT    = 0.0m;
                            decimal BusinessCharge      = 0.0m;
                            decimal VatOnBusinessCharge = 0.0m;
                            decimal TotalGPB            = 0.0m;
                            //

                            if (TemplateName.ToStr() == "Template13" || TemplateName.ToStr() == "Template14" || TemplateName.ToStr() == "Template24")
                            {
                                if (TemplateName.ToStr() == "Template13" || TemplateName.ToStr() == "Template24")
                                {
                                    netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6)
                                                .Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal());
                                    //  NetCharges = list.Where(c => c.VehicleType != "Saloon" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal());
                                }
                                else if (TemplateName.ToStr() == "Template14")
                                {
                                    netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6)
                                                .Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.ExtraDropCharges.ToDecimal());

                                    //  NetCharges = list.Where(c => c.VehicleType != "Saloon" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.ExtraDropCharges.ToDecimal());
                                }

                                invoiceGrandTotal = netAmount;
                            }
                            else if (TemplateName.ToStr() == "Template17")
                            {
                                NetCharges = list.Where(c => c.VehicleType != "Coach" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.ExtraDropCharges.ToDecimal());
                                netAmount  = list.Where(c => c.PaymentTypeId.ToInt() != 6)
                                             .Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.MeetAndGreetCharges.ToDecimal() + c.CongtionCharges.ToDecimal());

                                // NetCharges = list.Where(c => c.VehicleType != "Coach" && c.PaymentTypeId.ToInt() != 6).Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal() + c.MeetAndGreetCharges.ToDecimal() + c.CongtionCharges.ToDecimal());

                                invoiceGrandTotal = NetCharges + data.AdminFees.ToDecimal();
                                //  invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal();
                                invoiceGrandTotal2 = netAmount + data.AdminFees.ToDecimal();
                            }
                            //else if(&& this.ExportFileType.ToStr().ToLower() == "excel")
                            else if (TemplateName.ToStr() == "Template18")
                            {
                                netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6)
                                            .Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal());
                                invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal();
                                //NC
                                //valueAddedTax = (invoiceGrandTotal * 20) / 100;
                                DriverCostNonVAT = ((invoiceGrandTotal * 80) / 100);
                                BusinessCharge   = ((invoiceGrandTotal * 20) / 100);

                                VatOnBusinessCharge = ((BusinessCharge) * 20 / 100);
                                TotalGPB            = (DriverCostNonVAT + BusinessCharge + VatOnBusinessCharge);
                                // valueAddedTax
                            }
                            else if (TemplateName.ToStr() == "Template10" || TemplateName.ToStr() == "Template25" ||
                                     TemplateName.ToStr() == "Template27")
                            {
                                netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6)
                                            .Sum(c => c.Charges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal());


                                invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal();
                            }
                            else if (TemplateName.ToStr() == "Template21")
                            {
                                netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6)
                                            .Sum(c => c.Charges.ToDecimal());


                                invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal();
                            }



                            else
                            {
                                netAmount = list.Where(c => c.PaymentTypeId.ToInt() != 6)
                                            .Sum(c => c.Charges.ToDecimal() + c.ExtraDropCharges.ToDecimal() + c.ParkingCharges.ToDecimal() + c.WaitingCharges.ToDecimal());


                                invoiceGrandTotal = netAmount + data.AdminFees.ToDecimal();
                            }


                            string  vat              = "0";
                            decimal discountAmount   = 0.00m;
                            decimal DiscountPercent  = 0.00m;
                            decimal valueAddedTax    = 0.0m;
                            decimal AdminFeesPercent = 0.00m;
                            decimal AdminFees        = 0.00m;
                            string  HasAdminFees     = string.Empty;
                            string  HasDiscount      = "0";
                            string  CompanyAccountNo = string.Empty;


                            if (companyId != 0)
                            {
                                Gen_Company objCompany = db.Gen_Companies.FirstOrDefault(c => c.Id == companyId);

                                if (objCompany != null)
                                {
                                    if (objCompany.HasVat.ToBool())
                                    {
                                        valueAddedTax = (invoiceGrandTotal * 20) / 100;
                                        vat           = "1";
                                        if (objCompany.VatOnlyOnAdminFees.ToBool())
                                        {
                                            valueAddedTax = (data.AdminFees.ToDecimal() * 20) / 100;
                                            vat           = "1";
                                        }
                                    }

                                    if (objCompany.DiscountPercentage.ToDecimal() > 0)
                                    {
                                        discountAmount  = (invoiceGrandTotal * objCompany.DiscountPercentage.ToDecimal()) / 100;
                                        DiscountPercent = objCompany.DiscountPercentage.ToDecimal();
                                        HasDiscount     = "1";
                                    }
                                    if (objCompany.AdminFees > 0)
                                    {
                                        decimal GrandAmount = (invoiceGrandTotal - discountAmount);
                                        AdminFees        = (invoiceGrandTotal * objCompany.AdminFees.ToDecimal()) / 100;
                                        AdminFeesPercent = objCompany.AdminFees.ToDecimal();
                                        HasAdminFees     = "1";
                                    }


                                    CompanyAccountNo = objCompany.AccountNo.ToStr().Trim();
                                }
                            }

                            if (TemplateName.ToStr() == "Template17")
                            {
                                invoiceGrandTotal = (invoiceGrandTotal2 + valueAddedTax) - discountAmount;
                            }
                            else if (TemplateName.ToStr() == "Template45")
                            {
                                if (vat == "1")
                                {
                                    decimal subTotal = (invoiceGrandTotal - discountAmount);
                                    valueAddedTax = (subTotal * 20) / 100;


                                    invoiceGrandTotal = ((invoiceGrandTotal - discountAmount) + valueAddedTax);
                                }
                                else
                                {
                                    invoiceGrandTotal = ((invoiceGrandTotal - discountAmount) + valueAddedTax);
                                }
                            }
                            else
                            {
                                invoiceGrandTotal = (invoiceGrandTotal + valueAddedTax) - discountAmount;
                            }



                            StringBuilder text = new StringBuilder();

                            //text.Append("<html>");


                            //text.Append("<b>" + " Invoice # : " + list[0].InvoiceNo.ToStr() + " @ <color=Red>" + string.Format("{0:dd/MM/yy HH:mm}", list[0].InvoiceDate) + "</b>");
                            //text.Append("<br><br>");
                            //text.Append("<br><b><color=Black>Company : " + list[0].CompanyName.ToStr() + "</b>");
                            //text.Append("<br>Address : " + list[0].CompanyAddress.ToStr());
                            //text.Append("<br><br>");
                            //text.Append("<br><b>Gross Total : </b>" + Math.Round(netAmount.ToDecimal(), 2));

                            //if (valueAddedTax.ToDecimal() > 0)
                            //{
                            //    text.Append("<br><b>Vat : </b>" + Math.Round(valueAddedTax.ToDecimal(), 2));

                            //}


                            //if (AdminFees.ToDecimal() > 0)
                            //{
                            //    text.Append("<br><b>Admin Fees : </b>" + Math.Round(AdminFees.ToDecimal(), 2));

                            //}

                            //text.Append("<br><b>Total Due : </b>" + Math.Round(invoiceGrandTotal + AdminFees, 2));
                            //text.Append("<br><br>");
                            string newLine = Environment.NewLine;
                            text.Append("<html>");


                            text.Append("<b>" + " Invoice # : " + list[0].InvoiceNo.ToStr() + " @ <color=Red>" + string.Format("{0:dd/MM/yy HH:mm}", list[0].InvoiceDate) + "</b>");
                            text.Append("<br><br>");
                            text.Append(newLine + newLine);
                            text.Append("<br><b><color=Black>Company : " + list[0].CompanyName.ToStr() + "</b>");
                            text.Append(newLine + newLine);
                            text.Append("<br>Address : " + list[0].CompanyAddress.ToStr());
                            text.Append(newLine + newLine);
                            text.Append("<br><br>");
                            text.Append(newLine + newLine);
                            text.Append("<br><br><b><color=Red>Gross Total : </b>" + Math.Round(netAmount.ToDecimal(), 2));
                            text.Append(newLine + newLine);


                            if (HasDiscount.ToStr() == "1")
                            {
                                text.Append("<b>Discount " + string.Format("{0:##0.##}", DiscountPercent) + "%" + " : " + Math.Round(discountAmount, 2));
                                text.Append(newLine + newLine);
                            }


                            if (valueAddedTax.ToDecimal() > 0)
                            {
                                text.Append("<br><b><color=Red>Vat : </b>" + Math.Round(valueAddedTax.ToDecimal(), 2));
                                text.Append(newLine + newLine);
                            }


                            if (AdminFees.ToDecimal() > 0)
                            {
                                text.Append("<br><b><color=Red>Admin Fees : </b>" + Math.Round(AdminFees.ToDecimal(), 2));
                                text.Append(newLine + newLine);
                            }

                            text.Append("<br><b><color=Red>Total Due : </b>" + Math.Round(invoiceGrandTotal + AdminFees, 2));
                            text.Append("<br><br>");
                            text.Append(newLine + newLine);

                            frmCustomScreenInvoiceTip frmTip = new frmCustomScreenInvoiceTip(text.ToString());
                            frmTip.StartPosition = FormStartPosition.CenterParent;
                            frmTip.ShowInTaskbar = false;
                            frmTip.ShowDialog();
                            KeyEventArgs key = frmTip.LastSendEventArgs;

                            frmTip.Dispose();
                        }
                        //RadOffice2007ScreenTipElement screenTip = new RadOffice2007ScreenTipElement();
                        //screenTip.CaptionLabel.Margin = new Padding(3);

                        //screenTip.CaptionLabel.Text = text.ToStr();
                        ////   screenTip.CaptionLabel.Text = text.ToStr();
                        //screenTip.MainTextLabel.Text = string.Empty;
                        //screenTip.EnableCustomSize = false;



                        //cell.ScreenTip = screenTip;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }