📄 u_form_wastebillfind.~pas
字号:
unit U_Form_WasteBillFind;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, EasyGrid, ButtonExCtl, ComCtrls, Mask,uAdoSet,
uCheckValidate,uString;
type
TForm_WasteBillFind = class(TForm)
GroupBox1: TGroupBox;
Label3: TLabel;
beginDate: TMaskEdit;
_beginDate: TDateTimePicker;
ButtonExCtl1: TButtonExCtl;
BtnExit: TButtonExCtl;
Grid1: TEasyGrid;
procedure BtnExitClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormCreate(Sender: TObject);
procedure _beginDateCloseUp(Sender: TObject);
procedure ButtonExCtl1Click(Sender: TObject);
private
{ Private declarations }
_AdoNewProduce:TuAdoSet;
_Check:TCheckValidate;
_str:TuString;
public
{ Public declarations }
end;
var
Form_WasteBillFind: TForm_WasteBillFind;
implementation
uses U_Form_WasteBill,uGlobal;
{$R *.dfm}
procedure TForm_WasteBillFind.BtnExitClick(Sender: TObject);
begin
EnableWindow(Form_WasteBill.Handle,true);
close;
end;
procedure TForm_WasteBillFind.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
EnableWindow(Form_WasteBill.Handle,true);
canclose:=true;
end;
procedure TForm_WasteBillFind.FormCreate(Sender: TObject);
begin
_AdoNewProduce:=TuAdoSet.Create('newProduce',1);
_Check:=TCheckValidate.create;
_str:=TuString.Create;
beginDate.Text:=formatDateTime('yyyy-mm-dd',now);
_beginDate.Date:=strTodate(formatDateTime('yyyy-mm-dd',now));
with _AdoNewProduce do
begin
setGridTitle(grid1,1,'日期',140);
setGridTitle(grid1,2,'产品名称',140);
setGridTitle(grid1,3,'规格',80);
setGridTitle(grid1,4,'单位',80);
setGridTitle(grid1,5,'装卸损',90);
setGridTitle(grid1,6,'空瓶/半瓶/自爆',130);
setGridTitle(grid1,7,'其他',100);
setGridTitle(grid1,8,'酒库名称',80);
end;
end;
procedure TForm_WasteBillFind._beginDateCloseUp(Sender: TObject);
begin
beginDate.Text:=formatDateTime('yyyy-mm-dd',_beginDate.Date);
end;
procedure TForm_WasteBillFind.ButtonExCtl1Click(Sender: TObject);
var
param:TStringList;
strsql:string;
i,j:integer;
_Total1,_Total2,_Total3:double;
begin
param:=TStringList.Create;
{/*
查询记录
*/}
for i:=2 to grid1.RowCount-1 do
begin
for j:=1 to grid1.ColCount-1 do
begin
grid1.cells[j,i].ForeText:='';
end;
end;
grid1.RowCount:=3;
grid1.Refresh;
param.Clear;
param.Add(trim(begindate.text));
param.Add(trim(_whichStore));
strsql:='select SW_CheckDate,SW_produceName,SW_specification,SW_UnitName,SW_bottleNum1,SW_bottleNum2,SW_bottleNum3 from sale_wasteBill ';
strsql:=strsql+'where SW_Checkdate=:s1 and SW_whichStore=:s2';
if _AdoNewproduce.getRecordCount(strsql,param)<=0 then
begin
showmessage('损耗数据不存在...');
exit;
end
else
begin
param.Clear;
param.Add(trim(begindate.text));
param.Add(trim(_whichStore));
strsql:='select SW_CheckDate,SW_produceName,SW_specification,SW_UnitName,SW_bottleNum1,SW_bottleNum2,SW_bottleNum3 from sale_wasteBill ';
strsql:=strsql+'where SW_Checkdate=:s1 and SW_whichStore=:s2';
_AdoNewproduce.BindToGrid_JK(grid1,strsql,param,1,7,1);
end;
{/*
计算合计
*/}
_Total1:=0;
_Total2:=0;
_Total3:=0;
for i:=2 to grid1.RowCount-3 do
begin
if grid1.cells[5,i].foretext<>'' then
begin
_Total1:=_Total1+strToFloat(grid1.cells[5,i].foretext);
end;
if grid1.cells[6,i].foretext<>'' then
begin
_Total2:=_Total2+strToFloat(grid1.cells[6,i].foretext);
end;
if grid1.cells[7,i].foretext<>'' then
begin
_Total3:=_Total3+strToFloat(grid1.cells[7,i].foretext);
end;
end;
grid1.Cells[1,grid1.RowCount-1].ForeText:='合计:';
grid1.Cells[5,grid1.RowCount-1].ForeText:=formatFloat('##0',_Total1);
grid1.Cells[6,grid1.RowCount-1].ForeText:=formatFloat('##0',_Total2);
grid1.Cells[7,grid1.RowCount-1].ForeText:=formatFloat('##0',_Total3);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -