📄 mealprint.pas
字号:
unit mealprint;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Db, ppCtrls, ppBands, ppVar, ppPrnabl, ppClass,
ppCache, ppProd, ppReport, ppDB, ppComm, ppRelatv, ppDBPipe, ppDBBDE,
ADODB, Mask, Buttons,publicfunction,main;
type
TFormmealprint = class(TForm)
ADOmealtotal: TADODataSet;
DSmealtotal: TDataSource;
ppBDEPipeline2: TppBDEPipeline;
ppReport2: TppReport;
ppTitleBand2: TppTitleBand;
ppLabel28: TppLabel;
ppSystemVariable7: TppSystemVariable;
ppLabel29: TppLabel;
ppLabel30: TppLabel;
ppSystemVariable8: TppSystemVariable;
ppLabel31: TppLabel;
ppHeaderBand2: TppHeaderBand;
ppLine3: TppLine;
ppLabel21: TppLabel;
ppLabel22: TppLabel;
ppLabel23: TppLabel;
ppLabel24: TppLabel;
ppLabel25: TppLabel;
ppDetailBand2: TppDetailBand;
ppDBText10: TppDBText;
ppDBText11: TppDBText;
ppDBText12: TppDBText;
ppDBText13: TppDBText;
ppDBText14: TppDBText;
ppTitleBand1: TppTitleBand;
ppLabel1: TppLabel;
ppLabel11: TppLabel;
ppLabel13: TppLabel;
ppLabel14: TppLabel;
ppSystemVariable3: TppSystemVariable;
ppSystemVariable4: TppSystemVariable;
ppLabel16: TppLabel;
ppHeaderBand1: TppHeaderBand;
ppLine1: TppLine;
ppLabel2: TppLabel;
ppLabel4: TppLabel;
ppLabel5: TppLabel;
ppLabel6: TppLabel;
ppLabel7: TppLabel;
ppDetailBand1: TppDetailBand;
ppDBText1: TppDBText;
ppDBText2: TppDBText;
ppDBText3: TppDBText;
ppDBText4: TppDBText;
ppDBText5: TppDBText;
ppDBText6: TppDBText;
ppBDEPipeline1: TppBDEPipeline;
Dsmealrecord: TDataSource;
ADOmealrecord: TADODataSet;
RadioGroup1: TRadioGroup;
ComboBox1: TComboBox;
Edit1: TEdit;
Edit2: TEdit;
RadioGroup2: TRadioGroup;
MaskEdit3: TMaskEdit;
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
ppLabel20: TppLabel;
Query1: TADOQuery;
ComboBox2: TComboBox;
Query2: TADOQuery;
MaskEdit1: TMaskEdit;
MaskEdit2: TMaskEdit;
DataSource1: TDataSource;
ADODataSet1: TADODataSet;
DataSource2: TDataSource;
ppReport3: TppReport;
ppBDEPipeline3: TppBDEPipeline;
ppHeaderBand3: TppHeaderBand;
ppDetailBand3: TppDetailBand;
ppLabel17: TppLabel;
ppDBText18: TppDBText;
ppDBText19: TppDBText;
ppDBText20: TppDBText;
ppDBText23: TppDBText;
ppDBText24: TppDBText;
ppLabel18: TppLabel;
ppLabel19: TppLabel;
ppLabel32: TppLabel;
ppLabel36: TppLabel;
ppLabel41: TppLabel;
ppLine5: TppLine;
ppLabel43: TppLabel;
ppSystemVariable1: TppSystemVariable;
ppLabel44: TppLabel;
ppLabel45: TppLabel;
ppSystemVariable2: TppSystemVariable;
ppLabel47: TppLabel;
ppLabel12: TppLabel;
ppLabel27: TppLabel;
ppLabel46: TppLabel;
ppreport1: TppReport;
ppLabel49: TppLabel;
ppLabel50: TppLabel;
ppLabel51: TppLabel;
ppSummaryBand3: TppSummaryBand;
ADOmealtotalworkno: TStringField;
ADOmealtotalcardno: TStringField;
ADOmealtotalname: TStringField;
ADOmealtotaldeptno: TStringField;
ADOmealtotalrq: TStringField;
ADOmealtotalmoney1: TBCDField;
ADOmealtotalmoney2: TBCDField;
ppLabel3: TppLabel;
ppLabel8: TppLabel;
ppLabel9: TppLabel;
ppDBText7: TppDBText;
ppDBText8: TppDBText;
ADOmealrecordcardno: TStringField;
ADOmealrecordworkno: TStringField;
ADOmealrecordname: TStringField;
ADOmealrecordrq: TDateTimeField;
ADOmealrecorddept: TStringField;
ADOmealrecordmealtime: TStringField;
ADOmealrecordprice1: TFloatField;
ADOmealrecordprice2: TFloatField;
ppLine2: TppLine;
ppLabel10: TppLabel;
ppDBText9: TppDBText;
ppLabel15: TppLabel;
ppDBText15: TppDBText;
ppLabel26: TppLabel;
ppLabel33: TppLabel;
ppDBText16: TppDBText;
ADODataSet1workno: TStringField;
ADODataSet1cardno: TStringField;
ADODataSet1name: TStringField;
ADODataSet1dept: TStringField;
ADODataSet1rq: TStringField;
ADODataSet1price1: TBCDField;
ADODataSet1price2: TBCDField;
ppDBText17: TppDBText;
ppSummaryBand1: TppSummaryBand;
ppLabel34: TppLabel;
ppLabel35: TppLabel;
ppDBCalc1: TppDBCalc;
ppDBCalc3: TppDBCalc;
ppLabel38: TppLabel;
ppLabel39: TppLabel;
ppLabel40: TppLabel;
ppDBCalc4: TppDBCalc;
ppLabel42: TppLabel;
ppDBCalc5: TppDBCalc;
ppSummaryBand2: TppSummaryBand;
ppLabel52: TppLabel;
ppLabel53: TppLabel;
ppDBCalc7: TppDBCalc;
ppLabel54: TppLabel;
ppDBCalc8: TppDBCalc;
function printcondition:string;
function printcondition1:string;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ppReport1PreviewFormCreate(Sender: TObject);
procedure ppReport2PreviewFormCreate(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure MaskEdit1Exit(Sender: TObject);
procedure MaskEdit2Exit(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure MaskEdit1KeyPress(Sender: TObject; var Key: Char);
procedure MaskEdit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure ppReport3PreviewFormCreate(Sender: TObject);
procedure ppReport3BeforePrint(Sender: TObject);
procedure ppReport2BeforePrint(Sender: TObject);
procedure ppReport1BeforePrint(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Formmealprint: TFormmealprint;
fmat1,fmat2:string;
implementation
{$R *.DFM}
function TFormmealprint.printcondition1:string;
begin
result:='';
case RadioGroup1.itemindex of
0:result:='';
1:if combobox2.items.indexof(combobox2.text)<>-1 then result:='deptno=right('''+combobox2.text+''',5) ';
2:if (trim(edit1.text)<>'') and (trim(edit2.text)<>'') then result:='workno between '''+edit1.text+''' and '''+edit2.text+''' ';
end;
end;
function TFormmealprint.printcondition:string;
begin
result:='';
case RadioGroup1.itemindex of
0:result:='';
1:if combobox1.items.indexof(combobox1.text)<>-1 then result:='deptno=right('''+combobox1.text+''',5) ';
2:if (trim(edit1.text)<>'') and (trim(edit2.text)<>'') then result:='workno between '''+edit1.text+''' and '''+edit2.text+''' ';
end;
end;
procedure TFormmealprint.BitBtn1Click(Sender: TObject);
var
s:string;
s1:string;
begin
s:=printcondition;
s1:=printcondition1;
if (maskEdit3.Text<>fmat2)and(RadioGroup1.ItemIndex=0)and(RadioGroup2.ItemIndex=1)then
begin
AdomealTotal.Close;
ADOmealtotal.CommandText:='select * from mel05010 where rq='''+MaskEdit3.Text+''' order by deptno,workno';
pplabel31.Caption:=companyname1;
ppreport2.Print;
end
else if (MaskEdit3.Text<>fmat2)and(RadioGroup1.ItemIndex=1)and(RadioGroup2.ItemIndex=1)then
begin
AdomealTotal.Close;
ADOmealtotal.CommandText:='select * from mel05010 where rq='''+MaskEdit3.Text+''' and '+s1+' order by deptno,workno';
AdomealTotal.Open;
ppreport2.Print;
end
else if (maskEdit3.Text<>fmat2)and(RadioGroup1.ItemIndex=2)and(RadioGroup2.ItemIndex=1)then
begin
AdomealTotal.Close;
ADOmealtotal.CommandText:='select * from mel05010 where rq='''+MaskEdit3.Text+''' and '+s1+' order by deptno,workno';
AdomealTotal.Open;
ppreport2.Print;
end
else if (maskEdit1.Text<>fmat1)and(maskEdit2.Text<>fmat1)and(RadioGroup1.ItemIndex=0)and(RadioGroup2.ItemIndex=0)then
begin
ADOmealrecord.Close;
ADOmealrecord.CommandText:='Select * From mel04010 where rq between '''+MaskEdit1.Text+'''and+'''+MaskEdit2.Text+''' order by dept,workno';
ADOmealrecord.Open;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -