📄 unit2.pas
字号:
procedure Tfrmmain.Button13Click(Sender: TObject);
begin
if ComboBox4.Text = '' then
begin
Application.MessageBox('请选择查询条件。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
if ComboBox4.Text = '年' then
begin
if Edit6.Text = '' then
begin
Application.MessageBox('请输入年份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Querylb.SQL.Text := 'Select * from YearHaoCai where class='''+clclass+
''' and nian='+Edit6.Text;
Querylb.Open;
if Querylb.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox4.Text = '月' then
begin
if Trim(Edit12.Text) = '' then
Exit;
if (Edit6.Text = '') or(StrToInt(Edit12.Text) = 0) or (Edit12.Text = '') or(StrToInt(Edit12.Text) > 12) then
begin
Application.MessageBox('请输入年份和月份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Querylb.SQL.Text := 'Select * from MonthHaoCai where class='''+clclass+
''' and riqi='''+DateToStr(StrToDate(Edit6.Text+'-'+Edit12.Text+'-24'))+'''';
Querylb.Open;
if Querylb.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox4.Text = '周' then
begin
if WeekOfTheYear(DateTimePicker3.Date) <> WeekOfTheYear(DateTimePicker4.Date) then
begin
Application.MessageBox('两次的时间不在同一周!'+chr(13)+chr(10)+'请选择本周的第一天和最后一天','错误',MB_OK OR MB_ICONERROR);
Exit;
end;
Querylb.SQL.Text := 'Select * from WeekHaoCai where class='''+clclass+
''' and nian='+IntToStr(YearOf(DateTimePicker3.Date))+' and zhou='+
IntToStr(WeekOfTheYear(DateTimepicker3.Date));
Querylb.Open;
if Querylb.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
end;
procedure Tfrmmain.Button17Click(Sender: TObject);
begin
if ComboBox6.Text = '' then
begin
Application.MessageBox('请选择查询条件。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
if ComboBox6.Text = '年' then
begin
if Edit8.Text = '' then
begin
Application.MessageBox('请输入年份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Queryxgjs.SQL.Text := 'Select * from YearHaoCai where class='''+clclass+
''' and nian='+Edit8.Text;
Queryxgjs.Open;
if Queryxgjs.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox6.Text = '月' then
begin
if Trim(Edit13.Text) = '' then
Exit;
if (Edit8.Text = '') or (StrToInt(Edit13.Text) = 0) or (Edit13.Text = '') or (StrToInt(Edit13.Text) > 12) then
begin
Application.MessageBox('请输入年份和月份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Queryxgjs.SQL.Text := 'Select * from MonthHaoCai where class='''+clclass+
''' and riqi='''+DateToStr(StrToDate(Edit8.Text+'-'+Edit13.Text+'-24'))+'''';
Queryxgjs.Open;
if Queryxgjs.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox6.Text = '周' then
begin
if WeekOfTheYear(DateTimePicker5.Date) <> WeekOfTheYear(DateTimePicker6.Date) then
begin
Application.MessageBox('两次的时间不在同一周!'+chr(13)+chr(10)+'请选择本周的第一天和最后一天','错误',MB_OK OR MB_ICONERROR);
Exit;
end;
Queryxgjs.SQL.Text := 'Select * from WeekHaoCai where class='''+clclass+
''' and nian='+IntToStr(YearOf(DateTimePicker5.Date))+' and zhou='+
IntToStr(WeekOfTheYear(DateTimepicker5.Date));
Queryxgjs.Open;
if Queryxgjs.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
end;
procedure Tfrmmain.Button21Click(Sender: TObject);
begin
if ComboBox5.Text = '' then
begin
Application.MessageBox('请选择查询条件。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
if ComboBox5.Text = '年' then
begin
if Edit7.Text = '' then
begin
Application.MessageBox('请输入年份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Queryhxsj.SQL.Text := 'Select * from YearHaoCai where class='''+clclass+
''' and nian='+Edit7.Text;
Queryhxsj.Open;
if Queryhxsj.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox5.Text = '月' then
begin
if Trim(Edit14.Text) = '' then
Exit;
if ((Trim(Edit7.Text) = '') or (StrToInt(Edit14.Text) = 0) or (Trim(Edit14.Text) = '') or (StrToInt(Edit14.Text) > 12)) then
begin
Application.MessageBox('请输入年份和月份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Queryhxsj.SQL.Text := 'Select * from MonthHaoCai where class='''+clclass+
''' and riqi='''+DateToStr(StrToDate(Edit7.Text+'-'+Edit14.Text+'-24'))+'''';
Queryhxsj.Open;
if Queryhxsj.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox5.Text = '周' then
begin
if WeekOfTheYear(DateTimePicker7.Date) <> WeekOfTheYear(DateTimePicker8.Date) then
begin
Application.MessageBox('两次的时间不在同一周!'+chr(13)+chr(10)+'请选择本周的第一天和最后一天','错误',MB_OK OR MB_ICONERROR);
Exit;
end;
Queryhxsj.SQL.Text := 'Select * from WeekHaoCai where class='''+clclass+
''' and nian='+IntToStr(YearOf(DateTimePicker7.Date))+' and zhou='+
IntToStr(WeekOfTheYear(DateTimepicker7.Date));
Queryhxsj.Open;
if Queryhxsj.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
end;
procedure Tfrmmain.Button25Click(Sender: TObject);
begin
if ComboBox7.Text = '' then
begin
Application.MessageBox('请选择查询条件。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
if ComboBox7.Text = '年' then
begin
if Edit9.Text = '' then
begin
Application.MessageBox('请输入年份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Querydh.SQL.Text := 'Select * from YearHaoCai where class='''+clclass+
''' and nian='+Edit9.Text;
Querydh.Open;
if Querydh.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox7.Text = '月' then
begin
if Trim(Edit15.Text) = '' then
Exit;
if (Edit9.Text = '') or(StrToInt(Edit15.Text) = 0) or (Edit15.Text = '') or(StrToInt(Edit15.Text) > 12) then
begin
Application.MessageBox('请输入年份和月份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Querydh.SQL.Text := 'Select * from MonthHaoCai where class='''+clclass+
''' and riqi='''+DateToStr(StrToDate(Edit9.Text+'-'+Edit15.Text+'-24'))+'''';
Querydh.Open;
if Querydh.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox7.Text = '周' then
begin
if WeekOfTheYear(DateTimePicker9.Date) <> WeekOfTheYear(DateTimePicker10.Date) then
begin
Application.MessageBox('两次的时间不在同一周!'+chr(13)+chr(10)+'请选择本周的第一天和最后一天','错误',MB_OK OR MB_ICONERROR);
Exit;
end;
Querydh.SQL.Text := 'Select * from WeekHaoCai where class='''+clclass+
''' and nian='+IntToStr(YearOf(DateTimePicker9.Date))+' and zhou='+
IntToStr(WeekOfTheYear(DateTimepicker9.Date));
Querydh.Open;
if Querydh.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
end;
procedure Tfrmmain.Button29Click(Sender: TObject);
begin
if ComboBox8.Text = '' then
begin
Application.MessageBox('请选择查询条件。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
if ComboBox8.Text = '年' then
begin
if Edit10.Text = '' then
begin
Application.MessageBox('请输入年份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Queryjd.SQL.Text := 'Select * from YearHaoCai where class='''+clclass+
''' and nian='+Edit10.Text;
Queryjd.Open;
if Queryjd.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox8.Text = '月' then
begin
if Trim(Edit16.Text) = '' then
Exit;
if (Edit10.Text = '')or (StrToInt(Edit16.Text) = 0) or (Edit16.Text = '')or(StrToInt(Edit16.Text) > 12) then
begin
Application.MessageBox('请输入年份和月份。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
Queryjd.SQL.Text := 'Select * from MonthHaoCai where class='''+clclass+
''' and riqi='''+DateToStr(StrToDate(Edit10.Text+'-'+Edit16.Text+'-24'))+'''';
Queryjd.Open;
if Queryjd.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
if ComboBox8.Text = '周' then
begin
if WeekOfTheYear(DateTimePicker11.Date) <> WeekOfTheYear(DateTimePicker12.Date) then
begin
Application.MessageBox('两次的时间不在同一周!'+chr(13)+chr(10)+'请选择本周的第一天和最后一天','错误',MB_OK OR MB_ICONERROR);
Exit;
end;
Queryjd.SQL.Text := 'Select * from WeekHaoCai where class='''+clclass+
''' and nian='+IntToStr(YearOf(DateTimePicker11.Date))+' and zhou='+
IntToStr(WeekOfTheYear(DateTimepicker11.Date));
Queryjd.Open;
if Queryjd.Eof then
Application.MessageBox('不存在您所查询的记录!','提示',MB_OK);
end;
end;
procedure Tfrmmain.Button14Click(Sender: TObject);
begin
FrmYMRep := TFrmYMRep.Create(NIL);
if ComboBox4.Text = '' then
begin
Application.MessageBox('请选择查询条件。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
if (Trim(Edit6.Text) = '') and (ComboBox4.Text <> '周') then
begin
Application.MessageBox('请输入年份','提示',MB_OK);
Exit;
end;
if ComboBox4.Text = '年' then
begin
FrmYMRep.QRLabel10.Caption := IntToStr(StrToInt(Edit6.Text)-1)+'年'+'12月25日库存';
FrmYMRep.QRLabel19.Caption := Edit6.Text+'年'+'12月24日结存';
FrmYMRep.QRLabel13.Caption := '本年入库';
FrmYMRep.QRLabel16.Caption := '本年出库';
FrmYMRep.ADOQuery1.SQL.Text :='select * from YearHaoCai where class='''+clclass+
''' and nian='+Edit6.Text;
FrmYMRep.ADOQuery1.Open;
if FrmYMRep.ADOQuery1.Eof then
begin
Application.MessageBox('不存在本年度报表','提示',MB_OK);
Exit;
end;
FrmYMRep.QuickRep1.PreviewModal;
end;
if ComboBox4.Text = '月' then
begin
if Trim(Edit12.Text) = '' then
Exit;
if (Edit6.Text = '') or (StrToInt(Edit12.Text) > 12)or (StrToInt(Edit12.Text) = 0) then
begin
Application.MessageBox('请输入月份','提示',MB_OK);
Exit;
end;
if StrToInt(Edit12.Text) <= 1 then
FrmYMRep.QRLabel10.Caption := IntToStr(StrToInt(Edit6.Text)-1)+'年12月25日库存'
else
FrmYMRep.QRLabel10.Caption := Edit6.Text+'年'+IntToStr(StrToInt(Edit12.Text)-1)+'月25日库存';
FrmYMRep.QRLabel19.Caption := Edit6.Text+'年'+Edit12.Text+'月24日结存';
FrmYMRep.ADOQuery1.SQL.Text := 'Select * from MonthHaoCai where class='''+clclass+
''' and riqi='''+DateToStr(StrToDate(Edit6.Text+'-'+Edit12.Text+'-24'))+'''';
FrmYMRep.ADOQuery1.Open;
if FrmYMRep.ADOQuery1.Eof then
begin
Application.MessageBox('不存在本月报表','提示',MB_OK);
Exit;
end;
FrmYMRep.QuickRep1.PreviewModal;
end;
if ComboBox4.Text = '周' then
begin
if WeekOfTheYear(DateTimePicker3.Date) = WeekOfTheYear(DateTimePicker4.Date) then
begin
FrmWeekRep := TFrmWeekRep.Create(NIL);
FrmWeekRep.QRLabel5.Caption := DateToStr(DateTimePicker3.Date);
FrmWeekRep.QRLabel7.Caption := DateToStr(DateTimePicker4.Date);
FrmWeekRep.ADOQuery1.SQL.Text := 'Select * from WeekHaoCai where class='''+clclass+
''' and nian='+IntToStr(YearOf(DateTimePicker3.Date))+' and zhou='+
IntToStr(WeekOfTheYear(DateTimepicker3.Date));
FrmWeekRep.ADOQuery1.Open;
if FrmWeekRep.ADOQuery1.Eof then
begin
Application.MessageBox('不存在本周明细表','提示',MB_OK);
Exit;
end;
FrmWeekRep.QuickRep1.PreviewModal;
end
else
begin
Application.MessageBox('两次的时间不在同一周!'+chr(13)+chr(10)+'请选择本周的第一天和最后一天','错误',MB_OK OR MB_ICONERROR);
Exit;
end;
end;
FreeAndNil(FrmWeekRep);
FreeAndNil(FrmYMRep);
end;
procedure Tfrmmain.Button18Click(Sender: TObject);
begin
FrmYMRep := TFrmYMRep.Create(NIL);
if ComboBox6.Text = '' then
begin
Application.MessageBox('请选择查询条件。','提示',MB_OK or MB_ICONINFORMATION);
Exit;
end;
if (Trim(Edit8.Text) = '') and (ComboBox6.Text <> '周') then
begin
Application.MessageBox('请输入年份','提示',MB_OK);
Exit;
end;
if ComboBox6.Text = '年' then
begin
FrmYMRep.QRLabel10.Caption := IntToStr(StrToInt(Edit8.Text)-1)+'年'+'12月25日库存';
FrmYMRep.QRLabel19.Caption := Edit8.Text+'年'+'12月24日结存';
FrmYMRep.QRLabel13.Caption := '本年入库';
FrmYMRep.QRLabel16.Caption := '本年出库';
FrmYMRep.ADOQuery1.SQL.Text :='select * from YearHaoCai where class='''+clclass+
''' and nian='+Edit8.Text;
FrmYMRep.ADOQuery1.Open;
if FrmYMRep.ADOQuery1.Eof then
begin
Application.MessageBox('不存在本年度报表','提示',MB_OK);
Exit;
end;
FrmYMRep.QuickRep1.PreviewModal;
end;
if ComboBox6.Text = '月' then
begin
if Trim(Edit13.Text) = '' then
Exit;
if (Edit8.Text = '') or (StrToInt(Edit13.Text) > 12)or (StrToInt(Edit13.Text) = 0) then
begin
Application.MessageBox('请输入月份','提示',MB_OK);
Exit;
end;
if StrToInt(Edit13.Text) <= 1 then
FrmYMRep.QRLabel10.Caption := IntToStr(StrToInt(Edit8.Text)-1)+'年12月25日库存'
else
FrmYMRep.QRLabel10.Caption := Edit8.Text+'年'+IntToStr(StrToInt(Edit13.Text)-1)+'月25日库存';
FrmYMRep.QRLabel19.Caption := Edit8.Text+'年'+Edit13.Text+'月24日结存';
FrmYMRep.ADOQuery1.SQL.Text := 'Select * from MonthHaoCai where class='''+clclass+
''' and riqi='''+DateToStr(StrToDate(Edit8.Text+'-'+Edit13.Text+'-24'))+'''';
FrmYMRep.ADOQuery1.Open;
if FrmYMRep.ADOQuery1.Eof then
begin
Application.MessageBox('不存在本月报表','提示',MB_OK);
Exit;
end;
FrmYMRep.QuickRep1.PreviewModal;
end;
if ComboBox6.Text = '周' then
begin
if WeekOfTheYear(DateTimePicker5.Date) = WeekOfTheYear(DateTimePicker6.Date) then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -