private void торговляToolStripMenuItem_Click(object sender, EventArgs e) { // проверяем не запущена ли форма for (int x = 0; x < this.MdiChildren.Length; x++) { if (this.MdiChildren[x].Name == "Tform") { this.MdiChildren[x].Focus(); return; } } // Запускаем форму если она не запущена Form Tform = new Tform(); //скрываем форму из панели задач //secondForm.ShowInTaskbar = false; //устанавливаем форму по центру экрана Tform.StartPosition = FormStartPosition.CenterScreen; Tform.WindowState = FormWindowState.Maximized; //указываем владельца для формы Tform.MdiParent = this; // где containerInstance - это экземпляр контейнера или указатель на MainForm Tform.Show(); AttachAsMDIChild(Tform); }
private void GurnalSalesform_FormClosed(object sender, FormClosedEventArgs e) { Tform GurSalFrm = (Tform)this.Owner; GurSalFrm.txtShtovar.Focus(); }
private void button1_Click(object sender, EventArgs e) { Tform Calcfrm = (Tform)this.Owner; int l = Calcfrm.dGV.RowCount; if (l == 0) { MessageBox.Show("Чек пустой!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.txtnal.Focus(); return; } string type_pay = ""; if (chkbBeznal.Checked == true) { type_pay = "Б"; } else { type_pay = "Н"; } this.Cursor = Cursors.WaitCursor; int cheknow = _SRC.chek(); string[] ArrMinus = new string[Calcfrm.dGV.Rows.Count]; int iArr = 0; for (int i = 0; i < Calcfrm.dGV.Rows.Count; i++) { string Kod = Calcfrm.dGV.Rows[i].Cells[0].Value.ToString(); string Name = Calcfrm.dGV.Rows[i].Cells[1].Value.ToString(); double Rcena = Convert.ToDouble(Calcfrm.dGV.Rows[i].Cells[3].Value.ToString()); double Count = Convert.ToDouble(Calcfrm.dGV.Rows[i].Cells[4].Value.ToString()); double Summ = Convert.ToDouble(Calcfrm.dGV.Rows[i].Cells[5].Value.ToString()); double Zcena = Convert.ToDouble(Calcfrm.dGV.Rows[i].Cells[2].Value.ToString()); string kod_osn = Calcfrm.dGV.Rows[i].Cells[6].Value.ToString(); double obem_sps = Convert.ToDouble(Calcfrm.dGV.Rows[i].Cells[7].Value.ToString()); DateTime date1 = DateTime.Now; string datechek = date1.ToString("u").Remove(19); int chek = Convert.ToInt32(cheknow); //метод списания FIFO Calcfrm.Fifo(Kod, Count, Zcena, Rcena, chek, datechek, type_pay, kod_osn, obem_sps, Name); if (Calcfrm.FlagSaleMinus == 1) { Calcfrm.FlagSaleMinus = 0; ArrMinus[iArr] = Kod + " - " + Name; iArr++; } } if (ArrMinus[0] != null) { string messminus = "Внимание продажа в минус: " + Environment.NewLine; for (int k = 0; k < iArr; k++) { messminus += ArrMinus[k] + Environment.NewLine; } MessageBox.Show(messminus, "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (type_pay == "Н") { _SQl.SQL_Query("update source set cash=((Select cash from source)+" + Convert.ToInt32(lblSummShek.Text) + ")"); } if (Calcfrm.ckbPrintchek.Checked == true) { Calcfrm.PrintChek(cheknow.ToString()); } while (Calcfrm.dGV.Rows.Count != 0) { Calcfrm.dGV.Rows.Remove(Calcfrm.dGV.Rows[Calcfrm.dGV.Rows.Count - 1]); } Calcfrm.lblSumChekTform.Text = "0"; this.Cursor = Cursors.Default; this.Close(); Calcfrm.txtShtovar.Focus(); }
private void calcform_Load(object sender, EventArgs e) { Tform Calcfrm = (Tform)this.Owner; lblSummShek.Text = Calcfrm.lblSumChekTform.Text; }