Проектирование АСУ "Управления Здравоохранения Администрации Ленинского муниципального района"

Общая характеристика деятельности организации. Выявление недостатков существующей системы управления. Определение потребности в медицинском оборудовании. Выбор поставщиков по лотам. Контроль пуско-наладочных работ. Анализ надежности и отказоустойчивости.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 14.03.2013
Размер файла 4,8 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

Form7->Close();

break;

case 4:

Form11->Edit1->Text = ADOQuery1->FieldByName("Номер")->AsString;

Form11->ADOQuery1->Close();

Form7->Close();

break;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm7::FormShow(TObject *Sender)

{

switch(Form1->sw_1)

{

case 1:

ADOQuery1->Active = false;

ADOQuery1->SQL->Text = "SELECT lpu_id \"Номер ЛПУ\", lpu_name \"Название ЛПУ\" FROM spr_lpu";

ADOQuery1->Active = true;

break;

case 2:

ADOQuery1->Active = false;

ADOQuery1->SQL->Text = "SELECT post_id \"Номер\", post_name \"Название орг-ии\" FROM spr_post";

ADOQuery1->Active = true;

break;

case 3:

ADOQuery1->Active = false;

ADOQuery1->SQL->Text = "SELECT lpu_id \"Номер ЛПУ\", lpu_name \"Название ЛПУ\" FROM spr_lpu";

ADOQuery1->Active = true;

break;

case 4:

ADOQuery1->Active = false;

ADOQuery1->SQL->Text = "SELECT post_id \"Номер\", post_name \"Название орг-ии\" FROM spr_post";

ADOQuery1->Active = true;

break;

}

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit8.h"

#include "Unit1.h"

#include "Unit7.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm8 *Form8;

//---------------------------------------------------------------------------

__fastcall TForm8::TForm8(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm8::Edit1Change(TObject *Sender)

{

if(Edit1->Text != "")

{

ADOQuery2->Close();

ADOQuery2->SQL->Text = "SELECT post_name FROM spr_post WHERE post_id = " + Edit1->Text;

ADOQuery2->Open();

Label3->Caption = ADOQuery2->FieldByName("post_name")->AsString;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm8::Button1Click(TObject *Sender)

{

Form1->sw_1 = 2;

Form7 = new TForm7(this);

if (Form7->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

void __fastcall TForm8::Button2Click(TObject *Sender)

{

if(Label3->Caption != "")

{

ADOQuery1->Close();

ADOQuery1->SQL->Text = "SELECT * FROM plan_post_ob WHERE \"Поставщик\" = '" + Label3->Caption + "'";

ADOQuery1->Open();

}

else

MessageBox(0,"Введи номер или выбирите нужного поставщика из справочника","Ошибка",0);

}

//---------------------------------------------------------------------------

void __fastcall TForm8::Button3Click(TObject *Sender)

{

if(ADOQuery1->Active == true)

{

Memo1->Lines->Clear();

Memo1->Lines->Add("<Table border=1 align=center width=80%>");

Memo1->Lines->Add("<CAPTION><EM><B><H3>План поставки оборудования (для " + Label3->Caption + ")</H3></B></EM></CAPTION>");

ADOQuery1->First();

Memo1->Lines->Add("<tr>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> Номер договора </b>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> ЛПУ </b>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> Тип оборудования </b>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> Модель оборудования </b>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> Ед.Изм. </b>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> Кол-во </b>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> Дата поставки </b>");

Memo1->Lines->Add("<br>");

while(!ADOQuery1->Eof)

{

Memo1->Lines->Add("<tr>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("Номер контракта")->AsString);

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("ЛПУ")->AsString);

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("Тип оборудования")->AsString);

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("Модель оборудования")->AsString);

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("Ед.изм.")->AsString);

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("Кол-во")->AsString);

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("Дата поставки")->AsString);

Memo1->Lines->Add("<br>");

ADOQuery1->Next();

}

Memo1->Lines->Add("</table><br>");

Memo1->Lines->SaveToFile(ExtractFilePath(Application->ExeName) + "\План поставки оборудования (пост. #" + Edit1->Text + ").html");

}

else

MessageBox(0, "План поставки не сформирован","Ошибка", 0);

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit9.h"

#include "Unit1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm9 *Form9;

//---------------------------------------------------------------------------

__fastcall TForm9::TForm9(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm9::Button1Click(TObject *Sender)

{

ADOQuery1->Close();

ADOQuery1->SQL->Clear();

ADOQuery1->SQL->Add("SELECT plan_pnr.kontr_id \"Номер контракта\", spr_lpu.lpu_name \"ЛПУ\", spr_post.post_name \"Поставщик\", spr_type.type_name \"Тип оборудования\", spr_model.model_name \"Модель\", spr_ed_izm.ed_izm_sokr \"Ед.Изм\", kontr_oboryd.kol \"Кол-во\", plan_pnr.date_pnr_n \"Дата начала ПНР\", plan_pnr.date_pnr_o \"Дата окончания ПНР\" FROM plan_pnr, spr_post, spr_kontr, kontr_oboryd, spr_type, spr_model, spr_ed_izm, spr_lpu WHERE plan_pnr.kontr_id = spr_kontr.kontr_id AND spr_kontr.post_id = spr_post.post_id AND plan_pnr.obor_id = kontr_oboryd.obor_id AND kontr_oboryd.type_id = spr_type.type_id AND spr_model.model_id = kontr_oboryd.model_id AND spr_ed_izm.ed_izm_id = kontr_oboryd.ed_izm_id AND plan_pnr.kontr_id = kontr_oboryd.kontr_id AND spr_kontr.lpu_id = spr_lpu.lpu_id AND TO_CHAR(plan_pnr.date_pnr_n, 'YYYY') = "+ Edit1->Text + "ORDER BY plan_pnr.date_pnr_n ASC");

ADOQuery1->Open();

ADOQuery2->Close();

ADOQuery2->SQL->Text = "CREATE OR REPLACE VIEW plan_pnr_ob AS SELECT plan_pnr.kontr_id \"Номер контракта\", spr_lpu.lpu_name \"ЛПУ\", spr_post.post_name \"Поставщик\", spr_type.type_name \"Тип оборудования\", spr_model.model_name \"Модель\", spr_ed_izm.ed_izm_sokr \"Ед.Изм\", kontr_oboryd.kol \"Кол-во\", plan_pnr.date_pnr_n \"Дата начала ПНР\", plan_pnr.date_pnr_o \"Дата окончания ПНР\" FROM plan_pnr, spr_post, spr_kontr, kontr_oboryd, spr_type, spr_model, spr_ed_izm, spr_lpu WHERE plan_pnr.kontr_id = spr_kontr.kontr_id AND spr_kontr.post_id = spr_post.post_id AND plan_pnr.obor_id = kontr_oboryd.obor_id AND kontr_oboryd.type_id = spr_type.type_id AND spr_model.model_id = kontr_oboryd.model_id AND spr_ed_izm.ed_izm_id = kontr_oboryd.ed_izm_id AND plan_pnr.kontr_id = kontr_oboryd.kontr_id AND spr_kontr.lpu_id = spr_lpu.lpu_id AND TO_CHAR(plan_pnr.date_pnr_n, 'YYYY') = "+ Edit1->Text + "ORDER BY plan_pnr.date_pnr_n ASC";

ADOQuery2->ExecSQL();

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit10.h"

#include "Unit1.h"

#include "Unit7.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm10 *Form10;

//---------------------------------------------------------------------------

__fastcall TForm10::TForm10(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm10::Edit1Change(TObject *Sender)

{

if(Edit1->Text != "")

{

ADOQuery2->Close();

ADOQuery2->SQL->Text = "SELECT lpu_name FROM spr_lpu WHERE lpu_id = " + Edit1->Text;

ADOQuery2->Open();

Label3->Caption = ADOQuery2->FieldByName("lpu_name")->AsString;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm10::Button1Click(TObject *Sender)

{

Form1->sw_1 = 3;

Form7 = new TForm7(this);

if (Form7->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

void __fastcall TForm10::Button2Click(TObject *Sender)

{

if(Label3->Caption != "")

{

ADOQuery1->Close();

ADOQuery1->SQL->Text = "SELECT * FROM plan_pnr_ob WHERE \"ЛПУ\" = '" + Label3->Caption + "'";

ADOQuery1->Open();

}

else

MessageBox(0,"Введи номер или выбирите нужный ЛПУ из справочника","Ошибка",0);

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit11.h"

#include "Unit1.h"

#include "Unit7.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm11 *Form11;

//---------------------------------------------------------------------------

__fastcall TForm11::TForm11(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm11::Edit1Change(TObject *Sender)

{

if(Edit1->Text != "")

{

ADOQuery2->Close();

ADOQuery2->SQL->Text = "SELECT post_name FROM spr_post WHERE post_id = " + Edit1->Text;

ADOQuery2->Open();

Label3->Caption = ADOQuery2->FieldByName("post_name")->AsString;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm11::Button1Click(TObject *Sender)

{

Form1->sw_1 = 4;

Form7 = new TForm7(this);

if (Form7->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

void __fastcall TForm11::Button2Click(TObject *Sender)

{

if(Label3->Caption != "")

{

ADOQuery1->Close();

ADOQuery1->SQL->Text = "SELECT * FROM plan_pnr_ob WHERE \"Поставщик\" = '" + Label3->Caption + "'";

ADOQuery1->Open();

}

else

MessageBox(0,"Введи номер или выбирите нужного поставщика из справочника","Ошибка",0);

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit12.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm12 *Form12;

//---------------------------------------------------------------------------

__fastcall TForm12::TForm12(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm12::Button2Click(TObject *Sender)

{

ADOQuery2->SQL->Text = "CREATE OR REPLACE VIEW post_otkl AS SELECT plan_post.kontr_id \"№ договора\", spr_lpu.lpu_name \"ЛПУ\", spr_post.post_name \"Поставщик\", spr_type.type_name \"Тип\", spr_model.model_name \"Модель\", spr_ed_izm.ed_izm_sokr \"Ед.изм.\", kontr_oboryd.kol \"Кол-во по контр.\", post_fakt.kol_fakt \"Кол-во факт.\", kontr_oboryd.kol - post_fakt.kol_fakt \"Отклонение по кол-ву\", plan_post.date_post \"Дата поставки по плану\", post_fakt.date_fakt \"Дата факт. поставки\", post_fakt.date_fakt - plan_post.date_post \"Отклонения по сроку поставки\" FROM plan_post, spr_lpu, spr_kontr, spr_post, spr_type, kontr_oboryd, spr_model, spr_ed_izm, post_fakt WHERE plan_post.kontr_id = spr_kontr.kontr_id AND spr_lpu.lpu_id = spr_kontr.lpu_id AND spr_post.post_id = spr_kontr.post_id AND kontr_oboryd.kontr_id = plan_post.kontr_id AND kontr_oboryd.obor_id = plan_post.obor_id AND kontr_oboryd.type_id = spr_type.type_id AND kontr_oboryd.model_id = spr_model.model_id AND kontr_oboryd.ed_izm_id = spr_ed_izm.ed_izm_id AND kontr_oboryd.obor_id = post_fakt.obor_id AND kontr_oboryd.kontr_id = post_fakt.kontr_id AND post_fakt.date_fakt <= TO_DATE('" + MaskEdit1->Text + "','DD.MM.YYYY')";

ADOQuery2->ExecSQL();

ADOQuery1->Close();

ADOQuery1->SQL->Text = "SELECT * FROM post_otkl WHERE \"Отклонение по кол-ву\" > 0 OR \"Отклонения по сроку поставки\" > 0";

ADOQuery1->Open();

}

//---------------------------------------------------------------------------

void __fastcall TForm12::Button1Click(TObject *Sender)

{

if(MonthCalendar1->Visible == false)

MonthCalendar1->Visible = true;

else

MonthCalendar1->Visible = false;

}

//---------------------------------------------------------------------------

void __fastcall TForm12::MonthCalendar1DblClick(TObject *Sender)

{

MaskEdit1->Text = MonthCalendar1->Date;

MonthCalendar1->Visible = false;

}

//---------------------------------------------------------------------------

void __fastcall TForm12::FormShow(TObject *Sender)

{

MonthCalendar1->Date = Date();

MaskEdit1->Text = MonthCalendar1->Date;

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit13.h"

#include "Unit1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm13 *Form13;

bool flag;

//---------------------------------------------------------------------------

__fastcall TForm13::TForm13(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm13::FormShow(TObject *Sender)

{

MonthCalendar1->Date = Date();

MaskEdit1->Text = MonthCalendar1->Date;

}

//---------------------------------------------------------------------------

void __fastcall TForm13::Button1Click(TObject *Sender)

{

if(MonthCalendar1->Visible == false)

MonthCalendar1->Visible = true;

else

MonthCalendar1->Visible = false;

}

//---------------------------------------------------------------------------

void __fastcall TForm13::MonthCalendar1DblClick(TObject *Sender)

{

MaskEdit1->Text = MonthCalendar1->Date;

MonthCalendar1->Visible = false;

}

//---------------------------------------------------------------------------

void __fastcall TForm13::Button2Click(TObject *Sender)

{

ADOQuery2->SQL->Text = "CREATE OR REPLACE VIEW pnr_otkl AS SELECT otch_pnr.kontr_id \"Номер контр.\", spr_post.post_name \"Поставщик\", spr_lpu.lpu_name \"ЛПУ\", spr_type.type_name \"Тип оборудования\", spr_model.model_name \"Модель оборудования\", spr_ed_izm.ed_izm_sokr \"Ед.изм\", kontr_oboryd.kol \"Kол-во\", plan_pnr.date_pnr_n \"Дата начала ПНР по плану\" , begin_pnr.date_n_fakt \"Дата начала ПНР фактическая\", begin_pnr.date_n_fakt - plan_pnr.date_pnr_n \"Отклонение по сроку начала ПНР\", plan_pnr.date_pnr_o \"Дата окончания ПНР по плану\", otch_pnr.date_o_fakt \"Дата окончания ПНР фактическая\", otch_pnr.date_o_fakt - plan_pnr.date_pnr_o \"Откл-ие по сроку окончания ПНР\" FROM otch_pnr, spr_post, spr_kontr, spr_lpu, spr_type, kontr_oboryd, spr_model, spr_ed_izm, plan_pnr, begin_pnr WHERE otch_pnr.kontr_id = spr_kontr.kontr_id AND spr_kontr.post_id = spr_post.post_id AND spr_kontr.lpu_id = spr_lpu.lpu_id AND kontr_oboryd.kontr_id = otch_pnr.kontr_id AND kontr_oboryd.obor_id = otch_pnr.obor_id AND kontr_oboryd.type_id = spr_type.type_id AND spr_model.model_id = kontr_oboryd.model_id AND spr_model.ed_izm_id = spr_ed_izm.ed_izm_id AND plan_pnr.kontr_id = otch_pnr.kontr_id AND plan_pnr.obor_id = otch_pnr.obor_id AND begin_pnr.kontr_id = otch_pnr.kontr_id AND otch_pnr.obor_id = otch_pnr.obor_id AND ((begin_pnr.date_n_fakt - plan_pnr.date_pnr_n) <> 0 OR (plan_pnr.date_pnr_o - otch_pnr.date_o_fakt) <> 0) AND otch_pnr.date_o_fakt <= TO_DATE('" + MaskEdit1->Text + "','DD.MM.YYYY')";

ADOQuery2->ExecSQL();

ADOQuery1->Close();

ADOQuery1->SQL->Text = "SELECT * FROM pnr_otkl";

ADOQuery1->Open();

}

#include <vcl.h>

#pragma hdrstop

#include "Unit14.h"

#include "Unit1.h"

#include "Unit15.h"

#include "Unit16.h"

#include "Unit17.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm14 *Form14;

//---------------------------------------------------------------------------

__fastcall TForm14::TForm14(TComponent* Owner)

: TForm(Owner)

{

ADOQuery1->Active = true;

DBGrid1->Columns->Items[0]->Width = 65;

DBGrid1->Columns->Items[1]->Width = 550;

String sql;

sql = "select a.post_id \"Номер поставщика\", b.post_name \"Наименование\" from tender_post a, spr_post b where a.post_id = b.post_id and lot_id = ";

sql += ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->SQL->Text = sql;

ADOQuery2->Open();

DBGrid2->Columns->Items[1]->Width = 550;

Button2->Caption = "Выбор поставщиков для лота № ";

Button2->Caption = Button2->Caption + ADOQuery1->FieldByName("Номер лота")->AsString;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::Button1Click(TObject *Sender)

{

Form15 = new TForm15(this);

if (Form15->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::DBGrid1CellClick(TColumn *Column)

{

String sql;

sql = "select a.post_id \"Номер поставщика\", b.post_name \"Наименование\" from tender_post a, spr_post b where a.post_id = b.post_id and lot_id = ";

sql += ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->SQL->Text = sql;

ADOQuery2->Open();

DBGrid2->Columns->Items[1]->Width = 550;

Button2->Caption = "Выбор поставщиков для лота № ";

Button2->Caption = Button2->Caption + ADOQuery1->FieldByName("Номер лота")->AsString;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::Button2Click(TObject *Sender)

{

Form16 = new TForm16(this);

if (Form16->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::Button4Click(TObject *Sender)

{

Form17 = new TForm17(this);

if (Form17->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit14.h"

#include "Unit1.h"

#include "Unit15.h"

#include "Unit16.h"

#include "Unit17.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm14 *Form14;

//---------------------------------------------------------------------------

__fastcall TForm14::TForm14(TComponent* Owner)

: TForm(Owner)

{

ADOQuery1->Active = true;

DBGrid1->Columns->Items[0]->Width = 65;

DBGrid1->Columns->Items[1]->Width = 550;

String sql;

sql = "select a.post_id \"Номер поставщика\", b.post_name \"Наименование\" from tender_post a, spr_post b where a.post_id = b.post_id and lot_id = ";

sql += ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->SQL->Text = sql;

ADOQuery2->Open();

DBGrid2->Columns->Items[1]->Width = 550;

Button2->Caption = "Выбор поставщиков для лота № ";

Button2->Caption = Button2->Caption + ADOQuery1->FieldByName("Номер лота")->AsString;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::Button1Click(TObject *Sender)

{

Form15 = new TForm15(this);

if (Form15->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::DBGrid1CellClick(TColumn *Column)

{

String sql;

sql = "select a.post_id \"Номер поставщика\", b.post_name \"Наименование\" from tender_post a, spr_post b where a.post_id = b.post_id and lot_id = ";

sql += ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->SQL->Text = sql;

ADOQuery2->Open();

DBGrid2->Columns->Items[1]->Width = 550;

Button2->Caption = "Выбор поставщиков для лота № ";

Button2->Caption = Button2->Caption + ADOQuery1->FieldByName("Номер лота")->AsString;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::Button2Click(TObject *Sender)

{

Form16 = new TForm16(this);

if (Form16->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

void __fastcall TForm14::Button4Click(TObject *Sender)

{

Form17 = new TForm17(this);

if (Form17->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit15.h"

#include "Unit14.h"

#include "Unit1.h"

#include "Unit2.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm15 *Form15;

//---------------------------------------------------------------------------

__fastcall TForm15::TForm15(TComponent* Owner)

: TForm(Owner)

{

Form15->Caption = "Список поставщиков для лота № " + Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

Label2->Caption = "Список поставщиков для лота № " + Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->SQL->Text = "select a.post_id \"Номер\", b.post_name \"Наименование\" from spr_post b, tender_post a where b.post_id = a.post_id and a.lot_id = " + Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->Active = true;

ADOQuery2->First();

if(ADOQuery2->Eof)

{

ADOQuery1->SQL->Text = "select a.post_id \"Номер\" , a.post_name \"Наименование\" from spr_post a";

}

else

{

ADOQuery1->SQL->Text = "select a.post_id \"Номер\", a.post_name \"Наименование\" from spr_post a where post_id not in (0";

while(!ADOQuery2->Eof)

{

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ",";

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ADOQuery2->FieldByName("Номер")->AsString;

ADOQuery2->Next();

}

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ")";

}

ADOQuery1->Active = true;

DBGrid1->Columns->Items[0]->Width = 35;

DBGrid1->Columns->Items[1]->Width = 255;

DBGrid2->Columns->Items[0]->Width = 35;

DBGrid2->Columns->Items[1]->Width = 255;

ADOQuery1->First();

ADOQuery2->First();

if(ADOQuery1->Eof)

Button1->Enabled = false;

else

Button1->Enabled = true;

if(ADOQuery2->Eof)

Button2->Enabled = false;

else

Button2->Enabled = true;

}

//---------------------------------------------------------------------------

void __fastcall TForm15::Button1Click(TObject *Sender)

{

ADOQuery2->Active = false;

// int i = 1, f = 0, max = -1;

// ADOQuery2->SQL->Text = "select * from tender_post order by id_str asc";

// ADOQuery2->Active = true;

// ADOQuery2->First();

//Считаем ПК

// while(!ADOQuery2->Eof)

// {

// i = i + 1;

// ADOQuery2->Next();

// }

//Проверяем на уникальность и делаем i уникальным

// ADOQuery2->First();

// while(!ADOQuery2->Eof)

// {

// if(i == ADOQuery2->FieldByName("id_str")->AsInteger)

// f = 1;

// ADOQuery2->Next();

// }

// ADOQuery2->First();

// if(f == 1)

// {

// while(!ADOQuery2->Eof)

// {

// if(max < ADOQuery2->FieldByName("id_str")->AsInteger)

// max = ADOQuery2->FieldByName("id_str")->AsInteger;

// ADOQuery2->Next();

// }

// i = max + 1;

// }

// ADOQuery2->Active = false;

//Вставляем данные

String sql;

sql = "insert into tender_post values (";

// sql += i;

// sql += "," + ADOQuery1->FieldByName("Номер")->AsString + "," + Form14->ADOQuery1->FieldByName("Номер лота")->AsString + ",'')";

sql += ADOQuery1->FieldByName("Номер")->AsString + "," + Form14->ADOQuery1->FieldByName("Номер лота")->AsString + ",'')";

//ADOQuery2->SQL->Text =

//ADOQuery2->SQL->Text = ADOQuery2->SQL->Text + i;

//ADOQuery2->SQL->Text = ADOQuery2->SQL->Text + "," + ADOQuery1->FieldByName("Номер")->AsString + "," + Form14->ADOQuery1->FieldByName("Номер лота")->AsString + ")";

ADOQuery2->SQL->Text = sql;

ADOQuery2->ExecSQL();

//Открывает АДО2

ADOQuery2->SQL->Text = "select a.post_id \"Номер\", b.post_name \"Наименование\" from spr_post b, tender_post a where b.post_id = a.post_id and a.lot_id = " + Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->Open();

//Открываем АДО1

ADOQuery1->Active = false;

ADOQuery1->SQL->Text = "select a.post_id \"Номер\", a.post_name \"Наименование\" from spr_post a where post_id not in (0";

ADOQuery2->First();

while(!ADOQuery2->Eof)

{

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ",";

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ADOQuery2->FieldByName("Номер")->AsString;

ADOQuery2->Next();

}

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ")";

ADOQuery1->Active = true;

DBGrid1->Columns->Items[0]->Width = 35;

DBGrid1->Columns->Items[1]->Width = 255;

DBGrid2->Columns->Items[0]->Width = 35;

DBGrid2->Columns->Items[1]->Width = 255;

ADOQuery1->First();

ADOQuery2->First();

if(ADOQuery1->Eof)

Button1->Enabled = false;

else

Button1->Enabled = true;

if(ADOQuery2->Eof)

Button2->Enabled = false;

else

Button2->Enabled = true;

}

//---------------------------------------------------------------------------

void __fastcall TForm15::Button2Click(TObject *Sender)

{

String sql;

sql = "delete from tender_post where post_id = ";

sql += ADOQuery2->FieldByName("Номер")->AsString;

sql += " and lot_id = ";

sql += Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->Active = false;

ADOQuery2->SQL->Text = sql;

ADOQuery2->ExecSQL();

//Открывает АДО2

ADOQuery2->SQL->Text = "select a.post_id \"Номер\", b.post_name \"Наименование\" from spr_post b, tender_post a where b.post_id = a.post_id and a.lot_id = " + Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

ADOQuery2->Open();

//Открываем АДО1

ADOQuery1->Active = false;

ADOQuery1->SQL->Text = "select a.post_id \"Номер\", a.post_name \"Наименование\" from spr_post a where post_id not in (0";

ADOQuery2->First();

while(!ADOQuery2->Eof)

{

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ",";

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ADOQuery2->FieldByName("Номер")->AsString;

ADOQuery2->Next();

}

ADOQuery1->SQL->Text = ADOQuery1->SQL->Text + ")";

ADOQuery1->Active = true;

DBGrid1->Columns->Items[0]->Width = 35;

DBGrid1->Columns->Items[1]->Width = 255;

DBGrid2->Columns->Items[0]->Width = 35;

DBGrid2->Columns->Items[1]->Width = 255;

ADOQuery1->First();

ADOQuery2->First();

if(ADOQuery1->Eof)

Button1->Enabled = false;

else

Button1->Enabled = true;

if(ADOQuery2->Eof)

Button2->Enabled = false;

else

Button2->Enabled = true;

}

//---------------------------------------------------------------------------

void __fastcall TForm15::Button3Click(TObject *Sender)

{

Form1->sw_1 = 9;

Form2 = new TForm2(this);

if (Form2->ShowModal()==mrCancel) return;

}

void __fastcall TForm15::Button4Click(TObject *Sender)

{

Form14->ADOQuery1->Active = true;

Form14->DBGrid1->Columns->Items[0]->Width = 65;

Form14->DBGrid1->Columns->Items[1]->Width = 550;

String sql;

sql = "select a.post_id \"Номер поставщика\", b.post_name \"Наименование\" from tender_post a, spr_post b where a.post_id = b.post_id and lot_id = ";

sql += Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

Form14->ADOQuery2->SQL->Text = sql;

Form14->ADOQuery2->Open();

Form14->DBGrid2->Columns->Items[1]->Width = 550;

Form14->Button2->Caption = "Выбор поставщиков для лота № ";

Form14->Button2->Caption = Form14->Button2->Caption + Form14->ADOQuery1->FieldByName("Номер лота")->AsString;

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit16.h"

#include "Unit14.h"

#include "Unit1.h"

#include "Unit17.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm16 *Form16;

//---------------------------------------------------------------------------

int k;

int g=0;

__fastcall TForm16::TForm16(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm16::FormShow(TObject *Sender)

{

k = 0;

Label1->Caption = "Tе? ¦ " + Form14->ADOQuery1->FieldByName("=е?у? де?б")->AsString;

Form14->ADOQuery2->First();

Label2->Caption = "¦е±?бГ•ЦЩ: " + Form14->ADOQuery2->FieldByName("=бЦ?уцеГбцЦу")->AsString;

while(!Form14->ADOQuery2->Eof)

{

k++;

Form14->ADOQuery2->Next();

}

Form14->ADOQuery2->First();

StringGrid1->ColCount = k+1;

StringGrid2->ColCount = k+1;

}

//---------------------------------------------------------------------------

void __fastcall TForm16::TrackBar1Change(TObject *Sender)

{

Edit1->Text = TrackBar1->Position;

}

//---------------------------------------------------------------------------

void __fastcall TForm16::TrackBar2Change(TObject *Sender)

{

Edit2->Text = TrackBar2->Position;

}

//---------------------------------------------------------------------------

void __fastcall TForm16::RadioGroup1Click(TObject *Sender)

{

if(RadioGroup1->ItemIndex == 0)

{

RadioGroup2->Enabled = false;

CheckBox1->Enabled = false;

CheckBox2->Enabled = false;

CheckBox3->Enabled = false;

RadioGroup3->Enabled = false;

RadioGroup2->ItemIndex = -1;

CheckBox1->Checked = false;

CheckBox2->Checked = false;

CheckBox3->Checked = false;

RadioGroup3->ItemIndex = -1;

}

else

{

RadioGroup2->Enabled = true;

CheckBox1->Enabled = true;

CheckBox2->Enabled = true;

CheckBox3->Enabled = true;

RadioGroup3->Enabled = true;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm16::Button1Click(TObject *Sender)

{

int t;

if(!Form14->ADOQuery2->Eof)

{

//if(RadioGroup4->ItemIndex >= 0 && RadioGroup1->ItemIndex >= 0 && RadioGroup2->ItemIndex >= 0 && (CheckBox1->Checked == true || CheckBox2->Checked == true || CheckBox3->Checked == true) && RadioGroup3->ItemIndex >= 0)

if(RadioGroup4->ItemIndex >= 0 && ((RadioGroup1->ItemIndex > 0 && RadioGroup2->ItemIndex == 0 && (CheckBox1->Checked == true || CheckBox2->Checked == true || CheckBox3->Checked == true) && RadioGroup3->ItemIndex >= 0) || (RadioGroup1->ItemIndex > 0 && RadioGroup2->ItemIndex == 1) || RadioGroup1->ItemIndex == 0))

{

StringGrid1->Cells[g][0] = (TrackBar1->Position+100)/2;

StringGrid1->Cells[g][1] = TrackBar2->Position;

if(RadioGroup4->ItemIndex == 0)

StringGrid1->Cells[g][2] = 100;

else

StringGrid1->Cells[g][2] = 0;

switch(RadioGroup1->ItemIndex)

{

case 0:

StringGrid1->Cells[g][3] = 0;

StringGrid1->Cells[g][4] = 50;

StringGrid1->Cells[g][5] = 50;

StringGrid1->Cells[g][6] = 50;

break;

case 1:

StringGrid1->Cells[g][3] = 25;

break;

case 2:

StringGrid1->Cells[g][3] = 75;

break;

case 3:

StringGrid1->Cells[g][3] = 100;

break;

}

if(RadioGroup1->ItemIndex > 0)

{

switch(RadioGroup2->ItemIndex)

{

case 0:

StringGrid1->Cells[g][4] = 0;

break;

case 1:

StringGrid1->Cells[g][4] = 100;

StringGrid1->Cells[g][5] = 100;

StringGrid1->Cells[g][6] = 100;

break;

}

}

if(RadioGroup1->ItemIndex > 0 && RadioGroup2->ItemIndex == 0)

{

t = 100;

if(CheckBox1->Checked == true)

t = t - 35;

if(CheckBox2->Checked == true)

t = t - 45;

if(CheckBox3->Checked == true)

t = t - 20;

StringGrid1->Cells[g][5] = t;

switch(RadioGroup3->ItemIndex)

{

case 0:

StringGrid1->Cells[g][6] = 85;

break;

case 1:

StringGrid1->Cells[g][6] = 50;

break;

case 2:

StringGrid1->Cells[g][6] = 0;

break;

}

}

g++;

Form14->ADOQuery2->Next();

Label2->Caption = "¦е±?бГ•ЦЩ: " + Form14->ADOQuery2->FieldByName("=бЦ?уцеГбцЦу")->AsString;

}

}

else

{

double b;

for(int i=0; i<=6; i++)

{

t = 0;

for(int j=0; j<k; j++)

{

b = StringGrid1->Cells[j][i].ToInt();

t = t + b;

}

if(t != 0)

{

for(int j=0; j<k; j++)

{

b = StringGrid1->Cells[j][i].ToInt();

StringGrid2->Cells[j][i] = b/t;

}

}

else

{

for(int j=0; j<k; j++)

{

StringGrid2->Cells[j][i] = 0;

}

}

}

ADOQuery1->Active = true;

double summ;

String sql;

Form14->ADOQuery2->First();

for(int j=0; j<k; j++)

{

summ = 0;

for(int i=0; i<=6; i++)

{

b = StringGrid2->Cells[j][i].ToDouble();

b = b * (ADOQuery1->FieldByName("W1")->AsFloat);

ADOQuery1->Next();

summ = summ + b;

}

summ = summ * 100;

sql = "update tender_post set est = ";

sql += summ;

sql += " WHERE lot_id = ";

sql += Form14->ADOQuery1->FieldByName("=е?у? де?б")->AsString;

sql += " AND post_id = ";

sql += Form14->ADOQuery2->FieldByName("=е?у? ?е±?бГ•ЦЩб")->AsString;

ADOQuery2->SQL->Text = sql;

ADOQuery2->ExecSQL();

Form14->ADOQuery2->Next();

}

Button1->Enabled = false;

Button3->Enabled = true;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm16::RadioGroup2Click(TObject *Sender)

{

if(RadioGroup2->ItemIndex == 1)

{

CheckBox1->Enabled = false;

CheckBox2->Enabled = false;

CheckBox3->Enabled = false;

RadioGroup3->Enabled = false;

CheckBox1->Checked = false;

CheckBox2->Checked = false;

CheckBox3->Checked = false;

RadioGroup3->ItemIndex = -1;

}

else

{

CheckBox1->Enabled = true;

CheckBox2->Enabled = true;

CheckBox3->Enabled = true;

RadioGroup3->Enabled = true;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm16::Button3Click(TObject *Sender)

{

Form17 = new TForm17(this);

if (Form17->ShowModal()==mrCancel) return;

}

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Unit17.h"

#include "Unit14.h"

#include "Unit16.h"

#include "Unit1.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm17 *Form17;

//---------------------------------------------------------------------------

__fastcall TForm17::TForm17(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm17::FormShow(TObject *Sender)

{

Form14->ADOQuery1->First();

ComboBox1->Items->Clear();

while(!Form14->ADOQuery1->Eof)

{

ComboBox1->Items->Add(Form14->ADOQuery1->FieldByName("=е?у? де?б")->AsString);

Form14->ADOQuery1->Next();

}

}

//---------------------------------------------------------------------------

void __fastcall TForm17::ComboBox1Change(TObject *Sender)

{

Button1->Enabled = true;

String sql;

sql = "select b.post_name \"¦е±?бГ•ЦЩ\" , a.est \"+бддv\" from tender_post a, spr_post b where a.post_id = b.post_id and lot_id = ";

sql += ComboBox1->Text;

sql += " AND est is not null order by est desc";

ADOQuery1->SQL->Text = sql;

ADOQuery1->Open();

ADOQuery1->First();

if(ADOQuery1->Eof)

ShowMessage("-д Убццере де?б цу? ГvЯ?бццv? ?е±?бГ•ЦЩеГ \n ЦдЦ цу ??еГеУЦд± ГvЯе? ?е±?бГ•ЦЩеГ");

DBGrid1->Columns->Items[0]->Width = 250;

DBGrid1->Columns->Items[1]->Width = 150;

}

//---------------------------------------------------------------------------

void __fastcall TForm17::Button1Click(TObject *Sender)

{

ADOQuery1->First();

if(!ADOQuery1->Eof)

{

ADOQuery2->SQL->Text = "select distinct(b.type_name) from spec_lot a, spr_type b where b.type_id = a.type_id and lot_id = " + ComboBox1->Text;

ADOQuery2->Open();

Memo1->Lines->Clear();

Memo1->Lines->Add("<Table border=1 align=center width=80%>");

Memo1->Lines->Add("<CAPTION><EM><B><H3>T?Ц±еЩ ГvЯ?бццv? ?е±?бГ•ЦЩ (Уд Tе?б ¦ " + ComboBox1->Text + ")<br>" + ADOQuery2->FieldByName("type_name")->AsString + "</H3></B></EM></CAPTION>");

ADOQuery1->First();

Memo1->Lines->Add("<tr>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> ¦е±?бГ•ЦЩ </b>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add("<b> +бддv </b>");

Memo1->Lines->Add("<br>");

while(!ADOQuery1->Eof)

{

Memo1->Lines->Add("<tr>");

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("¦е±?бГ•ЦЩ")->AsString);

Memo1->Lines->Add("<td>");

Memo1->Lines->Add(ADOQuery1->FieldByName("+бддv")->AsString);

Memo1->Lines->Add("<br>");

ADOQuery1->Next();

}

Memo1->Lines->Add("</table><br>");

SaveDialog1->FileName = "T?Ц±еЩ ГvЯ?бццv? ?е±?бГ•ЦЩеГ Уд де?б ¦" + ComboBox1->Text + ".html";

if(SaveDialog1->Execute())

{

Memo1->Lines->SaveToFile(SaveDialog1->FileName + ".html");

}

}

else

MessageBox(0, "-д Убццере де?б цу? ГvЯ?бццv? ?е±?бГ•ЦЩеГ \n ЦдЦ цу ??еГеУЦд± ГvЯе? ?е±?бГ•ЦЩеГ","+°ЦЯЩб", 0);

}

Размещено на Allbest.ru


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.