298 lines
7.3 KiB
ObjectPascal
298 lines
7.3 KiB
ObjectPascal
unit U_CLYouKa_SHDJ;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
|
||
cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView,
|
||
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView,
|
||
cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, cxCheckBox, RM_Common,
|
||
RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, Menus,
|
||
cxCalendar, cxButtonEdit, cxTextEdit, cxPC;
|
||
|
||
type
|
||
TfrmCLYouKa_SHDJ = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBExport: TToolButton;
|
||
TBClose: TToolButton;
|
||
Panel1: TPanel;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Label1: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
CDS_Main: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDBMain: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
RMDBHZ: TRMDBDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
CDS_PRT: TClientDataSet;
|
||
TBDel: TToolButton;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
Label3: TLabel;
|
||
SJName: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1YHMonth: TcxGridDBColumn;
|
||
v1SJName: TcxGridDBColumn;
|
||
v1CheHao: TcxGridDBColumn;
|
||
v1JYQty: TcxGridDBColumn;
|
||
cxGrid2Level1: TcxGridLevel;
|
||
Label4: TLabel;
|
||
CheHao: TEdit;
|
||
v1MGLQty: TcxGridDBColumn;
|
||
v1CCQty: TcxGridDBColumn;
|
||
v1SJYHQty: TcxGridDBColumn;
|
||
v1KHYHQty: TcxGridDBColumn;
|
||
v1JFMoney: TcxGridDBColumn;
|
||
v1BTMoney: TcxGridDBColumn;
|
||
v1SFMoney: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
v1ZDKHXS: TcxGridDBColumn;
|
||
v1KHXS: TcxGridDBColumn;
|
||
v1XXPrice: TcxGridDBColumn;
|
||
v1KHNote: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ConNoMChange(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBExportClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure SPIDChange(Sender: TObject);
|
||
procedure SPSpecChange(Sender: TObject);
|
||
procedure GCNameChange(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
private
|
||
canshu1,canshu2,canshu3:string;
|
||
procedure InitGrid();
|
||
procedure setstatus();
|
||
{ Private declarations }
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmCLYouKa_SHDJ: TfrmCLYouKa_SHDJ;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun,U_SXCKInPut, U_JGSXCKInPut,U_CLKH_Sub;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmCLYouKa_SHDJ.setstatus();
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmCLYouKa_SHDJ:=nil;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.FormCreate(Sender: TObject);
|
||
begin
|
||
//cxGrid1.Align:=alClient;
|
||
BegDate.DateTime:=SGetServerDate(ADOQueryTemp);
|
||
canshu1:=Trim(DParameters1);
|
||
canshu2:=Trim(DParameters2);
|
||
canshu3:=Trim(DParameters3);
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add(' from CL_YHKH A');
|
||
sql.add(' where YHMonth='''+Trim(FormatDateTime('yyyy-MM',BegDate.Date))+'''');
|
||
if cxTabControl1.TabIndex=0 then
|
||
sql.Add(' and A.CLName=''<27><><EFBFBD>賵''');
|
||
if cxTabControl1.TabIndex=1 then
|
||
sql.Add(' and A.CLName=''<27>ó<EFBFBD>''');
|
||
SQL.Add(' order by SJName desc');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
BegDate.SetFocus;
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.ConNoMChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27>Ϳ<EFBFBD><CDBF><EFBFBD>ֵ<EFBFBD>б<EFBFBD>FM',Tv1,'<27>Ϳ<EFBFBD><CDBF><EFBFBD>ֵ');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27>Ϳ<EFBFBD><CDBF><EFBFBD>ֵ<EFBFBD>б<EFBFBD>FM',Tv1,'<27>Ϳ<EFBFBD><CDBF><EFBFBD>ֵ');
|
||
//setstatus();
|
||
//InitGrid();
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.TBExportClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then exit;
|
||
TcxGridToExcel('<27><>ʻԱ<CABB>ͺĿ<CDBA><C4BF><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_Main);
|
||
SInitCDSData20(ADOQueryMain,CDS_Main);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main,True);
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_Main,False);
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.TBDelClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
if Trim(CDS_Main.fieldbyname('YHID').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' delete from CL_YHKH where YHID='''+Trim(CDS_Main.fieldbyname('YHID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
CDS_Main.Delete;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end else
|
||
begin
|
||
CDS_Main.Delete;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.TBAddClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCLKH_Sub:=TfrmCLKH_Sub.Create(Application);
|
||
with frmCLKH_Sub do
|
||
begin
|
||
FBCId:='';
|
||
frmCLKH_Sub.canshu3:=Trim(Self.canshu3);
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmCLKH_Sub.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.TBEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then Exit;
|
||
try
|
||
frmCLKH_Sub:=TfrmCLKH_Sub.Create(Application);
|
||
with frmCLKH_Sub do
|
||
begin
|
||
ToolButton1.Visible:=false;
|
||
ToolButton2.Visible:=false;
|
||
Panel1.Visible:=false;
|
||
FBCId:=Trim(CDS_Main.fieldbyname('YHID').AsString);
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally;
|
||
frmCLKH_Sub.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.SPIDChange(Sender: TObject);
|
||
begin
|
||
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.SPSpecChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.GCNameChange(Sender: TObject);
|
||
begin
|
||
TBFind.Click;
|
||
end;
|
||
|
||
procedure TfrmCLYouKa_SHDJ.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
if cxTabControl1.TabIndex=0 then
|
||
v1MGLQty.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if cxTabControl1.TabIndex=1 then
|
||
v1MGLQty.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
initgrid();
|
||
end;
|
||
|
||
end.
|