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

📄 fx_unit.pas

📁 网上搜索来的进销存源码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
unit fx_unit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, Buttons, Series, TeEngine, ExtCtrls,
  TeeProcs, Chart, MXGRAPH, DB, ADODB;

type
  Tfx_form = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet5: TTabSheet;
    GroupBox1: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    RadioButton4: TRadioButton;
    RadioButton5: TRadioButton;
    GroupBox2: TGroupBox;
    DateTimePicker1: TDateTimePicker;
    Label2: TLabel;
    DateTimePicker2: TDateTimePicker;
    Label9: TLabel;
    ComboBox1: TComboBox;
    Label10: TLabel;
    ComboBox2: TComboBox;
    CheckBox1: TCheckBox;
    GroupBox9: TGroupBox;
    Label13: TLabel;
    SpeedButton5: TSpeedButton;
    DateTimePicker9: TDateTimePicker;
    DateTimePicker10: TDateTimePicker;
    GroupBox10: TGroupBox;
    Edit1: TEdit;
    Edit2: TEdit;
    SpeedButton6: TSpeedButton;
    SpeedButton10: TSpeedButton;
    Chart1: TChart;
    Series1: TBarSeries;
    SpeedButton1: TSpeedButton;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Label1: TLabel;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    CheckBox6: TCheckBox;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit3: TEdit;
    CheckBox7: TCheckBox;
    Chart2: TChart;
    Edit11: TEdit;
    Edit12: TEdit;
    BarSeries1: TBarSeries;
    procedure FormCreate(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure SpeedButton10Click(Sender: TObject);
    procedure SpeedButton9Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
    procedure SpeedButton7Click(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure RadioButton3Click(Sender: TObject);
    procedure RadioButton4Click(Sender: TObject);
    procedure RadioButton5Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
    procedure CheckBox4Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure CheckBox5Click(Sender: TObject);
    procedure CheckBox6Click(Sender: TObject);
    procedure CheckBox7Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fx_form: Tfx_form;

implementation

uses data_unit, kc_date_unit;

{$R *.dfm}

procedure Tfx_form.FormCreate(Sender: TObject);
begin
  self.PageControl1.ActivePageIndex := 0;
  self.Top := 74;
  self.Left := 11;
  self.Height := 491;
  self.Width := 767;
  datetimepicker1.Date := date;
  datetimepicker2.Date := date;
  datetimepicker9.Date := date;
  datetimepicker10.Date := date;
  edit6.Text := formatdatetime('MM-dd-yy', datetimepicker1.date);
  edit7.Text := formatdatetime('MM-dd-yy', datetimepicker2.date);
  edit11.Text := formatdatetime('MM-dd-yy', datetimepicker9.date);
  edit12.Text := formatdatetime('MM-dd-yy', datetimepicker10.date);
end;

procedure Tfx_form.SpeedButton6Click(Sender: TObject);
begin
  close;
end;

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

procedure Tfx_form.SpeedButton9Click(Sender: TObject);
begin
  close;
end;

procedure Tfx_form.SpeedButton8Click(Sender: TObject);
begin
  close;
end;

procedure Tfx_form.SpeedButton7Click(Sender: TObject);
begin
  close;
end;

procedure Tfx_form.RadioButton1Click(Sender: TObject);
begin
  combobox1.Clear;
  combobox2.Clear;
  combobox1.Items.Add('商品编码');
  combobox1.Items.Add('商品名称');
  combobox1.Items.Add('商品类别');
//combobox2.Items.Add('参考价格');
  combobox2.Items.Add('数量');
  combobox2.Items.Add('成本');
end;

procedure Tfx_form.RadioButton2Click(Sender: TObject);
begin
  combobox1.Clear;
  combobox2.Clear;
  combobox1.Items.Add('商品编码');
  combobox1.Items.Add('商品名称');
  combobox1.Items.Add('商品类别');
//combobox2.Items.Add('参考价格');
  combobox2.Items.Add('数量');
  combobox2.Items.Add('金额');
end;

procedure Tfx_form.RadioButton3Click(Sender: TObject);
begin
  combobox1.Clear;
  combobox2.Clear;
  combobox1.Items.Add('商品编码');
  combobox1.Items.Add('商品名称');
  combobox1.Items.Add('商品类别');
//combobox2.Items.Add('参考价格');
  combobox2.Items.Add('数量');
  combobox2.Items.Add('金额');
end;

procedure Tfx_form.RadioButton4Click(Sender: TObject);
begin
  combobox1.Clear;
  combobox2.Clear;
  combobox1.Items.Add('商品编码');
  combobox1.Items.Add('商品名称');
  combobox1.Items.Add('商品类别');
//combobox2.Items.Add('参考价格');
  combobox2.Items.Add('数量');
  combobox2.Items.Add('成本');

end;

procedure Tfx_form.RadioButton5Click(Sender: TObject);
var i: integer;
begin
  combobox1.Clear;
  combobox2.Clear;
  combobox1.Items.Add('商品编码');
  combobox1.Items.Add('商品名称');
  combobox1.Items.Add('商品类别');
//combobox2.Items.Add('参考价格');
  combobox2.Items.Add('数量');
  combobox2.Items.Add('成本');
  combobox2.Items.Add('库存上限');
  combobox2.Items.Add('库存下限');
  kc_date_form := Tkc_date_form.Create(application);
  kc_date_form.Show;
  if (length(edit6.Text) <> 0) and (length(edit7.Text) <> 0) then
  begin
    with database do
    begin
      adoq1.Connection := adoc;
//adoq1.SQL.Clear ;
//adoq1.SQL.Add('delete from kcb');
//adoq1.ExecSQL ;
//adoq1.SQL.Clear ;
//adoq1.SQL.Add('insert into kcb select jhd.录单日期,jhd.类别,jhd.商品编码,jhd.商品名称,jhd.规格,jhd.型号,');
//adoq1.SQL.Add('jhd.单位,jhd.数量 as 库存数量,jhd.金额 as 库存金额,spzl.库存上限,spzl.库存下限');
//adoq1.SQL.Add('FROM spzl INNER JOIN jhd ON spzl.商品编码 = jhd.商品编码 where jhd.录单日期 between #'+edit6.text+ '# and #' +edit7.text+'#');
//adoq1.ExecSQL ;

//*********************************************************

{adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,sum(数量) as 库存数量,sum(金额) as 库存金额 from jhd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,-sum(数量) as 库存数量,-sum(金额) as 库存金额 from jhthd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,-sum(数量) as 库存数量,-sum(金额) as 库存金额 from xshd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,sum(数量) as 库存数量,sum(金额) as 库存金额 from khthd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('insert into kcb select spzl.库存上限,spzl.库存下限');
adoq1.SQL.Add('FROM spzl INNER JOIN jhd ON spzl.商品编码 = kcb.商品编码');
adoq1.ExecSQL ;
//adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,sum(数量) as 库存数量,sum(金额) as 库存金额 from jhd where 录单日期 between #'+edit6.text+ '# and #' +edit7.text+'# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
//adoq1.ExecSQL ;
adoq1.SQL.Clear ;
adoq1.SQL.Add('select * from kcb');
adoq1.Active :=true;
showmessage('hao');
//**********************************************}
      adoq2.Connection := adoc;
      adoq1.SQL.Clear;
      adoq1.SQL.Add('delete from kcb');
      adoq1.ExecSQL;
      adoq1.SQL.Clear;
      adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,sum(数量) as 库存数量,sum(金额) as 库存金额 from jhd where 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# group by 商品编码,录单日期,类别,商品名称,规格,型号,单位');
      adoq1.ExecSQL;
      adoq1.SQL.Clear;
      adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,-sum(数量) as 库存数量,-sum(金额) as 库存金额 from jhthd where 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
      adoq1.ExecSQL;
      adoq1.SQL.Clear;
      adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,-sum(数量) as 库存数量,-sum(金额) as 库存金额 from xshd where 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
      adoq1.ExecSQL;
      adoq1.SQL.Clear;
      adoq1.SQL.Add('insert into kcb select 录单日期,类别,商品编码,商品名称,规格,型号,单位,sum(数量) as 库存数量,sum(金额) as 库存金额 from khthd where 录单日期 between #' + edit6.text + '# and #' + edit7.text + '# group by 录单日期,类别,商品编码,商品名称,规格,型号,单位');
      adoq1.ExecSQL;
      adoq1.SQL.Clear;
      adoq1.SQL.Add('select distinct kcb.商品编码 ,spzl.库存上限,spzl.库存下限 from kcb,spzl where kcb.商品编码 = spzl.商品编码');
      adoq1.Active := true;
      if adoq1.Recordset.RecordCount > 0 then
        for i := 0 to adoq1.Recordset.RecordCount do
        begin
          edit3.Text := adoq1.Fields.Fields[0].AsString;
          edit4.text := adoq1.Fields.Fields[1].AsVariant;
          edit5.text := adoq1.Fields.Fields[2].AsVariant;
          adoq2.SQL.Clear;
          adoq2.SQL.Add('update kcb set 库存上限=:sx,库存下限=:xx where 商品编码=:bm');
          adoq2.Parameters.ParamByName('bm').Value := edit3.Text;
          adoq2.Parameters.ParamByName('sx').Value := edit4.Text;
          adoq2.Parameters.ParamByName('xx').Value := edit5.Text;
          adoq2.ExecSQL;
          if not adoq1.Recordset.EOF then adoq1.MoveBy(1);
        end;
//else showmessage('库中没有记录!');
    end;

⌨️ 快捷键说明

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