📄 mainunit.pas
字号:
begin
Application.MessageBox('请先完成计算再进行打印!', '系统提示', MB_OK);
Exit ;
end;
{ if not DMSemi.getReport then
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
Exit ;
end; }
try
Form2 := TForm2.Create(Self);
try
Form2.qryMaster.Open ;
Form2.qryDetail.Open ;
Form2.qrlblTime.Caption := '会计区间:' + IniOptions.parambegindate
+' -- ' + IniOptions.paramenddate ;
Form2.qrlblCheckOut.Caption := '材料出库金额:' + floattostr(IniOptions.paramCheckOut);;
Form2.qrlblcheckin.Caption := '半成品入库金额:' + floattostr(IniOptions.paramCheckIn2 );
Form2.qrlblqlbldes.Caption := '总折旧金额:' + floattostr(edtdep.Value );
Form2.qckrpList.Preview ;
finally
Form2.Free ;
end;
except
on E : Exception do
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
end;
end;
end;
procedure Tfrm_main.ExcelE1Click(Sender: TObject);
begin
try
if not FCalculated then
begin
Application.MessageBox('请先完成计算再进行导出!', '系统提示', MB_OK);
Exit ;
end;
if not DMSemi.getReport then
begin
raise ECheckException.Create('不能取得报表数据!');
end;
//exlrprt.DataSet := DMSemi.qryTool ;
DMSemi.AllDepreciation := edtdep.Value ;
DMSemi.exlrprt.Template := ExtractFilePath(Application.ExeName)+'report2.xls' ;
DMSemi.exlrprt.Show();
except
on E : Exception do
begin
Application.MessageBox(PChar(e.Message), '提示', MB_OK +
MB_ICONINFORMATION);
{ Application.MessageBox('导出Excel时出错!', '提示', MB_OK +
MB_ICONINFORMATION); }
end;
end;
end;
procedure Tfrm_main.R3Click(Sender: TObject);
begin
if (not FCalculated) then
begin
Application.MessageBox('请先完成计算再进行打印!', '系统提示', MB_OK);
Exit ;
end;
{ if not DMSemi.getReport then
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
Exit ;
end; }
try
Form3 := TForm3.Create(Self);
try
Form3.qryMaster.Open ;
Form3.qryDetail.Open ;
Form3.qrlblTime.Caption := '会计区间:' + IniOptions.parambegindate
+' -- ' + IniOptions.paramenddate ;
Form3.qrlblCheckOut.Caption := '材料出库金额:' + floattostr(IniOptions.paramCheckOut);;
Form3.qrlblcheckin.Caption := '半成品入库金额:' + floattostr(IniOptions.paramCheckIn2);
Form3.qrlblqlbldes.Caption := '总折旧金额:' + floattostr(edtdep.Value );
Form3.qckrpList.Preview ;
finally
Form3.Free ;
end;
except
on E : Exception do
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
end;
end;
end;
procedure Tfrm_main.ExcelE2Click(Sender: TObject);
begin
try
if not FCalculated then
begin
Application.MessageBox('请先完成计算再进行导出!', '系统提示', MB_OK);
Exit ;
end;
if not DMSemi.getReport then
begin
raise ECheckException.Create('不能取得报表数据!');
end;
//exlrprt.DataSet := DMSemi.qryTool ;
DMSemi.AllDepreciation := edtdep.Value ;
DMSemi.exlrprt.Template := ExtractFilePath(Application.ExeName)+'report3.xls' ;
DMSemi.exlrprt.Show();
except
on E : Exception do
begin
Application.MessageBox(PChar(e.Message), '提示', MB_OK +
MB_ICONINFORMATION);
{ Application.MessageBox('导出Excel时出错!', '提示', MB_OK +
MB_ICONINFORMATION); }
end;
end;
end;
procedure Tfrm_main.P3Click(Sender: TObject);
begin
if (not FCalculated) then
begin
Application.MessageBox('请先完成计算再进行打印!', '系统提示', MB_OK);
Exit ;
end;
{ if not DMSemi.getReport then
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
Exit ;
end; }
try
Form4 := TForm4.Create(Self);
try
Form4.qryMaster.Open ;
Form4.qryDetail.Open ;
Form4.qrlblTime.Caption := '会计区间:' + IniOptions.parambegindate
+' -- ' + IniOptions.paramenddate ;
Form4.qrlblCheckOut.Caption := '材料出库金额:' + floattostr(IniOptions.paramCheckOut);;
Form4.qrlblcheckin.Caption := '半成品入库金额:' + floattostr(IniOptions.paramCheckIn2 );
Form4.qrlblqlbldes.Caption := '总折旧金额:' + floattostr(edtdep.Value );
Form4.qckrpList.Preview ;
finally
Form4.Free ;
end;
except
on E : Exception do
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
end;
end;
end;
procedure Tfrm_main.ExcelE4Click(Sender: TObject);
begin
try
if not FCalculated then
begin
Application.MessageBox('请先完成计算再进行导出!', '系统提示', MB_OK);
Exit ;
end;
if not DMSemi.getReport then
begin
raise ECheckException.Create('不能取得报表数据!');
end;
//exlrprt.DataSet := DMSemi.qryTool ;
DMSemi.AllDepreciation := edtdep.Value ;
DMSemi.exlrprt.Template := ExtractFilePath(Application.ExeName)+'report4.xls' ;
DMSemi.exlrprt.Show();
except
on E : Exception do
begin
Application.MessageBox(PChar(e.Message), '提示', MB_OK +
MB_ICONINFORMATION);
{ Application.MessageBox('导出Excel时出错!', '提示', MB_OK +
MB_ICONINFORMATION); }
end;
end;
end;
procedure Tfrm_main.P2Click(Sender: TObject);
begin
if (not FCalculated) then
begin
Application.MessageBox('请先完成计算再进行打印!', '系统提示', MB_OK);
Exit ;
end;
{ if not DMSemi.getReport then
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
Exit ;
end; }
try
frm_report := Tfrm_report.Create(Self);
try
frm_report.qryMaster.Open ;
frm_report.qryDetail.Open ;
frm_report.qrlblTime.Caption := '会计区间:' + IniOptions.parambegindate
+' -- ' + IniOptions.paramenddate ;
frm_report.qrlblCheckOut.Caption := '材料出库金额:' + floattostr(IniOptions.paramCheckOut);;
frm_report.qrlblcheckin.Caption := '半成品入库金额:' + floattostr(IniOptions.paramCheckIn2);
frm_report.qrlblqlbldes.Caption := '总折旧金额:' + floattostr(edtdep.Value );
frm_report.qckrpList.Preview ;
finally
frm_report.Free ;
end;
except
on E : Exception do
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
end;
end;
end;
procedure Tfrm_main.ExcelE3Click(Sender: TObject);
begin
try
if not FCalculated then
begin
Application.MessageBox('请先完成计算再进行导出!', '系统提示', MB_OK);
Exit ;
end;
if not DMSemi.getReport then
begin
raise ECheckException.Create('不能取得报表数据!');
end;
//exlrprt.DataSet := DMSemi.qryTool ;
DMSemi.AllDepreciation := edtdep.Value ;
DMSemi.exlrprt.Template := ExtractFilePath(Application.ExeName)+'report.xls' ;
DMSemi.exlrprt.Show();
except
on E : Exception do
begin
Application.MessageBox(PChar(e.Message), '提示', MB_OK +
MB_ICONINFORMATION);
{ Application.MessageBox('导出Excel时出错!', '提示', MB_OK +
MB_ICONINFORMATION); }
end;
end;
end;
procedure Tfrm_main.N4Click(Sender: TObject);
begin
frm_main.Close;
end;
procedure Tfrm_main.R1Click(Sender: TObject);
begin
btnExecute.Click;
end;
procedure Tfrm_main.N2Click(Sender: TObject);
begin
btnDataBaseSet.Click;
end;
procedure Tfrm_main.P4Click(Sender: TObject);
var
sql : string ;
begin
if (not FCalculated) then
begin
Application.MessageBox('请先完成计算再进行打印!', '系统提示', MB_OK);
Exit ;
end;
{ if not DMSemi.getReport
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
Exit ;
end; }
try
Form5 := TForm5.Create(Self);
try
Form5.qryMaster.Open ;
sql := 'select typename as 产品名称,cast(sum(cast(cinvdefine4 as float)*cast(ccount as float)) as numeric(18,4)) as 外加工费, '
+'cast(sum(cast(cinvdefine5 as float)*cast(ccount as float)) as numeric(18,4)) as 发黑费, '
+'cast(sum(cast(cinvdefine6 as float)*cast(ccount as float)) as numeric(18,4)) as 其它, '
+'sum(cAlldeprec) as 折旧费, cast(sum(cast(cplanvalue as float)*cast(ccount as float)) as numeric(18,4)) as 材料定额成本, '
+'sum(cdatumallvalue) as 材料实际成本,sum(cALLworkvalue) as 人工总成本,sum(callvalue) as 总成本 '
+' from (select a.*,b.cInvName as typename from AA_Aatmp_Inventory a,AA_Aatmp_sum_Inventory b '
+'where a.ctypeid=b.ctypeid) c group by typename' ;
form5.qryDetail.Close;
Form5.qryDetail.SQL.Text :=sql;
Form5.qryDetail.Open ;
Form5.qrlblTime.Caption := '会计区间:' + IniOptions.parambegindate
+' -- ' + IniOptions.paramenddate ;
Form5.qrlblCheckOut.Caption := '材料出库金额:' + floattostr(IniOptions.paramCheckOut);;
Form5.qrlblcheckin.Caption := '半成品入库金额:' + floattostr(IniOptions.paramCheckIn2 );
Form5.qrlblqlbldes.Caption := '总折旧金额:' + floattostr(edtdep.Value );
Form5.qckrpList.Preview ;
finally
Form5.Free ;
end;
except
on E : Exception do
begin
Application.MessageBox('不能取得报表数据!', '系统提示', MB_OK);
end;
end;
end;
procedure Tfrm_main.ExcelE5Click(Sender: TObject);
var
sql :string ;
begin
try
if not FCalculated then
begin
Application.MessageBox('请先完成计算再进行导出!', '系统提示', MB_OK);
Exit ;
end;
{if not DMSemi.getReport then
begin
raise ECheckException.Create('不能取得报表数据!');
end; }
//exlrprt.DataSet := DMSemi.qryTool ;
sql := 'select typename as cpmc,cast(sum(cast(cinvdefine4 as float)*cast(ccount as float)) as numeric(18,4)) as wjgf, '
+'cast(sum(cast(cinvdefine5 as float)*cast(ccount as float)) as numeric(18,4)) as fhf, '
+'cast(sum(cast(cinvdefine6 as float)*cast(ccount as float)) as numeric(18,4)) as qt, '
+'sum(cAlldeprec) as zjf, cast(sum(cast(cplanvalue as float)*cast(ccount as float)) as numeric(18,4)) as cledcb, '
+'sum(cdatumallvalue) as clsjcb,sum(cALLworkvalue) as rgzcb,sum(callvalue) as zcb '
+' from (select a.*,b.cInvName as typename from AA_Aatmp_Inventory a,AA_Aatmp_sum_Inventory b '
+'where a.ctypeid=b.ctypeid) c group by typename' ;
DMSemi.qryDetail.Close;
DMSemi.qryDetail.SQL.Text :=sql;
DMSemi.qryDetail.Open ;
DMSemi.AllDepreciation := edtdep.Value ;
DMSemi.exlrpt2.DataSet := DMSemi.qryDetail ;
DMSemi.exlrpt2.Template := ExtractFilePath(Application.ExeName)+'report5.xls' ;
DMSemi.exlrpt2.Show();
except
on E : Exception do
begin
Application.MessageBox(PChar(e.Message), '提示', MB_OK +
MB_ICONINFORMATION);
{ Application.MessageBox('导出Excel时出错!', '提示', MB_OK +
MB_ICONINFORMATION); }
end;
end;
end;
procedure Tfrm_main.N19Click(Sender: TObject);
var
dateStr:string;
strMin,strMax:string;
strMinMax:string;
ismax:Boolean;
i:integer;
searchDateQuery:TADOQuery;
begin
if (not FCalculated) then
begin
Application.MessageBox('请先完成计算再进行数据回填!', '系统提示', MB_OK);
Exit;
end;
// searchDateQuery:=TADOQuery.Create(self);
// searchDateQuery.Connection:= DMsemi.conDatabase;
// with searchDateQuery do
// begin
// sql.Text :='select cUnitAddress4En from UA_Account_Ex where trim(cUnitAddress4En)='''' or cUnitAddress4En is not null ';
// Open;
// if IsEmpty then
// begin
// sql.Text :='select cUnitAddress4En from UA_Account_Ex where trim(cUnitAddress4En)='''' or cUnitAddress4En is not null ';
// Open;
// if not isempty then
// begin
// Edit;
// first;
// fieldbyname('cUnitAddress4En').value:=datetostr(dtpBegin.Date)+'&'+datetostr(dtpEnd.Date) ;
// Post;
// end;
// end
// else
// begin
// strMinMax:=trim(fieldbyname('cUnitAddress4En').asstring);
// ismax:=False;
// for i:=1 to Length(strminmax) do
// begin
// if Copy(strminmax,i,1)='&' then
// begin
// ismax:=True;
// continue;
// end;
// if ismax then
// strmax:=strMax+Copy(strMinMax,i,1)
// else
// strmin:=strMin+copy(strMinmax,i,1);
// end;
// end;
// end;
// if (dtpBegin.Date>=StrToDate(strmax)) and (dtpBegin.Date<=StrToDate(strmax)) and (dtpEnd.Date>StrToDate(strmax)) then
// if application.messagebox(PChar(datetostr(dtpBegin.Date)+'至'+strmax+'的数据已经回填,是否退出?'),'系统提示',MB_YESNO+MB_ICONWARNING)=IDYES then
// Exit;
//
// if (dtpBegin.Date<=StrToDate(strmin)) and(dtpBegin.Date<=StrToDate(strmAX)) and (dtpEnd.Date<=StrToDate(strmax)) then
// if application.messagebox(PChar(datetostr(dtpbegin.date)+'至'+datetostr(dtpend.date)+'的数据已经回填,是否退出?'),'系统提示',MB_YESNO+MB_ICONWARNING)=IDYES then
// Exit;
//
// if (dtpBegin.Date<StrToDate(strmin)) and(dtpEnd.Date>=StrToDate(strmAX)) and (dtpEnd.Date<=StrToDate(strmax)) then
// if application.messagebox(PChar(strMin+'至'+strmax+'的数据已经回填,是否退出?'),'系统提示',MB_YESNO+MB_ICONWARNING)=IDYES then
// Exit;
// dateStr:=' and (ddate>='''+ datetostr(dtpBegin.Date) + ''' and ddate<='''+ datetostr(dtpEnd.Date) +''')';
dateStr:=' and (dDate>='''+ datetostr(dtpBegin.Date) + ''' and dDate<='''+ datetostr(dtpEnd.Date) +''')';
if DMSemi.setData(dateStr) then
Application.MessageBox('数据回填成功!', '系统提示', MB_OK)
else
Application.MessageBox('数据回填失败!', '系统提示', MB_OK);
end;
procedure Tfrm_main.H2Click(Sender: TObject);
begin
ShellExecute(handle,'Open',PChar(ExtractFilePath(Application.EXEName)+'help.chm'),nil,nil, SW_MAXIMIZE);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -