📄 u_form_handstorepdfind.pas
字号:
unit U_Form_handStorePDFind;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, EasyGrid, ButtonExCtl, ComCtrls, Mask,uAdoSet,
uCheckValidate,uString;
type
TForm_handStorePDFind = class(TForm)
GroupBox1: TGroupBox;
Label3: TLabel;
beginDate: TMaskEdit;
_beginDate: TDateTimePicker;
ButtonExCtl1: TButtonExCtl;
BtnExit: TButtonExCtl;
Grid1: TEasyGrid;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure BtnExitClick(Sender: TObject);
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_handStorePDFind: TForm_handStorePDFind;
implementation
uses U_Form_handStorePD,uGlobal;
{$R *.dfm}
procedure TForm_handStorePDFind.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
EnableWindow(Form_handStorePD.Handle,true);
canClose:=true;
end;
procedure TForm_handStorePDFind.BtnExitClick(Sender: TObject);
begin
EnableWindow(Form_handStorePD.Handle,true);
close;
end;
procedure TForm_handStorePDFind.FormCreate(Sender: TObject);
begin
_AdoNewProduce:=TuAdoSet.Create('newProduce',1);
_Check:=TCheckValidate.create;
_str:=TuString.Create;
with _AdoNewProduce do
begin
setGridTitle(grid1,1,'日期',160);
setGridTitle(grid1,2,'产品名称',140);
setGridTitle(grid1,3,'规格',80);
setGridTitle(grid1,4,'单位',80);
setGridTitle(grid1,5,'成套数',90);
setGridTitle(grid1,6,'空箱数',80);
setGridTitle(grid1,7,'整瓶数',100);
setGridTitle(grid1,8,'酒库名称',80);
end;
beginDate.Text:=formatDateTime('yyyy-mm-dd',now);
_beginDate.Date:=strTodate(formatDateTime('yyyy-mm-dd',now));
end;
procedure TForm_handStorePDFind._beginDateCloseUp(Sender: TObject);
begin
beginDate.Text:=formatDateTime('yyyy-mm-dd',_beginDate.Date);
end;
procedure TForm_handStorePDFind.ButtonExCtl1Click(Sender: TObject);
var
param:TStringList;
strsql:string;
i,j:integer;
_Total1,_Total2,_Total3:double;
begin
param:=TStringList.Create;
param.clear;
{/*
查询记录
*/}
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 SF_CheckDate,SF_produceName,SF_specification,SF_UnitName,SF_boxNum,SF_EmptyBoxNum,SF_bottleNum,SF_WhichStore ';
strsql:=strsql+' from sale_handRealStore where substring(SF_CheckDate,1,10)=:s1 and SF_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 SF_CheckDate,SF_produceName,SF_specification,SF_UnitName,SF_boxNum,SF_EmptyBoxNum,SF_bottleNum,SF_WhichStore ';
strsql:=strsql+' from sale_handRealStore where substring(SF_CheckDate,1,10)=:s1 and SF_whichStore=:s2';
_AdoNewproduce.BindToGrid_JK(grid1,strsql,param,1,8,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);
{/*
设置最后一行颜色
*/}
for i:=1 to grid1.ColCount-1 do
begin
grid1.Cells[i,grid1.RowCount-1].Color:=rgb(0,143,247);
grid1.Cells[i,grid1.RowCount-1].FontColor:=rgb(255,255,255);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -