Beispiel #1
0
        private void btn_edit_Click(object sender, EventArgs e)
        {
            if (grid_items_in_inv.CurrentRow != null)
            {
                DataTransfer.str_datetime  = date_out.Value.ToString("yyyyMMdd HH:mm:ss");
                DataTransfer.str_num       = grid_items_in_inv.CurrentRow.Index;
                DataTransfer.action_change = true;
                DataTransfer.quantity      = (int)grid_items_in_inv.CurrentRow.Cells[2].Value;
                DataTransfer.str_mark_num  = (int)grid_items_in_inv.CurrentRow.Cells[5].Value;
                if (grid_items_in_inv.CurrentRow.Cells[7].Value != DBNull.Value)
                {
                    DataTransfer.table_act = (string)grid_items_in_inv.CurrentRow.Cells[7].Value;
                }

                Out_inv_act_items itms = new Out_inv_act_items();
                itms.ShowDialog();

                if (DataTransfer.action)
                {
                    ds.Tables[0].Rows[DataTransfer.str_num][1] = DataTransfer.Item_value;
                    ds.Tables[0].Rows[DataTransfer.str_num][2] = DataTransfer.quantity;
                    ds.Tables[0].Rows[DataTransfer.str_num][3] = DataTransfer.price;
                    ds.Tables[0].Rows[DataTransfer.str_num][4] = DataTransfer.price * DataTransfer.quantity;
                    ds.Tables[0].Rows[DataTransfer.str_num][5] = DataTransfer.str_mark_num;
                    ds.Tables[0].Rows[DataTransfer.str_num][6] = DataTransfer.id;
                    if (DataTransfer.table_act != null)
                    {
                        ds.Tables[0].Rows[DataTransfer.str_num][7] = DataTransfer.table_act;
                    }

                    num_calc_sum.Value = calc_sum();
                }

                DataTransfer.str_num       = -1;
                DataTransfer.action        = false;
                DataTransfer.action_change = false;
                DataTransfer.id            = -1;
                DataTransfer.Item_value    = null;
                DataTransfer.table_act     = null;
                DataTransfer.price         = 0;
                DataTransfer.quantity      = 0;
                DataTransfer.str_mark_num  = -1;
                DataTransfer.str_datetime  = null;
            }
            else
            {
                MessageBox.Show("Не выбран товар", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            DataTransfer.str_datetime = date_out.Value.ToString("yyyyMMdd HH:mm:ss");

            Out_inv_act_items itms = new Out_inv_act_items();

            itms.ShowDialog();

            if (DataTransfer.action)
            {
                ds.Tables[0].Rows.Add(DataTransfer.Item_value, DataTransfer.quantity, DataTransfer.price, DataTransfer.price * DataTransfer.quantity, DataTransfer.id, DataTransfer.str_mark_num);

                num_calc_sum.Value = calc_sum();
            }

            DataTransfer.action       = false;
            DataTransfer.id           = -1;
            DataTransfer.Item_value   = null;
            DataTransfer.price        = 0;
            DataTransfer.quantity     = 0;
            DataTransfer.str_mark_num = -1;
            DataTransfer.str_datetime = null;
        }