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();
        }
        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();
        }
示例#3
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();
        }
示例#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
        private async void Btn_download_Click(object sender, RoutedEventArgs e)
        {//download
            try
            {
                HelpClass.StartAwait(grid_main);

                HelpClass.validateWindow(requiredControlList, this);
                if (cb_type.SelectedIndex != -1)
                {
                    //string activeState = "rn";//rn OR up  from buton
                    string activeState = cb_type.SelectedValue.ToString();

                    PackageUser pumodel = new PackageUser();
                    ReportCls   rc      = new ReportCls();
                    SendDetail  sd      = new SendDetail();
                    sd = await pumodel.ActivateServerOffline(packageUser.packageUserId, activeState);

                    packagesSend packtemp = new packagesSend();
                    if (sd.packageSend.result > 0)
                    {
                        //encode
                        string myContent = JsonConvert.SerializeObject(sd);

                        saveFileDialog.Filter = "File|*.ac;";
                        if (saveFileDialog.ShowDialog() == true)
                        {
                            string DestPath = saveFileDialog.FileName;

                            bool res = false;

                            res = rc.encodestring(myContent, DestPath);
                            // rc.DelFile(pdfpath);
                            //  rc.decodefile(DestPath,@"D:\stringlist.txt");
                            if (res)
                            {
                                //done
                                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                            }
                            else
                            {
                                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                            }
                        }
                    }
                    else
                    {
                        //error
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }

                    HelpClass.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
示例#6
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();
        }
示例#7
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);
            }
        }
        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();
        }
        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();
        }
示例#10
0
        public static void Header(List <ReportParameter> paramarr)
        {
            // List<ReportParameter> listParam = new List<ReportParameter>();

            ReportCls rep = new ReportCls();

            paramarr.Add(new ReportParameter("companyName", MainWindow.companyName));
            paramarr.Add(new ReportParameter("Fax", MainWindow.Fax));
            paramarr.Add(new ReportParameter("Tel", MainWindow.Mobile));
            paramarr.Add(new ReportParameter("Address", MainWindow.Address));
            paramarr.Add(new ReportParameter("Email", MainWindow.Email));
            paramarr.Add(new ReportParameter("logoImage", "file:\\" + rep.GetLogoImagePath()));
            paramarr.Add(new ReportParameter("show_header", MainWindow.show_header));
        }
示例#11
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();
        }
示例#12
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");
            }
        }
        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();
        }
        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();
        }
        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();
        }
        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();
        }
示例#17
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();
        }
        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();
        }
示例#19
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);
        }
示例#20
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);
            }
        }
示例#21
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);
            }
        }
示例#22
0
        private async void Btn_upload_Click(object sender, RoutedEventArgs e)
        {//upload
            try
            {
                HelpClass.StartAwait(grid_main);

                HelpClass.validateWindow(requiredControlList, this);
                if (cb_type.SelectedIndex != -1)
                {
                    PackageUser pumodel = new PackageUser();
                    //activeState = "up";
                    activeState = cb_type.SelectedValue.ToString();

                    if (activeState == "up")
                    {
                        string filepath = "";
                        openFileDialog.Filter = "INC|*.ac; ";

                        if (openFileDialog.ShowDialog() == true)
                        {
                            filepath = openFileDialog.FileName;

                            // bool resr = ReportCls.decodefile(filepath, @"D:\stringlist.txt");//comment
                            SendDetail dc        = new SendDetail();
                            string     objectstr = "";

                            objectstr = ReportCls.decodetoString(filepath);

                            dc = JsonConvert.DeserializeObject <SendDetail>(objectstr, new JsonSerializerSettings {
                                DateParseHandling = DateParseHandling.None
                            });

                            if (dc.packageSend.packageUserId == packageUser.packageUserId)
                            {
                                int res = await pumodel.updatecustomerdata(dc, activeState);

                                //   MessageBox.Show(res.ToString());
                                if (res > 0)
                                {
                                    if (res == 1)
                                    {
                                        // update done
                                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trRestoreDoneSuccessfuly"), animation: ToasterAnimation.FadeIn);
                                    }
                                    //else if (res == 2)
                                    //{
                                    //    //no update
                                    //    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trRestoreNotComplete"), animation: ToasterAnimation.FadeIn);
                                    //}
                                }
                                else
                                {
                                    // error
                                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trRestoreNotComplete"), animation: ToasterAnimation.FadeIn);
                                }
                            }
                            else
                            {
                                // The File dosn't belong to this Package
                                Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trRestoreNotComplete") + "The File dosn't belong to this Package", animation: ToasterAnimation.FadeIn);
                            }
                        }
                        else
                        {
                            // error
                            Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trRestoreNotComplete"), animation: ToasterAnimation.FadeIn);
                        }
                    }
                }
                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
示例#23
0
        private async void Btn_upload_Click(object sender, RoutedEventArgs e)
        {
            //upload
            bool ress = AvtivateServer.validateUrl(tb_serverUri.Text);

            if (ress)
            {
                //int chk = await ac.checkconn();
                try
                {
                    validateEmptyTextBox(tb_serverUri, p_errorServerUri, tt_errorServerUri, "trEmptyError");
                    if (!tb_serverUri.Text.Equals(""))
                    {
                        // start activate
                        string t = Global.APIUri;//temp delete


                        string message = "";
                        try
                        {
                            if (tb_serverUri.Text.Trim() != "".Trim())
                            {
                                bool           isServerActivated = true;
                                AvtivateServer ac = new AvtivateServer();
                                Global.APIUri = tb_serverUri.Text + @"/api/";

                                string filepath = "";
                                openFileDialog.Filter = "INC|*.ac; ";
                                SendDetail customerdata = new SendDetail();
                                SendDetail dc           = new SendDetail();
                                if (openFileDialog.ShowDialog() == true)
                                {
                                    filepath = openFileDialog.FileName;

                                    //   bool resr = ReportCls.decodefile(filepath, @"D:\stringlist.txt");//comment

                                    string objectstr = "";

                                    objectstr = ReportCls.decodetoString(filepath);

                                    dc = JsonConvert.DeserializeObject <SendDetail>(objectstr, new JsonSerializerSettings {
                                        DateParseHandling = DateParseHandling.None
                                    });
                                    packagesSend pss = new packagesSend();

                                    pss = dc.packageSend;
                                    isServerActivated = dc.packageSend.isServerActivated;
                                    pss.activeApp     = "all";//no comment

                                    dc.packageSend = pss;

                                    // string activeState = "";
                                    customerdata = await ac.OfflineActivate(dc, "up");
                                }
                                // upload

                                if (customerdata.packageSend.result > 0)
                                {
                                    if (isServerActivated == false || (isServerActivated == true && dc.packageSend.activeState == "up"))
                                    {
                                        // if first activate OR upgrade  show save dialoge to save customer data in file
                                        saveFileDialog.Filter = "File|*.ac;";
                                        if (saveFileDialog.ShowDialog() == true)
                                        {
                                            string DestPath = saveFileDialog.FileName;

                                            string myContent = JsonConvert.SerializeObject(customerdata);

                                            bool res = false;

                                            res = ReportCls.encodestring(myContent, DestPath);

                                            if (res)
                                            {
                                                //     //done
                                                //   MessageBox.Show("Success");
                                                Toaster.ShowSuccess(Window.GetWindow(this), message: "Success", animation: ToasterAnimation.FadeIn);
                                            }
                                            else
                                            {
                                                Toaster.ShowWarning(Window.GetWindow(this), message: "Error", animation: ToasterAnimation.FadeIn);
                                                //   MessageBox.Show("Error");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        // if extend show extend result
                                        //renew no save

                                        Toaster.ShowSuccess(Window.GetWindow(this), message: "Success Extend", animation: ToasterAnimation.FadeIn);
                                    }
                                }
                                else
                                {
                                    //MessageBox.Show(customerdata.packageSend.result.ToString());
                                    Toaster.ShowWarning(Window.GetWindow(this), message: "Error-" + customerdata.packageSend.result.ToString(), animation: ToasterAnimation.FadeIn);
                                }
                                //end uploaa
                            }
                        }
                        catch (Exception ex)
                        {
                            Global.APIUri = t;//temp delete
                            Toaster.ShowWarning(Window.GetWindow(this), message: "The server Not Found", animation: ToasterAnimation.FadeIn);
                        }


                        //end activate

                        await Task.Delay(2000);

                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: "The server Not Found", animation: ToasterAnimation.FadeIn);
                }
            }
            else
            {
                Toaster.ShowWarning(Window.GetWindow(this), message: "The server Not Found", animation: ToasterAnimation.FadeIn);
            }
        }
示例#24
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);
            }
        }
        private async void Btn_upgrade_Click(object sender, RoutedEventArgs e)
        {                                                       //upgrade
            int    chk           = 0;
            string activationkey = progDetails.packageSaleCode; //get from info

            if (progDetails.isOnlineServer.Value)               //online
            {
                try
                {
                    if (activationkey.Trim() != "".Trim())
                    {
                        AvtivateServer ac = new AvtivateServer();

                        chk = await ac.checkconn();

                        chk = await ac.StatSendserverkey(activationkey, "up");

                        // //change      chk = 3;
                        //nochange     chk = 2;

                        if (chk <= 0)
                        {
                            string message = "inc(" + chk + ")";

                            string messagecode = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(message));

                            string msg = MainWindow.resourcemanager.GetString("trUpgradeNotCompleted") + "(" +
                                         MainWindow.resourcemanager.GetString("trErrorCode") + ":" + messagecode + ")";

                            Toaster.ShowWarning(Window.GetWindow(this), message: msg, animation: ToasterAnimation.FadeIn);
                        }

                        else
                        {
                            if (chk == 3)
                            {
                                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trUpgradeCompleted"), animation: ToasterAnimation.FadeIn);
                                progDetails = await progDetailsModel.getCurrentInfo();

                                this.DataContext = progDetails;
                            }
                            else if (chk == 2)
                            {
                                Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trNoChanges"), animation: ToasterAnimation.FadeIn);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trServerNotFount"), animation: ToasterAnimation.FadeIn);
                }
            }
            else//offline
            {
                // start activate

                chk = 0;
                string message = "";
                try
                {
                    bool           isServerActivated = true;
                    AvtivateServer ac          = new AvtivateServer();
                    string         activeState = "up";
                    int            activematch = 0;

                    string filepath = "";
                    openFileDialog.Filter = "INC|*.ac; ";
                    SendDetail customerdata = new SendDetail();
                    SendDetail dc           = new SendDetail();
                    if (openFileDialog.ShowDialog() == true)
                    {
                        filepath = openFileDialog.FileName;

                        //   bool resr = ReportCls.decodefile(filepath, @"D:\stringlist.txt");//comment

                        string objectstr = "";

                        objectstr = ReportCls.decodetoString(filepath);

                        dc = JsonConvert.DeserializeObject <SendDetail>(objectstr, new JsonSerializerSettings {
                            DateParseHandling = DateParseHandling.None
                        });
                        packagesSend pss = new packagesSend();

                        pss = dc.packageSend;
                        isServerActivated = dc.packageSend.isServerActivated;
                        pss.activeApp     = "-";

                        dc.packageSend = pss;

                        // string activeState = "";
                        if (dc.packageSend.activeState == activeState)
                        {
                            activematch  = 1;
                            customerdata = await ac.OfflineActivate(dc, activeState);
                        }
                        else
                        {
                            Toaster.ShowWarning(Window.GetWindow(this), message: "The file isn't upgrade file", animation: ToasterAnimation.FadeIn);
                        }
                    }

                    // upload

                    if (activematch == 1)
                    {
                        if (customerdata.packageSend.result > 0)
                        {
                            // if first activate OR upgrade  show save dialoge to save customer data in file
                            saveFileDialog.Filter = "File|*.ac;";
                            if (saveFileDialog.ShowDialog() == true)
                            {
                                string DestPath = saveFileDialog.FileName;

                                string myContent = JsonConvert.SerializeObject(customerdata);

                                bool res = false;

                                res = ReportCls.encodestring(myContent, DestPath);

                                if (res)
                                {
                                    //     //done
                                    //   MessageBox.Show("Success");
                                    Toaster.ShowSuccess(Window.GetWindow(this), message: "Success", animation: ToasterAnimation.FadeIn);
                                }
                                else
                                {
                                    Toaster.ShowWarning(Window.GetWindow(this), message: "Error", animation: ToasterAnimation.FadeIn);
                                    //   MessageBox.Show("Error");
                                }
                            }
                        }
                        else
                        {
                            //   MessageBox.Show(customerdata.packageSend.result.ToString());
                            string msg = "NOT complete - " + customerdata.packageSend.result.ToString();
                            Toaster.ShowWarning(Window.GetWindow(this), msg, animation: ToasterAnimation.FadeIn);
                        }
                    }
                    else
                    {
                        //close
                    }

                    //end uploaa
                }
                catch (Exception ex)
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: "The server Not Found", animation: ToasterAnimation.FadeIn);
                }


                //end activate
            }
        }
示例#26
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();
        }
示例#27
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);
        }