コード例 #1
0
        public Mega()
        {
            InitializeComponent();
            show.show3(Datatable);

            System.Windows.Forms.BindingSource BindS = new System.Windows.Forms.BindingSource();
            BindS.DataSource = Datatable;
            DD.ItemsSource   = BindS;
            DDa.Visibility   = Visibility.Hidden;
            DD.Visibility    = Visibility.Visible;
            Encode.IsEnabled = false;

            Resultpri.Text   = Fos.sumPrice();
            Resultpri_a.Text = Fos.sumPrice_a();
        }
コード例 #2
0
        string GetPricea()
        {
            DataTable a     = new DataTable();
            var       Getdt = new Assest.OrcDataAcess();

            Getdt.show3(a);
            string result = "";
            double price  = 0;

            foreach (DataRow item in a.Rows)
            {
                price += double.Parse(item.Field <string>("PRICE_A").Replace("SAR ", ""));
            }
            result = price.ToString("N0") + "ر.س";
            return(result);
        }
コード例 #3
0
        public string SumPrice()
        {
            String    Result                = "";
            var       NumRess               = new List <string>();
            var       NumRessed             = new List <string>();
            var       ExtractPrice          = new List <string>();
            var       ExtractedPrice        = new List <string>();
            DataTable CountierOfPrice_NRess = new DataTable();
            var       accc = new Assest.OrcDataAcess();

            accc.show3(CountierOfPrice_NRess);
            foreach (DataRow r in CountierOfPrice_NRess.Rows)
            {
                NumRess.Add(r.Field <string>("NUMF"));
                ExtractPrice.Add(r.Field <string>("PRICE"));
            }
            for (int i = 0; i < NumRess.Count; i++)
            {
                NumRessed.Add(NumRess[i]);
                for (int ii = 0; ii < NumRessed.Count;)
                {
                    if (NumRessed[i] == NumRessed[ii])
                    {
                        ExtractedPrice.Add(ExtractPrice[i].Replace("SAR", "").Replace(",", ""));
                    }
                    else
                    {
                    }
                    ii++;
                }
            }
            int result = 0;

            if (ExtractedPrice.Count > 0)
            {
                for (int i = 0; i < ExtractedPrice.Count; i++)
                {
                    result += int.Parse(ExtractedPrice[i]);
                }
                int parsetodecimal = result;
                return("SAR " + parsetodecimal.ToString("N0"));
            }
            else
            {
                return(int.Parse("0").ToString("N0"));
            }
        }
コード例 #4
0
        private void GetInvoice()
        {
            DataTable fff  = new DataTable();
            var       orcc = new Assest.OrcDataAcess();

            orcc.show3(fff);
            var list   = new List <string>();
            int result = 0;

            foreach (DataRow R in fff.Rows)
            {
                //list.Add(R.Field<string>("NUMF"));
                result = int.Parse(R.Field <string>("NUMF"));
            }
            result        += 1;
            xrLabel11.Text = result.ToString();
        }
