D7wmguihua/桂华管理系统/U_SCGYSet.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

1015 lines
27 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_SCGYSet;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, ADODB, DBClient,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
cxControls, cxGridCustomView, cxGrid, cxPC, StdCtrls, ComCtrls, ExtCtrls,
ToolWin, cxCheckBox, Menus, cxGridBandedTableView,
cxGridDBBandedTableView, cxCalendar, cxButtonEdit, cxTextEdit;
type
TfrmSCGYSet = class(TForm)
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
Panel1: TPanel;
Label1: TLabel;
Label3: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
OrderNo: TEdit;
cxTabControl1: TcxTabControl;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
cxGrid1Level4: TcxGridLevel;
cxGridPopupMenu1: TcxGridPopupMenu;
CDS_Main: TClientDataSet;
DataSource1: TDataSource;
ADOTemp: TADOQuery;
ADOCmd: TADOQuery;
ADOQueryMain: TADOQuery;
cxGridPopupMenu2: TcxGridPopupMenu;
DSKB: TDataSource;
CDS_Sub: TClientDataSet;
ToolButton1: TToolButton;
v1Column2: TcxGridDBColumn;
ToolButton2: TToolButton;
v1Column8: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
ScrollBox1: TScrollBox;
cxGrid4: TcxGrid;
TvKB: TcxGridDBBandedTableView;
cxGridDBBandedColumn4: TcxGridDBBandedColumn;
cxGridDBBandedColumn5: TcxGridDBBandedColumn;
cxGridDBBandedColumn6: TcxGridDBBandedColumn;
cxGridLevel3: TcxGridLevel;
cxGrid3: TcxGrid;
TVPW: TcxGridDBBandedTableView;
cxGridDBBandedColumn1: TcxGridDBBandedColumn;
cxGridDBBandedColumn2: TcxGridDBBandedColumn;
cxGridDBBandedColumn3: TcxGridDBBandedColumn;
cxGridLevel2: TcxGridLevel;
cxGrid2: TcxGrid;
TvJS: TcxGridDBBandedTableView;
v2Column1: TcxGridDBBandedColumn;
v2Column2: TcxGridDBBandedColumn;
v2Column3: TcxGridDBBandedColumn;
cxGridLevel1: TcxGridLevel;
ToolBar2: TToolBar;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
VPWColumn1: TcxGridDBBandedColumn;
VPWColumn2: TcxGridDBBandedColumn;
VPWColumn3: TcxGridDBBandedColumn;
vJSColumn1: TcxGridDBBandedColumn;
cxGrid5: TcxGrid;
TvSYH: TcxGridDBBandedTableView;
cxGridDBBandedColumn8: TcxGridDBBandedColumn;
cxGridDBBandedColumn9: TcxGridDBBandedColumn;
cxGridDBBandedColumn10: TcxGridDBBandedColumn;
cxGridDBBandedColumn11: TcxGridDBBandedColumn;
cxGridDBBandedColumn12: TcxGridDBBandedColumn;
cxGridLevel4: TcxGridLevel;
vQSJColumn1: TcxGridDBBandedColumn;
vQSJColumn2: TcxGridDBBandedColumn;
vQSJColumn3: TcxGridDBBandedColumn;
vQSJColumn4: TcxGridDBBandedColumn;
vQSJColumn5: TcxGridDBBandedColumn;
vQSJColumn6: TcxGridDBBandedColumn;
vQSJColumn7: TcxGridDBBandedColumn;
vQSJColumn8: TcxGridDBBandedColumn;
vQSJColumn9: TcxGridDBBandedColumn;
vQSJColumn10: TcxGridDBBandedColumn;
vQSJColumn11: TcxGridDBBandedColumn;
vQSJColumn12: TcxGridDBBandedColumn;
vQSJColumn13: TcxGridDBBandedColumn;
cxGrid6: TcxGrid;
TvSLJ: TcxGridDBBandedTableView;
cxGridDBBandedColumn13: TcxGridDBBandedColumn;
cxGridDBBandedColumn14: TcxGridDBBandedColumn;
cxGridDBBandedColumn15: TcxGridDBBandedColumn;
cxGridDBBandedColumn16: TcxGridDBBandedColumn;
cxGridDBBandedColumn17: TcxGridDBBandedColumn;
cxGridDBBandedColumn18: TcxGridDBBandedColumn;
cxGridDBBandedColumn19: TcxGridDBBandedColumn;
cxGridDBBandedColumn20: TcxGridDBBandedColumn;
cxGridDBBandedColumn21: TcxGridDBBandedColumn;
cxGridDBBandedColumn22: TcxGridDBBandedColumn;
cxGridDBBandedColumn23: TcxGridDBBandedColumn;
cxGridDBBandedColumn24: TcxGridDBBandedColumn;
cxGridDBBandedColumn25: TcxGridDBBandedColumn;
cxGridDBBandedColumn26: TcxGridDBBandedColumn;
cxGridDBBandedColumn27: TcxGridDBBandedColumn;
cxGridLevel5: TcxGridLevel;
cxGridPopupMenu3: TcxGridPopupMenu;
CDS_SLJ: TClientDataSet;
DS_SLJ: TDataSource;
cxGridPopupMenu4: TcxGridPopupMenu;
cxGridPopupMenu5: TcxGridPopupMenu;
cxGridPopupMenu6: TcxGridPopupMenu;
vSLJColumn1: TcxGridDBBandedColumn;
v1Column3: TcxGridDBColumn;
cxGrid7: TcxGrid;
TvQSJ: TcxGridDBBandedTableView;
cxGridDBBandedColumn28: TcxGridDBBandedColumn;
cxGridDBBandedColumn29: TcxGridDBBandedColumn;
cxGridDBBandedColumn30: TcxGridDBBandedColumn;
cxGridDBBandedColumn31: TcxGridDBBandedColumn;
cxGridDBBandedColumn32: TcxGridDBBandedColumn;
cxGridDBBandedColumn33: TcxGridDBBandedColumn;
cxGridDBBandedColumn34: TcxGridDBBandedColumn;
cxGridDBBandedColumn35: TcxGridDBBandedColumn;
cxGridDBBandedColumn36: TcxGridDBBandedColumn;
cxGridLevel6: TcxGridLevel;
cxGridPopupMenu7: TcxGridPopupMenu;
DSSub: TDataSource;
CDS_KB: TClientDataSet;
Label4: TLabel;
CustomnoName: TEdit;
Label5: TLabel;
SWFBHW: TEdit;
Label6: TLabel;
SWFBKZ: TEdit;
Label7: TLabel;
SWFBColor: TEdit;
Label8: TLabel;
YLPB: TEdit;
Label2: TLabel;
SWFBCodeName: TEdit;
Label9: TLabel;
WKMS: TEdit;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
v1Column1: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure OrderNoChange(Sender: TObject);
procedure MenuItem3Click(Sender: TObject);
procedure MenuItem4Click(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure cxGridDBBandedColumn4PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure cxGridDBBandedColumn5PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure cxGridDBBandedColumn27PropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure TvKBMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure TvSLJMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure cxGridDBBandedColumn29PropertiesEditValueChanged(
Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
private
{ Private declarations }
FInt:Integer;
procedure InitGrid();
procedure InitGridSub();
procedure InitGridKB();
procedure InitGridSLJ();
function SaveKB():Boolean;
function SaveSub():Boolean;
function SaveSLJ():Boolean;
procedure KBSLJData();
procedure UpdateZBS(Sender: TObject);
public
{ Public declarations }
end;
var
frmSCGYSet: TfrmSCGYSet;
implementation
uses
U_DataLink,U_Fun, U_ZDYHelp;
{$R *.dfm}
procedure TfrmSCGYSet.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmSCGYSet.FormDestroy(Sender: TObject);
begin
frmSCGYSet:=nil;
end;
procedure TfrmSCGYSet.InitGrid();
begin
BegDate.SetFocus;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('exec P_SCGY_List :begdate,:enddate,:PState');
if cxTabControl1.TabIndex=0 then
begin
Parameters.ParamByName('begdate').Value:='2012-01-01';
Parameters.ParamByName('enddate').Value:='2050-10-10';
Parameters.ParamByName('PState').Value:=1;
end else
if cxTabControl1.TabIndex=1 then
begin
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.DateTime);
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',EndDate.DateTime+1);
Parameters.ParamByName('PState').Value:=2;
end else
if cxTabControl1.TabIndex=2 then
begin
Parameters.ParamByName('begdate').Value:=FormatDateTime('yyyy-MM-dd',BegDate.DateTime);
Parameters.ParamByName('enddate').Value:=FormatDateTime('yyyy-MM-dd',EndDate.DateTime+1);
Parameters.ParamByName('PState').Value:=3;
end;
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmSCGYSet.ToolButton1Click(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmSCGYSet.FormShow(Sender: TObject);
begin
EndDate.DateTime:=SGetServerDate(ADOTemp);
BegDate.DateTime:=EndDate.DateTime-30;
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
InitGrid();
KBSLJData();
if Trim(DParameters1)='<27><><EFBFBD><EFBFBD>' then
begin
TBSave.Visible:=False;
Tv1.OptionsSelection.CellSelect:=False;
end else
begin
ToolButton5.Visible:=False;
ToolButton6.Visible:=False;
end;
end;
procedure TfrmSCGYSet.cxTabControl1Change(Sender: TObject);
begin
InitGrid();
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
if Trim(DParameters1)<>'<27><><EFBFBD><EFBFBD>' then
begin
if cxTabControl1.TabIndex=2 then
Tv1.OptionsSelection.CellSelect:=False
else
Tv1.OptionsSelection.CellSelect:=True;
end;
end;
procedure TfrmSCGYSet.OrderNoChange(Sender: TObject);
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
end;
procedure TfrmSCGYSet.MenuItem3Click(Sender: TObject);
begin
CDS_Main.DisableControls;
with CDS_Main do
begin
First;
while not Eof do
begin
Edit;
FieldByName('SSel').Value:=True;
Post;
Next;
end;
end;
CDS_Main.EnableControls;
end;
procedure TfrmSCGYSet.MenuItem4Click(Sender: TObject);
begin
CDS_Main.DisableControls;
with CDS_Main do
begin
First;
while not Eof do
begin
Edit;
FieldByName('SSel').Value:=False;
Post;
Next;
end;
end;
CDS_Main.EnableControls;
end;
procedure TfrmSCGYSet.TBSaveClick(Sender: TObject);
begin
BegDate.SetFocus;
if CDS_Main.IsEmpty then Exit;
if cxTabControl1.TabIndex=2 then Exit;
if Trim(CDS_Main.FieldByName('SYDate').AsString)='' then
begin
Application.MessageBox('<27><><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if (SaveSub() and SaveKB() and SaveSLJ() ) then
begin
if cxTabControl1.TabIndex=0 then
CDS_Main.Delete;
KBSLJData();
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
end else
begin
end;
end;
function TfrmSCGYSet.SaveSub():Boolean;
var
maxno:string;
begin
try
Result:=False;
ADOCmd.Connection.BeginTrans;
with CDS_Sub do
begin
//First;
//while not Eof do
//begin
if Trim(CDS_Sub.fieldbyname('SYID').AsString)='' then
begin
if GetLSNo(ADOCmd,maxno,'SY','WFB_SCGY',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(CDS_Sub.fieldbyname('SYID').AsString);
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_SCGY where SYID='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_Sub.fieldbyname('SYID').AsString)='' then
begin
Append;
FieldByName('Filler').Value:=Trim(DName);
end else
begin
Edit;
FieldByName('Editer').Value:=Trim(DName);
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
end;
FieldByName('SYID').Value:=Trim(maxno);
FieldByName('MainId').Value:=Trim(CDS_Main.fieldbyname('MainId').AsString);
FieldByName('SWFBHW').Value:=Trim(CDS_Main.fieldbyname('SWFBHW').AsString);
FieldByName('WKMS').Value:=Trim(CDS_Main.fieldbyname('WKMS').AsString);
if Trim(CDS_Main.fieldbyname('SYDate').AsString)<>'' then
FieldByName('SYDate').Value:=Trim(CDS_Main.fieldbyname('SYDate').AsString);
SSetSaveDataCDSBandNew(ADOCmd,TVPW,CDS_Sub,'WFB_SCGY',0);
SSetSaveDataCDSBandNew(ADOCmd,TVJS,CDS_Sub,'WFB_SCGY',0);
SSetSaveDataCDSBandNew(ADOCmd,TVQSJ,CDS_Sub,'WFB_SCGY',0);
SSetSaveDataCDSBandNew(ADOCmd,TVSYH,CDS_Sub,'WFB_SCGY',0);
Post;
end;
with CDS_Main do
begin
Edit;
FieldByName('SYID').Value:=Trim(maxno);
Post;
end;
with CDS_Sub do
begin
Edit;
FieldByName('SYID').Value:=Trim(maxno);
Post;
end;
//Next;
//end;
end;
ADOCmd.Connection.CommitTrans;
Result:=True;
//Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
//Exit;
except
Result:=False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end;
function TfrmSCGYSet.SaveKB():Boolean;
var
maxno:string;
begin
BegDate.SetFocus;
Result:=False;
try
ADOCmd.Connection.BeginTrans;
with CDS_KB do
begin
First;
while not Eof do
begin
if Trim(CDS_KB.fieldbyname('KBID').AsString)='' then
begin
if GetLSNo(ADOCmd,maxno,'KB','WFB_SCGY_KB',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(CDS_KB.fieldbyname('KBID').AsString);
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_SCGY_KB where KBID='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_KB.fieldbyname('KBID').AsString)='' then
begin
Append;
FieldByName('Filler').Value:=Trim(DName);
end else
begin
Edit;
FieldByName('Editer').Value:=Trim(DName);
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
end;
FieldByName('SYID').Value:=Trim(CDS_Main.fieldbyname('SYID').AsString);
FieldByName('KBID').Value:=Trim(maxno);
FieldByName('YCLCode').Value:=Trim(CDS_KB.fieldbyname('YCLCode').AsString);
SSetSaveDataCDSBandNew(ADOCmd,TvKB,CDS_KB,'WFB_SCGY_KB',0);
Post;
end;
with CDS_KB do
begin
Edit;
FieldByName('KBID').Value:=Trim(maxno);
Post;
end;
Next;
end;
end;
ADOCmd.Connection.CommitTrans;
Result:=True;
///Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
//Exit;
except
Result:=False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end;
function TfrmSCGYSet.SaveSLJ():Boolean;
var
maxno:string;
begin
BegDate.SetFocus;
try
Result:=False;
ADOCmd.Connection.BeginTrans;
with CDS_SLJ do
begin
First;
while not Eof do
begin
if Trim(CDS_SLJ.fieldbyname('SLID').AsString)='' then
begin
if GetLSNo(ADOCmd,maxno,'SL','WFB_SCGY_ShuLi',3,1)=False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(CDS_SLJ.fieldbyname('SLID').AsString);
end;
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_SCGY_ShuLi where SLID='''+Trim(maxno)+'''');
Open;
end;
with ADOCmd do
begin
if Trim(CDS_SLJ.fieldbyname('SLID').AsString)='' then
begin
Append;
FieldByName('Filler').Value:=Trim(DName);
end else
begin
Edit;
FieldByName('Editer').Value:=Trim(DName);
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
end;
FieldByName('SYID').Value:=Trim(CDS_Main.fieldbyname('SYID').AsString);
FieldByName('SLID').Value:=Trim(maxno);
SSetSaveDataCDSBandNew(ADOCmd,TvSLJ,CDS_SLJ,'WFB_SCGY_ShuLi',0);
Post;
end;
with CDS_SLJ do
begin
Edit;
FieldByName('SLID').Value:=Trim(maxno);
Post;
end;
Next;
end;
end;
ADOCmd.Connection.CommitTrans;
Result:=True;
///Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
//Exit;
except
Result:=False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end;
procedure TfrmSCGYSet.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>',Tv1,'<27>޷IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmSCGYSet.ToolButton2Click(Sender: TObject);
begin
if CDS_Main.IsEmpty then Exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>',cxGrid1);
end;
procedure TfrmSCGYSet.InitGridSub();
begin
try
ADOTemp.DisableControls;
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select A.*,ZBL=SYDefFlt1/100*SYDefFlt2/100*SYDefFlt3/100*SYDefFlt4/100*SYDefFlt5/100*SYDefFlt6/100*SYDefFlt7/100');
SQL.Add(' from WFB_SCGY A where SYID='''+Trim(CDS_Main.fieldbyname('SYID').AsString)+'''');
Open;
end;
SCreateCDS20(ADOTemp,CDS_Sub);
SInitCDSData20(ADOTemp,CDS_Sub);
finally
ADOTemp.EnableControls;
end;
end;
procedure TfrmSCGYSet.InitGridKB();
begin
try
ADOTemp.DisableControls;
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_SCGY_KB where SYID='''+Trim(CDS_Main.fieldbyname('SYID').AsString)+'''');
Open;
end;
SCreateCDS20(ADOTemp,CDS_KB);
SInitCDSData20(ADOTemp,CDS_KB);
finally
ADOTemp.EnableControls;
end;
end;
procedure TfrmSCGYSet.InitGridSLJ();
begin
try
ADOTemp.DisableControls;
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_SCGY_Shuli where SYID='''+Trim(CDS_Main.fieldbyname('SYID').AsString)+'''');
Open;
end;
SCreateCDS20(ADOTemp,CDS_SLJ);
SInitCDSData20(ADOTemp,CDS_SLJ);
finally
ADOTemp.EnableControls;
end;
end;
procedure TfrmSCGYSet.Tv1CellClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
KBSLJData();
end;
procedure TfrmSCGYSet.KBSLJData();
begin
InitGridSub();
InitGridKB();
InitGridSLJ();
if Trim(CDS_Sub.fieldbyname('SYID').AsString)='' then
begin
with CDS_Sub do
begin
Append;
Post;
end;
end;
if Trim(CDS_KB.fieldbyname('KBID').AsString)='' then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from KH_Zdy where Type=''KBMac'' ');
Open;
end;
if ADOTemp.IsEmpty=False then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from KH_Zdy where Type=''KBMac'' order by ZdyNo ');
Open;
end;
with ADOTemp do
begin
First;
while not Eof do
begin
with CDS_KB do
begin
Append;
FieldByName('KBMac').Value:=Trim(ADOTemp.fieldbyname('ZdyName').AsString);
Post;
end;
Next;
end;
end;
end else
begin
with CDS_KB do
begin
Append;
Post;
end;
end;
end;
if Trim(CDS_SLJ.fieldbyname('SLID').AsString)='' then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from KH_Zdy where Type=''SLMac'' ');
Open;
end;
if ADOTemp.IsEmpty=False then
begin
with ADOTemp do
begin
Close;
sql.Clear;
sql.Add('select * from KH_Zdy where Type=''SLMac'' order by ZdyNo ');
Open;
end;
if Trim(CDS_Main.fieldbyname('WJGName').AsString)='<27><><EFBFBD><EFBFBD><><D6B1>' then
begin
with ADOTemp do
begin
First;
while not Eof do
begin
with CDS_SLJ do
begin
Append;
FieldByName('SLMac').Value:=Trim(ADOTemp.fieldbyname('ZdyName').AsString);
Post;
end;
Next;
end;
end;
end else
begin
with ADOTemp do
begin
First;
with CDS_SLJ do
begin
Append;
FieldByName('SLMac').Value:=Trim(ADOTemp.fieldbyname('ZdyName').AsString);
Post;
end;
end;
end;
end else
begin
with CDS_SLJ do
begin
Append;
Post;
end;
end;
end;
end;
procedure TfrmSCGYSet.ToolButton3Click(Sender: TObject);
begin
if FInt=1 then
begin
with CDS_KB do
begin
Append;
Post;
end;
end else
if FInt=2 then
begin
with CDS_SLJ do
begin
Append;
Post;
end;
end;
end;
procedure TfrmSCGYSet.ToolButton4Click(Sender: TObject);
begin
if FInt=1 then
begin
if Trim(CDS_KB.fieldbyname('KBID').AsString)<>'' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOCmd do
begin
Close;
sql.Clear;
sql.add('delete WFB_SCGY_KB where KBID='''+Trim(CDS_KB.fieldbyname('KBID').AsString)+'''');
ExecSQL;
end;
end;
CDS_KB.Delete;
end else
if FInt=2 then
begin
if Trim(CDS_SLJ.fieldbyname('SLID').AsString)<>'' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOCmd do
begin
Close;
sql.Clear;
sql.add('delete WFB_SCGY_Shuli where SLID='''+Trim(CDS_SLJ.fieldbyname('SLID').AsString)+'''');
ExecSQL;
end;
end;
CDS_SLJ.Delete;
end;
end;
procedure TfrmSCGYSet.cxGridDBBandedColumn4PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='KBMac';
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
Self.CDS_KB.Edit;
Self.CDS_KB.FieldByName('KBMac').Value:=Trim(ClientDataSet1.fieldbyname('zdyname').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmSCGYSet.cxGridDBBandedColumn5PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='YCL';
flagname:=<><D4AD><EFBFBD><EFBFBD>';
TBAdd.Visible:=False;
TBEdit.Visible:=False;
TBDel.Visible:=False;
TBSave.Visible:=False;
if ShowModal=1 then
begin
Self.CDS_KB.Edit;
Self.CDS_KB.FieldByName('YCLName').Value:=Trim(ClientDataSet1.fieldbyname('zdyname').AsString);
Self.CDS_KB.FieldByName('YCLCode').Value:=Trim(ClientDataSet1.fieldbyname('zdyNo').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmSCGYSet.cxGridDBBandedColumn27PropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp:=TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag:='SLMac';
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
Self.CDS_SLJ.Edit;
Self.CDS_SLJ.FieldByName('SLMac').Value:=Trim(ClientDataSet1.fieldbyname('zdyname').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmSCGYSet.TvKBMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
FInt:=1;
TvKB.Bands[0].Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
TvSLJ.Bands[0].Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
TvKB.Bands[0].Styles.Header.TextColor:=clBlue;
TvSLJ.Bands[0].Styles.Header.TextColor:=clBlack;
end;
procedure TfrmSCGYSet.TvSLJMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
FInt:=2;
TvKB.Bands[0].Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
TvSLJ.Bands[0].Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
TvKB.Bands[0].Styles.Header.TextColor:=clBlack;
TvSLJ.Bands[0].Styles.Header.TextColor:=clBlue;
end;
procedure TfrmSCGYSet.cxGridDBBandedColumn29PropertiesEditValueChanged(
Sender: TObject);
var
mvalue:String;
begin
UpdateZBS(Sender);
end;
procedure TfrmSCGYSet.UpdateZBS(Sender: TObject);
var
mvalue,FieldStr:String;
i:Integer;
XS,LXS:Double;
begin
mvalue:=TcxTextEdit(Sender).EditingText;
FieldStr:=TvQSJ.Controller.FocusedColumn.DataBinding.FilterFieldName;
if Trim(mvalue)='' then
mvalue:='0';
with CDS_Sub do
begin
Edit;
FieldByName(FieldStr).Value:=StrToFloat(mvalue);
Post;
end;
XS:=1.00;
for i:=1 to 7 do
begin
FieldStr:=Trim('SYDefFlt'+Trim(Inttostr(i)));
if Trim(CDS_Sub.FieldByName(FieldStr).AsString)='' then
begin
LXS:=0;
end else
begin
LXS:=CDS_Sub.FieldByName(FieldStr).Value;
end;
XS:=XS*LXS*1.00/100;
end;
with CDS_Sub do
begin
Edit;
FieldByName('ZBL').Value:=XS;
Post;
end;
end;
procedure TfrmSCGYSet.ToolButton5Click(Sender: TObject);
begin
if CDS_Main.IsEmpty then Exit;
if cxTabControl1.TabIndex=1 then
begin
if Trim(CDS_Main.FieldByName('Filler').AsString)=Trim(DName) then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('Update WFB_SCGY Set Chker='''+Trim(DName)+'''');
sql.Add(',ChkDate=getdate(),ChkStatus=''<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'' ');
sql.Add(' where SYID='''+Trim(CDS_Main.fieldbyname('SYID').AsString)+'''');
ExecSQL;
end;
with CDS_Main do
begin
edit;
FieldByName('ChkStatus').Value:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>';
FieldByName('Chker').Value:=Trim(DName);
Post;
end;
end;
end;
procedure TfrmSCGYSet.ToolButton6Click(Sender: TObject);
begin
if CDS_Main.IsEmpty then Exit;
if cxTabControl1.TabIndex>0 then
begin
if cxTabControl1.TabIndex=2 then
begin
if Trim(CDS_Main.FieldByName('Chker').AsString)<>Trim(DName) then
begin
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
Exit;
end;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('Update WFB_SCGY Set Chker='''+Trim(DName)+'''');
sql.Add(',ChkDate=getdate(),ChkStatus=''<27><><EFBFBD>˲<EFBFBD>ͨ<EFBFBD><CDA8>'' ');
sql.Add(' where SYID='''+Trim(CDS_Main.fieldbyname('SYID').AsString)+'''');
ExecSQL;
end;
with CDS_Main do
begin
edit;
FieldByName('ChkStatus').Value:='<27><><EFBFBD>˲<EFBFBD>ͨ<EFBFBD><CDA8>';
FieldByName('Chker').Value:=Trim(DName);
Post;
end;
end;
end;
end.