📄 upartsalegainrep.pas
字号:
unit uPartSalegainRep;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ActnList, LBCtrls, ExtCtrls, StdCtrls, FR_DSet, FR_DBSet,
FR_Class, DB, DBClient, SimpleDS, LBDBScrollBar, Grids, LBDBGrid;
type
TfrmPartSalegainRep = class(TForm)
Panel7: TPanel;
Image2: TImage;
Shape22: TShape;
Shape23: TShape;
Shape24: TShape;
Shape25: TShape;
LBSpeecButton1: TLBSpeecButton;
LBSpeecButton3: TLBSpeecButton;
ActionList1: TActionList;
Action2: TAction;
Action1: TAction;
Panel3: TPanel;
Label1: TLabel;
Panel4: TPanel;
Panel10: TPanel;
Panel1: TPanel;
Panel2: TPanel;
Shape2: TShape;
Shape3: TShape;
Shape5: TShape;
LBDBGrid1: TLBDBGrid;
Panel5: TPanel;
Panel6: TPanel;
Panel8: TPanel;
Panel13: TPanel;
LBDBScrollBar1: TLBDBScrollBar;
OpenView: TPanel;
Image1: TImage;
SelectInfoDs: TDataSource;
Report: TfrReport;
ReportDataSet: TfrDBDataSet;
Label4: TLabel;
Label6: TLabel;
Label7: TLabel;
Label19: TLabel;
Label20: TLabel;
Label12: TLabel;
Label2: TLabel;
Label3: TLabel;
Label5: TLabel;
SelectInfoData: TSimpleDataSet;
Label8: TLabel;
Label9: TLabel;
Label11: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label10: TLabel;
Label16: TLabel;
procedure FormShow(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Action1Execute(Sender: TObject);
procedure Action2Execute(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
procedure GetSum;
public
{ Public declarations }
end;
var
frmPartSalegainRep: TfrmPartSalegainRep;
SelectSh :TShape;
SType: integer;
const
sql='SELECT A.PARTNAME, (A.QUANTITY-A.REIMBURSEQRY) AS QUANTITY , A.PRICE, '+
'A.CESS, A.AGIO, ((A.QUANTITY-A.REIMBURSEQRY)*A.PRICE) AS TOTALSUM,'+
'A.REIMBURSEQRY, A.COSTPRICE, ((A.QUANTITY-A.REIMBURSEQRY)*A.COSTPRICE) AS COSTPRICESUM, '+
'(((A.QUANTITY-A.REIMBURSEQRY)*A.PRICE)-((A.QUANTITY-A.REIMBURSEQRY)*A.COSTPRICE)) AS GAINSUM, B.BILLCODE,'+
'B.CLIENTNAME FROM PARTSOUTPUTBODY A, PARTSOUTPUTHAND B WHERE '+
'A.BILLCODE=B.BILLCODE AND B.OUTPUTTYPE='+''''+'1'+''''+' AND B.ISAUDITING='+''''+'1'+'''';
implementation
uses uPublicvar, uMain, uDataMo, Tools;
{$R *.dfm}
procedure TfrmPartSalegainRep.GetSum;
var
Sum1, Sum2, Sum3, Sum4: Double;
s: string;
begin
dmData.ExistData.Data:=SelectInfoData.Data;
with dmData.ExistData do
begin
while not Eof do
begin
Sum1:=Sum1+Fieldbyname('QUANTITY').asfloat;
Sum2:=Sum2+Fieldbyname('COSTPRICESUM').asfloat;
Sum3:=Sum3+Fieldbyname('TOTALSUM').asfloat;
Sum4:=Sum4+Fieldbyname('GAINSUM').asfloat;
Next;
end;
Data:=NULL;
end;
Label13.Caption:=FloatToStr(Sum1);
s:=FloatToStr(Sum2);
Label14.Caption:=Addradixpoint(S, 2);
s:=FloatToStr(Sum3);
Label15.Caption:=Addradixpoint(S, 2);
s:=FloatToStr(Sum4);
Label16.Caption:=Addradixpoint(S, 2);
end;
procedure TfrmPartSalegainRep.FormShow(Sender: TObject);
begin
Action2Execute(Sender);
end;
procedure TfrmPartSalegainRep.FormActivate(Sender: TObject);
begin
GetWindowsItem(Caption, Self);
end;
procedure TfrmPartSalegainRep.FormDestroy(Sender: TObject);
begin
WindowItem.Delete(WindowItem.IndexOfObject(Self));
SelectInfoData.Close;
end;
procedure TfrmPartSalegainRep.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
frmPartSalegainRep:=Nil;
end;
procedure TfrmPartSalegainRep.Action1Execute(Sender: TObject);
begin
PrintView('RepPartSaleGainRep.frf', Report);
end;
procedure TfrmPartSalegainRep.Action2Execute(Sender: TObject);
begin
SelectBillType:=5;
SelectBillinfo;
if SelectSql<>'' then
begin
OpenData(Sql+SelectSql+' Order By B.BillCode Desc', SelectInfoData);
GetSum;
end;
end;
procedure TfrmPartSalegainRep.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=27 then Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -