コード例 #1
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath;
            bool   isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\Store\Ar\ArInventory.rdlc";//////////??????????
            }
            else
            {
                addpath = @"\Reports\Store\En\Inventory.rdlc";/////////???????????
            }
            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();

            clsReports.inventoryReport(invItemsLocations, rep, reppath, paramarr);////////////?????
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #2
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath;
            bool   isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\Catalog\Ar\ArStorageCostReport.rdlc";
            }
            else
            {
                addpath = addpath = @"\Reports\Catalog\En\StorageCostReport.rdlc";
            }
            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();

            clsReports.storageCostReport(storageCostQuery, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #3
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath;

            string firstTitle  = "accountProfits";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                if (selectedTab == 0)
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Profit\Ar\Profit.rdlc";
                    secondTitle = "invoice";
                }
                else
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Profit\Ar\ProfitItem.rdlc";
                    secondTitle = "items";
                }

                //Reports\StatisticReport\Sale\Daily\Ar
            }
            else
            {
                if (selectedTab == 0)
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Profit\En\Profit.rdlc";
                    secondTitle = "invoice";
                }
                else
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Profit\En\ProfitItem.rdlc";
                    secondTitle = "items";
                }
            }

            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title    = MainWindow.resourcemanagerreport.GetString("trAccounting") + " / " + subTitle;
            paramarr.Add(new ReportParameter("trTitle", Title));

            // IEnumerable<ItemUnitInvoiceProfit>
            clsReports.ProfitReport(profitsQuery, rep, reppath, paramarr);
            paramarr.Add(new ReportParameter("totalBalance", tb_total.Text));

            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #4
0
        public void BuildReport()
        {
            //string firstTitle = "paymentsReport";
            ////string secondTitle = "";
            ////string subTitle = "";
            //string Title = "";

            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath;
            bool   isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\SectionData\En\EnAgents.rdlc";
            }
            else
            {
                addpath = @"\Reports\SectionData\En\EnAgents.rdlc";
            }
            //D:\myproj\posproject3\AdministratorApp\AdministratorApp\Reports\statisticReports\En\EnBook.rdlc
            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            //     subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            //  Title = MainWindow.resourcemanagerreport.GetString("trAccountantReport");

            clsReports.agentReport(usersQuery, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #5
0
        public void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath     = "";
            string firstTitle  = "transfers";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\StatisticReport\Accounts\Pos\Ar\ArPosAccReport.rdlc";
            }
            else
            {
                addpath = @"\Reports\StatisticReport\Accounts\Pos\En\PosAccReport.rdlc";
            }
            secondTitle = "pos";


            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title    = MainWindow.resourcemanagerreport.GetString("trAccounting") + " / " + subTitle;
            if (_transtype == "d")
            {
                Title = Title + "/" + MainWindow.resourcemanagerreport.GetString("trDeposits");

                paramarr.Add(new ReportParameter("trPos1Header", MainWindow.resourcemanagerreport.GetString("trDepositor")));
                paramarr.Add(new ReportParameter("trPos2Header", MainWindow.resourcemanagerreport.GetString("trRecepient")));

                paramarr.Add(new ReportParameter("trBranch1Header", MainWindow.resourcemanagerreport.GetString("trFromBranch")));
                paramarr.Add(new ReportParameter("trBranch2Header", MainWindow.resourcemanagerreport.GetString("trToBranch")));
            }
            else if (_transtype == "p")
            {
                Title = Title + "/" + MainWindow.resourcemanagerreport.GetString("trReceives");
                paramarr.Add(new ReportParameter("trPos1Header", MainWindow.resourcemanagerreport.GetString("trRecepient")));
                paramarr.Add(new ReportParameter("trPos2Header", MainWindow.resourcemanagerreport.GetString("trDepositor")));

                paramarr.Add(new ReportParameter("trBranch1Header", MainWindow.resourcemanagerreport.GetString("trToBranch")));
                paramarr.Add(new ReportParameter("trBranch2Header", MainWindow.resourcemanagerreport.GetString("trFromBranch")));
            }


            paramarr.Add(new ReportParameter("trTitle", Title));
            //clsReports.cashTransferStsPos(temp, rep, reppath, paramarr);
            clsReports.posAccReportSTS(temp, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #6
0
        private void Btn_print_Click(object sender, RoutedEventArgs e)
        {//print
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                if (MainWindow.groupObject.HasPermissionAction(reportsPermission, MainWindow.groupObjects, "one") || SectionData.isAdminPermision())
                {
                    #region
                    if (invItemsQuery != null)
                    {
                        List <ReportParameter> paramarr = new List <ReportParameter>();

                        string addpath;
                        bool   isArabic = ReportCls.checkLang();
                        if (isArabic)
                        {
                            addpath = @"\Reports\Store\Ar\ArDestroyReport.rdlc";
                        }
                        else
                        {
                            addpath = @"\Reports\Store\EN\DestroyReport.rdlc";
                        }
                        string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

                        ReportCls.checkLang();

                        clsReports.invItem(invItemsQuery, rep, reppath, paramarr);
                        clsReports.setReportLanguage(paramarr);
                        clsReports.Header(paramarr);

                        rep.SetParameters(paramarr);
                        rep.Refresh();
                        LocalReportExtensions.PrintToPrinterbyNameAndCopy(rep, MainWindow.rep_printer_name, short.Parse(MainWindow.rep_print_count));
                    }
                    #endregion
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
コード例 #7
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();
            string addpath;
            string firstTitle  = "tax";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                if (selectedTab == 0)
                {
                    //invoice
                    addpath     = @"\Reports\StatisticReport\Accounts\Tax\Ar\ArTaxInvoice.rdlc";
                    secondTitle = "invoice";
                }
                else
                {
                    //items
                    addpath     = @"\Reports\StatisticReport\Accounts\Tax\Ar\ArTaxItem.rdlc";
                    secondTitle = "items";
                }
            }
            else
            {
                if (selectedTab == 0)
                {
                    //invoice
                    addpath     = @"\Reports\StatisticReport\Accounts\Tax\En\EnTaxInvoice.rdlc";
                    secondTitle = "invoice";
                }
                else
                {
                    //items
                    addpath     = @"\Reports\StatisticReport\Accounts\Tax\En\EnTaxItem.rdlc";
                    secondTitle = "items";
                }
            }
            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title    = MainWindow.resourcemanagerreport.GetString("trAccounting") + " / " + subTitle;
            paramarr.Add(new ReportParameter("trTitle", Title));
            clsReports.AccTaxReport(taxTemp, rep, reppath, paramarr);
            paramarr.Add(new ReportParameter("totalSum", tb_total.Text));
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);
            rep.SetParameters(paramarr);
            rep.Refresh();
        }
