Эксперт
   
Профиль
Группа: Завсегдатай
Сообщений: 2580
Регистрация: 26.2.2009
Репутация: 9 Всего: 58
|
Вот код измененного модуля: | Код | unit NachZarpUnit;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, Mask, ComCtrls;
type TNachZarpForm = class(TForm) ComboBox1: TComboBox; Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; BitBtn2: TBitBtn; DateTimePicker1: TDateTimePicker; DateTimePicker2: TDateTimePicker; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var NachZarpForm: TNachZarpForm;
implementation
uses OtchUnit, ZarpUnit, ZarpUnit1, ZarpUnit2, NachUnit, SotrudUnit;
{$R *.dfm}
procedure TNachZarpForm.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end;
procedure TNachZarpForm.BitBtn1Click(Sender: TObject);
begin OtchForm:=TOtchForm.Create(Owner); ZarpForm:=TZarpForm.Create(Owner); end;
procedure TNachZarpForm.BitBtn2Click(Sender: TObject); var i, j:integer; j1:integer; j2:integer; j3:integer; j4:integer; j5:integer; j6:integer; i1:integer; i2:integer; i3:integer; i4:integer; i5:integer; i6:integer; k:integer;
dateStart, dateEnd, dateCur: TDate; sotrudnik: string;
begin OtchForm := TOtchForm.Create(Owner); OtchForm.OtchStringGrid.ColWidths[0]:=60; OtchForm.OtchStringGrid.ColWidths[1]:=260; OtchForm.OtchStringGrid.ColWidths[2]:=300; OtchForm.OtchStringGrid.ColWidths[3]:=300; OtchForm.OtchStringGrid.ColWidths[4]:=60; OtchForm.OtchStringGrid.ColWidths[5]:=60; OtchForm.OtchStringGrid.ColWidths[6]:=60; OtchForm.OtchStringGrid.Cells[0,0]:=' Дата'; OtchForm.OtchStringGrid.Cells[1,0]:=' Ф.И.О.'; OtchForm.OtchStringGrid.Cells[2,0]:=' Вид работы, или удержания.'; OtchForm.OtchStringGrid.Cells[3,0]:=' Коментарий.'; OtchForm.OtchStringGrid.Cells[4,0]:='Стоимость'; OtchForm.OtchStringGrid.Cells[5,0]:='Сумма'; OtchForm.OtchStringGrid.Cells[6,0]:='Состояние счета';
ZarpForm := TZarpForm.Create(Owner); // i:=NachZarpForm.ComboBox1.ItemIndex; // NachZarpForm.Edit1.Text:=(FloatToStr(i)+')'); // ZarpForm.Caption:=NachZarpForm.ComboBox1.Text; // ZarpForm.ListBox1.Items:= OtchForm.OtchListBox1.Items; // ZarpForm.ListBox2.Items:= OtchForm.OtchListBox2.Items; // ZarpForm.ListBox3.Items:= OtchForm.OtchListBox3.Items; // ZarpForm.ListBox4.Items:= OtchForm.OtchListBox4.Items; // ZarpForm.ListBox5.Items:= OtchForm.OtchListBox5.Items; // ZarpForm.ListBox6.Items:= OtchForm.OtchListBox6.Items; ZarpForm.ZarpStringGrid.ColWidths[0]:=60; ZarpForm.ZarpStringGrid.ColWidths[1]:=260; ZarpForm.ZarpStringGrid.ColWidths[2]:=300; ZarpForm.ZarpStringGrid.ColWidths[3]:=300; ZarpForm.ZarpStringGrid.ColWidths[4]:=60; ZarpForm.ZarpStringGrid.ColWidths[5]:=60; ZarpForm.ZarpStringGrid.ColWidths[6]:=60; ZarpForm.ZarpStringGrid.Cells[0,0]:=' Дата'; ZarpForm.ZarpStringGrid.Cells[1,0]:=' Ф.И.О.'; ZarpForm.ZarpStringGrid.Cells[2,0]:=' Вид работы, или удержания.'; ZarpForm.ZarpStringGrid.Cells[3,0]:=' Коментарий.'; ZarpForm.ZarpStringGrid.Cells[4,0]:='Стоимость'; ZarpForm.ZarpStringGrid.Cells[5,0]:='Сумма'; ZarpForm.ZarpStringGrid.Cells[6,0]:='Состояние счета'; // // for j1:= ZarpForm.ListBox1.Items.Count -1 downto 0 do //begin // if pos(Edit1.Text,ansiuppercase( ZarpForm.ListBox1.Items.Strings[j1]))=0 then // ZarpForm.ListBox1.Items.Delete(j1); // end; // for j2:= ZarpForm.ListBox2.Items.Count -1 downto 0 do //begin // if pos(Edit1.Text,ansiuppercase( ZarpForm.ListBox2.Items.Strings[j2]))=0 then // ZarpForm.ListBox2.Items.Delete(j2); // end; // for j3:= ZarpForm.ListBox3.Items.Count -1 downto 0 do //begin // if pos(Edit1.Text,ansiuppercase( ZarpForm.ListBox3.Items.Strings[j3]))=0 then // ZarpForm.ListBox3.Items.Delete(j3); // end; // for j4:= ZarpForm.ListBox4.Items.Count -1 downto 0 do //begin // if pos(Edit1.Text,ansiuppercase( ZarpForm.ListBox4.Items.Strings[j4]))=0 then // ZarpForm.ListBox4.Items.Delete(j4); // end; // for j5:= ZarpForm.ListBox5.Items.Count -1 downto 0 do //begin // if pos(Edit1.Text,ansiuppercase( ZarpForm.ListBox5.Items.Strings[j5]))=0 then // ZarpForm.ListBox5.Items.Delete(j5); // end; // for j6:= ZarpForm.ListBox6.Items.Count -1 downto 0 do //begin // if pos(Edit1.Text,ansiuppercase( ZarpForm.ListBox6.Items.Strings[j6]))=0 then // ZarpForm.ListBox6.Items.Delete(j6); // end; // for i1 := 0 to ZarpForm.ListBox1.Items.Count - 1 do // if Pos((Edit1.Text), ZarpForm.ListBox1.Items[i1])>0 then // begin // ZarpForm.ListBox1.Items[i1] := StringReplace(ZarpForm.ListBox1.Items[i1],(Edit1.Text), '', [rfReplaceAll]); // end; // for i2 := 0 to ZarpForm.ListBox2.Items.Count - 1 do // if Pos((Edit1.Text), ZarpForm.ListBox2.Items[i2])>0 then // begin // ZarpForm.ListBox2.Items[i2] := StringReplace(ZarpForm.ListBox2.Items[i2],(Edit1.Text), '', [rfReplaceAll]); // end; // for i3 := 0 to ZarpForm.ListBox3.Items.Count - 1 do // if Pos((Edit1.Text), ZarpForm.ListBox3.Items[i3])>0 then // begin // ZarpForm.ListBox3.Items[i3] := StringReplace(ZarpForm.ListBox3.Items[i3],(Edit1.Text), '', [rfReplaceAll]); // end; // for i4 := 0 to ZarpForm.ListBox4.Items.Count - 1 do // if Pos((Edit1.Text), ZarpForm.ListBox4.Items[i4])>0 then // begin // ZarpForm.ListBox4.Items[i4] := StringReplace(ZarpForm.ListBox4.Items[i4],(Edit1.Text), '', [rfReplaceAll]); // end; // for i5 := 0 to ZarpForm.ListBox5.Items.Count - 1 do // if Pos((Edit1.Text), ZarpForm.ListBox5.Items[i5])>0 then // begin // ZarpForm.ListBox5.Items[i5] := StringReplace(ZarpForm.ListBox5.Items[i5],(Edit1.Text), '', [rfReplaceAll]); // end; // for i6 := 0 to ZarpForm.ListBox6.Items.Count - 1 do // if Pos((Edit1.Text), ZarpForm.ListBox6.Items[i6])>0 then // begin // ZarpForm.ListBox6.Items[i6] := StringReplace(ZarpForm.ListBox6.Items[i6],(Edit1.Text), '', [rfReplaceAll]); // end; // for k:=ZarpForm.ListBox1.Count-1 downto 0 do // if (StrToDate(ZarpForm.ListBox1.items[k])<NachZarpForm.DateTimePicker1.Date-1) or (StrToDate(ZarpForm.ListBox1.items[k])>NachZarpForm.DateTimePicker2.Date) then // begin // ZarpForm.ListBox1.Items.Delete(k); // ZarpForm.ListBox2.Items.Delete(k); // ZarpForm.ListBox3.Items.Delete(k); // ZarpForm.ListBox4.Items.Delete(k); // ZarpForm.ListBox5.Items.Delete(k); // ZarpForm.ListBox6.Items.Delete(k); // end; // Begin // ZarpForm.ZarpStringGrid.ColCount:=OtchForm.OtchStringGrid.ColCount; // ZarpForm.ZarpStringGrid.RowCount:=OtchForm.OtchStringGrid.RowCount; // ZarpForm.ZarpStringGrid.Cols[0]:= OtchForm.OtchStringGrid.Cols[0]; // ZarpForm.ZarpStringGrid.Cols[1]:= OtchForm.OtchStringGrid.Cols[1]; // ZarpForm.ZarpStringGrid.Cols[2]:= OtchForm.OtchStringGrid.Cols[2]; // ZarpForm.ZarpStringGrid.Cols[3]:= OtchForm.OtchStringGrid.Cols[3]; // ZarpForm.ZarpStringGrid.Cols[4]:= OtchForm.OtchStringGrid.Cols[4]; // ZarpForm.ZarpStringGrid.Cols[5]:= OtchForm.OtchStringGrid.Cols[5]; // ZarpForm.ZarpStringGrid.Cols[6]:= OtchForm.OtchStringGrid.Cols[6];
// ------------------------------------------- // Выбираем
dateStart := DateTimePicker1.Date; dateEnd := DateTimePicker2.Date;
ZarpForm.ZarpStringGrid.RowCount := 0; ZarpForm.ZarpStringGrid.ColCount := OtchForm.OtchStringGrid.ColCount;
// Двойка ниже идет, потому что данные в // OtchForm.OtchStringGrid начинаются с 3 строки for i := 2 to OtchForm.OtchStringGrid.RowCount - 1 do begin
// Получаем данные из стринггрида OtchForm.OtchStringGrid dateCur := StrToDate(OtchForm.OtchStringGrid.Cells[0, i]); sotrudnik := OtchForm.OtchStringGrid.Cells[1, i];
if sotrudnik = ComboBox1.Text then begin if (dateCur >= dateStart) and (dateCur <= dateEnd) then begin
ZarpForm.ZarpStringGrid.RowCount := ZarpForm.ZarpStringGrid.RowCount + 1;
for j := 0 to OtchForm.OtchStringGrid.ColCount - 1 do ZarpForm.ZarpStringGrid.Cells [j, ZarpForm.ZarpStringGrid.RowCount - 1] := OtchForm.OtchStringGrid.Cells[j, i];
end; end;
end;
// -------------------------------------------
OtchForm.Close; end; end.
|
Это сообщение отредактировал(а) Keeper89 - 6.7.2010, 00:03
|