Материал: Автоматизация контроля расчетов с абонентами в ЗАО "ХАНТСМАН-НМГ"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
102
GROUPBYЗапрос_Статистика_продаж.Тип_товара ORDERBY
Запрос_Статистика_продаж.Тип_товара")
);
cbStaff->Items->Text =
GetList(fData->GetStringsForQuery
("SELECT Запрос_Статистика_продаж.Сотрудник
FROM Запрос_Статистика_продаж GROUPBY
Запрос_Статистика_продаж.Сотрудник ORDERBY
Запрос_Статистика_продаж.Сотрудник")
);
cbProductType->Items->Text =
GetList(fData->GetStringsForQuery
("SELECT Тип_продукта FROM
Запрос_Статистика_продаж GROUP BY Тип_продукта ORDER BY
Тип_продукта ASC")
);
Filter();
}
catch (...) {
}
}
// ---------------------------------------------------------------------------
void __fastcall TfStatSale::cbCodeChange(TObject *Sender) {
//
Filter();
}
// ---------------------------------------------------------------------------
void __fastcall TfStatSale::Filter() {
//
try {
UnicodeString S = "";
UnicodeString F = "";
if (fData->UserType == utAdmin) {
if ((cbStaff->Text != "")) {
//
if (S != "")
S = S + ", ";
S = S + "Сотрудник '" + cbStaff->Text + "'";
if (F != "")
F = F + " and ";
F = F + "Сотрудник = " + QuotedStr(cbStaff-
>Text);
103
}
}
else {
//
if (F != "")
F = F + " and ";
F = F + "Код_Сотрудник = " + IntToStr(fData->UserID);
}
if ((cbCode->Text != "")) {
//
if (S != "")
S = S + ", ";
S = S + "Артикул '" + cbCode->Text + "'";
if (F != "")
F = F + " and ";
F = "Артикул = " + cbCode->Text;
}
if ((cbDate->Text != "")) {
//
if (S != "")
S = S + ", ";
S = S + "Дата '" + cbDate->Text + "'";
if (F != "")
F = F + " and ";
F = F + "Дата_ = " + QuotedStr(cbDate->Text);
}
if ((cbClient->Text != "")) {
//
if (S != "")
S = S + ", ";
S = S + "Клиент '" + cbClient->Text + "'";
if (F != "")
F = F + " and ";
F = F + "Клиент = " + Char (39) + cbClient->Text + Char
(39);
}
if ((cbCommodityType->Text != "")) {
//
if (S != "")
S = S + ", ";
S = S + "Категория товара '" + cbCommodityType->Text
104
+ "'";
if (F != "")
F = F + " and ";
F = F + "Тип_товара = " + QuotedStr(cbCommodityType-
>Text);
}
if ((cbProductType->Text != "")) {
//
if (S != "")
S = S + ", ";
S = S + "Тип продукта '" + cbProductType->Text + "'";
if (F != "")
F = F + " and ";
F = F + "Тип_продукта = " + QuotedStr(cbProductType-
>Text);
}
if (dtpLimit1->Checked) {
//
if (S != "")
S = S + ", ";
S = S + "Дата начала периода '" + DateToStr (dtpLimit1-
>DateTime) + "'";
if (F != "")
F = F + " and ";
F = F + "Дата_ >= " + QuotedStr(DateToStr(dtpLimit1-
>DateTime));
}
if (dtpLimit2->Checked) {
//
if (S != "")
S = S + ", ";
S = S + "Дата окончания периода '" + DateToStr
(dtpLimit2->DateTime) + "'";
if (F != "")
F = F + " and ";
F = F + "Дата_ <= " + QuotedStr(DateToStr(dtpLimit2-
>DateTime));
}
fData->cdsParams->Edit();
fData->cdsParamsSortType->Value = "Выборка: " + S;
105
fData->cdsParams->Post();
fData->tStatSale->Filtered = F != "";
fData->tStatSale->Filter = F;
}
catch (...) /* finally */ {
}
}
// ---------------------------------------------------------------------------
void __fastcall TfStatSale::bRefreshClick(TObject *Sender) {
//
Load();
}
// ---------------------------------------------------------------------------
void __fastcall TfStatSale::FormActivate(TObject *Sender) {
Load();
}
// ---------------------------------------------------------------------------
void __fastcall TfStatSale::FormKeyPress(TObject *Sender, System::WideChar
&Key)
{
if ((Char(Key) == 27))
Close();
}
// ---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ufUserEditor.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfUserEditor *fUserEditor;
//---------------------------------------------------------------------------
__fastcall TfUserEditor::TfUserEditor(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfUserEditor::bCancelClick(TObject *Sender)
106
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TfUserEditor::bOkClick(TObject *Sender)
{
//
if ( (fData->tUser->State == dsEdit) || (fData->tUser->State == dsInsert)
)
fData->tUser->Post();
Close();
}
//---------------------------------------------------------------------------
void __fastcall TfUserEditor::FormClose(TObject *Sender, TCloseAction
&Action)
{
fData->tUser->Cancel();
}
//---------------------------------------------------------------------------
void __fastcall TfUserEditor::FormKeyPress(TObject *Sender,
System::WideChar &Key)
{
//
if ( Key == Char(27) ) Close();
}
//---------------------------------------------------------------------------
Источник: https://baza.diplomsite.ru/previewfile/1837