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

📄 bm_priu.pas

📁 Delphi办公管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:

procedure TBM_PRIF.DBGrid3DblClick(Sender: TObject);
begin
canmodify:=true;
BM_PRIF_ADDF := TBM_PRIF_ADDF.Create(Application);
BM_PRIF_ADDF.Caption :='打印纸修改';
BM_PRIF_ADDF.CB1.Text :=AQ1.FieldByName('型号').AsString ;
BM_PRIF_ADDF.edit2.Text :=AQ1.FieldByName('支出数量').AsString ;
BM_PRIF_ADDF.CB2.Text :=AQ1.FieldByName('支出部门').AsString ;
 BM_PRIF_ADDF.CB3.Text :=AQ1.FieldByName('支出人').AsString ;
BM_PRIF_ADDF.edit1.Text :=AQ1.FieldByName('支出时间').AsString ;
BM_PRIF_ADDF.edit3.Text :=AQ1.FieldByName('经办人').AsString ;
BM_PRIF_ADDF.memo1.Text :=AQ1.FieldByName('备注').AsString ;
BM_PRIF_ADDF.edit5.Text := BM_PRIF.AQ1.FieldByName('编号').Asstring ;
BM_PRIF_ADDF.Show ;
end;

procedure TBM_PRIF.BitBtn6Click(Sender: TObject);
var
 DTmp:integer;
begin

 if AQ1.RecordCount >0 then
 begin
     DTmp:=AQ1.FieldByName('编号').AsInteger ;
     if MessageBox(0, '你确定删除该条记录', '提示', MB_YESNO + MB_ICONQUESTION) =IDYES then
        begin
          with  DM.QALL3   do
           begin
                close;
                sql.Clear ;
                sql.Add('delete from 打印纸支出 where 编号 ='+inttostr(DTmp));
                ExecSQL;

          end;
       end;
       AQ1.Close ;
       aq1.Open ;
      if AQ1.RecordCount =0 then SpeedButton8.Enabled :=false;
 end
 ELSE
 BEGIN
 showmessage('没有要删除的数据!');
 SpeedButton8.Enabled :=false;
 exit;
 end;
end;

procedure TBM_PRIF.SpeedButton10Click(Sender: TObject);
begin
close;
end;

procedure TBM_PRIF.SpeedButton8Click(Sender: TObject);
var
 DTmp:integer;
begin
TabbedNotebook2.PageIndex :=0;
 if AQ1.RecordCount >0 then
 begin
     DTmp:=AQ1.FieldByName('编号').AsInteger ;
     if MessageBox(0, '你确定删除该条记录', '提示', MB_YESNO + MB_ICONQUESTION) =IDYES then
        begin
          with  DM.QALL3   do
           begin
                close;
                sql.Clear ;
                sql.Add('delete from 打印纸支出 where 编号 ='+inttostr(DTmp));
                ExecSQL;

          end;
       end;
       AQ1.Close ;
       aq1.Open ;
      if AQ1.RecordCount =0 then SpeedButton8.Enabled :=false;
 end
 ELSE
 BEGIN
 showmessage('没有要删除的数据!');
 SpeedButton8.Enabled :=false;
 exit;
 end;

end;

procedure TBM_PRIF.SpeedButton7Click(Sender: TObject);
begin
try
canmodify:=false;
 BM_PRIF_ADDF := TBM_PRIF_ADDF.Create(Application);
 BM_PRIF_ADDF.Caption :='打印纸支出';
 BM_PRIF_ADDF.SHOW;
  except
    MessageBox(0, '窗体创建错误', '产生严重例外错误', MB_OK +
      MB_ICONSTOP);
  end;
end;

procedure TBM_PRIF.SpeedButton6Click(Sender: TObject);

var
  date1,date2:tdate;

begin
SpeedButton8.Enabled :=false;
sqltext:='select * from 打印纸支出';
sqltext2:='select 型号,sum(支出数量) as AA ,支出部门 from 打印纸支出';


if cb1.Text <>'' then
     begin
               sqltext:=sqltext+ ' where 支出部门="'+CB1.Text +'"';
               sqltext2:=sqltext2+ ' where 支出部门="'+CB1.Text +'"';
                  if cb2.Text <>'' then
                    begin
                    sqltext:=sqltext+ ' And 型号="'+CB2.Text +'"';
                    sqltext2:=sqltext2+ ' And 型号="'+CB2.Text +'"';
                    end;

                  if checkbox1.Checked then
                      begin
                        sqltext:=sqltext+' And 支出时间 >=:date1 and 支出时间<=:date2';
                         sqltext2:=sqltext2+' And 支出时间 >=:date1 and 支出时间<=:date2';
                      end;
     end
     else
     if cb2.Text <>'' then
     begin
                   sqltext:=sqltext+ ' where 型号="'+CB2.Text +'"';
                    sqltext2:=sqltext2+ ' where 型号="'+CB2.Text +'"';
                   if checkbox1.Checked then
                      begin
                        sqltext:=sqltext+' And 支出时间 >=:date1 and 支出时间<=:date2';
                        sqltext2:=sqltext2+' And 支出时间 >=:date1 and 支出时间<=:date2';
                      end;
     end
     else
     begin
      if checkbox1.Checked then
          begin
            sqltext:=sqltext+' where 支出时间 >=:date1 and 支出时间<=:date2';
             sqltext2:=sqltext2+' where 支出时间 >=:date1 and 支出时间<=:date2';
          end;
     end;
sqltext:=sqltext+' order by 型号';
  with AQ1 do
  begin
    with sql do
    begin
    close;
    clear;
    add(sqltext);
       if checkbox1.Checked then
         begin
           Parameters.parambyname('Date1').value:=dp1.datetime;//strtodate(MaskEdit1.Text);
           Parameters.parambyname('Date2').value:=dp2.DateTime;//(MaskEdit2.Text);
          end;
    end;
  open;
   if  aq1.RecordCount >0 then SpeedButton8.Enabled :=true;
  end;


  ///////////////////
sqltext2:=sqltext2+' group by 型号,支出部门';
  sqltext2:=sqltext2+' order by 支出部门';


 with DM.QALL2 do
  begin
    with sql do
    begin
    close;
    clear;
    add(sqltext2);
       if checkbox1.Checked then
         begin
           Parameters.parambyname('Date1').value:=dp1.datetime;//strtodate(MaskEdit1.Text);
           Parameters.parambyname('Date2').value:=dp2.DateTime;//(MaskEdit2.Text);
          end;
    end;
  open;
  if  DM.QALL2.RecordCount >0 then SpeedButton8.Enabled :=true;
  end;

BM_OFFICEF.StatusBar1.Panels[0].TEXT :='系统提示:符合条件记录为'+inttostr(AQ1.RecordCount)+'条!';


end;

procedure TBM_PRIF.SpeedButton9Click(Sender: TObject);
begin
dm.DAYINZHI.Refresh ;
end;

procedure TBM_PRIF.cb3DropDown(Sender: TObject);

var i:integer;
begin
CB3.Items.Clear ;

WITH DM.QALL do
 begin
    close;
    sql.Clear ;
    sql.Add('select distinct 型号 from 打印纸');
    open;
    first;
 end;
 for i:=0 to  DM.QALL.RecordCount-1  do
    begin
     CB3.Items.Add(DM.QALL.Fields[0].asstring);

     DM.QALL.next;
    end;


end;

procedure TBM_PRIF.cb4DropDown(Sender: TObject);
var i:integer;
begin
CB4.Items.Clear ;

WITH DM.QALL3 do
 begin
    close;
    sql.Clear ;
    sql.Add('select distinct 厂商 from 打印纸');
    open;
    first;
 end;
 for i:=0 to  DM.QALL3.RecordCount-1  do
    begin
     CB4.Items.Add(DM.QALL3.Fields[0].asstring);

     DM.QALL3.next;
    end;

