📄 frmpiceccalc.pas
字号:
unit frmPicecCalc;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, RM_dset, RM_dbset, RM_class, DB, ADODB, ComCtrls,
dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, dxCntner, StdCtrls,
Buttons, dxEditor, dxEdLib, ExtCtrls,DateUtils;
type
TPicecCalcForm = class(TForm)
Panel1: TPanel;
Label3: TLabel;
Label4: TLabel;
Label1: TLabel;
edtPersonID: TdxButtonEdit;
edtFirstDate: TDateTimePicker;
edtEndDate: TDateTimePicker;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
StatusBar1: TStatusBar;
spPicecCalc: TADOStoredProc;
dsPicecCalc: TDataSource;
rmpPicecCalc: TRMReport;
RMDBDataSet1: TRMDBDataSet;
SaveDialog: TSaveDialog;
grdPicecCalcTotal: TdxDBGrid;
grdPicecCalcTotalPicecID: TdxDBGridMaskColumn;
grdPicecCalcTotalPicecName: TdxDBGridMaskColumn;
grdPicecCalcTotalModelID: TdxDBGridMaskColumn;
grdPicecCalcTotalColor: TdxDBGridMaskColumn;
grdPicecCalcTotalShoesize: TdxDBGridMaskColumn;
grdPicecCalcTotalANum: TdxDBGridMaskColumn;
grdPicecCalcTotalPicecARate: TdxDBGridCurrencyColumn;
grdPicecCalcTotalAPicec: TdxDBGridCurrencyColumn;
grdPicecCalcTotalBNum: TdxDBGridMaskColumn;
grdPicecCalcTotalPicecBRate: TdxDBGridCurrencyColumn;
grdPicecCalcTotalBPicec: TdxDBGridCurrencyColumn;
spPicecCalcPicecID: TStringField;
spPicecCalcPicecName: TStringField;
spPicecCalcModelID: TStringField;
spPicecCalcColor: TStringField;
spPicecCalcShoesize: TStringField;
spPicecCalcANum: TIntegerField;
spPicecCalcPicecARate: TBCDField;
spPicecCalcAPicec: TBCDField;
spPicecCalcBNum: TIntegerField;
spPicecCalcPicecBRate: TBCDField;
spPicecCalcBPicec: TBCDField;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure edtPersonIDButtonClick(Sender: TObject;
AbsoluteIndex: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PicecCalcForm: TPicecCalcForm;
implementation
uses DataCenter, frmNoExist, frmMsg, ChoicePerson;
{$R *.dfm}
procedure TPicecCalcForm.BitBtn1Click(Sender: TObject);
var
NoExistQuery:TAdoQuery;
begin
NoexistQuery:=TAdoQuery.Create(self);
with NoexistQuery do
begin
Connection:=dmData.AdoConnection1;
Sql.Add('select distinct a.OrderNo,b.ModelID,b.Color,b.Shoesize from RateForms a left join RateFormsDetail b on a.OrderNo=b.OrderNo');
Sql.Add(' where (b.modelID<>'' and a.RateID<>'' and ((b.ModelID+b.Color+b.Shoesize) not in (select ModelID+Color+Shoesize from Rates)))');
Open;
if RecordCount>0 then
begin
application.CreateForm(TNoexistForm,NoexistForm);
NoexistForm.dsNoexist.DataSet:=NoexistQuery;
NoexistForm.ShowModal;
NoexistForm.Hide;
NoexistForm.Free;
end;
close;
Free;
end;
PicecCalcForm.Update;
spPicecCalc.Close;
spPicecCalc.Parameters[1].Value:=edtFirstDate.Date;
spPicecCalc.Parameters[2].Value:=edtEndDate.Date;
spPicecCalc.Parameters[3].Value:=edtPersonID.Text;
MsgForm:=TmsgForm.create(self);
MsgForm.Show;
screen.Cursor:=crSQLWAIT;
MsgForm.update;
spPicecCalc.open;
MsgForm.Hide;
screen.Cursor:=crDefault;
MsgForm.Close;
MsgForm.Free;
StatusBar1.Panels[0].Text:='总有记录数:'+inttostr(spPicecCalc.recordcount)+'条';
end;
procedure TPicecCalcForm.BitBtn4Click(Sender: TObject);
begin
if SaveDialog.Execute then
begin
if FileExists(SaveDialog.FileName) then
if MessageDlg(Format('文件"'+SaveDialog.FileName+'"已经存在,是否替换原有文件?', [SaveDialog.FileName]),mtConfirmation, mbYesNoCancel, 0) <> idYes then Exit;
grdPicecCalcTotal.SaveToXLS(SaveDialog.FileName,true);
end;
end;
procedure TPicecCalcForm.edtPersonIDButtonClick(Sender: TObject;
AbsoluteIndex: Integer);
begin
if Application.FindComponent('frmChoicePerson')=nil then
Application.CreateForm(TfrmChoicePerson,frmChoicePerson);
dmData.aquPersonel.SQL.Text:='select * from Personel';
dmData.aquPersonel.Open;
case frmChoicePerson.ShowModal of {返回的值}
mrCancel:
begin
edtFirstDate.SetFocus;
// ValueIsChange:=true;
end;
mrOk:
begin
edtPersonID.Text:=dmData.aquPersonelPersonID.Value;
edtFirstDate.SetFocus;
end;
end;
end;
procedure TPicecCalcForm.FormCreate(Sender: TObject);
begin
edtFirstDate.Date:=Date()-dayof(date())+1;
edtEndDate.Date:=date();
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -