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

📄 u_form_samplebillfind.pas

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

interface

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

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

var
  Form_sampleBillFind: TForm_sampleBillFind;

implementation

uses U_Form_SampleBill,uGlobal;

{$R *.dfm}

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

procedure TForm_sampleBillFind.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]:=120;
    grid1.Cells[2,1].ForeText:='开票日期';
    grid1.ColWidths[2]:=120;

    grid1.Cells[3,1].ForeText:='单位名称';
    grid1.ColWidths[3]:=120;

    grid1.Cells[4,1].ForeText:='产品名称';
    grid1.ColWidths[4]:=110;
    grid1.Cells[5,1].ForeText:='规格';
    grid1.ColWidths[5]:=70;
    grid1.Cells[6,1].ForeText:='包装';
    grid1.ColWidths[6]:=70;
    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]:=120;
    grid1.Cells[10,1].ForeText:='酒库名称';
    grid1.ColWidths[10]:=80;
    grid1.Cells[11,1].ForeText:='保管员';

    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_sampleBillFind.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
    EnableWindow(Form_SampleBill.Handle,true);
    CanClose:=true;
end;

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

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

procedure TForm_sampleBillFind.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;

procedure TForm_sampleBillFind.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(endDate.text));
    param.Add(trim(_whichStore));
    strSql:='select sampleBillCode,sampleBillDate,TRaderName,productName,specification,UnitName,productNum,bottleNum,OutStoreTime,';
    strSql:=strSql+'WhichStore,worker  from  sale_newsample_Office  where  sampleBilldate>=:s1  and  sampleBilldate<=:s2  and  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 sampleBillCode,sampleBillDate,TRaderName,productName,specification,UnitName,productNum,bottleNum,OutStoreTime,';
    strSql:=strSql+'WhichStore,worker  from  sale_newsample_Office  where  sampleBilldate>=:s1  and  sampleBilldate<=:s2  and  whichStore=:s3';
    _AdoNewproduce.BindToGrid(grid1,strSql,param);
     {/*
        计算合计:
    */}
    _Total1:=0;
    _Total2:=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;

    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);
    
     {/*
        设置最后一行颜色
    */}
    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 + -