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

📄 gyswldzgl.~pas

📁 《仓库管理系统》 开发语言:Delphi7.0 数据库:SQLServer2000 数据库文件:仓库管理系统_Data.MDF,仓库管理系统_Log.LDF(mingrisoft仓库管理系统Da
💻 ~PAS
字号:
unit gyswldzgl;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons, Grids, DBGrids, DB, ComCtrls;

type
  TForm47 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Label1: TLabel;
    ComboBox1: TComboBox;
    SpeedButton1: TSpeedButton;
    DBGrid1: TDBGrid;
    Panel4: TPanel;
    Label3: TLabel;
    DBGrid2: TDBGrid;
    Panel3: TPanel;
    Label2: TLabel;
    BitBtn1: TBitBtn;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Panel5: TPanel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    Shape3: TShape;
    Label8: TLabel;
    Shape1: TShape;
    Label12: TLabel;
    Label13: TLabel;
    Shape2: TShape;
    Label14: TLabel;
    Shape4: TShape;
    Label15: TLabel;
    Shape5: TShape;
    Label16: TLabel;
    Shape6: TShape;
    Panel6: TPanel;
    Label17: TLabel;
    DateTimePicker1: TDateTimePicker;
    Label18: TLabel;
    DateTimePicker2: TDateTimePicker;
    CheckBox1: TCheckBox;
    procedure Clear;//清空数据
    procedure FormShow(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure BitBtn1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure ComboBox1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form47: TForm47;
  gysbh: String ='';//记录供应商编号
implementation
  uses DataModal,gysxx4;
{$R *.dfm}

procedure TForm47.Clear;
begin
  DataSource1.DataSet := nil;
  DataSource2.DataSet := nil;
  Label8.Caption := '';
  Label12.Caption := '';
  Label13.Caption := '';
  Label14.Caption := '';
  Label15.Caption := '';
  Label16.Caption := '';
end;

procedure TForm47.FormShow(Sender: TObject);
begin
  ComboBox1.Clear;
  begin
    with Data.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select distinct 供应商全称 from 入库表 ');
      Open;
    end;
    while Not Data.ADOQuery1.Eof do
    begin
      ComboBox1.Items.Add(Data.ADOQuery1.FieldByName('供应商全称').Value);
      Data.ADOQuery1.Next;
    end;
  end;
  Clear;
  ComboBox1.SetFocus;
end;

procedure TForm47.SpeedButton1Click(Sender: TObject);
var
  syje: Real; //记录未付金额与结款金额之差
begin
  if Trim(ComboBox1.Text)<>'' then
  begin
    Clear;
    with Data.ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select * from 供应商基础信息表 where 供应商全称 = :a');
      Parameters.ParamByName('a').Value := Trim(ComboBox1.Text);
      Open;
    end;
    if Data.ADOQuery1.RecordCount<1 then
      Exit
    else if Data.ADOQuery1.RecordCount>1 then
    begin
      Application.CreateForm(TForm49,Form49);
      Form49.DataSource1.DataSet := Data.ADOQuery1 ;
      Form49.Showmodal;
      Form49.Free;
    end
    else
       gysbh:= Data.ADOQuery1.FieldByName('供应商编号').Value;
    with Data.ADOQuery2 do
    begin
      Close;
      SQL.Clear;
      if CheckBox1.Checked = False then
        SQL.Add('select *  from 入库表 where  供应商编号 = :b')
      else
      begin
        SQL.Add('select *  from 入库表 where  供应商编号 = :b and 入库票号 in(select 入库票号 from 入库票号表 where 入库时间 >= :a and 入库时间<= :c)');
        Parameters.ParamByName('a').Value := Int(DateTimePicker1.Date)-2;
        Parameters.ParamByName('c').Value := Int(DateTimePicker2.Date)-2+0.9998;
      end;
      Parameters.ParamByName('b').Value :=Trim(gysbh);
      Open;
    end;
    DataSource1.DataSet := Data.ADOQuery2 ;
    with Data.ADOQuery4 do
    begin
      Close;
      SQL.Clear;
      if CheckBox1.Checked = True then
      begin
        SQL.Add('select sum(实付金额)as sfje, sum(应付金额)as zje from  入库票号表 where  入库票号 in(select 入库票号 from 入库表 where  供应商编号 = :b and 入库票号 in(select 入库票号 from 入库票号表 where 入库时间 >= :a and 入库时间<= :c))');
        Parameters.ParamByName('a').Value := Int(DateTimePicker1.Date)-2;
        Parameters.ParamByName('c').Value := Int(DateTimePicker2.Date)-2+0.9998;
      end
      else
        SQL.Add('select sum(实付金额)as sfje, sum(应付金额)as zje from  入库票号表 where  入库票号 in(select 入库票号 from 入库表 where  供应商编号 = :b )');
      Parameters.ParamByName('b').Value :=Trim(gysbh);
      Open;
    end;
    if Data.ADOQuery4.FieldByName('sfje').Value<>null then
    begin
      label8.Caption := FloatToStr(Data.ADOQuery4.FieldByName('zje').Value);
      label12.Caption := FloatToStr(Data.ADOQuery4.FieldByName('sfje').Value);
      label13.Caption :=  FloatToStr(StrToFloat(Label8.Caption)- StrToFloat(Label12.Caption));
      with Data.ADOQuery4 do
      begin
        Close;
        SQL.Clear;
        if CheckBox1.Checked = False then
          SQL.Add('select *  from 供应商结款记录表 where 供应商编号 = :b')
        else
        begin
          SQL.Add('select *  from 供应商结款记录表 where 供应商编号 = :b and (结款时间>= :a and 结款时间<= :c) ');
          Parameters.ParamByName('a').Value := Int(DateTimePicker1.Date)+2;
          Parameters.ParamByName('c').Value := Int(DateTimePicker2.Date)+2+0.9998;
        end;
        Parameters.ParamByName('b').Value :=Trim(gysbh);
        Open;
      end;
      DataSource2.DataSet := Data.ADOQuery4;
      with Data.ADOQuery5 do
      begin
        Close;
        SQL.Clear;
        if CheckBox1.Checked = False then
          SQL.Add('select sum(结款金额)as jkje  From 供应商结款记录表 where 供应商编号 = :b  ')
        else
        begin
          SQL.Add('select sum(结款金额)as jkje  From 供应商结款记录表 where 供应商编号 = :b and (结款时间>= :a and 结款时间<= :c) ');
          Parameters.ParamByName('a').Value := Int(DateTimePicker1.Date)+2;
          Parameters.ParamByName('c').Value := Int(DateTimePicker2.Date)+2+0.9998;
        end;
        Parameters.ParamByName('b').Value :=Trim(gysbh);
        Open;
      end;
      if Data.ADOQuery5.FieldByName('jkje').Value <>null then
      begin
        label14.Caption := FloatToStr(Data.ADOQuery5.FieldByName('jkje').Value);
        syje := StrToFloat(label13.Caption)- StrToFloat(label14.Caption);
        if syje>=0 then
        begin
          label15.Caption := '0.0';
          label16.Caption := FloatToStr(syje);
        end
        else
        begin
          label15.Caption := FloatToStr(syje);
          label16.Caption := '0.0';
        end;
      end
      else
      begin
        label14.Caption := '0.0';
        syje := StrToFloat(label13.Caption)- StrToFloat(label14.Caption);
        if syje>=0 then
        begin
          label15.Caption := '0.0';
          label16.Caption := FloatToStr(syje);
        end
        else
        begin
          label15.Caption := FloatToStr(syje);
          label16.Caption := '0.0';
        end;
      end;
    end ;
  end;
end;

procedure TForm47.BitBtn1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  TBitBtn(Sender).Font.Color := clRed;
end;

procedure TForm47.BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  TBitBtn(Sender).Font.Color := clBlue;
end;

procedure TForm47.ComboBox1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Trim(ComboBox1.Text)<>'' then
    if Key = VK_RETURN then
      SpeedButton1.OnClick(Sender);
end;

end.

⌨️ 快捷键说明

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