⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prodrate.pas

📁 一个鞋塑企业的计件工资系统.开发目录为:D:PieceRate
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  dmData.aquPersonel.Open;
  case frmChoicePerson.ShowModal of  {返回的值}
    mrCancel:
    begin
      edtRateID.SetFocus;
      ValueIsChange:=true;
    end;
    mrOk:
    begin
      edtRateID.Text:=dmData.aquPersonelPersonID.Value;
      edtRateName.Text:=dmData.aquPersonelName.Value;
      edtFirstTime.SetFocus;
    end;
  end;
end;

procedure TfrmProdRate.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then { 判断是按执行键}
  if not (ActiveControl is TDbgrid) Then
  Begin { 不是在TDbgrid控件内}
    key:=#0;
    perform(WM_NEXTDLGCTL,0,0);{移动到下一个控件}
  end;
end;

procedure TfrmProdRate.edtRateIDChange(Sender: TObject);
begin
  ValueIsChange:=true;
end;

procedure TfrmProdRate.edtRateIDExit(Sender: TObject);
begin
  if ValueIsChange then
  begin
    ValueIsChange:=false;
    if edtRateID.text<>'' then
    begin
      with dmData do
      begin
        aquPersonel.SQL.Clear;
        aquPersonel.SQL.add('select * from Personel where PersonId Like :lcPersonId');
        aquPersonel.Parameters[0].Value:=trim(edtRateId.Text)+'%';
        aquPersonel.Open;
        case aquPersonel.RecordCount of
          0:edtRateIDButtonClick(frmProdRate,0);  {没有记录时}
          1:  {有一条记录时}
          begin
            edtRateID.Text:=aquPersonelPersonId.Value;
            edtRateName.Text:=aquPersonelName.Value;
          end
          else    {多条记录时}
          begin
            if Application.FindComponent('frmChoicePerson')=nil then Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
            case frmChoicePerson.ShowModal of  {返回的值}
              mrCancel:
              begin
                edtRateID.SetFocus;
                ValueIsChange:=true;
              end;
              mrOk:
              begin
                edtRateID.Text:=dmData.aquPersonelPersonID.Value;
                edtRateName.Text:=dmData.aquPersonelName.Value;
                edtFirstTime.SetFocus;
              end;
            end;
          end;
        end;
      end;
    end else
    begin
      edtRateID.Text:='';
      edtRateName.Text:='';
    end;
  end;
end;

procedure TfrmProdRate.FormCreate(Sender: TObject);
begin
  if not dmData.aquPersonel.Active then dmData.aquPersonel.Open;
  ValueIsChange:=false;
end;

procedure TfrmProdRate.edtPicecID1ButtonClick(Sender: TObject;
  AbsoluteIndex: Integer);
begin
  if Application.FindComponent('frmChoicePerson')=nil then
      Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
  frmProdRate.Tag:=edtPicecID1.Tag;
  dmData.aquPersonel.SQL.Text:='select * from Personel';
  dmData.aquPersonel.Open;
  case frmChoicePerson.ShowModal of  {返回的值}
    mrCancel:
    begin
      edtPicecID1.SetFocus;
      ValueIsChange:=true;
    end;
    mrOk:
    begin
      edtPicecID1.Text:=dmData.aquPersonelPersonID.Value;
      edtPicecName1.Text:=dmData.aquPersonelName.Value;
      edtPicecID2.SetFocus;
    end;
  end;
end;

procedure TfrmProdRate.edtPicecID1Change(Sender: TObject);
begin
  ValueIsChange:=true;

end;

procedure TfrmProdRate.edtPicecID1Exit(Sender: TObject);
begin
  if ValueIsChange then
  begin
    ValueIsChange:=false;
    if edtPicecID1.text<>'' then
    begin
      with dmData do
      begin
        aquPersonel.SQL.Clear;
        aquPersonel.SQL.add('select * from Personel where PersonId Like :lcPersonId');
        aquPersonel.Parameters[0].Value:=trim(edtPicecId1.Text)+'%';
        aquPersonel.Open;
        case aquPersonel.RecordCount of
          0:edtPicecID1ButtonClick(frmProdRate,0);  {没有记录时}
          1:  {有一条记录时}
          begin
            edtPicecID1.Text:=aquPersonelPersonId.Value;
            edtPicecName1.Text:=aquPersonelName.Value;
          end
          else    {多条记录时}
          begin
            if Application.FindComponent('frmChoicePerson')=nil then Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
            case frmChoicePerson.ShowModal of  {返回的值}
              mrCancel:
              begin
                edtPicecID1.SetFocus;
                ValueIsChange:=true;
              end;
              mrOk:
              begin
                edtPicecID1.Text:=dmData.aquPersonelPersonID.Value;
                edtPicecName1.Text:=dmData.aquPersonelName.Value;
                edtPicecId2.SetFocus;
              end;
            end;
          end;
        end;
      end;
    end else
    begin
      edtPicecID1.Text:='';
      edtPicecName1.Text:='';
    end;
  end;
end;

procedure TfrmProdRate.edtPicecID2ButtonClick(Sender: TObject;
  AbsoluteIndex: Integer);
begin
  if Application.FindComponent('frmChoicePerson')=nil then
      Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
  frmProdRate.Tag:=edtPicecID2.Tag;
  dmData.aquPersonel.SQL.Text:='select * from Personel';
  dmData.aquPersonel.Open;
  case frmChoicePerson.ShowModal of  {返回的值}
    mrCancel:
    begin
      edtPicecID2.SetFocus;
      ValueIsChange:=true;
    end;
    mrOk:
    begin
      edtPicecID2.Text:=dmData.aquPersonelPersonID.Value;
      edtPicecName2.Text:=dmData.aquPersonelName.Value;
      edtPicecID3.SetFocus;
    end;
  end;

end;

procedure TfrmProdRate.edtPicecID2Change(Sender: TObject);
begin
  ValueIsChange:=true;

end;

procedure TfrmProdRate.edtPicecID2Exit(Sender: TObject);
begin
  if ValueIsChange then
  begin
    ValueIsChange:=false;
    if edtPicecID2.text<>'' then
    begin
      with dmData do
      begin
        aquPersonel.SQL.Clear;
        aquPersonel.SQL.add('select * from Personel where PersonId Like :lcPersonId');
        aquPersonel.Parameters[0].Value:=trim(edtPicecId2.Text)+'%';
        aquPersonel.Open;
        case aquPersonel.RecordCount of
          0:edtPicecID2ButtonClick(frmProdRate,0);  {没有记录时}
          1:  {有一条记录时}
          begin
            edtPicecID2.Text:=aquPersonelPersonId.Value;
            edtPicecName2.Text:=aquPersonelName.Value;
          end
          else    {多条记录时}
          begin
            if Application.FindComponent('frmChoicePerson')=nil then Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
            case frmChoicePerson.ShowModal of  {返回的值}
              mrCancel:
              begin
                edtPicecID2.SetFocus;
                ValueIsChange:=true;
              end;
              mrOk:
              begin
                edtPicecID2.Text:=dmData.aquPersonelPersonID.Value;
                edtPicecName2.Text:=dmData.aquPersonelName.Value;
                edtPicecId3.SetFocus;
              end;
            end;
          end;
        end;
      end;
    end else
    begin
      edtPicecID2.Text:='';
      edtPicecName2.Text:='';
    end;
  end;

end;

procedure TfrmProdRate.edtPicecID3ButtonClick(Sender: TObject;
  AbsoluteIndex: Integer);
begin
  if Application.FindComponent('frmChoicePerson')=nil then
      Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
  frmProdRate.Tag:=edtPicecID3.Tag;
  dmData.aquPersonel.SQL.Text:='select * from Personel';
  dmData.aquPersonel.Open;
  case frmChoicePerson.ShowModal of  {返回的值}
    mrCancel:
    begin
      edtPicecID3.SetFocus;
      ValueIsChange:=true;
    end;
    mrOk:
    begin
      edtPicecID3.Text:=dmData.aquPersonelPersonID.Value;
      edtPicecName3.Text:=dmData.aquPersonelName.Value;
      edtPicecID4.SetFocus;
    end;
  end;
end;

procedure TfrmProdRate.edtPicecID3Change(Sender: TObject);
begin
  ValueIsChange:=true;

end;

procedure TfrmProdRate.edtPicecID3Exit(Sender: TObject);
begin
  if ValueIsChange then
  begin
    ValueIsChange:=false;
    if edtPicecID3.text<>'' then
    begin
      with dmData do
      begin
        aquPersonel.SQL.Clear;
        aquPersonel.SQL.add('select * from Personel where PersonId Like :lcPersonId');
        aquPersonel.Parameters[0].Value:=trim(edtPicecId3.Text)+'%';
        aquPersonel.Open;
        case aquPersonel.RecordCount of
          0:edtPicecID3ButtonClick(frmProdRate,0);  {没有记录时}
          1:  {有一条记录时}
          begin
            edtPicecID3.Text:=aquPersonelPersonId.Value;
            edtPicecName3.Text:=aquPersonelName.Value;
          end
          else    {多条记录时}
          begin
            if Application.FindComponent('frmChoicePerson')=nil then Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
            case frmChoicePerson.ShowModal of  {返回的值}
              mrCancel:
              begin
                edtPicecID3.SetFocus;
                ValueIsChange:=true;
              end;
              mrOk:
              begin
                edtPicecID3.Text:=dmData.aquPersonelPersonID.Value;
                edtPicecName3.Text:=dmData.aquPersonelName.Value;
                edtPicecId4.SetFocus;
              end;
            end;
          end;
        end;
      end;
    end else
    begin
      edtPicecID3.Text:='';
      edtPicecName3.Text:='';
    end;
  end;
end;

procedure TfrmProdRate.edtPicecID4ButtonClick(Sender: TObject;
  AbsoluteIndex: Integer);
begin
  if Application.FindComponent('frmChoicePerson')=nil then
      Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
  frmProdRate.Tag:=edtPicecID4.Tag;
  dmData.aquPersonel.SQL.Text:='select * from Personel';
  dmData.aquPersonel.Open;
  case frmChoicePerson.ShowModal of  {返回的值}
    mrCancel:
    begin
      edtPicecID4.SetFocus;
      ValueIsChange:=true;
    end;
    mrOk:
    begin
      edtPicecID4.Text:=dmData.aquPersonelPersonID.Value;
      edtPicecName4.Text:=dmData.aquPersonelName.Value;
      edtCheckID1.SetFocus;
    end;
  end;

end;

procedure TfrmProdRate.edtPicecID4Change(Sender: TObject);
begin
  ValueIsChange:=true;

end;

procedure TfrmProdRate.edtPicecID4Exit(Sender: TObject);
begin
  if ValueIsChange then
  begin
    ValueIsChange:=false;
    if edtPicecID4.text<>'' then
    begin
      with dmData do
      begin
        aquPersonel.SQL.Clear;
        aquPersonel.SQL.add('select * from Personel where PersonId Like :lcPersonId');
        aquPersonel.Parameters[0].Value:=trim(edtPicecId4.Text)+'%';
        aquPersonel.Open;
        case aquPersonel.RecordCount of
          0:edtPicecID4ButtonClick(frmProdRate,0);  {没有记录时}
          1:  {有一条记录时}
          begin
            edtPicecID4.Text:=aquPersonelPersonId.Value;
            edtPicecName4.Text:=aquPersonelName.Value;
          end
          else    {多条记录时}
          begin
            if Application.FindComponent('frmChoicePerson')=nil then Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
            case frmChoicePerson.ShowModal of  {返回的值}
              mrCancel:
              begin
                edtPicecID4.SetFocus;
                ValueIsChange:=true;
              end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -