示例#1
0
        public BillControl(string docType, List <Products> products, List <Buyers> buyers)
        {
            this.docType  = docType;
            this.products = products;
            InitializeComponent();
            label_billNumber.Text       = docType;
            button_previousBill.Enabled = false;
            button_nextBill.Enabled     = false;
            bills = WarehouseService.GetAllBillsWithDocType(docType);
            InitBillItemsTable();
            if (bills.Count > 0)
            {
                SelectBill(bills.Count - 1);
            }

            // enter kada se klikne za sifru proizvoda ili kolicinu da se doda u korpu
            quantity_textBox1.KeyUp      += Kolicina_KeyUp;
            sifraProizvoda_textBox.KeyUp += SifraProizvoda_KeyUp;

            // za pretragu po PIB-u ili maticnom broju
            textBox_PIB.KeyUp       += PIB_KeyUp;
            textBox_maticniBr.KeyUp += MaticniBroj_KeyUp;

            comboBoxOptions.Add("Sifra", "sifra");
            comboBoxOptions.Add("Naziv", "naziv");
            comboBoxOptions.Add("Barkod", "barkod");

            uplata_textBox1.KeyUp += UplataKeyUp;

            this.buyers = buyers;
            foreach (var buyer in buyers)
            {
                comboBox_kupci.Items.Add(buyer.sifra);
            }
            comboBox_kupci.SelectedIndexChanged += ComboBoxKupci_SelectedIndexChanged;

            uplata_textBox1.LostFocus        += new EventHandler(dataGridView1_LostFocus);
            sifraProizvoda_textBox.LostFocus += new EventHandler(dataGridView1_LostFocus);
            quantity_textBox1.LostFocus      += new EventHandler(dataGridView1_LostFocus);
            textBox_cek.LostFocus            += new EventHandler(dataGridView1_LostFocus);
            textBox_gotovina.LostFocus       += new EventHandler(dataGridView1_LostFocus);
            textBox_kartica.LostFocus        += new EventHandler(dataGridView1_LostFocus);
            textBox_virman.LostFocus         += new EventHandler(dataGridView1_LostFocus);
            textBox_PIB.LostFocus            += new EventHandler(dataGridView1_LostFocus);
            textBox_maticniBr.LostFocus      += new EventHandler(dataGridView1_LostFocus);

            // focus za nacine placanja
            textBox_cek.Click      += KeyEvent;
            textBox_gotovina.Click += KeyEvent;
            textBox_kartica.Click  += KeyEvent;
            textBox_virman.Click   += KeyEvent;

            textBox_cek.KeyPress      += TextBoxPrices_KeyPress;
            textBox_gotovina.KeyPress += TextBoxPrices_KeyPress;
            textBox_kartica.KeyPress  += TextBoxPrices_KeyPress;
            textBox_virman.KeyPress   += TextBoxPrices_KeyPress;

            textBox_cek.TextChanged      += TextBoxPrices_TextChanged;
            textBox_gotovina.TextChanged += TextBoxPrices_TextChanged;
            textBox_kartica.TextChanged  += TextBoxPrices_TextChanged;
            textBox_virman.TextChanged   += TextBoxPrices_TextChanged;
        }