Пример #1
0
            public static void Calc(int p_invoice_id)
            {
                var mInvoicePurchase = Get(p_invoice_id);
                var productsViews    = productPurchase.GetProductsFromInvoice(p_invoice_id).ToList();

                double money_without_addedd = 0f;
                double money_tax            = 0f;
                double money_stamp          = 0f;
                double money_total          = 0f;

                foreach (object o in productsViews)
                {
                    double MONEY_UNIT = F_File.GetPropertyDouble(o, "MONEY_UNIT");
                    double TAX_PERCE  = F_File.GetPropertyDouble(o, "TAX_PERCE");
                    double TAX_VALUE  = F_File.GetPropertyDouble(o, "TAX_VALUE");
                    double STAMP      = F_File.GetPropertyDouble(o, "STAMP");
                    double MONEY_PAID = F_File.GetPropertyDouble(o, "MONEY_PAID");

                    money_without_addedd = +MONEY_UNIT;
                    money_tax            = +TAX_VALUE;
                    money_stamp          = +STAMP;
                    money_total          = +MONEY_PAID;
                }

                mInvoicePurchase.MONEY_WITHOUT_ADDEDD = money_without_addedd;
                mInvoicePurchase.MONEY_TAX            = money_tax;
                mInvoicePurchase.MONEY_STAMP          = money_stamp;
                mInvoicePurchase.MONEY_TOTAL          = money_total;
                mInvoicePurchase.DATE = DateTime.Now;
                _db.SaveChanges();
            }
Пример #2
0
            public static void ValidateCancel(int p_invoice_id)
            {
                var mInvoicePurchase = Get(p_invoice_id);

                if (mInvoicePurchase.VALIDATION != 1)
                {
                    DialogError.Error(); return;
                }

                var productsViews = productPurchase.GetProductsFromInvoice(p_invoice_id).ToList();

                foreach (object o in productsViews)
                {
                    double QUANTITY   = F_File.GetPropertyDouble(o, "QUANTITY");
                    int    ID_PRODUCT = F_File.GetPropertyInt(o, "ID_PRODUCT");
                    var    p          = product.Get(ID_PRODUCT);
                    p.QUANTITY = p.QUANTITY + QUANTITY;
                }

                if (mInvoicePurchase.MONEY_PAID < mInvoicePurchase.MONEY_TOTAL)
                {
                    var c = wholesaler.Get((int)mInvoicePurchase.ID_USERS);
                    c.MONEY_ACCOUNT = c.MONEY_ACCOUNT + mInvoicePurchase.MONEY_UNPAID;
                }

                mInvoicePurchase.MONEY_PAID   = 0;
                mInvoicePurchase.MONEY_UNPAID = 0;
                mInvoicePurchase.VALIDATION   = 0;

                _db.SaveChanges();
            }
Пример #3
0
            public static void Validate(int p_invoice_id, double p_mony_paid, string p_description)
            {
                var mInvoiceSell = Get(p_invoice_id);

                if (mInvoiceSell.VALIDATION == 1)
                {
                    DialogError.Error(); return;
                }

                var productsViews = productSell.GetProductsFromInvoice(p_invoice_id).ToList();

                foreach (object o in productsViews)
                {
                    double QUANTITY   = F_File.GetPropertyDouble(o, "QUANTITY");
                    int    ID_PRODUCT = F_File.GetPropertyInt(o, "ID_PRODUCT");
                    var    p          = product.Get(ID_PRODUCT);
                    if ((p.QUANTITY - QUANTITY) < 0)
                    {
                        DialogError.Error(); return;
                    }
                    p.QUANTITY = p.QUANTITY - QUANTITY;
                }

                mInvoiceSell.MONEY_PAID   = p_mony_paid;
                mInvoiceSell.MONEY_UNPAID = mInvoiceSell.MONEY_TOTAL - p_mony_paid;
                mInvoiceSell.DESCRIPTION  = p_description;
                mInvoiceSell.VALIDATION   = 1;

                if (mInvoiceSell.MONEY_PAID < mInvoiceSell.MONEY_TOTAL)
                {
                    var c = customer.Get((int)mInvoiceSell.ID_USERS);
                    c.MONEY_ACCOUNT = c.MONEY_ACCOUNT - mInvoiceSell.MONEY_UNPAID;
                }
                _db.SaveChanges();
                if (mInvoiceSell.VALIDATION == 1)
                {
                    DialogInformation.OK(); return;
                }
            }