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

📄 u_form_productstockfind.~pas

📁 这是一个啤酒行业的软件
💻 ~PAS
字号:
unit U_Form_ProductStockFind;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, EasyGrid, StdCtrls, ButtonExCtl, ComCtrls, Mask,uAdoSet,
  uCheckValidate,uString;

type
  TForm_ProductStockFind = class(TForm)
    GroupBox1: TGroupBox;
    Grid1: TEasyGrid;
    Label3: TLabel;
    beginDate: TMaskEdit;
    _beginDate: TDateTimePicker;
    ButtonExCtl1: TButtonExCtl;
    BtnExit: TButtonExCtl;
    Label1: TLabel;
    endDate: TMaskEdit;
    _endDate: TDateTimePicker;
    procedure FormCreate(Sender: TObject);
    procedure BtnExitClick(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure _beginDateCloseUp(Sender: TObject);
    procedure _endDateCloseUp(Sender: TObject);
    procedure ButtonExCtl1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
    _AdoNewProduce:TuAdoSet;
    _Check:TCheckValidate;
    _str:TuString;
  public
    { Public declarations }
  end;

var
  Form_ProductStockFind: TForm_ProductStockFind;

implementation

uses U_Form_ProduceStock,uGlobal;

{$R *.dfm}

procedure TForm_ProductStockFind.FormCreate(Sender: TObject);
var
   i:integer;
begin
    _AdoNewProduce:=TuAdoSet.Create('newProduce',1);
    _Check:=TCheckValidate.create;
    _str:=TuString.Create;

    {/*
       设置表格标题
    */}
    grid1.Cells[1,1].ForeText:='编号';
    grid1.ColWidths[1]:=130;
    grid1.Cells[2,1].ForeText:='入库日期';
    grid1.ColWidths[2]:=130;
    grid1.Cells[3,1].ForeText:='入库时间';
    grid1.ColWidths[3]:=130;
    grid1.Cells[4,1].ForeText:='产品名称';
    grid1.ColWidths[4]:=120;
    grid1.Cells[5,1].ForeText:='规格';
    grid1.ColWidths[5]:=70;
    grid1.Cells[6,1].ForeText:='包装';
    grid1.ColWidths[6]:=60;
    grid1.Cells[7,1].ForeText:='成套数';
    grid1.ColWidths[7]:=70;
    grid1.Cells[8,1].ForeText:='空箱数';
    grid1.ColWidths[8]:=70;
    grid1.Cells[9,1].ForeText:='瓶数';
    grid1.ColWidths[9]:=70;
    grid1.Cells[10,1].ForeText:='酒库名称';
    grid1.ColWidths[10]:=90;
    grid1.Cells[11,1].ForeText:='保管员';
    grid1.ColWidths[11]:=70;

    for i:=1 to grid1.ColCount-1 do
    begin
         grid1.Cells[i,1].Color:=rgb(0,143,247);
         grid1.Cells[i,1].FontColor:=rgb(255,255,255); 
    end;///

    beginDate.Text:=formatDateTime('yyyy-mm-dd',now);
     _beginDate.Date:=strTodate(formatDateTime('yyyy-mm-dd',now));
    endDate.Text:=formatDateTime('yyyy-mm-dd',now);
     _endDate.Date:=strTodate(formatDateTime('yyyy-mm-dd',now));
end;

procedure TForm_ProductStockFind.BtnExitClick(Sender: TObject);
begin
    EnableWindow(Form_ProduceStock.Handle,true);
    close;
end;

procedure TForm_ProductStockFind.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
      EnableWindow(Form_ProduceStock.Handle,true);
      CanClose:=true;
end;

procedure TForm_ProductStockFind._beginDateCloseUp(Sender: TObject);
begin
     begindate.Text:=formatDateTime('yyyy-mm-dd',_begindate.Date);
end;

procedure TForm_ProductStockFind._endDateCloseUp(Sender: TObject);
begin
      enddate.Text:=formatDateTime('yyyy-mm-dd',_enddate.Date);
end;

procedure TForm_ProductStockFind.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(endDate.text));
    param.Add(trim(_whichStore));
    strSql:='select SI_IntoBillCode,SI_IntoDate,SI_intoTime,SI_productName,SI_specification,SI_UnitName,SI_productNum,SI_EmptyBoxNum,';
    strSql:=strSql+'SI_bottleNum,SI_WhichStore,SI_StoreMan  from  sale_IntoStore  where SI_intoDate>=:s1 and  SI_IntoDate<=:s2 and SI_whichStore=:s3';
    if _AdoNewproduce.getRecordCount(strsql,param)<=0 then
    begin
       showmessage('入库记录不存在');
       exit;
    end;


    param.Clear;
    param.Add(trim(begindate.text));
    param.Add(trim(endDate.text));
    param.Add(trim(_whichStore));
    strSql:='select SI_IntoBillCode,SI_IntoDate,SI_intoTime,SI_productName,SI_specification,SI_UnitName,SI_productNum,SI_EmptyBoxNum,';
    strSql:=strSql+'SI_bottleNum,SI_WhichStore,SI_StoreMan  from  sale_IntoStore  where SI_intoDate>=:s1 and  SI_IntoDate<=:s2 and SI_whichStore=:s3  order by SI_IntoBillCode';
    _AdoNewproduce.BindToGrid(grid1,strSql,param);
    {/*
        计算合计:
    */}
    _Total1:=0;
    _Total2:=0;
    _Total3:=0;
    for i:=2 to grid1.RowCount-2 do
    begin
        if  grid1.cells[7,i].foretext<>'' then
        begin
            _Total1:=_Total1+strToFloat(grid1.cells[7,i].foretext);
        end;
         if  grid1.cells[8,i].foretext<>'' then
        begin
            _Total2:=_Total2+strToFloat(grid1.cells[8,i].foretext);
        end;
         if  grid1.cells[9,i].foretext<>'' then
        begin
            _Total3:=_Total3+strToFloat(grid1.cells[9,i].foretext);
        end;
    end;
    grid1.cells[1,grid1.RowCount-1].ForeText:='合计:';
    grid1.cells[7,grid1.RowCount-1].ForeText:=formatFloat('##0',_Total1);
    grid1.cells[8,grid1.RowCount-1].ForeText:=formatFloat('##0',_Total2);
    grid1.cells[9,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;

procedure TForm_ProductStockFind.FormShow(Sender: TObject);
var
    i,j:integer;
begin
    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;
end;

end.

⌨️ 快捷键说明

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