end;

procedure TBM_PRIF.SpeedButton1Click(Sender: TObject);
var
  date1,date2:tdate;

begin
SpeedButton3.Enabled :=false;
sqltext:='select * from 打印纸';
//sqltext2:='select 型号,sum(支出数量) as AA from 打印纸';


if cb3.Text <>'' then
     begin
               sqltext:=sqltext+ ' where 型号="'+CB3.Text +'"';
                  //  sqltext2:=sqltext2+ ' where 支出部门="'+CB1.Text +'"';
                  if cb4.Text <>'' then
                    begin
                    sqltext:=sqltext+ ' And 厂商="'+CB4.Text +'"';
                   // sqltext2:=sqltext2+ ' And 型号="'+CB2.Text +'"';
                    end;

                  if checkbox2.Checked then
                      begin
                        sqltext:=sqltext+' And 进货时间 >=:date1 and 进货时间<=:date2';
                        // sqltext2:=sqltext2+' And 支出时间 >=:date1 and 支出时间<=:date2';
                      end;
     end
     else
     if cb4.Text <>'' then
     begin
                   sqltext:=sqltext+ ' where 厂商="'+CB4.Text +'"';
                   // sqltext2:=sqltext2+ ' where 型号="'+CB2.Text +'"';
                   if checkbox2.Checked then
                      begin
                        sqltext:=sqltext+' And 进货时间 >=:date1 and 进货时间<=:date2';
                       // sqltext2:=sqltext2+' And 支出时间 >=:date1 and 支出时间<=:date2';
                      end;
     end
     else
     begin
      if checkbox2.Checked then
          begin
            sqltext:=sqltext+' where 进货时间 >=:date1 and 进货时间<=:date2';
             //sqltext2:=sqltext2+' where 支出时间 >=:date1 and 支出时间<=:date2';
          end;
     end;
//sqltext:=sqltext+' order by 型号';
  with AQ2 do
  begin
    with sql do
    begin
    close;
    clear;
    add(sqltext);
       if checkbox2.Checked then
         begin
           Parameters.parambyname('Date1').value:=dp3.datetime;//strtodate(MaskEdit1.Text);
           Parameters.parambyname('Date2').value:=dp4.DateTime;//(MaskEdit2.Text);
          end;
    end;
  open;
   if  aq2.RecordCount >0 then SpeedButton3.Enabled :=true;
  end;


  ///////////////////
 // sqltext2:=sqltext2+' group by 型号';
 {  with DM.QALL2 do
  begin
    with sql do
    begin
    close;
    clear;
    add(sqltext2);
       if checkbox1.Checked then
         begin
           Parameters.parambyname('Date1').value:=dp1.datetime;//strtodate(MaskEdit1.Text);
           Parameters.parambyname('Date2').value:=dp2.DateTime;//(MaskEdit2.Text);
          end;
    end;
  open;
  if  DM.QALL2.RecordCount >0 then SpeedButton8.Enabled :=true;
  end; }
BM_OFFICEF.StatusBar1.Panels[0].TEXT :='系统提示:符合条件记录为'+inttostr(AQ2.RecordCount)+'条!';



end;

procedure TBM_PRIF.DBGrid4DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
begin
 inherited;
  With DbGrid4 do
  begin
    if ((State = [gdSelected]) or (State = [gdSelected,gdFocused])) then
      begin
      Canvas.Font.Color := clYellow;
      Canvas.Brush.Color := clNavy;
      end
    else
      begin
      if DataCol mod 2 <> 0  then Canvas.Brush.Color := clWhite
      else Canvas.Brush.Color := $00EAEAEA;
      end;
    DefaultDrawColumnCell(Rect,DataCol,Column,State);
  end;
end;

end.

⌨️ 快捷键说明

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