Example #1
0
        private void cash2OutButton_Click(object sender, EventArgs e)
        {
            if (cash2OutBox.Text != "")
            {
                string cash2 = cash2OutBox.Text.ToString();

                for (int i = 0; i < cash2.Length; i++)
                {
                    if (cash2[i] == ',')
                    {
                        string c2Str1 = cash2.Substring(0, i);
                        string c2Str2 = cash2.Substring(i + 1);
                        cash2 = c2Str1 + '.' + c2Str2;
                    }
                }

                decimal cash2Sum = decimal.Parse(cash2);

                var entity = new Cash2
                {
                    Date  = DateTime.Now,
                    Money = -cash2Sum
                };
                var income = new Income
                {
                    Date     = DateTime.Now,
                    Article  = "Прехвърляне от Каса 2",
                    Quantity = 1,
                    Price    = cash2Sum,
                    Repair   = 0.00m,
                    TypeId   = 1,
                };
                techzone.Incomes.Add(income);
                techzone.Cash2s.Add(entity);
                techzone.SaveChanges();
                cashBox.Text         = GetCash();
                TotalSumCashBox.Text = (decimal.Parse(cashBox.Text) + decimal.Parse(POSCashBox.Text)).ToString("F2");
                sum.Text             = IncomForDay();
                GetRefferenceIncomeBoxData();
            }
            else
            {
                cash2OutBox.Select();
            }
            cash2OutBox.Text = "";
            cash2Box.Text    = GetCash2();
        }
Example #2
0
        private void cash2InButton_Click(object sender, EventArgs e)
        {
            if (cash2InBox.Text != "")
            {
                string cash2 = cash2InBox.Text.ToString();

                for (int i = 0; i < cash2.Length; i++)
                {
                    if (cash2[i] == ',')
                    {
                        string c2Str1 = cash2.Substring(0, i);
                        string c2Str2 = cash2.Substring(i + 1);
                        cash2 = c2Str1 + '.' + c2Str2;
                    }
                }
                decimal cash2Sum = decimal.Parse(cash2);

                var entity = new Cash2
                {
                    Date  = DateTime.Now,
                    Money = cash2Sum
                };
                var cost = new Cost
                {
                    Name = "Прехвърляне към Каса 2",
                    Sum  = cash2Sum,
                    Date = DateTime.Now,
                };
                techzone.Costs.Add(cost);
                techzone.Cash2s.Add(entity);
                techzone.SaveChanges();
                cashBox.Text         = GetCash();
                TotalSumCashBox.Text = (decimal.Parse(cashBox.Text) + decimal.Parse(POSCashBox.Text)).ToString("F2");
                costForDayBox.Text   = CostForDay();
                GetRefferenceCostBoxData();
            }
            else
            {
                cash2InBox.Select();
            }
            cash2InBox.Text = "";
            cash2Box.Text   = GetCash2();
        }