491 lines
14 KiB
ObjectPascal
491 lines
14 KiB
ObjectPascal
|
|
unit U_GRYearPFList_NB;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
|||
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
|
|||
|
|
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
|||
|
|
cxGridDBTableView, cxGrid, DBClient, cxCalendar, cxButtonEdit, cxSplitter,
|
|||
|
|
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
|
|||
|
|
cxTextEdit, cxPC, cxCheckBox, Menus;
|
|||
|
|
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmGRYearPFList_NB = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBMain: TRMDBDataSet;
|
|||
|
|
RMXLSExport1: TRMXLSExport;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1PFDate: TcxGridDBColumn;
|
|||
|
|
v1GRName: TcxGridDBColumn;
|
|||
|
|
v1PFSJNum: TcxGridDBColumn;
|
|||
|
|
TVv1PFNote: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
lbl1: TLabel;
|
|||
|
|
lbl3: TLabel;
|
|||
|
|
GRName: TEdit;
|
|||
|
|
Dept: TEdit;
|
|||
|
|
TVPFSumNum: TcxGridDBColumn;
|
|||
|
|
TVPFStatus: TcxGridDBColumn;
|
|||
|
|
TBTJ: TToolButton;
|
|||
|
|
TBCXTJ: TToolButton;
|
|||
|
|
cxGrid3: TcxGrid;
|
|||
|
|
TV2: TcxGridDBTableView;
|
|||
|
|
TPFYDian: TcxGridDBColumn;
|
|||
|
|
TPFMNum: TcxGridDBColumn;
|
|||
|
|
TPFZPNum: TcxGridDBColumn;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
cxSplitter1: TcxSplitter;
|
|||
|
|
TPFSJNum: TcxGridDBColumn;
|
|||
|
|
TPFXJNum: TcxGridDBColumn;
|
|||
|
|
TPFSumNum: TcxGridDBColumn;
|
|||
|
|
Source1: TDataSource;
|
|||
|
|
Order_Sub: TClientDataSet;
|
|||
|
|
v1PFXJNum: TcxGridDBColumn;
|
|||
|
|
v1GangWei: TcxGridDBColumn;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
v1PFNum: TcxGridDBColumn;
|
|||
|
|
v1Dept: TcxGridDBColumn;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
PFYear: TEdit;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
PFMonth: TEdit;
|
|||
|
|
v1PFYear: TcxGridDBColumn;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
TV3: TcxGridDBTableView;
|
|||
|
|
V2Chker: TcxGridDBColumn;
|
|||
|
|
V2ChkStatus: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
DataSource2: TDataSource;
|
|||
|
|
PF_Sub: TClientDataSet;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
procedure GRNameChange(Sender: TObject);
|
|||
|
|
procedure TBTJClick(Sender: TObject);
|
|||
|
|
procedure TBCXTJClick(Sender: TObject);
|
|||
|
|
procedure TPFSJNumPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure TPFXJNumPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure TV2KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
FInt,PFInt:Integer;
|
|||
|
|
canshu1,canshu2:string;
|
|||
|
|
FNowDate:TDateTime;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
procedure Setstatus();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmGRYearPFList_NB: TfrmGRYearPFList_NB;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun,U_KDInPut,U_ModuleNote, U_ZDYHelp,U_GRYearPFList_Sub,
|
|||
|
|
U_ZDYHelpSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFlist_NB.setstatus();
|
|||
|
|
begin
|
|||
|
|
TBTJ.Visible:=False;
|
|||
|
|
TBCXTJ.Visible:=False;
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:begin
|
|||
|
|
TBTJ.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
1:begin
|
|||
|
|
TBCXTJ.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
2:begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmGRYearPFList_NB:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv1,'н<><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.InitGrid();
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain DO
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.*,B.* from GRYearPF_Sub A ');
|
|||
|
|
sql.Add('inner join OA_Chk B on B.Mainid=A.PFSubid and isnull(OAType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
if cxTabControl1.TabIndex<>0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where A.Filltime>='''+formatdatetime('yyyy-MM-dd',BegDate.Time)+''' ');
|
|||
|
|
sql.Add('and A.Filltime<'''+formatdatetime('yyyy-MM-dd',enddate.Time+1)+''' ');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where isnull(B.ChkStatus,'''')='''' ');
|
|||
|
|
end;
|
|||
|
|
if cxTabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.Add('and isnull(B.ChkStatus,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
end;
|
|||
|
|
sql.Add('and B.Chker='''+trim(DName)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OA_Chk where MainId='''+Trim(Order_Main.fieldbyname('PFSubID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(OAType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,PF_Sub);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,PF_Sub);
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from GRYearPF_SubMX ');
|
|||
|
|
sql.Add('where PFSubID='''+trim(Order_Main.fieldbyname('PFSubID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryCmd,Order_Sub);
|
|||
|
|
SInitCDSData20(ADOQueryCmd,Order_Sub);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.InitForm();
|
|||
|
|
begin
|
|||
|
|
EndDate.Date:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
BegDate.Date:=SGetServerDate(ADOQueryTemp)-7;
|
|||
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',Tv1,'н<><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
setstatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',cxGrid1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i:Integer;
|
|||
|
|
begin
|
|||
|
|
InitForm();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
setstatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.ToolButton4Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fPrintFile:String;
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
if Order_Main.Locate('SSel',True,[])=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf' ;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if Order_Main.FieldByName('SSel').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
{with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from JYOrder_Main_MD where MDID='''+Trim(Order_Main.fieldbyname('MDID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.FieldByName('NotPrint').AsBoolean=True then
|
|||
|
|
begin
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end; }
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryPrint do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select B.OrderNo,B.MPRTCodeName,B.MPRTMF,B.MPRTKZ,C.PRTHX,C.PRTColorNo,C.PRTColor,GangNo=A.GangNo,A.PS,A.Qty,A.QtyUnit,A.MDID ');
|
|||
|
|
SQL.Add(',B.MPRTCode,B.MPRTGY,C.PRTColorEng,A.SelfGangNo');
|
|||
|
|
sql.Add('from JYOrder_Main_MD A');
|
|||
|
|
sql.Add('inner join JYOrder_Main B on A.OrdMainid=B.Mainid');
|
|||
|
|
sql.Add(' inner join JYOrder_Sub C on A.OrdSubid=C.SubId');
|
|||
|
|
sql.Add(' where A.MDID='''+Trim(Order_Main.fieldbyname('MDID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
//RM1.ShowReport;
|
|||
|
|
RM1.PrintReport;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.Tv1CellClick(Sender: TcxCustomGridTableView;
|
|||
|
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from GRYearPF_SubMX ');
|
|||
|
|
sql.Add('where PFSubID='''+trim(Order_Main.fieldbyname('PFSubID').AsString)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryCmd,Order_Sub);
|
|||
|
|
SInitCDSData20(ADOQueryCmd,Order_Sub);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OA_Chk where MainId='''+Trim(Order_Main.fieldbyname('PFSubID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(OAType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryTemp,PF_Sub);
|
|||
|
|
SInitCDSData20(ADOQueryTemp,PF_Sub);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.GRNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active=False then Exit;
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TBTJClick(Sender: TObject);
|
|||
|
|
var maxno: string;
|
|||
|
|
begin
|
|||
|
|
ToolBar1.SetFocus;
|
|||
|
|
if Order_Main.IsEmpty then exit;
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update GRYearPF_SubMX set PFZPNum='''+trim(Order_Sub.FieldByName('PFZPNum').AsString)+'''');
|
|||
|
|
if Order_Sub.FieldByName('PFSJNum').AsString<>'' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(',PFSJNum='''+trim(Order_Sub.FieldByName('PFSJNum').AsString)+''' ');
|
|||
|
|
end;
|
|||
|
|
if Order_Sub.FieldByName('PFXJNum').AsString<>'' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(',PFXJNum='''+trim(Order_Sub.FieldByName('PFXJNum').AsString)+''' ');
|
|||
|
|
end;
|
|||
|
|
SQL.Add(',PFSumNum=PFZPNum+isnull(PFSJNum,0)+isnull(PFXJNum,0) ');
|
|||
|
|
sql.Add('where PFSubMXID='''+trim(Order_Sub.FieldByName('PFSubMXID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update GRYearPF_Sub set ');
|
|||
|
|
sql.Add('PFSJNum=(select isnull(sum(PFSJNum),0) from GRYearPF_SubMX where PFSubid=GRYearPF_Sub.PFsubid)');
|
|||
|
|
sql.Add(',PFXJNum=(select isnull(sum(PFXJNum),0) from GRYearPF_SubMX where PFSubid=GRYearPF_Sub.PFsubid) ');
|
|||
|
|
sql.add('where PFSubID='''+trim(Order_Main.FieldByName('PFSubID').AsString)+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update OA_Chk set ChkStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.Add('where CKID='''+trim(Order_Main.fieldbyname('CKID').asstring)+''' ');
|
|||
|
|
sql.Add(' and isnull(OAType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from OA_Chk ');
|
|||
|
|
sql.Add('where Mainid='''+trim(Order_Main.fieldbyname('PFSubid').asstring)+''' ');
|
|||
|
|
sql.Add('and isnull(OAType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.Add('and isnull(Chkstatus,'''')<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update GRYearPF_Sub set PFStatus=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'', ');
|
|||
|
|
sql.Add('PFSumNum=(case when isnull(PFSJNum,0)<>0 and isnull(PFXJNum,0)<>0 then ');
|
|||
|
|
sql.Add('(PFNum+isnull(PFXJNum,0)+isnull(PFSJNum,0))/3 ');
|
|||
|
|
sql.Add('else (PFNum+isnull(PFXJNum,0)+isnull(PFSJNum,0))/2 end) ');
|
|||
|
|
sql.Add('where PFSubID='''+trim(Order_Main.fieldbyname('PFSubID').asstring)+''' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TBCXTJClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then exit;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',1)=2 then Exit;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update OA_Chk set Chkstatus='''' where CKID='''+trim(Order_Main.fieldbyname('CKID').AsString)+'''');
|
|||
|
|
sql.Add(' and isnull(OAType,'''')=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update GRYearPF_Sub set PFStatus=''<27><><EFBFBD>ύ'' ');
|
|||
|
|
sql.Add('where PFSubID='''+trim(Order_Main.fieldbyname('PFSubID').asstring)+''' ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TPFSJNumPropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var mvalue: string;
|
|||
|
|
begin
|
|||
|
|
{mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
if strtofloat(mvalue)>Order_Sub.fieldbyname('PFMNum').asfloat then
|
|||
|
|
begin
|
|||
|
|
application.messagebox('<27><><EFBFBD>ֲ<EFBFBD><D6B2>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
mvalue:='';
|
|||
|
|
end;
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('PFSJNum').Value:=Trim(mvalue);
|
|||
|
|
FieldByName('PFSumNum').Value:=fieldbyname('PFZPNum').AsFloat+fieldbyname('PFSJNum').AsFloat+fieldbyname('PFXJNum').AsFloat;
|
|||
|
|
Post;
|
|||
|
|
end;}
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TPFXJNumPropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var mvalue: string;
|
|||
|
|
begin
|
|||
|
|
{mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
if strtofloat(mvalue)>Order_Sub.fieldbyname('PFMNum').asfloat then
|
|||
|
|
begin
|
|||
|
|
application.messagebox('<27><><EFBFBD>ֲ<EFBFBD><D6B2>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ');
|
|||
|
|
mvalue:='';
|
|||
|
|
end;
|
|||
|
|
with Order_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('PFXJNum').Value:=Trim(mvalue);
|
|||
|
|
FieldByName('PFSumNum').Value:=fieldbyname('PFZPNum').AsFloat+fieldbyname('PFSJNum').AsFloat+fieldbyname('PFXJNum').AsFloat;
|
|||
|
|
Post;
|
|||
|
|
end;}
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmGRYearPFList_NB.TV2KeyUp(Sender: TObject; var Key: Word;
|
|||
|
|
Shift: TShiftState);
|
|||
|
|
begin
|
|||
|
|
TV2.DataController.GotoNext;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|