Exemple #1
0
        public static decimal renduCalc()
        {
            decimal rendu = 0.0m;

            decimal noRendu = 0.0m;

            decimal sum = ClassBond.getSumMoney();

            foreach (var tm in ClassSync.TypesPayDB.t)
            {
                rendu += tm.Rendu_Avoir ?? false?ClassBond.getMoneyFromType(tm) : 0.0m;

                noRendu += !tm.Rendu_Avoir ?? false?ClassBond.getMoneyFromType(tm) : 0.0m;
            }

            return(sum - noRendu < 0 ? -rendu : sum - noRendu - rendu);
        }
Exemple #2
0
        public static void bay()
        {
            if (x.Element("checks") != null && b.Element("check").Elements("product").Count() > 0)
            {
                b = new ClassActionsCaisse().Descendants(b);

                try
                {
                    foreach (ClassSync.TypesPayDB type in ClassSync.TypesPayDB.t)
                    {
                        decimal m = ClassBond.getMoneyFromType(type);

                        b.Element("check").Add(new XAttribute(type.NameCourt.TrimEnd(), m));
                    }
                }
                catch (Exception ex)
                {
                    string text = "KOD 001" + ex.Message;

                    new ClassFunctuon().showMessageSB(text);

                    new ClassLog(text + b.ToString());
                }

                decimal rendu = ClassETC_fun.renduCalc();

                try
                {
                    b.Element("check").Add(new XAttribute("Rendu", rendu.ToString("0.00")));
                }

                catch (Exception ex)
                {
                    string text = "KOD 002" + ex.Message;

                    new ClassFunctuon().showMessageSB(text);

                    new ClassLog(text + b.ToString());
                }


                try
                {
                    b.Element("check").Add(
                        new XAttribute("sum", ClassBond.getSumMoney()),
                        new XAttribute("date", DateTime.Now)
                        );
                }
                catch (Exception ex)
                {
                    string text = "KOD 003" + ex.Message;

                    new ClassFunctuon().showMessageSB(text);

                    new ClassLog(text + b.ToString());
                }

                try
                {
                    if (ClassDiscounts.client.barcode != null && !ClassProMode.modePro)
                    {
                        addSetDiscountCardBareCode(
                            ClassDiscounts.client.barcode,
                            ClassDiscounts.client.points - (ClassDiscounts.client.addPoints ? 1 : 0) + (ClassDiscounts.client.discountSet ? ClassDiscounts.client.maxPoints : 0),
                            ClassDiscounts.client.addPoints ? 1 : 0,
                            ClassDiscounts.client.discountSet ? 8 : 0,
                            ClassDiscounts.client.nameFirst + " " + ClassDiscounts.client.nameLast
                            );
                    }
                }
                catch (Exception ex)
                {
                    string text = "KOD 004" + ex.Message;

                    new ClassFunctuon().showMessageSB(text);

                    new ClassLog(text + b.ToString());
                }


                //  try
                {
                    //   b.Element("check").Add(new XAttribute("barcodeCheck", getCodeBarCheck()));
                    if (ClassProMode.modePro || ClassProMode.devis)
                    {
                        ClassProMode.move(ClassProMode.devis);
                    }
                    else
                    {
                        x.Element("checks").Add(
                            b.Element("check")
                            );
                    }
                }
                // catch (Exception ex)
                {
                    //   string text = "KOD 005" + ex.Message;

                    // new ClassFunctuon().showMessageSB(text);

                    // new ClassLog(text + b.ToString());
                }

                //    try
                {
                    if (!ClassProMode.modePro && !ClassProMode.devis)
                    {
                        new ClassPrintCheck(b, false);
                    }
                }
                //  catch (Exception ex)
                {
                    //    string text = "KOD 006" + ex.Message;

                    //  new ClassFunctuon().showMessageSB(text);

                    //new ClassLog(text + b.ToString());
                }

                try
                {
                    System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker();

                    if (!ClassProMode.modePro && !ClassProMode.devis)
                    {
                        worker.DoWork             += new System.ComponentModel.DoWorkEventHandler(worker_DoWork);
                        worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
                        worker.RunWorkerAsync();
                    }
                }

                catch (Exception ex)
                {
                    string text = "KOD 007" + ex.Message;

                    // new ClassFunctuon().showMessageSB(text);

                    new ClassLog(text + b.ToString());
                }

                try
                {
                    if (!ClassProMode.modePro && !ClassProMode.devis)
                    {
                        x.Save(path);

                        b = null;

                        openProductsCheck();

                        ClassDiscounts.restoreDiscount();
                    }
                }
                catch (Exception ex)
                {
                    string text = "KOD 008" + ex.Message;

                    new ClassFunctuon().showMessageSB(text);

                    new ClassLog(text + b.ToString());
                }
            }
            else
            {
                new ClassFunctuon().showMessageSB("файл check.xml отсутвует или структура не правильная");
            }
        }