Ejemplo n.º 1
0
        private void searchCustomer_TextChanged_1(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    int          customer     = Convert.ToInt32(searchCustomer.Text);
                    CustomerDebt customerDebt = CustomerDebt.getCDebt(customer);
                    DebitSale    debitSale    = DebitSale.getDebitSale(customer);


                    if (customer == null)
                    {
                        MessageBox.Show("The debt information of the customer entered was not found!", "ERROR");
                    }
                    else
                    {
                        List <DebitSale> debtSoldProducts = DebitSale.getallDSale();

                        if (debtSoldProducts != null)
                        {
                            foreach (DebitSale s in debtSoldProducts)
                            {
                                Object[] SoldProducts_debt = { s.customer_no, s.product_no, s.CustomerDebt.debt_amount, s.sale_date, s.sale_no, s.payment_method, };
                                table.Rows.Add(SoldProducts_debt);
                            }
                        }
                    }
                }
                catch (Exception EX)
                {
                    MessageBox.Show(EX.Message, "ERROR");
                }
            }
        }
        private void SubFormReport_Load(object sender, EventArgs e)
        {
            DataTable table = new DataTable();

            table.Columns.Add("Customer No", typeof(int));
            table.Columns.Add("Product No", typeof(string));
            table.Columns.Add("Total Amount", typeof(int));
            table.Columns.Add("Total Sale", typeof(float));

            dataGridView2.DataSource = table;

            List <DebitSale> prdts = DebitSale.getallDSale();

            if (prdts != null)
            {
                foreach (DebitSale p in prdts)
                {
                    object[] row = { p.customer_no, p.product_no, 1, p.price };
                    table.Rows.Add(row);
                }
            }
        }
Ejemplo n.º 3
0
        private void SubFormDebt_Load(object sender, EventArgs e)
        {
            table.Columns.Add("Customer No", typeof(int));
            table.Columns.Add("Product No", typeof(int));
            //table.Columns.Add("Debt Amount", typeof(int));
            table.Columns.Add("Sale Price", typeof(float));
            table.Columns.Add("Debt Date", typeof(DateTime));
            //table.Columns.Add("Sale No", typeof(int));
            //table.Columns.Add("Payment_method", typeof(string));
            dataGridView1.DataSource = table;

            List <DebitSale> debtSoldProducts = DebitSale.getallDSale();

            if (debtSoldProducts != null)
            {
                foreach (DebitSale p in debtSoldProducts)
                {
                    object[] row = { (p.customer_no), (p.product_no), p.price, (p.sale_date).ToString() };
                    // s.customer_no, s.product_no, s.CustomerDebt.debt_amount , s.sale_date, s.sale_no, s.payment_method
                    table.Rows.Add(row);
                }
            }
            hesapla();
        }
        /*public void KarHesaplama() // bu metot grafiklerin metotu.
         * {
         *
         *
         *
         *
         * }*/



        public void SubFormCharts_Load(object sender, EventArgs e)
        {
            List <DebitSale> debtSoldProducts = DebitSale.getallDSale();
            int sayi = debtSoldProducts.Count;

            List <CashSale> cashSoldProducts = CashSale.getallCSale();
            int             sayim            = cashSoldProducts.Count;

            var objChart = urunbazli.ChartAreas[0];

            objChart.AxisX.IntervalType                 = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
            objChart.AxisX.LabelStyle.Format            = "";
            objChart.AxisX.LabelStyle.IsEndLabelVisible = true;
            objChart.AxisX.Minimum  = 0;
            objChart.AxisX.Maximum  = sayi + sayim + 5;
            objChart.AxisX.Interval = 1;

            objChart.AxisY.IntervalType                 = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
            objChart.AxisY.LabelStyle.Format            = "";
            objChart.AxisY.LabelStyle.IsEndLabelVisible = true;
            objChart.AxisY.Minimum  = -1.5;
            objChart.AxisY.Maximum  = 1.5;
            objChart.AxisY.Interval = 0.2;



            DebitSale.getallDSale();
            CashSale.getallCSale();

            for (int j = 0; j < (sayi + sayim); j++)
            {
                float kar   = 0;
                float zarar = 0;

                float satis = debtSoldProducts[j].price;
                float giris = debtSoldProducts[j].unit_input_price;

                //float satisim = cashSoldProducts[j].price;
                //float girisim = cashSoldProducts[j].unit_input_price;

                if ((satis - giris) > 0)
                {
                    kar = satis - giris;
                    urunbazli.Series["Kar"].Points.AddXY(j, kar);
                }
                else if ((satis - giris) < 0)
                {
                    zarar = satis - giris;
                    urunbazli.Series["Zarar"].Points.AddXY(j, zarar);
                }

                /*else if((satisim - girisim) > 0 && satis == null)
                 * {
                 *  kar = satisim - girisim;
                 *  urunbazli.Series["Kar"].Points.AddXY(j, kar);
                 * }
                 * else if((satisim - girisim) < 0 && satis == null)
                 * {
                 *  zarar = satisim - girisim;
                 *  urunbazli.Series["Zarar"].Points.AddXY(j, zarar);
                 * }
                 * else if((satis - giris) > 0 && (satisim - girisim) > 0)
                 * {
                 *  kar = (satisim - girisim) + (satis - giris);
                 *  urunbazli.Series["Kar"].Points.AddXY(j, kar);
                 * }
                 * else if((satis - giris) < 0 && (satisim - girisim) < 0)
                 * {
                 *  zarar = (satisim - girisim) + (satis + giris);
                 *  urunbazli.Series["Zarar"].Points.AddXY(j, zarar);
                 * }
                 * else if((satis - giris) > 0 && (satisim - girisim) < 0)
                 * {
                 *  if((satis - giris) > (satisim - girisim))
                 *  {
                 *      kar = (satis - giris) - (satisim - girisim);
                 *      urunbazli.Series["Kar"].Points.AddXY(j, kar);
                 *  }
                 *  else if((satis - giris) < (satisim - girisim))
                 *  {
                 *      zarar = (satisim - girisim) - (satis - giris);
                 *      urunbazli.Series["Zarar"].Points.AddXY(j, zarar);
                 *  }
                 * }
                 * else if((satis - giris) < 0 && (satisim - girisim) > 0)
                 * {
                 *  if ((satis - giris) > (satisim - girisim))
                 *  {
                 *      zarar = (satis - giris) -(satisim - girisim) ;
                 *      urunbazli.Series["Zarar"].Points.AddXY(j, zarar);
                 *
                 *  }
                 *  else if ((satis - giris) < (satisim - girisim))
                 *  {
                 *      kar = (satisim - girisim) - (satis - giris);
                 *      urunbazli.Series["Kar"].Points.AddXY(j, kar);
                 *  }
                 * }*/
            }
        }