Смекни!
smekni.com

Разработка программного обеспечения поддержки процессов учета хранения товаров на складе (стр. 13 из 14)

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

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}

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

void __fastcall TForm1::N6Click(TObject *Sender)

{

Form1->Close();

}

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

void __fastcall TForm1::N8Click(TObject *Sender)

{

this->GroupBox2->Visible=false;

this->GroupBox3->Visible=false;

this->GroupBox4->Visible=false;

this->GroupBox5->Visible=false;

this->GroupBox6->Visible=false;

this->GroupBox7->Visible=false;

this->GroupBox13->Visible=false;

this->GroupBox1->Visible=true;

UpdateComboBoxGoods();

}

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

void __fastcall TForm1::N2Click(TObject *Sender)

{

this->GroupBox1->Visible=false;

this->GroupBox3->Visible=false;

this->GroupBox4->Visible=false;

this->GroupBox5->Visible=false;

this->GroupBox6->Visible=false;

this->GroupBox7->Visible=false;

this->GroupBox13->Visible=false;

this->GroupBox2->Visible=true;

UpdateComboBoxSale();

}

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

void __fastcall TForm1::N3Click(TObject *Sender)

{

this->GroupBox1->Visible=false;

this->GroupBox2->Visible=false;

this->GroupBox4->Visible=false;

this->GroupBox6->Visible=false;

this->GroupBox5->Visible=false;

this->GroupBox7->Visible=false;

this->GroupBox13->Visible=false;

this->GroupBox3->Visible=true;

UpdateComboBoxSupplies();

}

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

void __fastcall TForm1::N4Click(TObject *Sender)

{

this->GroupBox2->Visible=false;

this->GroupBox3->Visible=false;

this->GroupBox1->Visible=false;

this->GroupBox5->Visible=false;

this->GroupBox6->Visible=false;

this->GroupBox7->Visible=false;

this->GroupBox13->Visible=false;

this->GroupBox4->Visible=true;

UpdateComboBoxWrite_off();

}

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

void __fastcall TForm1::N5Click(TObject *Sender)

{

this->GroupBox2->Visible=false;

this->GroupBox3->Visible=false;

this->GroupBox1->Visible=false;

this->GroupBox4->Visible=false;

this->GroupBox6->Visible=false;

this->GroupBox7->Visible=false;

this->GroupBox13->Visible=false;

this->GroupBox5->Visible=true;

UpdateComboBoxInventory();

}

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

void __fastcall TForm1::N29Click(TObject *Sender)

{

this->GroupBox2->Visible=false;

this->GroupBox3->Visible=false;

this->GroupBox1->Visible=false;

this->GroupBox4->Visible=false;

this->GroupBox5->Visible=false;

this->GroupBox7->Visible=false;

this->GroupBox13->Visible=false;

// this->GroupBox6->Visible=true;

Form1->Enabled=false;

Form2->Show();

}

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

void TForm1:: GZ()

{

TDataSet *ds1 = DataSource18->DataSet;

TDataSet *ds2 = DataSource20->DataSet;

TDataSet *ds3 = DataSource19->DataSet;

int S= 0;

int tpost

int zpost

int length = ds1->RecordCount;

AnsiString *str1 = new AnsiString[length];

int gr = (int)Form1->Table1->FieldValues["id_group"];

int dn = (int)Form1->Table1->FieldValues["dn"];

int dk = (int)Form1->Table1->FieldValues["dk"];

for (ds1->First();!ds1->Eof; ds1->Next())

{

if(Form1->Table2->FieldValues["id_group"]==gr)

{

S = 0;

for (ds2->First();!ds2->Eof; ds2->Next())

Form1->Button11->Caption = "Zapasi";

if(Form1->Table3->FieldValues["id_name"]==Form1->Table2->FieldValues["id_tov"])

if((int)Form1->Table3->FieldValues["date"]>=dn && (int)Form1->Table3->FieldValues["date"]<=dk && Form1->Table3->FieldValues["id_packing"]==pac)

S=S+ Form1->Table3->FieldValues["amount"];

Form1->Table1->Append();

Form1->Table1->FieldValues["id_name"] = Form1->Table2->FieldValues["id_tov"];

Form1->Table1->FieldValues["Vsale"] = S;

Form1->Table1->Post();

}

}

Vprod = 0;

for (ds3->First(), ds3->Next();!ds3->Eof; ds3->Next())

S = S + Form1->Table1->FieldValues["Vsale"];

for (ds3->First(), ds3->Next();!ds3->Eof; ds3->Next())

{

Form1->Table1->Append();

Form1->Table1->FieldValues["spare"] = Form1->Table1->FieldValues FGZ = (tpost + zpost) * P – P* tpost

Form1->Table1->Post();

Form1->Query6->Active=false;

Form1->Query6->Active=true;

}

Form1->Query6->Active=false;

Form1->Query6->Active=true;

}

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

void __fastcall TForm1::ORZClick(TObject *Sender)

{

this->GroupBox2->Visible=false;

this->GroupBox3->Visible=false;

this->GroupBox1->Visible=false;

this->GroupBox4->Visible=false;

this->GroupBox5->Visible=false;

this->GroupBox6->Visible=false;

this->GroupBox13->Visible=false;

// this->GroupBox7->Visible=true;

Form1->Enabled=false;

Form3->Show();

}

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

void __fastcall TForm1::Button11Click(TObject *Sender)

{

Form1->GroupBox6->Visible=false;

}

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

void __fastcall TForm1::Button12Click(TObject *Sender)

{

Form1->Enabled=false;

Form2->Show();

}

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

void __fastcall TForm1::Button13Click(TObject *Sender)

{

Form1->GroupBox7->Visible=false;

}

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

void __fastcall TForm1::Button14Click(TObject *Sender)

{

Form1->Enabled=false;

Form3->Show();

}

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

void TForm1::UpdateComboBoxGoods()

{

ComboBox1->Clear();

ComboBox2->Clear();

ComboBox3->Clear();

ComboBox4->Clear();

ComboBox5->Clear();

Query8->Active = false;

Query8->Active = true;

TDataSet *ds = DataSource8->DataSet;

int length = ds->RecordCount;

AnsiString *str = new AnsiString[length];

int i = 0, j = 0;

for (ds->First();!ds->Eof; ds->Next())

str[i++] = DataSource8->DataSet->FieldByName("Tov")->AsString;

for (j = 0; j < length; j++)

{

ComboBox1->Items->Add(str[j]);

}

Query9->Active = false;

Query9->Active = true;

TDataSet *ds1 = DataSource9->DataSet;

length = ds1->RecordCount;

AnsiString *str1 = new AnsiString[length];

i = 0;

for (ds1->First();!ds1->Eof; ds1->Next())

str1[i++] = DataSource9->DataSet->FieldByName("Group")->AsString;

for (j = 0; j < length; j++)

{

ComboBox2->Items->Add(str1[j]);

}

Query10->Active = false;

Query10->Active = true;

TDataSet *ds2 = DataSource10->DataSet;

length = ds2->RecordCount;

AnsiString *str2 = new AnsiString[length];

i = 0;

for (ds2->First();!ds2->Eof; ds2->Next())

str2[i++] = DataSource10->DataSet->FieldByName("Naimenovanie")->AsString;

for (j = 0; j < length; j++)

{

ComboBox3->Items->Add(str2[j]);

}

Query11->Active = false;

Query11->Active = true;

TDataSet *ds3 = DataSource11->DataSet;

length = ds3->RecordCount;

AnsiString *str3 = new AnsiString[length];

i = 0;

for (ds3->First();!ds3->Eof; ds3->Next())

str3[i++] = DataSource11->DataSet->FieldByName("Prodagi")->AsString;

for (j = 0; j < length; j++)

{

ComboBox4->Items->Add(str3[j]);

}

Query12->Active = false;

Query12->Active = true;

TDataSet *ds4 = DataSource12->DataSet;

length = ds4->RecordCount;

AnsiString *str4 = new AnsiString[length];

i = 0;

for (ds4->First();!ds4->Eof; ds4->Next())

str4[i++] = DataSource12->DataSet->FieldByName("Proizvoditel")->AsString;

for (j = 0; j < length; j++)

{

ComboBox5->Items->Add(str4[j]);

}

}

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

void __fastcall TForm1::Button2Click(TObject *Sender)

{

UpdateComboBoxGoods();

Edit1->Text = "";

Edit2->Text = "";

Edit3->Text = "";

Edit4->Text = "";

}

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

void TForm1::UpdateComboBoxSale()

{

ComboBox6->Clear();

ComboBox7->Clear();

ComboBox10->Clear();

Query8->Active = false;

Query8->Active = true;

TDataSet *ds = DataSource8->DataSet;

int length = ds->RecordCount;

AnsiString *str = new AnsiString[length];

int i = 0, j = 0;

for (ds->First();!ds->Eof; ds->Next())

str[i++] = DataSource8->DataSet->FieldByName("Tov")->AsString;

for (j = 0; j < length; j++)

{

ComboBox6->Items->Add(str[j]);

}

Query9->Active = false;

Query9->Active = true;

TDataSet *ds1 = DataSource9->DataSet;

length = ds1->RecordCount;

AnsiString *str1 = new AnsiString[length];

i = 0;

for (ds1->First();!ds1->Eof; ds1->Next())

str1[i++] = DataSource9->DataSet->FieldByName("Group")->AsString;

for (j = 0; j < length; j++)

{

ComboBox7->Items->Add(str1[j]);

}

Query13->Active = false;

Query13->Active = true;

TDataSet *ds2 = DataSource13->DataSet;

length = ds2->RecordCount;

AnsiString *str2 = new AnsiString[length];

i = 0;

for (ds2->First();!ds2->Eof; ds2->Next())

str2[i++] = DataSource13->DataSet->FieldByName("Surname")->AsString;

for (j = 0; j < length; j++)

{

ComboBox10->Items->Add(str2[j]);

}

}

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

void __fastcall TForm1::Button4Click(TObject *Sender)

{

UpdateComboBoxSale();

Edit5->Text = "";

Edit9->Text = "";

}

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

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

void TForm1::UpdateComboBoxSupplies()

{

ComboBox8->Clear();

ComboBox9->Clear();

ComboBox11->Clear();

Query8->Active = false;

Query8->Active = true;

TDataSet *ds = DataSource8->DataSet;

int length = ds->RecordCount;

AnsiString *str = new AnsiString[length];

int i = 0, j = 0;

for (ds->First();!ds->Eof; ds->Next())

str[i++] = DataSource8->DataSet->FieldByName("Name")->AsString;

for (j = 0; j < length; j++)

{

ComboBox8->Items->Add(str[j]);

}

// delete ds;

Query9->Active = false;

Query9->Active = true;

TDataSet *ds1 = DataSource9->DataSet;

length = ds1->RecordCount;

AnsiString *str1 = new AnsiString[length];

i = 0;

for (ds1->First();!ds1->Eof; ds1->Next())

str1[i++] = DataSource9->DataSet->FieldByName("Group")->AsString;

for (j = 0; j < length; j++)

{

ComboBox9->Items->Add(str1[j]);

}

Query13->Active = false;

Query13->Active = true;

TDataSet *ds2 = DataSource13->DataSet;

length = ds2->RecordCount;

AnsiString *str2 = new AnsiString[length];

i = 0;

for (ds2->First();!ds2->Eof; ds2->Next())

str2[i++] = DataSource13->DataSet->FieldByName("Name")->AsString;

for (j = 0; j < length; j++)

{

ComboBox11->Items->Add(str2[j]);

}

}

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

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

void __fastcall TForm1::Button6Click(TObject *Sender)

{

UpdateComboBoxSupplies();

Edit6->Text = "";

Edit7->Text = "";

}

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

void TForm1::UpdateComboBoxWrite_off()

{

ComboBox12->Clear();

ComboBox13->Clear();

ComboBox14->Clear();

ComboBox15->Clear();

Query8->Active = false;

Query8->Active = true;

TDataSet *ds = DataSource8->DataSet;

int length = ds->RecordCount;

AnsiString *str = new AnsiString[length];

int i = 0, j = 0;

for (ds->First();!ds->Eof; ds->Next())

str[i++] = DataSource8->DataSet->FieldByName("Tov")->AsString;

for (j = 0; j < length; j++)

{

ComboBox12->Items->Add(str[j]);

}

Query9->Active = false;

Query9->Active = true;

TDataSet *ds1 = DataSource9->DataSet;

length = ds1->RecordCount;

AnsiString *str1 = new AnsiString[length];

i = 0;

for (ds1->First();!ds1->Eof; ds1->Next())

str1[i++] = DataSource9->DataSet->FieldByName("Group")->AsString;

for (j = 0; j < length; j++)

{

ComboBox13->Items->Add(str1[j]);

}

Query13->Active = false;

Query13->Active = true;

TDataSet *ds2 = DataSource13->DataSet;

length = ds2->RecordCount;

AnsiString *str2 = new AnsiString[length];

i = 0;

for (ds2->First();!ds2->Eof; ds2->Next())

str2[i++] = DataSource13->DataSet->FieldByName("Name")->AsString;

for (j = 0; j < length; j++)

{

ComboBox14->Items->Add(str2[j]);

}

Query14->Active = false;

Query14->Active = true;

TDataSet *ds3 = DataSource14->DataSet;

length = ds3->RecordCount;

AnsiString *str3 = new AnsiString[length];

i = 0;

for (ds3->First();!ds3->Eof; ds3->Next())

str3[i++] = DataSource14->DataSet->FieldByName("Spisanie")->AsString;

for (j = 0; j < length; j++)

{

ComboBox15->Items->Add(str3[j]);

}

}

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

void __fastcall TForm1::Button8Click(TObject *Sender)

{

UpdateComboBoxWrite_off();

Edit10->Text = "";

Edit8->Text = "";

}

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

void TForm1::UpdateComboBoxInventory()

{

ComboBox16->Clear();

ComboBox17->Clear();

ComboBox10->Clear();

Query8->Active = false;

Query8->Active = true;

TDataSet *ds = DataSource8->DataSet;

int length = ds->RecordCount;

AnsiString *str = new AnsiString[length];

int i = 0, j = 0;

for (ds->First();!ds->Eof; ds->Next())

str[i++] = DataSource8->DataSet->FieldByName("Name")->AsString;

for (j = 0; j < length; j++)

{

ComboBox16->Items->Add(str[j]);

}

Query9->Active = false;

Query9->Active = true;

TDataSet *ds1 = DataSource9->DataSet;

length = ds1->RecordCount;

AnsiString *str1 = new AnsiString[length];

i = 0;

for (ds1->First();!ds1->Eof; ds1->Next())

str1[i++] = DataSource9->DataSet->FieldByName("Group")->AsString;

for (j = 0; j < length; j++)

{

ComboBox17->Items->Add(str1[j]);