?? ukctj.pas
字號:
unit Ukctj;
interface
uses
Windows, Messages, SysUtils,Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, DBCtrlsEh, Grids, DBGridEh,
ExtCtrls, PrnDbgeh,udm, Mask;
type
Tfkctj = class(TForm)
TabControl1: TTabControl;
Label2: TLabel;
fromdate: TDBDateTimeEditEh;
Label4: TLabel;
todate: TDBDateTimeEditEh;
BitBtn5: TBitBtn;
BitBtn1: TBitBtn;
PrintDBGridEh1: TPrintDBGridEh;
BitBtn3: TBitBtn;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
DBGridEh1: TDBGridEh;
TabSheet2: TTabSheet;
Label1: TLabel;
Label3: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Bevel1: TBevel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
rk: TEdit;
py: TEdit;
ty: TEdit;
xs: TEdit;
pk: TEdit;
bs: TEdit;
pf: TEdit;
ls: TEdit;
zj: TEdit;
js: TEdit;
ce: TEdit;
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fkctj: Tfkctj;
implementation
{$R *.dfm}
procedure Tfkctj.BitBtn5Click(Sender: TObject);
var sqlstr,wherestr:string;
begin
sqlstr:='select a.* , 購進金額=case when (b.類型=''批發'') or (b.類型= ''零售'' ) then b.成本金額 else b.金額 end '
+',b.* ,b.編號 as 銷售編號,c.姓名 ,d.名稱 as 購藥單位 from ypzdk a,cr b ,ygb c ,company d where a.id=b.ypid and b.開票人=c.ygid and b.入庫單位=d.clientid ';
if (fromdate.Text=' - - ') and (todate.Text<>' - - ') then
wherestr:=' and 日期<='''+trim(todate.Text)+'''' ;
if (fromdate.Text<>' - - ') and (todate.Text<>' - - ') then
wherestr:=' and 日期>='''+trim(fromdate.Text)+''' and 日期<='''+trim(todate.Text)+'''' ;
if (fromdate.Text<>' - - ') and (todate.Text=' - - ') then
wherestr:=' and 日期>='''+trim(fromdate.Text)+'''' ;
if (fromdate.Text=' - - ') and (todate.Text=' - - ') then
wherestr:=' ';
sqlstr:=sqlstr+wherestr+' ';
//showmessage(sqlstr);
adodm.tcrlist.Close;
adodm.tcrlist.CommandText:= sqlstr;
adodm.tcrlist.Open;
adodm.ttemp.Close;
sqlstr:='select 金額=case when (類型=''批發'') or (類型=''零售'' ) then SUM(成本金額)'
+'else SUM(金額) end ,類型 from cr ' ;
sqlstr:=sqlstr+' where 1<2 '+wherestr+' group by 類型 ';
adodm.ttemp.commandtext:=sqlstr;
adodm.ttemp.Open;
if adodm.ttemp.Locate('類型','批發',[]) then
pf.Text:=floattostr(adodm.ttemp.fieldbyname('金額').AsFloat)
else pf.Text:='0';
if adodm.ttemp.Locate('類型','零售',[]) then
ls.Text:=floattostr(adodm.ttemp.fieldbyname('金額').AsFloat)
else ls.Text:='0';
if adodm.ttemp.Locate('類型','盤盈',[]) then
py.Text:=floattostr(adodm.ttemp.fieldbyname('金額').AsFloat)
else py.Text:='0';
if adodm.ttemp.Locate('類型','盤虧',[]) then
pk.Text:=floattostr(adodm.ttemp.fieldbyname('金額').AsFloat)
else pk.Text:='0';
if adodm.ttemp.Locate('類型','入庫',[]) then
rk.Text:=floattostr(adodm.ttemp.fieldbyname('金額').AsFloat)
else rk.Text:='0';
if adodm.ttemp.Locate('類型','退藥',[]) then
ty.Text:=floattostr(adodm.ttemp.fieldbyname('金額').AsFloat)
else ty.Text:='0';
if adodm.ttemp.Locate('類型','報損',[]) then
bs.Text:=floattostr(adodm.ttemp.fieldbyname('金額').AsFloat)
else bs.Text:='0';
xs.Text:=floattostr(strtofloat(pf.Text)+strtofloat(ls.Text)) ;
zj.Text:=floattostr(strtofloat(rk.Text)+strtofloat(py.Text)) ;
js.Text:=floattostr(strtofloat(ty.Text)+strtofloat(pk.Text)+strtofloat(xs.Text)+strtofloat(bs.Text)) ;
ce.Text:=floattostr(strtofloat(zj.Text)-strtofloat(js.Text)) ;
end;
procedure Tfkctj.BitBtn3Click(Sender: TObject);
begin
close;
end;
procedure Tfkctj.FormClose(Sender: TObject; var Action: TCloseAction);
begin
adodm.ttemp.Close;
adodm.tcrlist.Close;
action:=cafree;
end;
procedure Tfkctj.FormShow(Sender: TObject);
begin
adodm.ttemp.Close;
adodm.tcrlist.Close;
end;
procedure Tfkctj.BitBtn1Click(Sender: TObject);
begin
if pagecontrol1.ActivePageIndex=0 then
begin
printdbgrideh1.Title.Text:=' 庫存變動一覽表 ('+fromdate.Text+'-'+todate.Text +')' ;
printdbgrideh1.AfterGridText.Text:=datetostr(date);
printdbgrideh1.Preview;
end else
begin
showmessage('本軟件是測試版,請手工抄寫,給您帶來不便,請購買正式版!');
end
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -