Дипломная работа: Автоматизация документооборота учета материально-технического оборудования в ООО "ТРАНСКОМ"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
101
{
this.Location = new
System.Drawing.Point((Screen.PrimaryScreen.Bounds.Widththis.Width) / 2,
(Screen.PrimaryScreen.Bounds.Heightthis.Height) / 2);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
getReport();
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
getReport();
}
public void getReport()
{
hash.Clear();
if (radioButton1.Checked) // ПосостояниюМТО
{
tableAlias = "Отчет \"По состоянию МТО\"";
fMain.showSQLinComboAndHash1("select id_sos, sostoyanie from sostoyaniya", ref
this.comboBox1, ref hash);
}
else if (radioButton2.Checked) // ПокатегорииМТО
{
tableAlias = "Отчет \"По категории МТО\"";
fMain.showSQLinComboAndHash1("select id_kat, kategoriya from kategorii", ref
this.comboBox1, ref hash);
}
}
private void button1_Click(object sender, EventArgs e)
102
{
if (!radioButton1.Checked && !radioButton2.Checked)
return;
if (comboBox1.SelectedIndex < 0)
return;
int colCnt = 16;
string headers = "ID,Филиал,ID,Наименование,Инв. номер,ID,Категория
МТО,Дата выпуска,ID,Состояние,Дата ввода,Стоимость,Срок ПИ,Дата
списания,ID,МОЛ";
string hiddenCols = "0,2,5,8,14";
string colSizes = "0,190,0,130,80,0,250,75,0,180,75,70,40,75,0,250";
string sql = @"
select
c.id_fil, concat(c.kod, ' ', c.filial) as filial,
a.id_mto, a.naimenovanie, a.inventarniy_nomer,
b.id_kat, kategoriya,
date_format(a.data_vipuska, '%Y-%m-%d'),
f.id_sos, sostoyanie,
date_format(a.data_vvoda, '%Y-%m-%d'), a.stoimost, a.srok_pi,
date_format(a.data_spisaniya, '%Y-%m-%d'),
d.id_mol, concat('[', d.kod, '] ', d.fio, ' тел: ', d.tel) as
mol
from mto as a
inner join kategorii as b on a.id_kat=b.id_kat
inner join filiali as c on a.id_fil=c.id_fil
inner join mol as d on a.id_mol=d.id_mol
inner join sostoyaniya as f on a.id_sos=f.id_sos
where ";
if (radioButton1.Checked) // ПосостояниюМТО
{
string id_sos = hash[comboBox1.SelectedIndex].ToString();
sql += "a.id_sos=" + id_sos;
fMain.loadSQLinGridView(colCnt, sql, this.dataGridView1,
headers, hiddenCols, colSizes);
103
}
else if (radioButton2.Checked) // ПокатегорииМТО
{
string id_kat = hash[comboBox1.SelectedIndex].ToString();
sql += "a.id_kat=" + id_kat;
fMain.loadSQLinGridView(colCnt, sql, this.dataGridView1,
headers, hiddenCols, colSizes);
}
}
private void button2_Click(object sender, EventArgs e)
{
if (!radioButton1.Checked && !radioButton2.Checked)
return;
if (comboBox1.SelectedIndex < 0)
return;
SaveFileDialog saveDlg = new SaveFileDialog();
saveDlg.Filter = "Excel Files|*.xlsx";
saveDlg.DefaultExt = ".xlsx";
saveDlg.Title = "Выгрузка \"" + tableAlias + "\" вфайл Excel";
saveDlg.FileName = tableAlias + ".xlsx";
if (saveDlg.ShowDialog() == DialogResult.OK)
{
try
{
string path =
fMain.getFullPathWithoutExtension(saveDlg.FileName);
fMain.printGrid(this.dataGridView1, tableAlias, path);
}
catch (Exception ex)
{
MessageBox.Show("Ошибка. Не удалось сохранить файл
Excel\r\n" + ex.Message);
}
104
}
}
}
}
Подмодули управления справочниками
private void категорииМТОToolStripMenuItem_Click(object sender, EventArgs e)
{
links myLinksTmp = new links("kategorii");
OpenCatalog("select id_kat, kod, kategoriya from kategorii",
"id_kat#int#1,kod#str#1,kategoriya#str#1",
"Категории МТО",
"ID,Код,Категория",
"0,50,500",
"0",
myLinksTmp,
null,
null,
null,
null);
}
private void филиалыToolStripMenuItem_Click(object sender, EventArgs e)
{
links myLinksTmp = new links("filiali");
OpenCatalog("select id_fil, kod, filial from filiali",
"id_fil#int#1,kod#str#1,filial#str#1",
"Филиалы ООО 'ТрансКом'",
"ID,Код,Филиал",
"0,50,500",
"0",
myLinksTmp,
null,
null,
105
null,
null);
}
private void мОЛToolStripMenuItem_Click(object sender, EventArgs e)
{
links myLinksTmp = new links("mol");
OpenCatalog("select id_mol, fio, kod, tel from mol",
"id_mol#int#1,fio#str#1,kod#str#1,tel#str#1",
"Материально ответственные лица",
"ID,ФИО,Код филиала,Телефон",
"0,400,100,100",
"0",
myLinksTmp,
null,
null,
null,
null);
}
private void техническиеСостоянияМТОToolStripMenuItem_Click(object
sender, EventArgs e)
{
links myLinksTmp = new links("sostoyaniya");
OpenCatalog("select id_sos, kod, sostoyanie from sostoyaniya",
"id_sos#int#1,kod#str#1,sostoyanie#str#1",
"Техничение состояния МТО",
"ID,Код,Состояние МТО",
"0,50,500",
"0",
myLinksTmp,
null,
null,
null,
Источник: https://baza.diplomsite.ru/previewfile/1755