Модераторы: Snowy, MetalFan, bems, Poseidon

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Из StringGrid1 в StringGrid2, Скопировать сведения по рабочим 
:(
    Опции темы
ABUTAEV
Дата 5.7.2010, 22:55 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 17
Регистрация: 21.4.2010

Репутация: нет
Всего: нет



Не получается посмотреть. Форум меня не признает. Downloads закачивает только html в 14kb с сообщением, что для гостей эта функция запрещена. Попробовал выйти и зайти под своим именем, но увы, то же самое. Наверное придется оставить до лучших времен.
PM MAIL   Вверх
Keeper89
Дата 5.7.2010, 23:47 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
****


Профиль
Группа: Завсегдатай
Сообщений: 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


--------------------
PM MAIL WWW   Вверх
ABUTAEV
Дата 6.7.2010, 19:30 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 17
Регистрация: 21.4.2010

Репутация: нет
Всего: нет



Уважаемый Keeper89, Вы просто гений. Разобраться в том что натворил я, и понять мою ситуацию не каждому под силу. Я прошу перед Вами и перед ВСЕМИ ВОНОГРАДОВЦАМИ, прощение, за то что  может быть обидел ВАС. ПРОСТИТЕ МЕНЯ ЛЮДИ ДОБРЫЕ! То, что вы делаете на ФОРУМЕ большое дело, это я убедился на своем примере. Дай Бог ВАМ ВСЕМ ЗДОРОВЬЯ! Еще раз прошу не обижаться на старика.   smile 

Это сообщение отредактировал(а) ABUTAEV - 6.7.2010, 19:38
PM MAIL   Вверх
Keeper89
Дата 6.7.2010, 20:08 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
****


Профиль
Группа: Завсегдатай
Сообщений: 2580
Регистрация: 26.2.2009

Репутация: 9
Всего: 58



ABUTAEV, спасибо, рад помочь smile

На будущее постарайтесь перевести систему на работу с базой данных, иначе Вы сами в конце концов начнете мучиться с тем, что сделали.


--------------------
PM MAIL WWW   Вверх
Ответ в темуСоздание новой темы Создание опроса
Правила форума "Delphi: Для новичков"
SnowyMetalFan
bemsPoseidon
Rrader

Запрещается!

1. Публиковать ссылки на вскрытые компоненты

2. Обсуждать взлом компонентов и делиться вскрытыми компонентами

  • Литературу по Дельфи обсуждаем здесь
  • Действия модераторов можно обсудить здесь
  • С просьбами о написании курсовой, реферата и т.п. обращаться сюда
  • Вопросы по реализации алгоритмов рассматриваются здесь
  • 90% ответов на свои вопросы можно найти в DRKB (Delphi Russian Knowledge Base) - крупнейшем в рунете сборнике материалов по Дельфи


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, Snowy, MetalFan, bems, Poseidon, Rrader.

 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Delphi: Для новичков | Следующая тема »


 




[ Время генерации скрипта: 0.0419 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.