📄 u_form_initstoragefind.~pas
字号:
unit U_Form_InitStorageFind;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, EasyGrid, StdCtrls, ButtonExCtl, ComCtrls, Mask,uAdoSet,uCheckValidate,uString;
type
TForm_InitStorageFind = class(TForm)
GroupBox1: TGroupBox;
Grid1: TEasyGrid;
Label3: TLabel;
beginDate: TMaskEdit;
_beginDate: TDateTimePicker;
ButtonExCtl1: TButtonExCtl;
BtnExit: TButtonExCtl;
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;
_Adosale:TuAdoSet;
_Check:TCheckValidate;
_str:TuString;
public
{ Public declarations }
end;
var
Form_InitStorageFind: TForm_InitStorageFind;
implementation
uses U_Form_InitStorage,uGlobal;
{$R *.dfm}
procedure TForm_InitStorageFind.BtnExitClick(Sender: TObject);
begin
EnableWindow(Form_InitStorage.Handle,true);
Close;
end;
procedure TForm_InitStorageFind.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
EnableWindow(Form_InitStorage.Handle,true);
CanClose:=true;
end;
procedure TForm_InitStorageFind.FormCreate(Sender: TObject);
begin
_AdoNewProduce:=TuAdoSet.Create('newProduce',1);
_Adosale:=TuAdoSet.Create('newsale',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,'序号',60);
setGridTitle(grid1,2,'产品名称',100);
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;
end;
procedure TForm_InitStorageFind._beginDateCloseUp(Sender: TObject);
begin
beginDate.Text:=formatDateTime('yyyy-mm-dd',_beginDate.Date);
end;
procedure TForm_InitStorageFind.ButtonExCtl1Click(Sender: TObject);
var
param:TStringList;
strsql:string;
i,j:integer;
_Checkdate:string;
_Total1,_Total2,_Total3:double;
begin
param:=TStringList.Create;
{/*
执行存储过程,将符合条件的记录存储到表sale_followstore_#tmp中
*/}
param.Clear;
param.Add(trim(begindate.text));
param.Add(trim(_whichStore));
strsql:='sale_followstore_1';
_AdoNewProduce.actionSP(strsql,param);
{/*
查询记录
*/}
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(_whichStore));
strsql:='select SF_produceName,SF_unitName,SF_specification,SF_BoxNum,Sf_EmptyBoxNum,SF_BottleNum,SF_WhichStore ';
strsql:=strsql+' from sale_followStore_#tmp where SF_WhichStore=:s1';
if _AdoNewproduce.getRecordCount(strsql,param)<=0 then
begin
showmessage('接班记录不存在...');
exit;
end
else
begin
param.clear;
param.Add(trim(_whichStore));
strsql:='select SF_OrderID,SF_produceName,SF_unitName,SF_specification,SF_BoxNum,Sf_EmptyBoxNum,SF_BottleNum,SF_WhichStore ';
strsql:=strsql+' from sale_followStore_#tmp where SF_WhichStore=:s1 order by SF_orderID';
_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 + -