Variant app, sheets, sheet, books, book, cell


Download 48 Kb.
Sana25.07.2020
Hajmi48 Kb.
#124793
Bog'liq
Дастур коди


Дастур коди

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

#include

#include

#include

#pragma hdrstop

#include "Unit1.h"

#include "Unit2.h"

#include "Unit3.h"

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

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm1 *Form1;

Variant app, sheets, sheet, books, book, cell;

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

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}



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

void __fastcall TForm1::Label3Click(TObject *Sender)

{

Panel_KITOB->Visible=true;



Panel_KITOB->Align=alClient;

Panel_kitobXON->Visible=False;

}

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



void __fastcall TForm1::Label6Click(TObject *Sender)

{

DataModule2->ADO_kitob->Insert();



Panel_YANGI->Visible=true;

}

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



void __fastcall TForm1::BitBtn2Click(TObject *Sender)

{

int a,b,s;



a=StrToFloat(DBEdit4->Text);

b=StrToFloat(DBEdit7->Text);

s=a*b;

DBEdit8->Text=FloatToStr(s);



DataModule2->ADO_kitob->Post();

ShowMessage("Qabul qilindi!");

Panel_YANGI->Visible=False;

}

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



void __fastcall TForm1::BitBtn1Click(TObject *Sender)

{

DataModule2->ADO_kitob->Cancel();



Panel_YANGI->Visible=False;

}

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



void __fastcall TForm1::Label7Click(TObject *Sender)

{

DataModule2->ADO_kitob->Edit();



Panel_YANGI->Visible=true;

}

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



void __fastcall TForm1::Label8Click(TObject *Sender)

{

if(MessageDlg("Rostdan ham o'chirmoqchimisiz?", mtWarning,TMsgDlgButtons()<

{

DataModule2->ADO_kitob->Delete();

}

}

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



void __fastcall TForm1::Edit1Change(TObject *Sender)

{

if (Edit1->Text=="")



{

DataModule2->ADO_kitob->Filtered=False;

}

else


{

DataModule2->ADO_kitob->Filtered=False;

DataModule2->ADO_kitob->Filter="Kitib_nomi LIKE '%"+Edit1->Text+"%'";

DataModule2->ADO_kitob->Filtered=true;

}

}

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



void __fastcall TForm1::Label4Click(TObject *Sender)

{

Panel_kitobXON->Visible=true;



Panel_kitobXON->Align=alClient;

Panel_KITOB->Visible=False;

}

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



void __fastcall TForm1::Label20Click(TObject *Sender)

{

DataModule2->ADOT_kitobxon->Insert();



Panel_qabul->Visible=true;

Panel_topshir->Visible=False;

}

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



void __fastcall TForm1::BitBtn4Click(TObject *Sender)

{

DataModule2->ADOT_kitobxon->Post();



ShowMessage("Ma`lumot kiritildi!");

Panel_qabul->Visible=False;

}

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



void __fastcall TForm1::BitBtn3Click(TObject *Sender)

{

DataModule2->ADOT_kitobxon->Cancel();



Panel_qabul->Visible=False;

}

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



void __fastcall TForm1::Label22Click(TObject *Sender)

{

if(MessageDlg("Rostdan ham o'chirmoqchimisiz?", mtWarning, TMsgDlgButtons() << mbOK << mbCancel, 0) == mrOk)



{

DataModule2->ADOT_kitobxon->Delete();

}

}

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



void __fastcall TForm1::Label21Click(TObject *Sender)

{

DataModule2->ADOT_kitobxon->Edit();



Panel_topshir->Visible=true;

Panel_topshir->Align=alBottom;

Panel_qabul->Visible=False;

}

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



void __fastcall TForm1::BitBtn6Click(TObject *Sender)

{

DataModule2->ADOT_kitobxon->Post();



ShowMessage("Tasdiqlandi!");

Panel_topshir->Visible=False;

}

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



void __fastcall TForm1::Edit2Change(TObject *Sender)

{

if (Edit2->Text=="")



{

DataModule2->ADOT_kitobxon->Filtered=False;

}

else


{

DataModule2->ADOT_kitobxon->Filtered=False;

DataModule2->ADOT_kitobxon->Filter="Obunachi_FISH LIKE '%"+Edit2->Text+"%'";

DataModule2->ADOT_kitobxon->Filtered=true;

}

}

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



void __fastcall TForm1::BitBtn7Click(TObject *Sender)

{

DataModule2->ADO_kitob->Cancel();



Panel_topshir->Visible=False;

}

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



void __fastcall TForm1::Label5Click(TObject *Sender)

{

Form3->Show();



}

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

void __fastcall TForm1::Label9Click(TObject *Sender)

{

app=CreateOleObject("Excel.Application");



app.OlePropertySet("Visible",true);

app.OlePropertySet("SheetsInNewWorkbook",4);

books=app.OlePropertyGet("WorkBooks");

books.OleProcedure("Add");

book=books.OlePropertyGet("Item",1);

sheets=book.OlePropertyGet("WorkSheets");

sheet=sheets.OlePropertyGet("Item",1);

sheet.OlePropertySet("Name","Xisobot");


cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,1);

cell.OlePropertySet("Value","INVENTAR RAQAMI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,2);

cell.OlePropertySet("Value","KITOB NOMI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,3);

cell.OlePropertySet("Value","MUALLIFI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,4);

cell.OlePropertySet("Value","ADADI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,5);

cell.OlePropertySet("Value","BIRLIK NARXI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,6);

cell.OlePropertySet("Value","UMUMIY SUMMASI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,7);

cell.OlePropertySet("Value","NASHRIYOT NOMI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",1,8);

cell.OlePropertySet("Value","KITOB TURI");

cell.OlePropertyGet("Font").OlePropertySet("Size",12);

cell.OlePropertyGet("Font").OlePropertySet("Color",clRed);

cell.OlePropertyGet("Interior").OlePropertySet("ColorIndex",28);
DataModule2->ADO_kitob->First();

for (int i=0; iADO_kitob->RecordCount; i++)

{

cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,1);



cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("INV_raqami")->AsVariant);
cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,2);

cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("Kitib_nomi")->AsVariant);


cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,3);

cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("Muallifi")->AsVariant);


cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,4);

cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("Adadi")->AsVariant);


cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,5);

cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("Birlik_narxi")->AsVariant);


cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,6);

cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("Umumiy_summasi")->AsVariant);


cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,7);

cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("Nashriyot_nomi")->AsVariant);


cell=sheet.OlePropertyGet("Cells").OlePropertyGet("Item",i+2,8);

cell.OlePropertySet("Value",DataModule2->ADO_kitob->FieldByName("Kitob_turi")->AsVariant);


DataModule2->ADO_kitob->Next();

}

}



//---------------------------------------------------------------------------
Download 48 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling