Esempio n. 1
0
        public static void addProductCheck(ClassProducts.product p, decimal qty)
        {
            decimal procent     = ClassDiscounts.client.procent + ClassDiscounts.client.procent_default;
            decimal sumDiscount = Math.Truncate(p.price * qty * procent) / 100;
            decimal total       = (p.price * qty - sumDiscount);
            int     ii          = 0;

            openProductsCheck();
            if (b.Element("check").Elements("product").Count() > 0)
            {
                //    string val = b.Element("check").Elements("product").LastOrDefault().Element("ii").Value;
                ii = b.Element("check").Elements("product").Count();   //int.Parse(val) + 1;
            }
            XElement e = (
                new XElement("product",
                             new XElement("ii", ii),
                             new XElement("CustumerId", p.CustumerId),
                             new XElement("Name", p.Name),
                             new XElement("Desc", p.Desc),
                             new XElement("price", p.price),
                             new XElement("priceGros", p.priceGros),
                             new XElement("tva", p.tva),
                             new XElement("qty", qty),
                             new XElement("CodeBare", p.CodeBare),
                             new XElement("balance", p.balance),
                             new XElement("contenance", p.contenance),
                             new XElement("uniteContenance", p.uniteContenance),
                             new XElement("tare", p.tare),
                             new XElement("date", p.date ?? DateTime.Now),
                             new XElement("cusumerIdRealStock", p.cusumerIdRealStock),
                             new XElement("cusumerIdSubGroup", p.cusumerIdSubGroup),
                             new XElement("ProductsWeb_CustomerId", p.ProductsWeb_CustomerId),
                             new XElement("grp", p.grp),
                             new XElement("sgrp", p.sgrp),
                             new XElement("Discount", procent),
                             new XElement("sumDiscount", sumDiscount),
                             new XElement("total", Math.Truncate(total * 100) / 100)
                             )
                );

            b.Element("check").Add(e);

            ClassCustomerDisplay.writePrice(p.Name, qty, p.price);
            new ClassFunctuon().writeToatl();
            ClassETC_fun.wm_sound(@"Data\Beep.wav");

            b.Save(path_b);

            ClassCheck.c = null;

            if (worker.IsBusy)
            {
                //  worker.CancelAsync();

                worker.Dispose();

                worker = new System.ComponentModel.BackgroundWorker();
            }
            worker.DoWork             += new System.ComponentModel.DoWorkEventHandler(worker_DoWork_Total);
            worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_RunWorkerCompleted_Total);
            worker.RunWorkerAsync();
        }
Esempio n. 2
0
        private static void worker_DoWork_Total(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            System.Threading.Thread.Sleep(1000);

            ClassCustomerDisplay.total_sum(getTotalPrice());
        }