コード例 #5
0
        private void Print_Click(object sender, RoutedEventArgs e)
        {
            var SumPricee = new FunctionsOfSum();

            var Fa_delete = new Assest.OrcDataAcess();
            var FA        = new Assest.OrcDataAcess();

            try
            {
                double afo      = 0;
                var    Filtring = new List <string>();
                foreach (string item in PriceList)
                {
                    Filtring.Add(item.Replace("SAR", ""));
                }

                var           accc = new Assest.OrcDataAcess();
                List <string> L0   = new List <string>();
                List <string> L1   = new List <string>();
                List <string> L2   = new List <string>();
                List <string> L3   = new List <string>();
                List <string> L4   = new List <string>();
                List <string> L5   = new List <string>();
                List <string> L6   = new List <string>(); //
                List <string> L7   = new List <string>(); //dis
                List <string> L8   = new List <string>(); //pricef
                List <string> L9   = new List <string>(); //dat


                /*
                 *
                 *
                 *
                 */



                DataTable tt = new DataTable();
                accc.Show(tt);

                //                Finall_Price = (Double)((Price * Discount) / 100) - Price;

                foreach (DataRow r in tt.Rows)
                {
                    L1.Add(r.Field <string>("NAME"));
                    L2.Add(r.Field <string>("BARCODE"));
                    L3.Add(r.Field <string>("PRICE_A"));
                    L4.Add(r.Field <string>("PRICE"));
                    L5.Add(r.Field <string>("ID"));
                    L6.Add(r.Field <string>("QUANTITY"));
                    L7.Add(r.Field <string>("Dis"));
                    L8.Add(r.Field <string>("Price_F"));
                }
                tt.Clear();
                accc.show3(tt);
                foreach (DataRow r in tt.Rows)
                {
                    L0.Add(r.Field <String>("NUMF"));
                }
                foreach (string asf in Filtring)
                {
                    afo += double.Parse(asf);
                }
                PriceList.Add(afo.ToString());
                Pricce.Text = "SAR " + afo.ToString();

                var RepHelper = new ReportHelper();
                var ILIST     = new List <ReportHelper>();
                ILIST.Add(new ReportHelper()
                {
                    Getprice_ = Pricce.Text
                });
                XtraReport3 report            = new XtraReport3();
                SQLiteConnectionParameters FF = new SQLiteConnectionParameters();
                FF.FileName = System.Windows.Forms.Application.StartupPath + "\\dbPascal.db";
                ((SqlDataSource)report.DataSource).ConnectionParameters = FF;
                XtraReportPreviewModel model   = new XtraReportPreviewModel(report);
                DocumentPreviewWindow  windoww = new DocumentPreviewWindow()
                {
                    Model = model
                };
                report.CreateDocument(true);
                windoww.ShowDialog();

                string id_3 = "";
                //int finalprice = int.Parse(SumPricee.sumPrice().Replace("SAR", "").Replace(",", ""));
                //double Ristt = double.Parse(afo.ToString().Replace("SAR", "").Replace(",", ""));
                //double FInaal = finalprice + Ristt;
                for (int i = 0; i < L1.Count; i++)
                {
                    if (L1[i] == Name.Text)
                    {
                        id_3 = L5[i];
                    }
                }
                List <int> sawf = new List <int>();

                foreach (string d in L0)
                {
                    sawf.Add(int.Parse(d));
                }
                #region Convert Days to arabic language
                string dayoftheweek = "";
                switch (DateTime.Now.DayOfWeek)
                {
                case DayOfWeek.Sunday:
                {
                    dayoftheweek = ".الاحد";
                    break;
                }

                case DayOfWeek.Monday:
                {
                    dayoftheweek = ".الاثنين";
                    break;
                }

                case DayOfWeek.Thursday:
                {
                    dayoftheweek = ".الخميس";
                    break;
                }

                case DayOfWeek.Saturday:
                {
                    dayoftheweek = ".السبت";
                    break;
                }

                case DayOfWeek.Friday:
                {
                    dayoftheweek = "الجمعة.";
                    break;
                }

                case DayOfWeek.Tuesday:
                {
                    dayoftheweek = "الثلاثاء.";
                    break;
                }

                case DayOfWeek.Wednesday:
                {
                    dayoftheweek = "الاربعاء.";
                    break;
                }
                }
                #endregion
                if (L0.Count == 0)
                {
                    //null
                }

                else
                {
                    numfa = sawf.Max() + 1;
                }
                if (sawf.Count == 0)
                {
                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                    for (int i = 0; i < L1.Count; i++)
                    {
                        double Price        = 0;
                        double Discount     = 0;
                        double Finall_Price = 0;
                        string Result       = "";

                        DateTime dtttt = new DateTime();
                        for (int ii = 0; ii < asdf.Count; ii++)
                        {
                            if (L1[i] == asdf[ii])
                            {
                                accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text);

                                Price        = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", ""));
                                Discount     = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", ""));
                                Finall_Price = (Double)((Price * Discount) / 100) - Price;
                                Finall_Price = Finall_Price * int.Parse(L6[i]);
                                Result       = "SAR " + Finall_Price.ToString("N2").Replace("-", "");
                                var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result);
                                mainwi.EDIT_MAX();
                            }

                            /*
                             *
                             * L1.Add(r.Field<string>("NAME"));
                             * L2.Add(r.Field<string>("BARCODE"));
                             * L3.Add(r.Field<string>("PRICE_A"));
                             * L4.Add(r.Field<string>("PRICE"));
                             * L5.Add(r.Field<string>("ID"));
                             * L6.Add(r.Field<string>("QUANTITY"));
                             * L7.Add(r.Field<string>("Dis"));
                             * L8.Add(r.Field<string>("Price_F"));
                             */
                        }
                    }

                    if (GID.Count > 0)
                    {
                        for (int i = 0; i < GID.Count; i++)
                        {
                            FA.Delete(GID[i]);
                        }
                    }
                }
                else
                {
                    #region Date

                    UmAlQuraCalendar um          = new UmAlQuraCalendar();
                    String           CurrentDate = (int.Parse(DateTime.Now.Year.ToString()) < 1600) ? DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() :
                                                   um.GetYear(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetMonth(DateTime.Parse(DateTime.Now.ToString())).ToString() + "/" + um.GetDayOfMonth(DateTime.Parse(DateTime.Now.ToString())).ToString();

                    #endregion


                    for (int i = 0; i < L1.Count; i++)
                    {
                        double Price        = 0;
                        double Discount     = 0;
                        double Finall_Price = 0;
                        string Result       = "";

                        DateTime dtttt = new DateTime();
                        for (int ii = 0; ii < asdf.Count; ii++)
                        {
                            if (L1[i] == asdf[ii])
                            {
                                accc.insert3(CurrentDate, L1[i], getwholeprice(i, L4, L7), L5[i], L6[i], L3[i], L2[i], numfa.ToString(), dayoftheweek, Pricce.Text);
                                Price        = (String.IsNullOrEmpty(L4[i].Replace("SAR", ""))) ? 0 : (Double)Double.Parse(double.Parse(L4[i].Replace("SAR", "")).ToString().Replace("SAR", ""));
                                Discount     = (String.IsNullOrEmpty(L7[i].Replace("%", ""))) ? 0 : (Double)Double.Parse(double.Parse(L7[i].Replace("%", "")).ToString().Replace("%", ""));
                                Finall_Price = (Double)((Price * Discount) / 100) - Price;
                                Finall_Price = Finall_Price * int.Parse(L6[i]);
                                Result       = "SAR " + Finall_Price.ToString("N2").Replace("-", "");
                                var mainwi = new MainWindow(L1[i], L4[i], L6[i], L2[i], L3[i], L5[i], L7[i], Result);
                                mainwi.EDIT_MAX();
                            }
                        }
                    }

                    if (GID.Count > 0)
                    {
                        for (int i = 0; i < GID.Count; i++)
                        {
                            FA.Updating_QUa("0", GID[i].ToString());
                        }
                    }
                }
                asdf.Clear();



                for (int i = 0; i < PriceList.Count; i++)
                {
                    Fa_delete._Delete(double.Parse(PriceList[i].Replace("SAR", "").Replace(",", "")));
                }
            }
            catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message + ":" + ex.HResult.ToString()); }
            DD.ItemsSource = "";
            Observ.Clear();
            NameList.Clear();
            PriceList.Clear();
        }