1414 lines
42 KiB
ObjectPascal
1414 lines
42 KiB
ObjectPascal
|
|
unit U_CYGL;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
|||
|
|
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
|||
|
|
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
|||
|
|
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
|||
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
|||
|
|
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
|||
|
|
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
|||
|
|
cxTextEdit, cxDBLookupComboBox, ComObj, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
|
cxNavigator, U_BaseList, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges,
|
|||
|
|
dxBarBuiltInMenu, cxPC, dxSkinOffice2013White, dxSkinWXI,
|
|||
|
|
dxScrollbarAnnotations, Vcl.Menus;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
Tfrmcygl = class(TfrmBaseList)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
btnAdd: TToolButton;
|
|||
|
|
btnEdit: TToolButton;
|
|||
|
|
TBDel: TToolButton;
|
|||
|
|
btnChk: TToolButton;
|
|||
|
|
btnReChk: TToolButton;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
DS_1: TDataSource;
|
|||
|
|
CDS_1: TClientDataSet;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
GPM_1: TcxGridPopupMenu;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
|
Tv1Column15: TcxGridDBColumn;
|
|||
|
|
Tv1Column16: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
Panel3: TPanel;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
TV2: TcxGridDBTableView;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
DS_2: TDataSource;
|
|||
|
|
CDS_2: TClientDataSet;
|
|||
|
|
CDS_3: TClientDataSet;
|
|||
|
|
DS_3: TDataSource;
|
|||
|
|
cxGrid3: TcxGrid;
|
|||
|
|
TV3: TcxGridDBTableView;
|
|||
|
|
cxGridLevel3: TcxGridLevel;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
ADOQuery2: TADOQuery;
|
|||
|
|
GPM_2: TcxGridPopupMenu;
|
|||
|
|
GPM_3: TcxGridPopupMenu;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
|
TV3Column1: TcxGridDBColumn;
|
|||
|
|
TV3Column2: TcxGridDBColumn;
|
|||
|
|
TV3Column3: TcxGridDBColumn;
|
|||
|
|
TV3Column4: TcxGridDBColumn;
|
|||
|
|
TV3Column5: TcxGridDBColumn;
|
|||
|
|
TV3Column6: TcxGridDBColumn;
|
|||
|
|
TV3Column7: TcxGridDBColumn;
|
|||
|
|
TV3Column8: TcxGridDBColumn;
|
|||
|
|
TV3Column9: TcxGridDBColumn;
|
|||
|
|
TV3Column10: TcxGridDBColumn;
|
|||
|
|
TV3Column11: TcxGridDBColumn;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
TV2Column1: TcxGridDBColumn;
|
|||
|
|
TV2Column2: TcxGridDBColumn;
|
|||
|
|
TV2Column3: TcxGridDBColumn;
|
|||
|
|
TV2Column4: TcxGridDBColumn;
|
|||
|
|
TV2Column5: TcxGridDBColumn;
|
|||
|
|
TV2Column6: TcxGridDBColumn;
|
|||
|
|
TV2Column7: TcxGridDBColumn;
|
|||
|
|
TV2Column8: TcxGridDBColumn;
|
|||
|
|
TV2Column9: TcxGridDBColumn;
|
|||
|
|
TV2Column10: TcxGridDBColumn;
|
|||
|
|
TV2Column11: TcxGridDBColumn;
|
|||
|
|
TV2Column12: TcxGridDBColumn;
|
|||
|
|
TV2Column13: TcxGridDBColumn;
|
|||
|
|
TV2Column14: TcxGridDBColumn;
|
|||
|
|
TV2Column15: TcxGridDBColumn;
|
|||
|
|
TV2Column16: TcxGridDBColumn;
|
|||
|
|
TV2Column17: TcxGridDBColumn;
|
|||
|
|
TV2Column18: TcxGridDBColumn;
|
|||
|
|
TV2Column19: TcxGridDBColumn;
|
|||
|
|
TV2Column20: TcxGridDBColumn;
|
|||
|
|
TV2Column21: TcxGridDBColumn;
|
|||
|
|
TV2Column22: TcxGridDBColumn;
|
|||
|
|
TV2Column23: TcxGridDBColumn;
|
|||
|
|
TV2Column24: TcxGridDBColumn;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
ADOQueryTemp2: TADOQuery;
|
|||
|
|
ADOQueryTemp3: TADOQuery;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
KHNumber: TEdit;
|
|||
|
|
Tv1Column18: TcxGridDBColumn;
|
|||
|
|
Tv1Column19: TcxGridDBColumn;
|
|||
|
|
TV2Column25: TcxGridDBColumn;
|
|||
|
|
TV2Column27: TcxGridDBColumn;
|
|||
|
|
TV2Column28: TcxGridDBColumn;
|
|||
|
|
TV2Column29: TcxGridDBColumn;
|
|||
|
|
TV2Column30: TcxGridDBColumn;
|
|||
|
|
ToolButton5: TToolButton;
|
|||
|
|
ToolButton6: TToolButton;
|
|||
|
|
Tv1Column20: TcxGridDBColumn;
|
|||
|
|
Tv1Column21: TcxGridDBColumn;
|
|||
|
|
Tv1Column22: TcxGridDBColumn;
|
|||
|
|
TV3Column12: TcxGridDBColumn;
|
|||
|
|
ToolButton7: TToolButton;
|
|||
|
|
ToolButton8: TToolButton;
|
|||
|
|
ToolButton9: TToolButton;
|
|||
|
|
ToolButton10: TToolButton;
|
|||
|
|
Tv1Column23: TcxGridDBColumn;
|
|||
|
|
Tv1Column24: TcxGridDBColumn;
|
|||
|
|
CheckBox2: TCheckBox;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
ZGBegDate: TDateTimePicker;
|
|||
|
|
ZGEndDate: TDateTimePicker;
|
|||
|
|
CheckBox1: TCheckBox;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
XGYJ: TEdit;
|
|||
|
|
Button1: TButton;
|
|||
|
|
Button2: TButton;
|
|||
|
|
ToolButton11: TToolButton;
|
|||
|
|
Tv1Column25: TcxGridDBColumn;
|
|||
|
|
Tv1Column26: TcxGridDBColumn;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
KHName: TEdit;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
BZ: TEdit;
|
|||
|
|
Tv1Column27: TcxGridDBColumn;
|
|||
|
|
Tv1Column28: TcxGridDBColumn;
|
|||
|
|
Tv1Column29: TcxGridDBColumn;
|
|||
|
|
Tv1Column30: TcxGridDBColumn;
|
|||
|
|
PopupMenu1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
ZDR: TEdit;
|
|||
|
|
Tv1Column31: TcxGridDBColumn;
|
|||
|
|
TV3Column13: TcxGridDBColumn;
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure btnAddClick(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure btnEditClick(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
procedure TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure btnChkClick(Sender: TObject);
|
|||
|
|
procedure btnReChkClick(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
|
procedure ToolButton9Click(Sender: TObject);
|
|||
|
|
procedure ToolButton10Click(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
procedure ToolButton11Click(Sender: TObject);
|
|||
|
|
procedure Button2Click(Sender: TObject);
|
|||
|
|
procedure Button1Click(Sender: TObject);
|
|||
|
|
procedure KHNumberKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure KHNumberChange(Sender: TObject);
|
|||
|
|
procedure KHNameChange(Sender: TObject);
|
|||
|
|
procedure BZChange(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure Initmain();
|
|||
|
|
procedure InitSub();
|
|||
|
|
procedure SetStatus();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FAuthority: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmcygl: Tfrmcygl;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CYD, U_CYSZ;
|
|||
|
|
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure Tfrmcygl.SetStatus();
|
|||
|
|
begin
|
|||
|
|
btnAdd.Visible := false;
|
|||
|
|
btnEdit.Visible := false;
|
|||
|
|
ToolButton3.Visible := false;
|
|||
|
|
ToolButton4.Visible := false;
|
|||
|
|
TBDel.Visible := false;
|
|||
|
|
btnChk.Visible := false;
|
|||
|
|
btnReChk.Visible := false;
|
|||
|
|
ToolButton5.Visible := false;
|
|||
|
|
ToolButton6.Visible := false;
|
|||
|
|
ToolButton7.Visible := false;
|
|||
|
|
ToolButton8.Visible := false;
|
|||
|
|
ToolButton9.Visible := false;
|
|||
|
|
ToolButton10.Visible := false;
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:
|
|||
|
|
begin
|
|||
|
|
// ToolButton7.Visible := true;
|
|||
|
|
ToolButton9.Visible := true;
|
|||
|
|
btnAdd.Visible := true;
|
|||
|
|
btnEdit.Visible := true;
|
|||
|
|
ToolButton3.Visible := true;
|
|||
|
|
ToolButton4.Visible := true;
|
|||
|
|
TBDel.Visible := true;
|
|||
|
|
end;
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
ToolButton10.Visible := true;
|
|||
|
|
if trim(DName) = 'ADMIN' then
|
|||
|
|
begin
|
|||
|
|
ToolButton7.Visible := True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// btnReChk.Visible := True;
|
|||
|
|
// ToolButton5.Visible := True;
|
|||
|
|
end;
|
|||
|
|
2:
|
|||
|
|
begin
|
|||
|
|
if trim(DName) = 'ADMIN' then
|
|||
|
|
begin
|
|||
|
|
btnReChk.Visible := True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ToolButton5.Visible := True;
|
|||
|
|
end;
|
|||
|
|
3:
|
|||
|
|
begin
|
|||
|
|
ToolButton6.Visible := True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.Initmain();
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
CDS_2.EmptyDataSet;
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp2 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select *,convert(varchar(10),A.ZGfinishdate,120) as ZGfinishdate1 from BS_CYGL_main A ');
|
|||
|
|
sql.Add('where BIOSID =' + quotedstr((CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryTemp2, CDS_2);
|
|||
|
|
SInitCDSData(ADOQueryTemp2, CDS_2);
|
|||
|
|
TV2.DataController.Filter.Clear;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.InitSub();
|
|||
|
|
begin
|
|||
|
|
if CDS_2.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
CDS_3.EmptyDataSet;
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp3 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from BS_CYGL_sub A ');
|
|||
|
|
sql.Add('where mainid =' + quotedstr((CDS_2.fieldbyname('mainid').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryTemp3, CDS_3);
|
|||
|
|
SInitCDSData(ADOQueryTemp3, CDS_3);
|
|||
|
|
TV2.DataController.Filter.Clear;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.KHNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select B.YSKTime from BS_CYGL_CY A INNER JOIN BS_CYGL_main B on B.BIOSID=A.BIOSID ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select AA.* ,row_number() over(order by CJdate) as NO ');
|
|||
|
|
sql.Add(',DJStatus=case when (select getDate())>AA.YSKTime and status =''1'' then 1 else 0 end ');
|
|||
|
|
sql.Add(',DJStatus1=case when THZT =''1'' then 1 else 0 end ');
|
|||
|
|
sql.Add('from (select A.*,convert(varchar(10),B.YSKTime,120) as YSKTime,convert(varchar(10),B.ZGfinishdate,120) as ZGfinishdate,B.ZYSK,ZSL=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',ZTJ=(select sum(Zvolume) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPYCYQTY=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPWCYQTY=isnull((select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)-isnull((select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)');
|
|||
|
|
// sql.Add(',YSKTime=(select YSKTime from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',ZYSK=(select ZYSK from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPZQTY=(select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add('from BS_CYGL_CY A LEFT JOIN BS_CYGL_Main B ON B.BIOSID=A.BIOSID ) AA');
|
|||
|
|
if CheckBox2.Checked = true then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where CJdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
|
sql.Add('and CJdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
|
end;
|
|||
|
|
if CheckBox1.Checked = true then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where ZGfinishdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGBegDate.DateTime)));
|
|||
|
|
sql.Add('and ZGfinishdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGenddate.DateTime + 1)));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''0''');
|
|||
|
|
end;
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''8''');
|
|||
|
|
end;
|
|||
|
|
// 2:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''6''');
|
|||
|
|
// end;
|
|||
|
|
2:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''1''');
|
|||
|
|
end;
|
|||
|
|
3:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if trim(KHName.text) <> '' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and AA.KHName like ''%' + trim(KHName.text) + '%'' ');
|
|||
|
|
end;
|
|||
|
|
// showmessage(sql.text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
TV1.DataController.Filter.Clear;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.KHNumberChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ToolButton2.Click;
|
|||
|
|
// try
|
|||
|
|
// ADOQueryMain.DisableControls;
|
|||
|
|
//
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// Filtered := False;
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select B.YSKTime from BS_CYGL_CY A INNER JOIN BS_CYGL_main B on B.BIOSID=A.BIOSID ');
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// with ADOQueryMain do
|
|||
|
|
// begin
|
|||
|
|
// Filtered := False;
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select AA.* ,row_number() over(order by CJdate) as NO ');
|
|||
|
|
// sql.Add(',DJStatus=case when (select getDate())>AA.YSKTime and status =''1'' then 1 else 0 end ');
|
|||
|
|
// sql.Add(',DJStatus1=case when THZT =''1'' then 1 else 0 end ');
|
|||
|
|
// sql.Add('from (select A.*,convert(varchar(10),B.YSKTime,120) as YSKTime,convert(varchar(10),B.ZGfinishdate,120) as ZGfinishdate,B.ZYSK,ZSL=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',ZTJ=(select sum(Zvolume) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',CPYCYQTY=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',CPWCYQTY=isnull((select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)-isnull((select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)');
|
|||
|
|
//// sql.Add(',YSKTime=(select YSKTime from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
//// sql.Add(',ZYSK=(select ZYSK from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',CPZQTY=(select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add('from BS_CYGL_CY A LEFT JOIN BS_CYGL_Main B ON B.BIOSID=A.BIOSID ) AA');
|
|||
|
|
// if CheckBox2.Checked = true then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add('where CJdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
|
// sql.Add('and CJdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
|
// end;
|
|||
|
|
// if CheckBox1.Checked = true then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add('where ZGfinishdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGBegDate.DateTime)));
|
|||
|
|
// sql.Add('and ZGfinishdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGenddate.DateTime + 1)));
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// case cxTabControl1.TabIndex of
|
|||
|
|
// 0:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''0''');
|
|||
|
|
// end;
|
|||
|
|
// 1:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''8''');
|
|||
|
|
// end;
|
|||
|
|
//// 2:
|
|||
|
|
//// begin
|
|||
|
|
//// sql.Add(' and isnull(AA.status,''0'')=''6''');
|
|||
|
|
//// end;
|
|||
|
|
// 2:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''1''');
|
|||
|
|
// end;
|
|||
|
|
// 3:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
// if trim(KHNumber.text) <> '' then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and AA.KHNumber like ''%' + trim(KHNumber.text) + '%'' ');
|
|||
|
|
// end;
|
|||
|
|
//// showmessage(sql.text);
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
// SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
// SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
// finally
|
|||
|
|
// ADOQueryMain.EnableControls;
|
|||
|
|
// TV1.DataController.Filter.Clear;
|
|||
|
|
//
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.KHNumberKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
// try
|
|||
|
|
// ADOQueryMain.DisableControls;
|
|||
|
|
//
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// Filtered := False;
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select B.YSKTime from BS_CYGL_CY A INNER JOIN BS_CYGL_main B on B.BIOSID=A.BIOSID ');
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// with ADOQueryMain do
|
|||
|
|
// begin
|
|||
|
|
// Filtered := False;
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select AA.* ,row_number() over(order by CJdate) as NO ');
|
|||
|
|
// sql.Add(',DJStatus=case when (select getDate())>AA.YSKTime and status =''1'' then 1 else 0 end ');
|
|||
|
|
// sql.Add(',DJStatus1=case when THZT =''1'' then 1 else 0 end ');
|
|||
|
|
// sql.Add('from (select A.*,convert(varchar(10),B.YSKTime,120) as YSKTime,convert(varchar(10),B.ZGfinishdate,120) as ZGfinishdate,B.ZYSK,ZSL=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',ZTJ=(select sum(Zvolume) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',CPYCYQTY=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',CPWCYQTY=isnull((select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)-isnull((select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)');
|
|||
|
|
//// sql.Add(',YSKTime=(select YSKTime from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
//// sql.Add(',ZYSK=(select ZYSK from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',CPZQTY=(select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add('from BS_CYGL_CY A LEFT JOIN BS_CYGL_Main B ON B.BIOSID=A.BIOSID ) AA');
|
|||
|
|
// if CheckBox2.Checked = true then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add('where CJdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
|
// sql.Add('and CJdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
|
// end;
|
|||
|
|
// if CheckBox1.Checked = true then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add('where ZGfinishdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGBegDate.DateTime)));
|
|||
|
|
// sql.Add('and ZGfinishdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGenddate.DateTime + 1)));
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// case cxTabControl1.TabIndex of
|
|||
|
|
// 0:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''0''');
|
|||
|
|
// end;
|
|||
|
|
// 1:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''8''');
|
|||
|
|
// end;
|
|||
|
|
//// 2:
|
|||
|
|
//// begin
|
|||
|
|
//// sql.Add(' and isnull(AA.status,''0'')=''6''');
|
|||
|
|
//// end;
|
|||
|
|
// 2:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''1''');
|
|||
|
|
// end;
|
|||
|
|
// 3:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
// if trim(KHNumber.text) <> '' then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and AA.KHNumber like''%' + trim(KHNumber.text) + '%'' ');
|
|||
|
|
// end;
|
|||
|
|
// if (trim(Dname) <> 'ADMIN') or (trim(Dname) <> '<27><><EFBFBD><EFBFBD>') then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add('and Filler=''' + trim(Dname) + ''' ');
|
|||
|
|
// end;
|
|||
|
|
//// showmessage(sql.text);
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
// SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
// SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
// finally
|
|||
|
|
// ADOQueryMain.EnableControls;
|
|||
|
|
// TV1.DataController.Filter.Clear;
|
|||
|
|
//
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
SelOKNo(CDS_1, True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
SelOKNo(CDS_1, false);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.InitGrid();
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
WSql := SGetFilters(Panel1, 1, 2);
|
|||
|
|
if trim(WSql) <> '' then
|
|||
|
|
begin
|
|||
|
|
WSql := ' and ' + trim(WSql);
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
Tv1.BeginUpdate();
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select B.YSKTime from BS_CYGL_CY A INNER JOIN BS_CYGL_main B on B.BIOSID=A.BIOSID ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select AA.* ,row_number() over(order by CJdate) as NO ');
|
|||
|
|
sql.Add(',DJStatus=case when (select getDate())>AA.YSKTime and status =''1'' then 1 else 0 end ');
|
|||
|
|
sql.Add(',DJStatus1=case when THZT =''1'' then 1 else 0 end ');
|
|||
|
|
sql.Add('from (select A.*,convert(varchar(10),B.YSKTime,120) as YSKTime,convert(varchar(10),B.ZGfinishdate,120) as ZGfinishdate,B.ZYSK,ZSL=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',ZJSJC=(select top 1 CoAbbrName from BS_Company B where B.CoName=A.ZJS and B.Valid=''Y'' )');
|
|||
|
|
sql.Add(',ZTJ=(select sum(Zvolume) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPYCYQTY=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPWCYQTY=isnull((select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)-isnull((select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)');
|
|||
|
|
// sql.Add(',YSKTime=(select YSKTime from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',ZYSK=(select ZYSK from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
|
|||
|
|
sql.Add(',CPZQTY=(select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',ZBoxs=(select sum(Boxs) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add('from BS_CYGL_CY A LEFT JOIN BS_CYGL_Main B ON B.BIOSID=A.BIOSID ) AA');
|
|||
|
|
if CheckBox2.Checked = true then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where CJdate >=' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
|
sql.Add('and CJdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
|
end;
|
|||
|
|
if CheckBox1.Checked = true then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where ZGfinishdate >=' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGBegDate.DateTime)));
|
|||
|
|
sql.Add('and ZGfinishdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGenddate.DateTime + 1)));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''0''');
|
|||
|
|
end;
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''8''');
|
|||
|
|
end;
|
|||
|
|
// 2:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''6''');
|
|||
|
|
// end;
|
|||
|
|
2:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''1''');
|
|||
|
|
end;
|
|||
|
|
3:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if (trim(Dname) <> 'ADMIN') and (trim(Dname) <> '<27><><EFBFBD><EFBFBD>') and (trim(DCode) <> '014') then
|
|||
|
|
begin
|
|||
|
|
sql.Add('and Filler=''' + trim(Dname) + ''' ');
|
|||
|
|
end;
|
|||
|
|
sql.Add((WSql));
|
|||
|
|
sql.Add(' order by ZGfinishdate desc ');
|
|||
|
|
// showmessage(sql.text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
Tv1.DataController.Filter.Refresh;
|
|||
|
|
Tv1.EndUpdate;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.btnAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
try
|
|||
|
|
frmCYD := TfrmCYD.Create(Application);
|
|||
|
|
with frmCYD do
|
|||
|
|
begin
|
|||
|
|
// FCOID := '';
|
|||
|
|
// fFlileFlag := self.fFlileFlag;
|
|||
|
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FBIOSID := '';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCYD.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.btnChkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''1'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.btnEditClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmCYD := TfrmCYD.Create(Application);
|
|||
|
|
with frmCYD do
|
|||
|
|
begin
|
|||
|
|
// FCOID := '';
|
|||
|
|
// fFlileFlag := self.fFlileFlag;
|
|||
|
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FBIOSID := Trim(Self.CDS_1.fieldbyname('BIOSID').AsString);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCYD.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.btnReChkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
CDS_1.DisableControls;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_1.FieldByName('SSel').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''8'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// try
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update BS_CYGL_CY SET status=''8'' ');
|
|||
|
|
// sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
// application.MessageBox('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// except
|
|||
|
|
// application.MessageBox('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// end;
|
|||
|
|
// TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.Button1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update BS_CYGL_CY ');
|
|||
|
|
sql.Add('Set XGYJ=''' + Trim(XGYJ.text) + '''');
|
|||
|
|
sql.Add(',THZT=''1'',Status=''0''');
|
|||
|
|
sql.Add('where BIOSID=''' + Trim(CDS_1.fieldbyname('BIOSID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27>˻سɹ<D8B3>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
Panel4.Visible := False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.Button2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Panel4.Visible := False;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.BZChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select B.YSKTime from BS_CYGL_CY A INNER JOIN BS_CYGL_main B on B.BIOSID=A.BIOSID ');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select AA.* ,row_number() over(order by CJdate) as NO ');
|
|||
|
|
sql.Add(',DJStatus=case when (select getDate())>AA.YSKTime and status =''1'' then 1 else 0 end ');
|
|||
|
|
sql.Add(',DJStatus1=case when THZT =''1'' then 1 else 0 end ');
|
|||
|
|
sql.Add('from (select A.*,convert(varchar(10),B.YSKTime,120) as YSKTime,convert(varchar(10),B.ZGfinishdate,120) as ZGfinishdate,B.ZYSK,ZSL=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',ZTJ=(select sum(Zvolume) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPYCYQTY=(select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPWCYQTY=isnull((select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)-isnull((select sum(BCdecimalQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID ),0)');
|
|||
|
|
// sql.Add(',YSKTime=(select YSKTime from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
// sql.Add(',ZYSK=(select ZYSK from BS_CYGL_main B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add(',CPZQTY=(select sum(DDQTY) from BS_CYGL_Sub B where B.BIOSID=A.BIOSID )');
|
|||
|
|
sql.Add('from BS_CYGL_CY A LEFT JOIN BS_CYGL_Main B ON B.BIOSID=A.BIOSID ) AA');
|
|||
|
|
if CheckBox2.Checked = true then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where CJdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime)));
|
|||
|
|
sql.Add('and CJdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1)));
|
|||
|
|
end;
|
|||
|
|
if CheckBox1.Checked = true then
|
|||
|
|
begin
|
|||
|
|
sql.Add('where ZGfinishdate >' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGBegDate.DateTime)));
|
|||
|
|
sql.Add('and ZGfinishdate <=' + quotedstr(FormatDateTime('yyyy-MM-dd', ZGenddate.DateTime + 1)));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''0''');
|
|||
|
|
end;
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''8''');
|
|||
|
|
end;
|
|||
|
|
// 2:
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and isnull(AA.status,''0'')=''6''');
|
|||
|
|
// end;
|
|||
|
|
2:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''1''');
|
|||
|
|
end;
|
|||
|
|
3:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if trim(BZ.text) <> '' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and AA.BZ like ''%' + trim(BZ.text) + '%'' ');
|
|||
|
|
end;
|
|||
|
|
// showmessage(sql.text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
TV1.DataController.Filter.Clear;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if CheckBox1.Checked then
|
|||
|
|
begin
|
|||
|
|
// CheckBox1.Checked := true;
|
|||
|
|
CheckBox2.Checked := false;
|
|||
|
|
InitGrid();
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
CheckBox1.Checked := false;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.CheckBox2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if CheckBox2.Checked then
|
|||
|
|
begin
|
|||
|
|
// CheckBox2.Checked := true;
|
|||
|
|
CheckBox1.Checked := false;
|
|||
|
|
InitGrid();
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
CheckBox2.Checked := false;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
SetStatus();
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
|
BegDate.DateTime := EndDate.DateTime - 90;
|
|||
|
|
ZGEndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
|
ZGBegDate.DateTime := EndDate.DateTime - 90;
|
|||
|
|
FAuthority := trim(fParameters1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frmcygl := nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
ReadCxGrid(trim(self.caption) + 'Tv1', Tv1, '<27><><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>');
|
|||
|
|
ReadCxGrid(trim(self.caption) + 'Tv2', Tv2, '<27><><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>');
|
|||
|
|
ReadCxGrid(trim(self.caption) + 'Tv3', Tv3, '<27><><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>');
|
|||
|
|
SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
Tv1.Controller.FocusedRowIndex := 0;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.TBDelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update BS_Contract_Main ');
|
|||
|
|
sql.Add('Set CYZT=''0''');
|
|||
|
|
sql.Add('where ConMId=''' + Trim(CDS_1.fieldbyname('FConMId').AsString) + '''');
|
|||
|
|
// ShowMessage(sql.text);
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
// sql.add('insert into Bs_Contract_Main_DEL select * from BS_Contract_Main where ConMid=''' + trim(CDS_1.fieldbyname('ConMid').AsString) + ''' ');
|
|||
|
|
// sql.add('insert into Bs_Contract_sub_DEL select * from BS_Contract_sub where ConMid=''' + trim(CDS_1.fieldbyname('ConMid').AsString) + ''' ');
|
|||
|
|
sql.Add('DELETE from BS_CYGL_CY where BIOSID=''' + trim(CDS_1.fieldbyname('BIOSID').AsString) + ''' ');
|
|||
|
|
sql.Add('DELETE from BS_CYGL_Main where BIOSID=''' + trim(CDS_1.fieldbyname('BIOSID').AsString) + ''' ');
|
|||
|
|
sql.Add('DELETE from BS_CYGL_sub where BIOSID=''' + trim(CDS_1.fieldbyname('BIOSID').AsString) + ''' ');
|
|||
|
|
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton10Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
CDS_1.DisableControls;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_1.FieldByName('SSel').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''0'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// try
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update BS_CYGL_CY SET status=''0'' ');
|
|||
|
|
// sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// except
|
|||
|
|
// application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// end;
|
|||
|
|
// TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton11Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if (trim(DName) <> 'ADMIN') and (trim(DName) <> '<27><>õ') then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˺<EFBFBD><CBBA><EFBFBD><EFBFBD>˻<EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
Panel4.Left := (self.Width - Panel4.Width) div 2;
|
|||
|
|
Panel4.Visible := true;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
WriteCxGrid(trim(self.caption) + 'Tv1', Tv1, '<27><><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>');
|
|||
|
|
writeCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>');
|
|||
|
|
writeCxGrid(trim(Self.Caption) + 'tv3', Tv3, '<27><><EFBFBD>˹<EFBFBD><CBB9><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmCYSZ := TfrmCYSZ.Create(Application);
|
|||
|
|
with frmCYSZ do
|
|||
|
|
begin
|
|||
|
|
// FCOID := '';
|
|||
|
|
// fFlileFlag := self.fFlileFlag;
|
|||
|
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
Fmainid := '';
|
|||
|
|
FFBIOSID := Trim(Self.CDS_1.fieldbyname('BIOSID').AsString);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCYSZ.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton4Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
// if CDS_1.IsEmpty then
|
|||
|
|
// Exit;
|
|||
|
|
//// ShowMessage(Trim(CDS_1.fieldbyname('Filler').AsString));
|
|||
|
|
//// ShowMessage(Trim(DName));
|
|||
|
|
// if Trim(CDS_1.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
frmCYSZ := TfrmCYSZ.Create(Application);
|
|||
|
|
with frmCYSZ do
|
|||
|
|
begin
|
|||
|
|
// FCOID := '';
|
|||
|
|
// fFlileFlag := self.fFlileFlag;
|
|||
|
|
PState := '<27><EFBFBD>';
|
|||
|
|
Fmainid := Trim(Self.CDS_2.fieldbyname('mainid').AsString);
|
|||
|
|
FFBIOSID := Trim(Self.CDS_1.fieldbyname('BIOSID').AsString);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCYSZ.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''9'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton6Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''1'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton7Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
CDS_1.DisableControls;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_1.FieldByName('SSel').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''1'',THZT=''0'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// try
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update BS_CYGL_CY SET status=''1'',THZT=''0'' ');
|
|||
|
|
// sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
// application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// except
|
|||
|
|
// application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// end;
|
|||
|
|
// TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton8Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''8'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
except
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.ToolButton9Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7><EFBFBD>ύ<EFBFBD><E1BDBB>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
CDS_1.DisableControls;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_1.FieldByName('SSel').AsBoolean = True then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('update BS_CYGL_CY SET status=''8'' ');
|
|||
|
|
sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
application.MessageBox('<27>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// try
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update BS_CYGL_CY SET status=''8'' ');
|
|||
|
|
// sql.Add('where BIOSID=' + quotedstr(trim(CDS_1.fieldbyname('BIOSID').AsString)));
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
// application.MessageBox('<27>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// except
|
|||
|
|
// application.MessageBox('<27>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
// end;
|
|||
|
|
// TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
// if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('DJstatus').Index] = '1' then
|
|||
|
|
// ACanvas.Brush.Color := clRed;
|
|||
|
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('DJstatus1').Index] = '1' then
|
|||
|
|
ACanvas.Brush.Color := clAQUA;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
Initmain();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure Tfrmcygl.TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
InitSub();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|