コード例 #8
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath     = "";
            string firstTitle  = "banksReport";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";
            bool   isArabic    = ReportCls.checkLang();

            if (isArabic)
            {
                if (selectedTab == 0)
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Bank\Ar\ArDeposite.rdlc";
                    secondTitle = "pull";
                }
                else if (selectedTab == 1)
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Bank\Ar\ArPull.rdlc";
                    secondTitle = "deposit";
                }
            }
            else
            {
                if (selectedTab == 0)
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Bank\En\Deposite.rdlc";
                    secondTitle = "pull";
                }
                else if (selectedTab == 1)
                {
                    addpath     = @"\Reports\StatisticReport\Accounts\Bank\En\Pull.rdlc";
                    secondTitle = "deposit";
                    //
                }
            }

            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title    = MainWindow.resourcemanagerreport.GetString("trAccounting") + " / " + subTitle;
            paramarr.Add(new ReportParameter("trTitle", Title));
            clsReports.cashTransferStsBank(temp, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #9
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath;
            bool   isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                if (chk_locked.IsChecked == true)
                {
                    addpath = @"\Reports\Store\Ar\ArStorageResReport.rdlc";
                }
                else
                {
                    addpath = @"\Reports\Store\Ar\ArStorageReport.rdlc";
                }
            }
            else
            {
                if (chk_locked.IsChecked == true)
                {
                    addpath = @"\Reports\Store\EN\StorageResReport.rdlc";
                }
                else
                {
                    addpath = @"\Reports\Store\EN\StorageReport.rdlc";
                }
            }
            if (repTitle2 == "")
            {
                repTitle2 = "trStored";
            }
            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            clsReports.setReportLanguage(paramarr);

            clsReports.itemLocation(itemLocationListQuery, rep, reppath, paramarr);
            paramarr.Add(new ReportParameter("Title2", MainWindow.resourcemanagerreport.GetString(repTitle2)));
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #10
0
        public async Task <string> BuildReport()
        {
            //string firstTitle = "paymentsReport";
            ////string secondTitle = "";
            ////string subTitle = "";
            //string Title = "";

            List <ReportParameter> paramarr = new List <ReportParameter>();
            List <PackageUser>     purl     = new List <PackageUser>();

            packUserRep = await packUserRep.GetByID(packuser.packageUserId);
            await getdata();

            if (PayOpModel.payOpId <= 0)
            {
                return("0");//not pay yet
            }
            else
            {
                string addpath;
                bool   isArabic = ReportCls.checkLang();
                if (isArabic)
                {
                    addpath = @"\Reports\Sale\Book\Ar\ArBook.rdlc";
                }
                else
                {
                    addpath = @"\Reports\Sale\Book\En\EnBook.rdlc";
                }
                //D:\myproj\posproject3\AdministratorApp\AdministratorApp\Reports\Sale\Book\En\EnBook.rdlc
                string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);
                //     subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
                //  Title = MainWindow.resourcemanagerreport.GetString("trAccountantReport");


                clsReports.setReportLanguage(paramarr);
                clsReports.Header(paramarr);
                SetReportparam(paramarr);
                clsReports.BookSale(purl, rep, reppath, paramarr);
                rep.SetParameters(paramarr);

                rep.Refresh();
                return("1");
            }
        }
コード例 #11
0
        public void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath;
            bool   isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                if (selectedTab == 0)
                {
                    addpath = @"\Reports\Sale\Ar\dailySale.rdlc";
                }
                else
                {
                    addpath = @"\Reports\Sale\Ar\dailySaleOQ.rdlc";
                }
            }
            else
            {
                if (selectedTab == 0)
                {
                    addpath = @"\Reports\Sale\En\dailySale.rdlc";
                }
                else
                {
                    addpath = @"\Reports\Sale\En\dailySaleOQ.rdlc";
                }
            }

            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();

            clsReports.SaledailyReport(itemTransferQuery, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #12
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath     = "";
            string firstTitle  = "fund";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\StatisticReport\Accounts\Fund\Ar\ArFund.rdlc";
            }
            else
            {
                //english
                addpath = @"\Reports\StatisticReport\Accounts\Fund\En\Fund.rdlc";
            }

            secondTitle = "branch";
            subTitle    = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title       = MainWindow.resourcemanagerreport.GetString("trAccounting") + " / " + subTitle;
            paramarr.Add(new ReportParameter("trTitle", Title));

            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            //  getpuritemcount
            paramarr.Add(new ReportParameter("totalBalance", tb_total.Text));

            clsReports.FundStsReport(balancesQuery, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #13
0
        private void BuildOperationReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath     = "";
            string firstTitle  = "closing";//trDailyClosing
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\StatisticReport\Accounts\Closing\Ar\ArClosOp.rdlc";
            }
            else
            {
                //english
                addpath = @"\Reports\StatisticReport\Accounts\Closing\En\EnClosOp.rdlc";
            }

            secondTitle = "operations";// trOperations
            subTitle    = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title       = MainWindow.resourcemanagerreport.GetString("trAccounting") + " / " + subTitle;
            paramarr.Add(new ReportParameter("trTitle", Title));

            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            //  getpuritemcount
            //paramarr.Add(new ReportParameter("totalBalance", tb_total.Text));
            //  OpenClosOperatinModel
            clsReports.ClosingOpStsReport(opquery, rep, reppath, paramarr, openclosrow);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #14
0
        public void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath = "";
            //string firstTitle = "destroied";
            //string secondTitle = "";
            //string subTitle = "";
            string Title = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\StatisticReport\Storage\Destructive\Ar\ArDes.rdlc";
            }
            else
            {
                addpath = @"\Reports\StatisticReport\Storage\Destructive\En\Des.rdlc";
            }

            // secondTitle = "destroied";
            //  subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title = MainWindow.resourcemanagerreport.GetString("trStorageReport") + " / " + MainWindow.resourcemanagerreport.GetString("trDestructives");
            paramarr.Add(new ReportParameter("trTitle", Title));

            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();

            clsReports.itemTransferInvoiceDestroied(temp, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #15
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath     = "";
            string firstTitle  = "DirectEntry";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                addpath = @"\Reports\StatisticReport\Storage\Direct\Ar\ArItem.rdlc";
            }
            else
            {
                addpath = @"\Reports\StatisticReport\Storage\Direct\En\Item.rdlc";
            }
            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();
            secondTitle = "items";
            subTitle    = clsReports.ReportTabTitle(firstTitle, secondTitle);

            Title = MainWindow.resourcemanagerreport.GetString("trStorageReport") + " / " + subTitle;
            paramarr.Add(new ReportParameter("trTitle", Title));

            clsReports.itemTransferInvoiceExternal(temp, rep, reppath, paramarr);

            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #16
0
        public EmailClass fillRequirdTempData(string total, string emailto, SysEmails email, List <SetValues> setvlist)
        {//
            string invheader = "";
            string invfooter = "";
            string invbody   = "";


            EmailClass mailtosend = new EmailClass();

            mailtosend.from       = email.email;
            mailtosend.smtpclient = email.smtpClient;
            mailtosend.port       = (int)email.port;

            mailtosend.password = Encoding.UTF8.GetString(Convert.FromBase64String(email.password));
            mailtosend.isSSl    = (bool)email.isSSL;
            mailtosend.AddTolist(emailto);
            mailtosend.subject = "Reqierment" + DateTime.Now.ToString();



            // data
            ReportCls             repm = new ReportCls();
            List <MailimageClass> imgs = new List <MailimageClass>();
            MailimageClass        img  = new MailimageClass();
            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                invheader = repm.ReadFile(@"EmailTemplates\ordertemplate\ar\invheader.tmp");
                invfooter = repm.ReadFile(@"EmailTemplates\ordertemplate\ar\invfooter.tmp");


                invbody = repm.ReadFile(@"EmailTemplates\reqtemplate\ar\invbody.tmp");
            }
            else
            { // en
                invheader = repm.ReadFile(@"EmailTemplates\ordertemplate\en\invheader.tmp");
                invfooter = repm.ReadFile(@"EmailTemplates\ordertemplate\en\invfooter.tmp");


                invbody = repm.ReadFile(@"EmailTemplates\reqtemplate\en\invbody.tmp");
            }


            //header info

            invheader = invheader.Replace("[[companyname]]", MainWindow.companyName.Trim());
            invheader = invheader.Replace("[[phone]]", MainWindow.Phone.Trim());
            invheader = invheader.Replace("[[Email]]", MainWindow.Email.Trim());
            invheader = invheader.Replace("[[fax]]", MainWindow.Fax.Trim());
            invheader = invheader.Replace("[[address]]", MainWindow.Address.Trim());
            invheader = invheader.Replace("[[trphone]]", MainWindow.resourcemanagerreport.GetString("trPhone").Trim() + ": ");
            invheader = invheader.Replace("[[trfax]]", MainWindow.resourcemanagerreport.GetString("trFax").Trim() + ": ");
            invheader = invheader.Replace("[[traddress]]", MainWindow.resourcemanagerreport.GetString("trAddress").Trim() + ": ");


            // string title = "Purchase Order";Required Amount: [[trreqamount]] [[reqamount]]
            //BODY
            if (isArabic)
            {
                invbody = invbody.Replace("[[trreqamount]]", " " + ":" + MainWindow.resourcemanagerreport.GetString("trRequired").Trim());
            }
            else
            {
                invbody = invbody.Replace("[[trreqamount]]", MainWindow.resourcemanagerreport.GetString("trRequired").Trim() + ": ");
            }
            invbody = invbody.Replace("[[reqamount]]", total.Trim() + " " + MainWindow.Currency);
            string title = setvlist.Where(x => x.notes == "title").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "title").FirstOrDefault().value.ToString();

            invheader = invheader.Replace("[[title]]", title.Trim());



            invbody = invbody.Replace("[[thankstitle]]", title);
            //   string thankstext = "Please provide to us,with a price list,along with your terms and conditions of sale, applicable discounts, shipping dates and additional sales and corporate policies. Should the information you provide be acceptable and competitive. ";
            string thankstext = setvlist.Where(x => x.notes == "text1").FirstOrDefault() is null ? ""
                  : setvlist.Where(x => x.notes == "text1").FirstOrDefault().value.ToString();

            invbody = invbody.Replace("[[thankstext]]", thankstext);



            // string invoicenote = "Thank you for your cooperation. We have also enclosed our procurement specifications and conditions for your review <br/> Sincerely";
            string invoicenote = setvlist.Where(x => x.notes == "text2").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "text2").FirstOrDefault().value.ToString();

            invbody = invbody.Replace("[[invoicenote]]", invoicenote);
            string link1 = setvlist.Where(x => x.notes == "link1text").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "link1text").FirstOrDefault().value.ToString();

            string link2 = setvlist.Where(x => x.notes == "link2text").FirstOrDefault() is null ? ""
                 : setvlist.Where(x => x.notes == "link2text").FirstOrDefault().value.ToString();
            string link3 = setvlist.Where(x => x.notes == "link3text").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "link3text").FirstOrDefault().value.ToString();

            invfooter = invfooter.Replace("[[support]]", link1);
            invfooter = invfooter.Replace("[[returnpolicy]]", link2);
            invfooter = invfooter.Replace("[[aboutus]]", link3);
            string link1url = setvlist.Where(x => x.notes == "link1url").FirstOrDefault() is null ? ""
                       : setvlist.Where(x => x.notes == "link1url").FirstOrDefault().value.ToString();
            string link2url = setvlist.Where(x => x.notes == "link2url").FirstOrDefault() is null ? ""
                       : setvlist.Where(x => x.notes == "link2url").FirstOrDefault().value.ToString();
            string link3url = setvlist.Where(x => x.notes == "link3url").FirstOrDefault() is null ? ""
                       : setvlist.Where(x => x.notes == "link3url").FirstOrDefault().value.ToString();

            invfooter = invfooter.Replace("[[supporturl]]", link1url);
            invfooter = invfooter.Replace("[[returnpolicyurl]]", link2url);
            invfooter = invfooter.Replace("[[aboutusurl]]", link3url);

            //invfooter = invfooter.Replace("[[year]]", DateTime.Now.Year.ToString());
            invfooter = invfooter.Replace("[[year]]", repm.DecTostring(DateTime.Now.Year));



            //  invitemtable
            // foreach

            // end foreach


            string mailbody = invheader + invbody + invfooter;



            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(mailbody, null, "text/html");
            string        testpath = repm.GetPath(@"EmailTemplates\mail.html");

            //
            if (!File.Exists(testpath))
            {
                // Create a file to write to.
                string createText = mailbody;
                File.WriteAllText(testpath, createText);
            }
            else
            {
                File.Delete(testpath);
                // Create a file to write to.
                string createText = mailbody;
                File.WriteAllText(testpath, createText);
            }



            img.path    = repm.GetLogoImagePath();
            img.imageId = "logo";
            imgs.Add(img);
            img      = new MailimageClass();
            img.path = repm.GetPath(@"EmailTemplates\images\req2.gif");

            img.imageId = "image-2";
            imgs.Add(img);
            img      = new MailimageClass();
            img.path = repm.GetPath(@"EmailTemplates\images\req1.png");

            img.imageId = "image-3";
            imgs.Add(img);

            foreach (MailimageClass row in imgs)
            {
                htmlView.LinkedResources.Add(mailtosend.Linkimage(@row.path, row.imageId));
            }

            //

            mailtosend.htmlView = htmlView;


            return(mailtosend);
        }
コード例 #17
0
        private void BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath;
            string firstTitle  = "dailySalesStatistic";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                if (selectedTab == 0)
                {
                    secondTitle = "invoice";
                    addpath     = @"\Reports\StatisticReport\Sale\Daily\Ar\dailySale.rdlc";
                }
                else if (selectedTab == 1)
                {
                    secondTitle = "order";
                    addpath     = @"\Reports\StatisticReport\Sale\Daily\Ar\dailySaleOQ.rdlc";
                }
                else
                {
                    //  selectedTab == 2
                    secondTitle = "quotation";
                    addpath     = @"\Reports\StatisticReport\Sale\Daily\Ar\dailySaleOQ.rdlc";
                }
                subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            }
            else
            {
                if (selectedTab == 0)
                {
                    secondTitle = "invoice";
                    addpath     = @"\Reports\StatisticReport\Sale\Daily\En\dailySale.rdlc";
                }
                else if (selectedTab == 1)
                {
                    secondTitle = "order";
                    addpath     = @"\Reports\StatisticReport\Sale\Daily\En\dailySaleOQ.rdlc";
                }
                else
                {
                    //  selectedTab == 2
                    secondTitle = "quotation";
                    addpath     = @"\Reports\StatisticReport\Sale\Daily\En\dailySaleOQ.rdlc";
                }
                subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            }

            string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

            ReportCls.checkLang();

            Title = MainWindow.resourcemanagerreport.GetString("trSalesReport") + " / " + subTitle;
            paramarr.Add(new ReportParameter("trTitle", Title));

            clsReports.SaledailyReport(itemTrasferInvoicesQuery, rep, reppath, paramarr);
            clsReports.setReportLanguage(paramarr);
            clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #18
0
        private void Btn_exportToExcel_Click(object sender, RoutedEventArgs e)
        {//export to excel
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                if (MainWindow.groupObject.HasPermissionAction(reportsPermission, MainWindow.groupObjects, "one") || SectionData.isAdminPermision())
                {
                    #region
                    if (invItemsQuery != null)
                    {
                        //    Thread t1 = new Thread(() =>
                        //{
                        List <ReportParameter> paramarr = new List <ReportParameter>();

                        string addpath;
                        bool   isArabic = ReportCls.checkLang();
                        if (isArabic)
                        {
                            addpath = @"\Reports\Store\Ar\ArDestroyReport.rdlc";
                        }
                        else
                        {
                            addpath = @"\Reports\Store\EN\DestroyReport.rdlc";
                        }
                        string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

                        ReportCls.checkLang();

                        clsReports.invItem(invItemsQuery, rep, reppath, paramarr);
                        clsReports.setReportLanguage(paramarr);
                        clsReports.Header(paramarr);

                        rep.SetParameters(paramarr);

                        rep.Refresh();
                        this.Dispatcher.Invoke(() =>
                        {
                            saveFileDialog.Filter = "EXCEL|*.xls;";
                            if (saveFileDialog.ShowDialog() == true)
                            {
                                string filepath = saveFileDialog.FileName;
                                LocalReportExtensions.ExportToExcel(rep, filepath);
                            }
                        });
                        //});
                        //    t1.Start();
                    }
                    #endregion
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
コード例 #19
0
        private void Btn_preview_Click(object sender, RoutedEventArgs e)
        {//preview
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                if (MainWindow.groupObject.HasPermissionAction(reportsPermission, MainWindow.groupObjects, "one") || SectionData.isAdminPermision())
                {
                    #region
                    if (invItemsQuery != null)
                    {
                        Window.GetWindow(this).Opacity = 0.2;
                        string pdfpath = "";

                        List <ReportParameter> paramarr = new List <ReportParameter>();

                        pdfpath = @"\Thumb\report\temp.pdf";
                        pdfpath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, pdfpath);

                        string addpath;
                        bool   isArabic = ReportCls.checkLang();
                        if (isArabic)
                        {
                            addpath = @"\Reports\Store\Ar\ArDestroyReport.rdlc";
                        }
                        else
                        {
                            addpath = @"\Reports\Store\EN\DestroyReport.rdlc";
                        }
                        string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

                        ReportCls.checkLang();

                        clsReports.invItem(invItemsQuery, rep, reppath, paramarr);
                        clsReports.setReportLanguage(paramarr);
                        clsReports.Header(paramarr);

                        rep.SetParameters(paramarr);

                        rep.Refresh();

                        LocalReportExtensions.ExportToPDF(rep, pdfpath);
                        wd_previewPdf w = new wd_previewPdf();
                        w.pdfPath = pdfpath;
                        if (!string.IsNullOrEmpty(w.pdfPath))
                        {
                            w.ShowDialog();
                            w.wb_pdfWebViewer.Dispose();
                        }
                        Window.GetWindow(this).Opacity = 1;
                    }
                    #endregion
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
コード例 #20
0
        //ReportCls reportclass = new ReportCls();

        public async void  BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath     = "";
            string firstTitle  = "Serials";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            //if (isArabic)
            //{
            //addpath = @"\Reports\StatisticReport\Accounts\Paymetns\Ar\ArVendor.rdlc";
            //secondTitle = "vendors";
            //}
            //else
            //{
            //addpath = @"\Reports\StatisticReport\Accounts\Paymetns\En\Vendor.rdlc";
            //secondTitle = "vendors";
            //}
            addpath = @"\Reports\Sale\Book\Serials\En\serials.rdlc";

            string      reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);
            PackageUser puModel = new PackageUser();
            Customers   cuModel = new Customers();
            Users       agModel = new Users();

            puModel = await puModel.GetByID(packageUserID);

            cuModel = await cuModel.GetByID((int)puModel.customerId);

            agModel = await agModel.GetByID((int)puModel.userId);

            string serkey    = puModel.packageSaleCode;
            string agentname = "";

            if (agModel.userId == 3)
            {
                agentname = "Increase";
            }
            else
            {
                agentname = agModel.name + " " + agModel.lastName;
            }



            //ReportCls.checkLang();
            //subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title = "Serials";
            paramarr.Add(new ReportParameter("trTitle", Title));

            paramarr.Add(new ReportParameter("Agent", agentname));
            paramarr.Add(new ReportParameter("Customer", cuModel.custname + " " + cuModel.lastName));
            paramarr.Add(new ReportParameter("serverKey", serkey));

            List <PosSerials> repserialList = new List <PosSerials>();

            repserialList = await posSerialModel.GetByPackUserId(packageUserID);

            clsReports.serialsReport(repserialList.Where(s => s.isActive == 1), rep, reppath, paramarr);
            //clsReports.setReportLanguage(paramarr);
            //clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }
コード例 #21
0
        private void Btn_pdf_Click(object sender, RoutedEventArgs e)
        {//pdf
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "report") || SectionData.isAdminPermision())
                {
                    #region
                    if (sectionsQuery != null)
                    {
                        List <ReportParameter> paramarr = new List <ReportParameter>();

                        string addpath;
                        bool   isArabic = ReportCls.checkLang();
                        if (isArabic)
                        {
                            addpath = @"\Reports\Store\Ar\ArSectionReport.rdlc";
                        }
                        else
                        {
                            addpath = @"\Reports\Store\EN\SectionReport.rdlc";
                        }
                        string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);

                        ReportCls.checkLang();

                        clsReports.section(sectionsQuery, rep, reppath);
                        clsReports.setReportLanguage(paramarr);
                        clsReports.Header(paramarr);

                        rep.SetParameters(paramarr);

                        rep.Refresh();

                        saveFileDialog.Filter = "PDF|*.pdf;";

                        if (saveFileDialog.ShowDialog() == true)
                        {
                            string filepath = saveFileDialog.FileName;
                            LocalReportExtensions.ExportToPDF(rep, filepath);
                        }
                    }
                    #endregion
                }
                else
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
コード例 #22
0
        public EmailClass fillSaleTempData(Invoice invoice, List <ItemTransfer> invoiceItems, List <PayedInvclass> mailpayedList, SysEmails email, Agent toAgent, List <SetValues> setvlist)
        {
            string invheader    = "";
            string invfooter    = "";
            string invbody      = "";
            string invitemtable = "";
            string invitemrow   = "";
            string paytable     = "";
            string payrow       = "";
            string taxdiv       = "";
            string deliverydiv  = "";

            //payrow.tmp
            //    paytable.tmp
            EmailClass mailtosend  = new EmailClass();
            ReportCls  reportclass = new ReportCls();

            mailtosend.from       = email.email;
            mailtosend.smtpclient = email.smtpClient;
            mailtosend.port       = (int)email.port;

            mailtosend.password = Encoding.UTF8.GetString(Convert.FromBase64String(email.password));
            mailtosend.isSSl    = (bool)email.isSSL;
            mailtosend.AddTolist(toAgent.email);



            string cashTr       = "";
            string sumP         = "";
            string deservedcash = "";

            // data
            ReportCls             repm = new ReportCls();
            List <MailimageClass> imgs = new List <MailimageClass>();
            MailimageClass        img  = new MailimageClass();


            decimal disval       = repm.calcpercentval(invoice.discountType, invoice.discountValue, invoice.total);
            decimal manualdisval = repm.calcpercentval(invoice.manualDiscountType, invoice.manualDiscountValue, invoice.total);

            invoice.discountValue = disval + manualdisval;
            invoice.discountType  = "1";

            bool isArabic = ReportCls.checkLang();

            if (isArabic)
            {
                invheader   = repm.ReadFile(@"EmailTemplates\ordertemplate\ar\invheader.tmp");
                invfooter   = repm.ReadFile(@"EmailTemplates\ordertemplate\ar\invfooter.tmp");
                deliverydiv = repm.ReadFile(@"EmailTemplates\saletemplate\ar\deliverydiv.tmp");
                if (invoice.invType == "s" || invoice.invType == "pw" || invoice.invType == "p")
                {
                    invbody      = repm.ReadFile(@"EmailTemplates\saletemplate\ar\invbody.tmp");
                    invitemtable = repm.ReadFile(@"EmailTemplates\saletemplate\ar\invitemtable.tmp");
                    invitemrow   = repm.ReadFile(@"EmailTemplates\saletemplate\ar\invitemrow.tmp");

                    paytable = repm.ReadFile(@"EmailTemplates\saletemplate\ar\paytable.tmp");
                    payrow   = repm.ReadFile(@"EmailTemplates\saletemplate\ar\payrow.tmp");
                    taxdiv   = repm.ReadFile(@"EmailTemplates\saletemplate\ar\taxdiv.tmp");
                }
                else if (invoice.invType == "or" || invoice.invType == "ors")
                {
                    invbody      = repm.ReadFile(@"EmailTemplates\saleordertemplate\ar\invbody.tmp");
                    invitemtable = repm.ReadFile(@"EmailTemplates\saleordertemplate\ar\invitemtable.tmp");
                    invitemrow   = repm.ReadFile(@"EmailTemplates\saleordertemplate\ar\invitemrow.tmp");
                }
                else if (invoice.invType == "q" || invoice.invType == "qs")
                {
                    invbody      = repm.ReadFile(@"EmailTemplates\quotationtemplate\ar\invbody.tmp");
                    invitemtable = repm.ReadFile(@"EmailTemplates\quotationtemplate\ar\invitemtable.tmp");
                    invitemrow   = repm.ReadFile(@"EmailTemplates\quotationtemplate\ar\invitemrow.tmp");
                }
            }
            else
            { // en
                invheader   = repm.ReadFile(@"EmailTemplates\ordertemplate\en\invheader.tmp");
                invfooter   = repm.ReadFile(@"EmailTemplates\ordertemplate\en\invfooter.tmp");
                deliverydiv = repm.ReadFile(@"EmailTemplates\saletemplate\en\deliverydiv.tmp");
                if (invoice.invType == "s" || invoice.invType == "pw" || invoice.invType == "p")
                {
                    invbody      = repm.ReadFile(@"EmailTemplates\saletemplate\en\invbody.tmp");
                    invitemtable = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemtable.tmp");
                    invitemrow   = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemrow.tmp");

                    paytable = repm.ReadFile(@"EmailTemplates\saletemplate\en\paytable.tmp");
                    payrow   = repm.ReadFile(@"EmailTemplates\saletemplate\en\payrow.tmp");

                    taxdiv = repm.ReadFile(@"EmailTemplates\saletemplate\en\taxdiv.tmp");
                }
                else if (invoice.invType == "or" || invoice.invType == "ors")
                {
                    invbody      = repm.ReadFile(@"EmailTemplates\saleordertemplate\en\invbody.tmp");
                    invitemtable = repm.ReadFile(@"EmailTemplates\saleordertemplate\en\invitemtable.tmp");
                    invitemrow   = repm.ReadFile(@"EmailTemplates\saleordertemplate\en\invitemrow.tmp");
                }
                else if (invoice.invType == "q" || invoice.invType == "qs")
                {
                    invbody      = repm.ReadFile(@"EmailTemplates\quotationtemplate\en\invbody.tmp");
                    invitemtable = repm.ReadFile(@"EmailTemplates\quotationtemplate\en\invitemtable.tmp");
                    invitemrow   = repm.ReadFile(@"EmailTemplates\quotationtemplate\en\invitemrow.tmp");
                }
                else
                {
                    invbody      = repm.ReadFile(@"EmailTemplates\saletemplate\en\invbody.tmp");
                    invitemtable = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemtable.tmp");
                    invitemrow   = repm.ReadFile(@"EmailTemplates\saletemplate\en\invitemrow.tmp");

                    paytable = repm.ReadFile(@"EmailTemplates\saletemplate\en\paytable.tmp");
                    payrow   = repm.ReadFile(@"EmailTemplates\saletemplate\en\payrow.tmp");
                }
            }


            //header info

            invheader = invheader.Replace("[[companyname]]", MainWindow.companyName.Trim());
            invheader = invheader.Replace("[[phone]]", MainWindow.Phone.Trim());
            invheader = invheader.Replace("[[Email]]", MainWindow.Email.Trim());
            invheader = invheader.Replace("[[fax]]", MainWindow.Fax.Trim());
            invheader = invheader.Replace("[[address]]", MainWindow.Address.Trim());
            invheader = invheader.Replace("[[trphone]]", MainWindow.resourcemanagerreport.GetString("trPhone").Trim() + ": ");
            invheader = invheader.Replace("[[trfax]]", MainWindow.resourcemanagerreport.GetString("trFax").Trim() + ": ");
            invheader = invheader.Replace("[[traddress]]", MainWindow.resourcemanagerreport.GetString("trAddress").Trim() + ": ");


            //BODY

            // string title = "Purchase Order";
            string title = setvlist.Where(x => x.notes == "title").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "title").FirstOrDefault().value.ToString();

            mailtosend.subject = title.Trim();
            invheader          = invheader.Replace("[[title]]", title.Trim());

            invbody = invbody.Replace("[[thankstitle]]", title);
            //   string thankstext = "Please provide to us,with a price list,along with your terms and conditions of sale, applicable discounts, shipping dates and additional sales and corporate policies. Should the information you provide be acceptable and competitive. ";
            string thankstext = setvlist.Where(x => x.notes == "text1").FirstOrDefault() is null ? ""
                  : setvlist.Where(x => x.notes == "text1").FirstOrDefault().value.ToString();

            invbody = invbody.Replace("[[thankstext]]", thankstext);


            if (invoice.invoiceId > 0)
            {
                if ((invoice.invType == "s" || invoice.invType == "sd" || invoice.invType == "sbd" || invoice.invType == "sb" || invoice.invType == "p" || invoice.invType == "pw"))
                {
                    decimal sump    = mailpayedList.Sum(x => x.cash).Value;
                    decimal deservd = (decimal)invoice.totalNet - sump;

                    cashTr = MainWindow.resourcemanagerreport.GetString("trCashType");

                    sumP         = reportclass.DecTostring(sump);
                    deservedcash = reportclass.DecTostring(deservd);
                    invbody      = invbody.Replace("[[payedsum]]", sumP);
                    invbody      = invbody.Replace("[[deservedcash]]", deservedcash);
                    //  paytable
                    // foreach
                    string datapayrows = "";
                    string paymethod   = "";
                    payrow = payrow.Replace("[[currency]]", MainWindow.Currency);
                    foreach (PayedInvclass row in mailpayedList)
                    {
                        string rowhtml = payrow;

                        rowhtml = rowhtml.Replace("[[cashpayrow]]", reportclass.DecTostring(row.cash));

                        paymethod = row.processType == "cash" ? cashTr : row.cardName;
                        rowhtml   = rowhtml.Replace("[[paymethodrow]]", paymethod);


                        datapayrows += rowhtml;
                    }
                    paytable = paytable.Replace("[[payrow]]", datapayrows);

                    // end foreach
                    invbody = invbody.Replace("[[paytable]]", paytable);
                }

                invbody = invbody.Replace("[[invoicecode]]", invoice.invNumber);
                invbody = invbody.Replace("[[invoicedate]]", repm.DateToString(invoice.invDate));
                //invbody = invbody.Replace("[[invoicetotal]]", invoice.total.ToString());
                invbody = invbody.Replace("[[invoicetotal]]", repm.DecTostring(invoice.total));
                //invbody = invbody.Replace("[[invoicediscount]]", invoice.discountValue.ToString());
                if (invoice.discountType == "2")
                {
                    if (isArabic)
                    {
                        invbody = invbody.Replace("[[invoicediscount]]", "% " + repm.DecTostring(invoice.discountValue));
                    }
                    else
                    {
                        invbody = invbody.Replace("[[invoicediscount]]", repm.DecTostring(invoice.discountValue) + " %");
                    }
                }
                else
                {
                    if (isArabic)
                    {
                        invbody = invbody.Replace("[[invoicediscount]]", MainWindow.Currency + " " + repm.DecTostring(invoice.discountValue));
                    }
                    else
                    {
                        invbody = invbody.Replace("[[invoicediscount]]", repm.DecTostring(invoice.discountValue) + " " + MainWindow.Currency);
                    }
                }

                //invbody = invbody.Replace("[[invoicetax]]", invoice.tax.ToString());
                if (invoice.tax == 0 || invoice.tax == null)
                {
                    invbody = invbody.Replace("[[invoicetax]]", repm.DecTostring(invoice.tax));
                    invbody = invbody.Replace("[[trinvoicetax]]", MainWindow.resourcemanagerreport.GetString("trTax").Trim());
                    invbody = invbody.Replace("[[taxdiv]]", "");
                }
                else
                {
                    taxdiv  = taxdiv.Replace("[[invoicetax]]", repm.DecTostring(invoice.tax));
                    taxdiv  = taxdiv.Replace("[[trinvoicetax]]", MainWindow.resourcemanagerreport.GetString("trTax").Trim());
                    invbody = invbody.Replace("[[taxdiv]]", taxdiv);
                }
                //shipping cost section
                if ((invoice.invType == "s" || invoice.invType == "or" || invoice.invType == "q" || invoice.invType == "qs" || invoice.invType == "ors"))
                {
                    if (invoice.shippingCost > 0)
                    {
                        deliverydiv = deliverydiv.Replace("[[shippingcost]]", repm.DecTostring(invoice.shippingCost));
                        deliverydiv = deliverydiv.Replace("[[totaldeserved]]", repm.DecTostring(invoice.totalNet));

                        invbody = invbody.Replace("[[totalnet]]", repm.DecTostring(invoice.totalNet - invoice.shippingCost));
                        invbody = invbody.Replace("[[deliverydiv]]", deliverydiv);
                    }
                    else
                    {
                        invbody = invbody.Replace("[[deliverydiv]]", "");
                        invbody = invbody.Replace("[[totalnet]]", repm.DecTostring(invoice.totalNet));
                    }
                }
                else
                {
                    invbody = invbody.Replace("[[totalnet]]", repm.DecTostring(invoice.totalNet));
                    invbody = invbody.Replace("[[deliverydiv]]", "");
                }
                // end shippingcost
            }

            //  invoiceItems.trQuantity trQTR

            invitemtable = invitemtable.Replace("[[tritems]]", MainWindow.resourcemanagerreport.GetString("trItem").Trim());
            invitemtable = invitemtable.Replace("[[trunit]]", MainWindow.resourcemanagerreport.GetString("trUnit").Trim());
            invitemtable = invitemtable.Replace("[[trprice]]", MainWindow.resourcemanagerreport.GetString("trPrice").Trim());
            invitemtable = invitemtable.Replace("[[trquantity]]", MainWindow.resourcemanagerreport.GetString("trQTR").Trim());
            invitemtable = invitemtable.Replace("[[trtotalrow]]", MainWindow.resourcemanagerreport.GetString("trTotal").Trim());


            invbody = invbody.Replace("[[trinvoicecode]]", MainWindow.resourcemanagerreport.GetString("trInvoiceNumber").Trim() + ": ");
            invbody = invbody.Replace("[[trinvoicedate]]", MainWindow.resourcemanagerreport.GetString("trDate").Trim() + ": ");

            // invbody = invbody.Replace("[[trinvoicetotal]]", MainWindow.resourcemanagerreport.GetString("trSum").Trim() + ": ");

            invbody = invbody.Replace("[[trinvoicetotal]]", MainWindow.resourcemanagerreport.GetString("trSum").Trim());
            invbody = invbody.Replace("[[currency]]", MainWindow.Currency);
            //

            invbody = invbody.Replace("[[trinvoicediscount]]", MainWindow.resourcemanagerreport.GetString("trDiscount").Trim());

            invbody = invbody.Replace("[[trtotalnet]]", MainWindow.resourcemanagerreport.GetString("trTotal").Trim());


            // string invoicenote = "Thank you for your cooperation. We have also enclosed our procurement specifications and conditions for your review <br/> Sincerely";
            string invoicenote = setvlist.Where(x => x.notes == "text2").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "text2").FirstOrDefault().value.ToString();

            invbody = invbody.Replace("[[invoicenote]]", invoicenote);
            string link1 = setvlist.Where(x => x.notes == "link1text").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "link1text").FirstOrDefault().value.ToString();

            string link2 = setvlist.Where(x => x.notes == "link2text").FirstOrDefault() is null ? ""
                 : setvlist.Where(x => x.notes == "link2text").FirstOrDefault().value.ToString();
            string link3 = setvlist.Where(x => x.notes == "link3text").FirstOrDefault() is null ? ""
                : setvlist.Where(x => x.notes == "link3text").FirstOrDefault().value.ToString();

            invfooter = invfooter.Replace("[[support]]", link1);
            invfooter = invfooter.Replace("[[returnpolicy]]", link2);
            invfooter = invfooter.Replace("[[aboutus]]", link3);
            string link1url = setvlist.Where(x => x.notes == "link1url").FirstOrDefault() is null ? ""
                       : setvlist.Where(x => x.notes == "link1url").FirstOrDefault().value.ToString();
            string link2url = setvlist.Where(x => x.notes == "link2url").FirstOrDefault() is null ? ""
                       : setvlist.Where(x => x.notes == "link2url").FirstOrDefault().value.ToString();
            string link3url = setvlist.Where(x => x.notes == "link3url").FirstOrDefault() is null ? ""
                       : setvlist.Where(x => x.notes == "link3url").FirstOrDefault().value.ToString();

            invfooter = invfooter.Replace("[[supporturl]]", link1url);
            invfooter = invfooter.Replace("[[returnpolicyurl]]", link2url);
            invfooter = invfooter.Replace("[[aboutusurl]]", link3url);

            invfooter = invfooter.Replace("[[year]]", DateTime.Now.Year.ToString());



            //  invitemtable
            // foreach
            string datarows = "";

            foreach (ItemTransfer row in invoiceItems)
            {
                string rowhtml = invitemrow;
                row.price = decimal.Parse(SectionData.DecTostring(row.price));
                rowhtml   = rowhtml.Replace("[[col1]]", row.itemName.Trim());
                rowhtml   = rowhtml.Replace("[[col2]]", row.unitName.Trim());
                rowhtml   = rowhtml.Replace("[[col3]]", row.price.ToString());
                rowhtml   = rowhtml.Replace("[[col4]]", row.quantity.ToString());

                rowhtml = rowhtml.Replace("[[col5]]", (row.quantity * row.price).ToString());
                //     rowhtml = rowhtml.Replace("[[col4]]", (row.quantity * row.price).ToString());

                datarows += rowhtml;
            }
            invitemtable = invitemtable.Replace("[[invitemrow]]", datarows);
            // end foreach


            invbody = invbody.Replace("[[invitemtable]]", invitemtable);

            string mailbody = invheader + invbody + invfooter;



            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(mailbody, null, "text/html");
            string        testpath = repm.GetPath(@"EmailTemplates\mail.html");

            //
            if (!File.Exists(testpath))
            {
                // Create a file to write to.
                string createText = mailbody;
                File.WriteAllText(testpath, createText);
            }
            else
            {
                File.Delete(testpath);
                // Create a file to write to.
                string createText = mailbody;
                File.WriteAllText(testpath, createText);
            }



            img.path    = repm.GetLogoImagePath();
            img.imageId = "logo";
            imgs.Add(img);
            img      = new MailimageClass();
            img.path = repm.GetPath(@"EmailTemplates\images\image-2.gif");

            img.imageId = "image-2";
            imgs.Add(img);

            foreach (MailimageClass row in imgs)
            {
                htmlView.LinkedResources.Add(mailtosend.Linkimage(@row.path, row.imageId));
            }

            //

            mailtosend.htmlView = htmlView;


            return(mailtosend);
        }