private void PrintMethod()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DS ds = new DS();

            ds.RequiredCategory.Rows.Clear();
            int i = 0;

            foreach (var item in categories.Where(w => w.RequiredQty > 0))
            {
                ds.RequiredCategory.Rows.Add();
                ds.RequiredCategory[i]["Serial"]   = i + 1;
                ds.RequiredCategory[i]["Category"] = item.Category + " " + item.Company;
                ds.RequiredCategory[i]["Required"] = item.RequiredQty;
                i++;
            }
            ReportWindow           rpt = new ReportWindow();
            RequiredCategoryReport requiredCategoryRPT = new RequiredCategoryReport();

            requiredCategoryRPT.SetDataSource(ds.Tables["RequiredCategory"]);
            rpt.crv.ViewerCore.ReportSource = requiredCategoryRPT;
            Mouse.OverrideCursor            = null;
            rpt.ShowDialog();

            //requiredCategoryRPT.PrintOptions.PrinterName = _selectedPrinter;
            //requiredCategoryRPT.PrintToPrinter(1, true, 0, 0);
        }
Example #2
0
        private void PrintMethod()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DS ds = new DS();

            ds.Sale.Rows.Clear();
            int i = 0;

            foreach (var item in _supplyOfferCategories)
            {
                ds.Sale.Rows.Add();
                ds.Sale[i]["Client"]     = _selectedSupplyOffer.Client.Name;
                ds.Sale[i]["Serial"]     = i + 1;
                ds.Sale[i]["Category"]   = item.Category + " " + item.Company;
                ds.Sale[i]["Qty"]        = item.Qty;
                ds.Sale[i]["Price"]      = Math.Round(Convert.ToDecimal(item.CostAfterTax), 2);
                ds.Sale[i]["TotalPrice"] = Math.Round(Convert.ToDecimal(item.CostTotalAfterTax), 2);
                ds.Sale[i]["BillPrice"]  = Math.Round(Convert.ToDecimal(_selectedSupplyOffer.CostAfterTax), 2);
                i++;
            }
            ReportWindow      rpt            = new ReportWindow();
            SupplyOfferReport supplyOfferRPT = new SupplyOfferReport();

            supplyOfferRPT.SetDataSource(ds.Tables["Sale"]);
            rpt.crv.ViewerCore.ReportSource = supplyOfferRPT;
            Mouse.OverrideCursor            = null;
            _currentWindow.Hide();
            rpt.ShowDialog();
            _currentWindow.ShowDialog();
        }
        private void PrintMethod()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DS ds = new DS();

            ds.RequiredCategory.Rows.Clear();
            int i = 0;

            foreach (var item in _categoryServ.GetAllRequiredCategories().Where(w => w.RequiredQty > 0))
            {
                ds.RequiredCategory.Rows.Add();
                ds.RequiredCategory[i]["Serial"]   = i + 1;
                ds.RequiredCategory[i]["Company"]  = item.Company;
                ds.RequiredCategory[i]["Category"] = item.Category;
                //ds.RequiredCategory[i]["Cost"] = item.Cost;
                //ds.RequiredCategory[i]["Qty"] = item.Qty;
                ds.RequiredCategory[i]["Required"] = item.RequiredQty;
                i++;
            }
            ReportWindow           rpt = new ReportWindow();
            RequiredCategoryReport requiredCategoryRPT = new RequiredCategoryReport();

            requiredCategoryRPT.SetDataSource(ds.Tables["RequiredCategory"]);
            rpt.crv.ViewerCore.ReportSource = requiredCategoryRPT;
            Mouse.OverrideCursor            = null;
            rpt.ShowDialog();
        }
Example #4
0
        protected void gameSubmissionDone(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                this.enableInterface();
                return;
            }

            ReportWindow report = new ReportWindow(analyzer, this);

            report.ShowDialog();
            if (report.SentOrSaved)
            {
                analyzer.game.Submitted = true;
                Games.saveCustomGames();
            }
            if (askAboutGame())
            {
                return;
            }

            submitGame.IsEnabled = Games.HasUnsubmittedGames;

            this.enableInterface();
        }
        private void ExecuteSave()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DateTime _dt = DateTime.Now;

            _saleOfferServ.AddSaleOffer(_newSaleOffer);
            int _saleOfferID = _saleOfferServ.GetLastSaleOfferID();

            foreach (var item in _saleOfferCategories)
            {
                SaleOfferCategory _saleOfferCategory = new SaleOfferCategory
                {
                    CategoryID              = item.CategoryID,
                    PriceAfterDiscount      = item.PriceAfterDiscount,
                    PriceTotalAfterDiscount = item.PriceTotalAfterDiscount,
                    Price              = item.Price,
                    PriceTotal         = item.PriceTotal,
                    Discount           = item.Discount,
                    DiscountValue      = item.DiscountValue,
                    DiscountValueTotal = item.DiscountValueTotal,
                    SaleOfferID        = _saleOfferID,
                    Qty = item.Qty
                };
                _saleOfferCategoryServ.AddSaleOfferCategory(_saleOfferCategory);
            }

            DS ds = new DS();

            ds.Sale.Rows.Clear();
            int i = 0;

            foreach (var item in _saleOfferCategories)
            {
                ds.Sale.Rows.Add();
                ds.Sale[i]["Client"]     = _selectedClient.Name;
                ds.Sale[i]["Serial"]     = i + 1;
                ds.Sale[i]["Category"]   = item.Category + " " + item.Company;
                ds.Sale[i]["Qty"]        = item.Qty;
                ds.Sale[i]["Price"]      = Math.Round(Convert.ToDecimal(item.PriceAfterDiscount), 2);
                ds.Sale[i]["TotalPrice"] = Math.Round(Convert.ToDecimal(item.PriceTotalAfterDiscount), 2);
                ds.Sale[i]["BillPrice"]  = Math.Round(Convert.ToDecimal(_newSaleOffer.PriceAfterDiscount), 2);;
                i++;
            }
            ReportWindow    rpt          = new ReportWindow();
            SaleOfferReport saleOfferRPT = new SaleOfferReport();

            saleOfferRPT.SetDataSource(ds.Tables["Sale"]);
            rpt.crv.ViewerCore.ReportSource = saleOfferRPT;
            Mouse.OverrideCursor            = null;
            _currentWindow.Hide();
            rpt.ShowDialog();
            NewSaleOffer         = new SaleOffer();
            NewSaleOfferCategory = new SaleOfferCategoryVM();
            SaleOfferCategories  = new ObservableCollection <SaleOfferCategoryVM>();
            NewSaleOffer.Date    = DateTime.Now;
            OldPrices            = new ObservableCollection <SaleCategory>();
            _currentWindow.ShowDialog();
        }
Example #6
0
        private void PrintMethod()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DS ds = new DS();

            ds.ClientAccount.Rows.Clear();
            int i = 0;

            foreach (var item in _clientAccounts)
            {
                ds.ClientAccount.Rows.Add();
                ds.ClientAccount[i]["Serial"]        = i + 1;
                ds.ClientAccount[i]["Client"]        = _selectedClient.Name;
                ds.ClientAccount[i]["DateFrom"]      = _dateFrom;
                ds.ClientAccount[i]["DateTo"]        = _dateTo;
                ds.ClientAccount[i]["Date"]          = item.Date;
                ds.ClientAccount[i]["Statement"]     = item.Statement;
                ds.ClientAccount[i]["Debit"]         = item.Debit;
                ds.ClientAccount[i]["Credit"]        = item.Credit;
                ds.ClientAccount[i]["TotalDebit"]    = _selectedClientAccount.TotalDebit;
                ds.ClientAccount[i]["TotalCredit"]   = _selectedClientAccount.TotalCredit;
                ds.ClientAccount[i]["DuringAccount"] = Math.Abs(Convert.ToDecimal(_selectedClientAccount.DuringAccount));
                if (_selectedClientAccount.DuringAccount > 0)
                {
                    ds.ClientAccount[i]["DuringAccountType"] = "له";
                }
                else if (_selectedClientAccount.DuringAccount < 0)
                {
                    ds.ClientAccount[i]["DuringAccountType"] = "عليه";
                }
                ds.ClientAccount[i]["NotDuringAccount"] = Math.Abs(Convert.ToDecimal(_selectedClientAccount.OldAccount));
                if (_selectedClientAccount.OldAccount > 0)
                {
                    ds.ClientAccount[i]["NotDuringAccountType"] = "له";
                }
                else if (_selectedClientAccount.OldAccount < 0)
                {
                    ds.ClientAccount[i]["NotDuringAccountType"] = "عليه";
                }
                ds.ClientAccount[i]["CurrentAccount"] = Math.Abs(Convert.ToDecimal(_selectedClientAccount.CurrentAccount));
                if (_selectedClientAccount.CurrentAccount > 0)
                {
                    ds.ClientAccount[i]["CurrentAccountType"] = "له";
                }
                else if (_selectedClientAccount.CurrentAccount < 0)
                {
                    ds.ClientAccount[i]["CurrentAccountType"] = "عليه";
                }
                i++;
            }
            ReportWindow        rpt = new ReportWindow();
            ClientAccountReport accountClientRPT = new ClientAccountReport();

            accountClientRPT.SetDataSource(ds.Tables["ClientAccount"]);
            rpt.crv.ViewerCore.ReportSource = accountClientRPT;
            Mouse.OverrideCursor            = null;
            rpt.ShowDialog();
        }
        private void ExecuteSaveAsync()
        {
            Mouse.OverrideCursor        = Cursors.Wait;
            _selectedSupplyOffer.Client = _selectedClient;
            _supplyOfferServ.UpdateSupplyOffer(_selectedSupplyOffer);
            _supplyOfferCategoryServ.DeleteSupplyOfferCategories(ID);

            foreach (var item in _supplyOfferCategories)
            {
                SupplyOfferCategory _supplyOfferCategory = new SupplyOfferCategory
                {
                    CategoryID             = item.CategoryID,
                    Cost                   = item.Cost,
                    CostAfterDiscount      = item.CostAfterDiscount,
                    CostAfterTax           = item.CostAfterTax,
                    CostTotal              = item.CostTotal,
                    CostTotalAfterDiscount = item.CostTotalAfterDiscount,
                    CostTotalAfterTax      = item.CostTotalAfterTax,
                    Discount               = item.Discount,
                    DiscountValue          = item.DiscountValue,
                    DiscountValueTotal     = item.DiscountValueTotal,
                    SupplyOfferID          = ID,
                    Qty           = item.Qty,
                    Tax           = item.Tax,
                    TaxValue      = item.TaxValue,
                    TaxValueTotal = item.TaxValueTotal
                };
                _supplyOfferCategoryServ.AddSupplyOfferCategory(_supplyOfferCategory);
            }

            DS ds = new DS();

            ds.Sale.Rows.Clear();
            int i = 0;

            foreach (var item in _supplyOfferCategories)
            {
                ds.Sale.Rows.Add();
                ds.Sale[i]["Client"]     = _selectedClient.Name;
                ds.Sale[i]["Serial"]     = i + 1;
                ds.Sale[i]["Category"]   = item.Category + " " + item.Company;
                ds.Sale[i]["Qty"]        = item.Qty;
                ds.Sale[i]["Price"]      = Math.Round(Convert.ToDecimal(item.CostAfterTax), 2);
                ds.Sale[i]["TotalPrice"] = Math.Round(Convert.ToDecimal(item.CostTotalAfterTax), 2);
                ds.Sale[i]["BillPrice"]  = Math.Round(Convert.ToDecimal(_selectedSupplyOffer.CostAfterTax), 2);
                i++;
            }
            ReportWindow      rpt            = new ReportWindow();
            SupplyOfferReport supplyOfferRPT = new SupplyOfferReport();

            supplyOfferRPT.SetDataSource(ds.Tables["Sale"]);
            rpt.crv.ViewerCore.ReportSource = supplyOfferRPT;
            Mouse.OverrideCursor            = null;
            _currentWindow.Hide();
            rpt.ShowDialog();
            _currentWindow.Close();
        }
Example #8
0
        //主动上报
        private void Button_Click_Report(object sender, RoutedEventArgs e)
        {
            Topmost = false
            ;
            ReportWindow window = new ReportWindow();

            window.ShowDialog();

            Topmost = true;
        }
Example #9
0
        private void BtnReportSearch_Click(object sender, RoutedEventArgs e)
        {
            ReportWindow window = new ReportWindow()
            {
                ShowInTaskbar = false,
                Owner         = this
            };

            window.ShowDialog();
        }
Example #10
0
        private static void Report(Exception e, bool waitForClose)
        {
            if (e != null)
            {
                var logger = LogManager.GetLogger("UnHandledException");
                logger.Fatal(ExceptionFormatter.FormatException(e));

                var reportWindow = new ReportWindow(e);

                if (waitForClose)
                {
                    reportWindow.ShowDialog();
                }
                else
                {
                    reportWindow.Show();
                }
            }
        }
Example #11
0
        //public ICommand ReportCommand { get; set; }

        //xử lí
        public MainViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                isLoaded = true;
                p.Hide(); //Ẩn màn hình menu
                //Đăng nhập
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();

                var loginVM = loginWindow.DataContext as LoginViewModel; //Lấy data context từ static resource LoginVM ngoài LoginWindow.xaml

                //loginWindow là màn hình login, còn loginVM là dữ liệu của màn hình đó
                if (loginVM.isLogin) //Login được mới hiện menu
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            }
                                                            );


            MasterCommand      = new RelayCommand <object>((p) => { return(true); }, (p) => { MasterWindow wd = new MasterWindow(); wd.ShowDialog(); });
            TransactionCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { TransactionWindow wd = new TransactionWindow(); wd.ShowDialog(); });
            ReportCommand      = new RelayCommand <object>((p) => { return(true); }, (p) => { ReportWindow wd = new ReportWindow(); wd.ShowDialog(); });
        }
        private void PrintMethod()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DS ds = new DS();

            ds.Sale.Rows.Clear();
            int i = 0;

            foreach (var item in _saleCategories)
            {
                ds.Sale.Rows.Add();
                ds.Sale[i]["ID"]            = ID;
                ds.Sale[i]["Date"]          = _selectedSale.Date;
                ds.Sale[i]["Client"]        = _selectedSale.Client.Name;
                ds.Sale[i]["Serial"]        = i + 1;
                ds.Sale[i]["Category"]      = item.Category + " " + item.Company;
                ds.Sale[i]["Qty"]           = item.Qty;
                ds.Sale[i]["Price"]         = Math.Round(Convert.ToDecimal(item.PriceAfterDiscount), 2);
                ds.Sale[i]["TotalPrice"]    = Math.Round(Convert.ToDecimal(item.PriceTotalAfterDiscount), 2);
                ds.Sale[i]["BillPrice"]     = _selectedSale.PriceAfterDiscount;
                ds.Sale[i]["OldDebt"]       = Math.Abs(Convert.ToDecimal(_selectedSale.OldDebt));
                ds.Sale[i]["TransportCost"] = _selectedSale.TransportCost;
                ds.Sale[i]["BillTotal"]     = Math.Abs(Convert.ToDecimal(_selectedSale.PriceTotal));
                ds.Sale[i]["Paid"]          = _selectedSale.Paid;
                ds.Sale[i]["NewDebt"]       = Math.Abs(Convert.ToDecimal(_selectedSale.NewDebt));
                if (_selectedSale.NewDebt > 0)
                {
                    ds.Sale[i]["Type"] = "له";
                }
                else if (_selectedSale.NewDebt < 0)
                {
                    ds.Sale[i]["Type"] = "عليه";
                }
                ds.Sale[i]["Salesperson"] = _selectedSale.Salesperson.Name;
                ds.Sale[i]["PrintingMan"] = _selectedSale.PrintingMan;

                if (_selectedSale.OldDebt > 0)
                {
                    ds.Sale[i]["Type2"] = "له";
                }
                else if (_selectedSale.OldDebt < 0)
                {
                    ds.Sale[i]["Type2"] = "عليه";
                }
                ds.Sale[i]["Address"] = _selectedSale.Client.Address;
                try
                {
                    ToWord toWord = new ToWord(Math.Abs(Convert.ToDecimal(_selectedSale.NewDebt)), currencies[0]);
                    ds.Sale[i]["NewDebtAR"] = toWord.ConvertToArabic();
                }
                catch
                {
                    ds.Sale[i]["NewDebtAR"] = string.Empty;
                }
                i++;
            }
            ReportWindow rpt     = new ReportWindow();
            SaleReport   saleRPT = new SaleReport();

            saleRPT.SetDataSource(ds.Tables["Sale"]);
            rpt.crv.ViewerCore.ReportSource = saleRPT;
            Mouse.OverrideCursor            = null;
            _currentWindow.Hide();
            rpt.ShowDialog();
            _currentWindow.ShowDialog();

            //var dialog = new PrintDialog();
            //dialog.PrintVisual(_currentWindow, "ss");
            //bool? print = dialog.ShowDialog();
            //if (print.HasValue && print.Value)
            //{
            //    string startupPath = Environment.CurrentDirectory;
            //    printorderRPT.Load(startupPath + @"\..\..\PrintingOrderPaperRpt.rpt");
            //    printorderRPT.SetDataSource(ds.Tables["PrintOrder"]);
            //    printorderRPT.Subreports[0].SetDataSource(ds.Tables["PrintOrderRaws"]);
            //    printorderRPT.PrintOptions.PrinterName = dialog.PrintQueue.Name;
            //    try
            //    {
            //        printorderRPT.PrintToPrinter(1, true, 0, 0);
            //    }
            //    catch { }
            //}
        }
Example #13
0
        private void Btn_Report_Click(object sender, RoutedEventArgs e)
        {
            if (rbText != null)
            {
                if (TB_Report.Text != null)
                {
                    try
                    {
                        int ReportID = int.Parse(TB_Report.Text.ToString());
                    }

                    catch
                    {
                        MessageBox.Show("Введите целое число");
                        return;
                    }

                    ReportWindow RW = new ReportWindow();


                    switch (rbText)
                    {
                    case "Client":
                    {
                        RW.InfoList = LoadClientInfo(int.Parse(TB_Report.Text.ToString()));

                        cmndReport = new SqlCommand("select count(Rides_ID) from Rides where ClientID=@ClientID", connect);
                        SqlParameter param = new SqlParameter();
                        param.ParameterName = "@ClientID";
                        param.Value         = int.Parse(TB_Report.Text.ToString());
                        cmndReport.Parameters.Add(param);
                        SqlDataReader reader = cmndReport.ExecuteReader();
                        while (reader.Read())
                        {
                            object num = reader.GetValue(0);
                            RW.RidesCount = int.Parse(num.ToString());
                        }
                        reader.Close();

                        cmndReport          = new SqlCommand("select sum(Distance) from Rides where ClientID=@ClientID", connect);
                        param               = new SqlParameter();
                        param.ParameterName = "@ClientID";
                        param.Value         = int.Parse(TB_Report.Text.ToString());
                        cmndReport.Parameters.Add(param);
                        reader = cmndReport.ExecuteReader();
                        while (reader.Read())
                        {
                            object num = reader.GetValue(0);
                            RW.DistanceSum = double.Parse(num.ToString());
                        }
                        reader.Close();


                        cmndReport          = new SqlCommand("select sum(Summary) from Rides where ClientID=@ClientID", connect);
                        param               = new SqlParameter();
                        param.ParameterName = "@ClientID";
                        param.Value         = int.Parse(TB_Report.Text.ToString());
                        cmndReport.Parameters.Add(param);
                        reader = cmndReport.ExecuteReader();
                        while (reader.Read())
                        {
                            object num = reader.GetValue(0);
                            RW.Sum = int.Parse(num.ToString());
                        }
                        reader.Close();
                    }
                    break;


                    case "Driver":
                    {
                        RW.InfoList = LoadDriverInfo(int.Parse(TB_Report.Text.ToString()));
                        cmndReport  = new SqlCommand("select count(Rides_ID) from Rides where DriverID=@DriverID", connect);
                        SqlParameter param = new SqlParameter();
                        param.ParameterName = "@DriverID";
                        param.Value         = int.Parse(TB_Report.Text.ToString());
                        cmndReport.Parameters.Add(param);
                        SqlDataReader reader = cmndReport.ExecuteReader();
                        while (reader.Read())
                        {
                            object num = reader.GetValue(0);
                            RW.RidesCount = int.Parse(num.ToString());
                        }
                        reader.Close();

                        cmndReport          = new SqlCommand("select sum(Distance) from Rides where DriverID=@DriverID", connect);
                        param               = new SqlParameter();
                        param.ParameterName = "@DriverID";
                        param.Value         = int.Parse(TB_Report.Text.ToString());
                        cmndReport.Parameters.Add(param);
                        reader = cmndReport.ExecuteReader();
                        while (reader.Read())
                        {
                            object num = reader.GetValue(0);
                            RW.DistanceSum = double.Parse(num.ToString());
                        }
                        reader.Close();


                        cmndReport          = new SqlCommand("select sum(Summary) from Rides where DriverID=@DriverID", connect);
                        param               = new SqlParameter();
                        param.ParameterName = "@DriverID";
                        param.Value         = int.Parse(TB_Report.Text.ToString());
                        cmndReport.Parameters.Add(param);
                        reader = cmndReport.ExecuteReader();
                        while (reader.Read())
                        {
                            object num = reader.GetValue(0);
                            RW.Sum = int.Parse(num.ToString());
                        }
                        reader.Close();
                    }
                    break;
                    }
                    RW.ShowDialog();
                }
            }
        }
Example #14
0
        private void PrintMethod(string parameter)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DS ds = new DS();

            ds.Sale.Rows.Clear();
            int i = 0;

            foreach (var item in _saleCategories)
            {
                ds.Sale.Rows.Add();
                ds.Sale[i]["ID"]           = ID;
                ds.Sale[i]["Date"]         = _selectedSale.Date;
                ds.Sale[i]["Client"]       = _selectedSale.Client.Name;
                ds.Sale[i]["Serial"]       = i + 1;
                ds.Sale[i]["Category"]     = item.Category + " " + item.Company;
                ds.Sale[i]["Qty"]          = item.Qty;
                ds.Sale[i]["Price"]        = Math.Round(Convert.ToDecimal(item.Price), 2);
                ds.Sale[i]["TotalPrice"]   = Math.Round(Convert.ToDecimal(item.PriceTotal), 2);
                ds.Sale[i]["BillPrice"]    = _selectedSale.Price;
                ds.Sale[i]["OldDebt"]      = Math.Abs(Convert.ToDecimal(_selectedSale.OldDebt));
                ds.Sale[i]["BillTotal"]    = Math.Abs(Convert.ToDecimal(_selectedSale.PriceTotal));
                ds.Sale[i]["Paid"]         = _selectedSale.CashPaid;
                ds.Sale[i]["DiscountPaid"] = _selectedSale.DiscountPaid;
                ds.Sale[i]["NewDebt"]      = Math.Abs(Convert.ToDecimal(_selectedSale.NewDebt));
                if (_selectedSale.NewDebt > 0)
                {
                    ds.Sale[i]["Type"] = "له";
                }
                else if (_selectedSale.NewDebt < 0)
                {
                    ds.Sale[i]["Type"] = "عليه";
                }

                if (_selectedSale.OldDebt > 0)
                {
                    ds.Sale[i]["Type2"] = "له";
                }
                else if (_selectedSale.OldDebt < 0)
                {
                    ds.Sale[i]["Type2"] = "عليه";
                }
                i++;
            }
            ReportWindow rpt = new ReportWindow();

            if (parameter == "Client")
            {
                SaleReport saleRPT = new SaleReport();
                saleRPT.SetDataSource(ds.Tables["Sale"]);
                rpt.crv.ViewerCore.ReportSource = saleRPT;
                Mouse.OverrideCursor            = null;
            }
            else
            {
                SaleReport2 saleRPT = new SaleReport2();
                saleRPT.SetDataSource(ds.Tables["Sale"]);
                rpt.crv.ViewerCore.ReportSource = saleRPT;
                Mouse.OverrideCursor            = null;
            }
            _currentWindow.Hide();
            rpt.ShowDialog();
            _currentWindow.ShowDialog();
        }
Example #15
0
        public void Print(object pp)
        {
            string type = "";

            if (LableType == "Lable16")
            {
                type = "L16";
            }
            else if (LableType == "Lable24")
            {
                type = "L24";
            }
            else if (LableType == "Lable18")
            {
                type = "L18";
            }
            //PrintWindow _print = new PrintWindow(new ObservableCollection<object>(ListOfGroupD));
            //_print.ShowDialog();
            if (NoLangthVis == "Visible")
            {
                if (string.IsNullOrEmpty(LableType))
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Enter Lable.", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else if (string.IsNullOrEmpty(NoOfLable))
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Enter LabelNo.", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else if (string.IsNullOrEmpty(TextAlign))
                {
                    CustomDialogBox tempDB = new CustomDialogBox("Select TextAlign.", DialogType.Information);
                    tempDB.ShowDialog();
                }
                else
                {
                    GroupDetail  _GRoupDetail  = new GroupDetail();
                    ReportWindow _ReportWindow = new ReportWindow(PrintGD, ListOfGridSC, NoOfLable, type, TextAlign, FontStyle, FontWeight, Font);
                    _ReportWindow.ShowDialog();
                }
            }
            else
            {
                if (ListOfGroupD.Where(a => a.IsCheck == true).Count() > 0)
                {
                    if (string.IsNullOrEmpty(LableType))
                    {
                        CustomDialogBox tempDB = new CustomDialogBox("Enter Lable.", DialogType.Information);
                        tempDB.ShowDialog();
                    }
                    else if (string.IsNullOrEmpty(TextAlign))
                    {
                        CustomDialogBox tempDB = new CustomDialogBox("Select TextAlign.", DialogType.Information);
                        tempDB.ShowDialog();
                    }
                    else
                    {
                        ObservableCollection <GroupDetail> _GD = new ObservableCollection <GroupDetail>(ListOfGroupD.Where(w => w.IsCheck == true).ToList());
                        foreach (GroupDetail item in _GD)
                        {
                            item.Lable5 = item.Lable5;
                        }
                        ReportWindow _ReportWindow = new ReportWindow(ListOfGridSC, _GD, type, TextAlign, FontStyle, FontWeight, Font);
                        _ReportWindow.ShowDialog();
                    }
                }
                else
                {
                    CustomDialogBox tempDB = new CustomDialogBox("No Date Found.", DialogType.Information);
                    tempDB.ShowDialog();
                }
            }
        }
        private void ExecuteSave()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            DateTime _dt = DateTime.Now;

            _newSale.RegistrationDate = _dt;
            _saleServ.AddSale(_newSale);
            int _saleID = _saleServ.GetLastSaleID();

            foreach (var item in _saleCategories)
            {
                SaleCategory _saleCategory = new SaleCategory
                {
                    CategoryID              = item.CategoryID,
                    Cost                    = item.Cost,
                    PriceAfterDiscount      = item.PriceAfterDiscount,
                    PriceTotalAfterDiscount = item.PriceTotalAfterDiscount,
                    CostTotal               = item.CostTotal,
                    Price                   = item.Price,
                    PriceTotal              = item.PriceTotal,
                    Discount                = item.Discount,
                    DiscountValue           = item.DiscountValue,
                    DiscountValueTotal      = item.DiscountValueTotal,
                    SaleID                  = _saleID,
                    Qty = item.Qty
                };
                _saleCategoryServ.AddSaleCategory(_saleCategory);

                Category cat = _categoryServ.GetCategory(item.CategoryID);
                cat.Qty = cat.Qty - item.Qty;
                _categoryServ.UpdateCategory(cat);
            }

            ClientAccount _account = new ClientAccount
            {
                ClientID         = _newSale.ClientID,
                Date             = _newSale.Date,
                RegistrationDate = _dt,
                Statement        = "فاتورة مبيعات رقم " + _saleID,
                Credit           = _newSale.Paid,
                Debit            = _newSale.PriceAfterDiscount + _newSale.TransportCost
            };

            _clientAccountServ.AddAccount(_account);

            if (_newSale.Paid > 0)
            {
                Safe _safe = new Safe
                {
                    Date             = _newSale.Date,
                    RegistrationDate = _dt,
                    Statement        = "فاتورة مبيعات رقم " + _saleID + " للعميل: " + _selectedClient.Name,
                    Amount           = _newSale.Paid,
                    Source           = 4
                };
                _safeServ.AddSafe(_safe);
            }


            DS ds = new DS();

            ds.Sale.Rows.Clear();
            int i = 0;

            foreach (var item in _saleCategories)
            {
                ds.Sale.Rows.Add();
                ds.Sale[i]["ID"]            = _saleID;
                ds.Sale[i]["Date"]          = _newSale.Date;
                ds.Sale[i]["Client"]        = _selectedClient.Name;
                ds.Sale[i]["Serial"]        = i + 1;
                ds.Sale[i]["Category"]      = item.Category + " " + item.Company;
                ds.Sale[i]["Qty"]           = item.Qty;
                ds.Sale[i]["Price"]         = Math.Round(Convert.ToDecimal(item.PriceAfterDiscount), 2);
                ds.Sale[i]["TotalPrice"]    = Math.Round(Convert.ToDecimal(item.PriceTotalAfterDiscount), 2);
                ds.Sale[i]["BillPrice"]     = Math.Round(Convert.ToDecimal(_newSale.PriceAfterDiscount), 2);;
                ds.Sale[i]["OldDebt"]       = Math.Abs(Convert.ToDecimal(_newSale.OldDebt));
                ds.Sale[i]["TransportCost"] = _newSale.TransportCost;
                ds.Sale[i]["BillTotal"]     = Math.Abs(Math.Round(Convert.ToDecimal(_newSale.PriceTotal), 2));
                ds.Sale[i]["Paid"]          = _newSale.Paid;
                ds.Sale[i]["NewDebt"]       = Math.Abs(Math.Round(Convert.ToDecimal(_newSale.NewDebt), 2));
                if (_newSale.NewDebt > 0)
                {
                    ds.Sale[i]["Type"] = "له";
                }
                else if (_newSale.NewDebt < 0)
                {
                    ds.Sale[i]["Type"] = "عليه";
                }
                ds.Sale[i]["Salesperson"] = _selectedSalesperson.Name;
                ds.Sale[i]["PrintingMan"] = _newSale.PrintingMan;

                if (_newSale.OldDebt > 0)
                {
                    ds.Sale[i]["Type2"] = "له";
                }
                else if (_newSale.OldDebt < 0)
                {
                    ds.Sale[i]["Type2"] = "عليه";
                }
                ds.Sale[i]["Address"] = _selectedClient.Address;
                try
                {
                    ToWord toWord = new ToWord(Math.Abs(Convert.ToDecimal(_newSale.NewDebt)), currencies[0]);
                    ds.Sale[i]["NewDebtAR"] = toWord.ConvertToArabic();
                }
                catch
                {
                    ds.Sale[i]["NewDebtAR"] = string.Empty;
                }
                i++;
            }
            ReportWindow rpt     = new ReportWindow();
            SaleReport   saleRPT = new SaleReport();

            saleRPT.SetDataSource(ds.Tables["Sale"]);
            rpt.crv.ViewerCore.ReportSource = saleRPT;
            Mouse.OverrideCursor            = null;
            _currentWindow.Hide();
            rpt.ShowDialog();
            NewSale         = new Sale();
            NewSaleCategory = new SaleCategoryVM();
            SaleCategories  = new ObservableCollection <SaleCategoryVM>();
            NewSale.Date    = DateTime.Now;
            OldPrices       = new ObservableCollection <SaleCategory>();
            _currentWindow.ShowDialog();
        }
Example #17
0
        private void OverigeRapporten_Click(object sender, RoutedEventArgs e)
        {
            ReportWindow repVal = new ReportWindow(mijnenOverzicht);

            repVal.ShowDialog();
        }
        private async void ExecuteSaveAsync()
        {
            if (NewSupply.Future == true && NewSupplyFuture.Place == null)
            {
                await _currentWindow.ShowMessageAsync("فشل الإضافة", "يجب كتابة مكان الدفع", MessageDialogStyle.Affirmative, new MetroDialogSettings()
                {
                    AffirmativeButtonText = "موافق",
                    DialogMessageFontSize = 25,
                    DialogTitleFontSize   = 30
                });

                return;
            }
            Mouse.OverrideCursor = Cursors.Wait;
            DateTime _dt = DateTime.Now;

            _newSupply.RegistrationDate = _dt;
            _supplyServ.AddSupply(_newSupply);
            int _supplyID = _supplyServ.GetLastSupplyID();

            foreach (var item in _supplyCategories)
            {
                SupplyCategory _supplyCategory = new SupplyCategory
                {
                    CategoryID             = item.CategoryID,
                    Cost                   = item.Cost,
                    CostAfterDiscount      = item.CostAfterDiscount,
                    CostAfterTax           = item.CostAfterTax,
                    CostTotal              = item.CostTotal,
                    CostTotalAfterDiscount = item.CostTotalAfterDiscount,
                    CostTotalAfterTax      = item.CostTotalAfterTax,
                    Discount               = item.Discount,
                    DiscountValue          = item.DiscountValue,
                    DiscountValueTotal     = item.DiscountValueTotal,
                    SupplyID               = _supplyID,
                    Qty           = item.Qty,
                    Tax           = item.Tax,
                    TaxValue      = item.TaxValue,
                    TaxValueTotal = item.TaxValueTotal,
                    Price         = item.Price
                };
                _supplyCategoryServ.AddSupplyCategory(_supplyCategory);

                Category cat = _categoryServ.GetCategory(item.CategoryID);
                if (cat.Qty + item.Qty != 0)
                {
                    cat.Cost = (item.CostTotalAfterDiscount + (cat.Cost * cat.Qty)) / (cat.Qty + item.Qty);
                }
                cat.Qty   = cat.Qty + item.Qty;
                cat.Price = item.Price;
                _categoryServ.UpdateCategory(cat);
            }

            if (_newSupply.Future == true)
            {
                _newSupplyFuture.Change   = _newSupply.Change;
                _newSupplyFuture.SupplyID = _supplyID;
                if (_newSupplyFuture.Cheque == false)
                {
                    _newSupplyFuture.ChequeNumber = null;
                }
                _supplyFutureServ.AddSupplyFuture(_newSupplyFuture);
                _placesSuggestions.Add(_newSupplyFuture.Place);
            }
            ClientAccount _account = new ClientAccount
            {
                ClientID         = _newSupply.ClientID,
                Date             = _newSupply.Date,
                RegistrationDate = _dt,
                Statement        = "فاتورة مشتريات رقم " + _supplyID,
                Credit           = _newSupply.CostAfterTax,
                Debit            = _newSupply.CashPaid
            };

            _clientAccountServ.AddAccount(_account);
            if (_newSupply.DiscountPaid != 0 || _newSupply.TotalDiscount != 0)
            {
                _account = new ClientAccount
                {
                    ClientID         = _newSupply.ClientID,
                    Date             = _newSupply.Date,
                    RegistrationDate = _dt,
                    Statement        = "خصومات فاتورة مشتريات رقم " + _supplyID,
                    Credit           = _newSupply.DiscountPaid,
                    Debit            = _newSupply.TotalDiscount
                };
                _clientAccountServ.AddAccount(_account);
            }
            if (_newSupply.CashPaid > 0)
            {
                Safe _safe = new Safe
                {
                    Date             = _newSupply.Date,
                    RegistrationDate = _dt,
                    Statement        = "فاتورة مشتريات رقم " + _supplyID + " من العميل : " + _selectedClient.Name,
                    Amount           = -_newSupply.CashPaid,
                    Source           = 3
                };
                _safeServ.AddSafe(_safe);
            }

            DS ds = new DS();

            ds.Sale.Rows.Clear();
            int i = 0;

            foreach (var item in _supplyCategories)
            {
                ds.Sale.Rows.Add();
                ds.Sale[i]["ID"]         = _supplyID;
                ds.Sale[i]["Date"]       = _newSupply.Date;
                ds.Sale[i]["Client"]     = _selectedClient.Name;
                ds.Sale[i]["Serial"]     = i + 1;
                ds.Sale[i]["Category"]   = item.Category + " " + item.Company;
                ds.Sale[i]["Qty"]        = item.Qty;
                ds.Sale[i]["Price"]      = Math.Round(Convert.ToDecimal(item.CostAfterTax), 2);
                ds.Sale[i]["TotalPrice"] = Math.Round(Convert.ToDecimal(item.CostTotalAfterTax), 2);
                ds.Sale[i]["BillPrice"]  = Math.Round(Convert.ToDecimal(_newSupply.CostAfterTax), 2);
                ds.Sale[i]["OldDebt"]    = Math.Abs(Math.Round(Convert.ToDecimal(_newSupply.OldDebt), 2));

                ds.Sale[i]["Paid"]    = Math.Abs(Math.Round(Convert.ToDecimal(_newSupply.CashPaid + _newSupply.DiscountPaid), 2));
                ds.Sale[i]["NewDebt"] = Math.Abs(Math.Round(Convert.ToDecimal(_newSupply.NewDebt), 2));
                if (_newSupply.NewDebt > 0)
                {
                    ds.Sale[i]["PrintingMan"] = "له";
                }
                else if (_newSupply.NewDebt < 0)
                {
                    ds.Sale[i]["PrintingMan"] = "عليه";
                }

                if (_newSupply.OldDebt > 0)
                {
                    ds.Sale[i]["Type"] = "له";
                }
                else if (_newSupply.OldDebt < 0)
                {
                    ds.Sale[i]["Type"] = "عليه";
                }
                ds.Sale[i]["BillTotal"] = Math.Abs(Math.Round(Convert.ToDecimal(_newSupply.OldDebt), 2) + Math.Round(Convert.ToDecimal(_newSupply.CostAfterTax), 2));
                if (Math.Round(Convert.ToDecimal(_newSupply.OldDebt), 2) + Math.Round(Convert.ToDecimal(_newSupply.CostAfterTax), 2) > 0)
                {
                    ds.Sale[i]["Type2"] = "له";
                }
                else if (Math.Round(Convert.ToDecimal(_newSupply.OldDebt), 2) + Math.Round(Convert.ToDecimal(_newSupply.CostAfterTax), 2) < 0)
                {
                    ds.Sale[i]["Type2"] = "عليه";
                }
                i++;
            }
            ReportWindow rpt       = new ReportWindow();
            SupplyReport supplyRPT = new SupplyReport();

            supplyRPT.SetDataSource(ds.Tables["Sale"]);
            rpt.crv.ViewerCore.ReportSource = supplyRPT;
            Mouse.OverrideCursor            = null;
            _currentWindow.Hide();
            rpt.ShowDialog();

            NewSupply            = new Supply();
            NewSupplyCategory    = new SupplyCategoryVM();
            NewSupplyFuture      = new SupplyFuture();
            SupplyCategories     = new ObservableCollection <SupplyCategoryVM>();
            NewSupply.Date       = DateTime.Now;
            NewSupplyFuture.Date = DateTime.Now;
            OldCosts             = new ObservableCollection <SupplyCategory>();
            _currentWindow.ShowDialog();
        }
Example #19
0
        private void ExecuteSave(string parameter)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                DateTime _dt = DateTime.Now;
                _newSale.RegistrationDate = _dt;
                _saleServ.AddSale(_newSale);
                int _saleID = _saleServ.GetLastSaleID();

                foreach (var item in _saleCategories)
                {
                    SaleCategory _saleCategory = new SaleCategory
                    {
                        CategoryID = item.CategoryID,
                        Cost       = item.Cost,
                        CostTotal  = item.CostTotal,
                        Price      = item.Price,
                        PriceTotal = item.PriceTotal,
                        SaleID     = _saleID,
                        Qty        = item.Qty
                    };
                    _saleCategoryServ.AddSaleCategory(_saleCategory);

                    Category cat = _categoryServ.GetCategory(item.CategoryID);
                    cat.Qty = cat.Qty - item.Qty;
                    _categoryServ.UpdateCategory(cat);
                }

                ClientAccount _account = new ClientAccount
                {
                    ClientID         = _newSale.ClientID,
                    Date             = _newSale.Date,
                    RegistrationDate = _dt,
                    Statement        = "فاتورة مبيعات رقم " + _saleID,
                    Credit           = _newSale.CashPaid + _newSale.DiscountPaid,
                    Debit            = _newSale.Price
                };
                _clientAccountServ.AddAccount(_account);

                if (_newSale.CashPaid > 0)
                {
                    Safe _safe = new Safe
                    {
                        Date             = _newSale.Date,
                        RegistrationDate = _dt,
                        Statement        = "فاتورة مبيعات رقم " + _saleID + " للعميل: " + _selectedClient.Name,
                        Amount           = _newSale.CashPaid,
                        Source           = 4
                    };
                    _safeServ.AddSafe(_safe);
                }

                DS ds = new DS();
                ds.Sale.Rows.Clear();
                int i = 0;
                foreach (var item in _saleCategories)
                {
                    ds.Sale.Rows.Add();
                    ds.Sale[i]["ID"]           = _saleID;
                    ds.Sale[i]["Date"]         = _newSale.Date;
                    ds.Sale[i]["Client"]       = _selectedClient.Name;
                    ds.Sale[i]["Serial"]       = i + 1;
                    ds.Sale[i]["Category"]     = item.Category + " " + item.Company;
                    ds.Sale[i]["Qty"]          = item.Qty;
                    ds.Sale[i]["Price"]        = Math.Round(Convert.ToDecimal(item.Price), 2);
                    ds.Sale[i]["TotalPrice"]   = Math.Round(Convert.ToDecimal(item.PriceTotal), 2);
                    ds.Sale[i]["BillPrice"]    = Math.Round(Convert.ToDecimal(_newSale.Price), 2);;
                    ds.Sale[i]["OldDebt"]      = Math.Abs(Convert.ToDecimal(_newSale.OldDebt));
                    ds.Sale[i]["BillTotal"]    = Math.Abs(Math.Round(Convert.ToDecimal(_newSale.PriceTotal), 2));
                    ds.Sale[i]["Paid"]         = _newSale.CashPaid;
                    ds.Sale[i]["DiscountPaid"] = _newSale.DiscountPaid;
                    ds.Sale[i]["NewDebt"]      = Math.Abs(Math.Round(Convert.ToDecimal(_newSale.NewDebt), 2));
                    if (_newSale.NewDebt > 0)
                    {
                        ds.Sale[i]["Type"] = "له";
                    }
                    else if (_newSale.NewDebt < 0)
                    {
                        ds.Sale[i]["Type"] = "عليه";
                    }

                    if (_newSale.OldDebt > 0)
                    {
                        ds.Sale[i]["Type2"] = "له";
                    }
                    else if (_newSale.OldDebt < 0)
                    {
                        ds.Sale[i]["Type2"] = "عليه";
                    }

                    i++;
                }
                ReportWindow rpt = new ReportWindow();
                if (parameter == "Client")
                {
                    SaleReport saleRPT = new SaleReport();
                    saleRPT.SetDataSource(ds.Tables["Sale"]);
                    rpt.crv.ViewerCore.ReportSource = saleRPT;
                    Mouse.OverrideCursor            = null;
                }
                else
                {
                    SaleReport2 saleRPT = new SaleReport2();
                    saleRPT.SetDataSource(ds.Tables["Sale"]);
                    rpt.crv.ViewerCore.ReportSource = saleRPT;
                    Mouse.OverrideCursor            = null;
                }
                _currentWindow.Hide();
                rpt.ShowDialog();
                NewSale         = new Sale();
                NewSaleCategory = new SaleCategoryVM();
                SaleCategories  = new ObservableCollection <SaleCategoryVM>();
                NewSale.Date    = DateTime.Now;
                OldPrices       = new ObservableCollection <SaleCategory>();
                _currentWindow.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public void OpenReportWindow(Window w)
        {
            ReportWindow window = new ReportWindow();

            window.ShowDialog();
        }