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

📄 jxccx.pas

📁 一个基于数据的药品行业管理系统,较全面,可供学习数据的开发人员参考消息
💻 PAS
字号:
unit jxccx;

interface

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

type
  Tfrm_jxccx = class(TForm)
    ToolBar1: TToolBar;
    tprint: TToolButton;
    tfind: TToolButton;
    ImageList2: TImageList;
    DBGrid1: TDBGrid;
    GroupBox1: TGroupBox;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    txtdjbh: TEdit;
    txtpc: TEdit;
    txtzdrq: TEdit;
    txtcsbh: TComboBox;
    txthcbh: TComboBox;
    Panel1: TPanel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    txtjhsl: TEdit;
    txtjhje: TEdit;
    txtckje: TEdit;
    txtkcje: TEdit;
    txtkcsl: TEdit;
    txtcksl: TEdit;
    Bevel1: TBevel;
    Bevel2: TBevel;
    Bevel3: TBevel;
    Bevel4: TBevel;
    Bevel5: TBevel;
    Bevel6: TBevel;
    Bevel7: TBevel;
    Bevel8: TBevel;
    procedure tfindClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frm_jxccx: Tfrm_jxccx;

implementation

uses date1;

{$R *.dfm}

procedure Tfrm_jxccx.tfindClick(Sender: TObject);
begin
groupbox1.Visible:=true;
txtcsbh.Clear;
txtcsbh.Items.Add(' ');
txthcbh.Clear;
txthcbh.Items.Add(' ');
with data do
begin
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from csda');
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
  while not aq1.Eof do
  begin
    txtcsbh.Items.Add(aq1.Fields.Fieldbyname('csbh').Value+'-'+aq1.Fields.Fieldbyname('csmc').Value);
    aq1.Next;
  end;
  end;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add('select * from hcda');
aq1.Open;
if aq1.Recordset.RecordCount>0 then
begin
  while not aq1.Eof do
  begin
    txthcbh.Items.Add(aq1.Fields.Fieldbyname('hcbh').Value+'-'+aq1.Fields.Fieldbyname('hcmc').Value);
    aq1.Next;
  end;
  end;
aq1.close;   
 end;

end;

procedure Tfrm_jxccx.Button1Click(Sender: TObject);
var sqlstr,wherestr,sumsql,groupstr:string;
    jhsl,jhje,cksl,ckje,kcsl,kcje:Currency;
begin
jhsl:=0.00;
jhje:=0.00;
cksl:=0.00;
ckje:=0.00;
kcsl:=0.00;
kcje:=0.00;
with data do
begin
sqlstr:='select a.djbh as 单据编号,a.csbh as 厂商编号 ,b.csmc as 厂商名称,'+
'a.hcbh as 耗材编号 ,c.hcmc as 耗材名称,c.jldw as 单位,a.jhdj as 进货单价,'+
'a.sl as 数量,a.je as 金额,a.pc as  批号,a.type as 类型'+
' from hclsz a,csda b,hcda c where a.csbh=b.csbh and a.hcbh=c.hcbh';
if (txtdjbh.text='') and (txtzdrq.Text='')
  and (txtcsbh.ItemIndex<=0) and (txthcbh.ItemIndex<=0) and (txtpc.Text='') then
  begin
  sqlstr:=sqlstr;
  wherestr:='';
  end
else
  begin
  if txtdjbh.text<>'' then
     wherestr:=' and a.djbh='+quotedstr(trim(txtdjbh.text));
  if txtcsbh.text<> '' then
     wherestr:=wherestr+' and a.csbh='+quotedstr(copy(trim(txtcsbh.text),1,4));
  if txthcbh.text<> '' then
     wherestr:=wherestr+' and a.hcbh='+quotedstr(copy(trim(txthcbh.text),1,4));
  if txtpc.text<>'' then
     wherestr:=' and a.pc='+quotedstr(trim(txtpc.text));
  end;
sqlstr:=sqlstr+wherestr;
aq1.Connection:=adoc1;
aq1.Close;
aq1.SQL.Clear;
aq1.SQL.Add(sqlstr);
aq1.Open;
if aq1.Recordset.RecordCount=0 then
   begin
   groupbox1.Visible:=false;
   showmessage('没有符合条件的纪录');
   exit;
   end;
if aq1.Recordset.RecordCount>0 then
   begin
   {stringgrid1.Cells[0,0]:='进货数量';
   stringgrid1.Cells[1,0]:='进货金额';
   stringgrid1.Cells[2,0]:='出库数量';
   stringgrid1.Cells[3,0]:='出库金额';
   stringgrid1.Cells[4,0]:='库存数量';
   stringgrid1.Cells[5,0]:='库存金额';
   stringgrid1.RowCount:=aq1.Recordset.RecordCount+1; }
   while not aq1.Eof do
   begin
   if trim(aq1.FieldByName('类型').Value)='J' then
   begin
     jhsl:=jhsl+aq1.FieldByName('数量').AsCurrency;
     jhje:=jhje+aq1.FieldByName('金额').AsCurrency;
   end;
   if trim(aq1.FieldByName('类型').Value)='L' then
   begin
     cksl:=cksl+aq1.FieldByName('数量').AsCurrency;
     ckje:=ckje+aq1.FieldByName('金额').AsCurrency;
   end;
   aq1.Next;
   end;
   kcsl:=jhsl-cksl;
   kcje:=jhje-ckje;
   txtjhsl.Text:=formatfloat('0.00',jhsl);
   txtjhje.Text:=formatfloat('0.00',jhje);
   txtcksl.Text:=formatfloat('0.00',cksl);
   txtckje.Text:=formatfloat('0.00',ckje);
   txtkcsl.Text:=formatfloat('0.00',kcsl);
   txtkcje.Text:=formatfloat('0.00',kcje);
   data.DataSource1.DataSet:=data.Aq1;
   dbgrid1.DataSource:=data.DataSource1;
   aq1.FieldByName('厂商名称').DisplayWidth:=30;
   aq1.FieldByName('耗材名称').DisplayWidth:=30;
   groupbox1.Visible:=false;
   end;
end;
end;

procedure Tfrm_jxccx.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
end;

end.

⌨️ 快捷键说明

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