D7snShanfengT/山峰贸易管理/U_CLYouKa_CZGCF.pas
DESKTOP-E401PHE\Administrator c363cb75a7 调整之后的山凤水泥厂
2026-02-26 09:41:35 +08:00

282 lines
7.0 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_CLYouKa_CZGCF;
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, cxCurrencyEdit,
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
type
TfrmCLYouKa_CZGCF = 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;
Label4: TLabel;
CheHao: TEdit;
cxGrid2: TcxGrid;
Tv1: TcxGridDBTableView;
v1YHMonth: TcxGridDBColumn;
v1SJName: TcxGridDBColumn;
v1CheHao: TcxGridDBColumn;
v1CCQty: TcxGridDBColumn;
v1MGLQty: TcxGridDBColumn;
v1JYQty: TcxGridDBColumn;
v1ZFLQty: TcxGridDBColumn;
v1KHXS: TcxGridDBColumn;
v1KHYHQty: TcxGridDBColumn;
v1XXPrice: TcxGridDBColumn;
v1JFMoney: TcxGridDBColumn;
v1BTMoney: TcxGridDBColumn;
v1SFMoney: TcxGridDBColumn;
cxGrid2Level1: TcxGridLevel;
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);
private
canshu1,canshu2,canshu3:string;
procedure InitGrid();
procedure setstatus();
{ Private declarations }
public
{ Public declarations }
end;
var
frmCLYouKa_CZGCF: TfrmCLYouKa_CZGCF;
implementation
uses
U_DataLink,U_RTFun,U_SXCKInPut, U_JGSXCKInPut,U_CLKH_CZBCFSub;
{$R *.dfm}
procedure TfrmCLYouKa_CZGCF.setstatus();
begin
end;
procedure TfrmCLYouKa_CZGCF.FormDestroy(Sender: TObject);
begin
frmCLYouKa_CZGCF:=nil;
end;
procedure TfrmCLYouKa_CZGCF.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmCLYouKa_CZGCF.FormCreate(Sender: TObject);
begin
//cxGrid1.Align:=alClient;
BegDate.DateTime:=SGetServerDate(ADOQueryTemp);
canshu1:=Trim(DParameters1);
canshu2:=Trim(DParameters2);
canshu3:=Trim(DParameters3);
end;
procedure TfrmCLYouKa_CZGCF.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.* ');
sql.Add(' from CL_YHKH_CF A');
sql.add(' where YHMonth='''+Trim(FormatDateTime('yyyy-MM',BegDate.Date))+'''');
SQL.Add(' order by SJName desc');
Open;
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmCLYouKa_CZGCF.TBRafreshClick(Sender: TObject);
begin
BegDate.SetFocus;
InitGrid();
end;
procedure TfrmCLYouKa_CZGCF.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
end;
end;
procedure TfrmCLYouKa_CZGCF.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><><EFBFBD>رó<D8B1><C3B3><EFBFBD><EFBFBD>Ǽ<EFBFBD>',Tv1,'<27>Ϳ<EFBFBD><CDBF><EFBFBD>ֵ');
Close;
end;
procedure TfrmCLYouKa_CZGCF.FormShow(Sender: TObject);
begin
ReadCxGrid('<27><><EFBFBD>رó<D8B1><C3B3><EFBFBD><EFBFBD>Ǽ<EFBFBD>',Tv1,'<27>Ϳ<EFBFBD><CDBF><EFBFBD>ֵ');
//setstatus();
//InitGrid();
end;
procedure TfrmCLYouKa_CZGCF.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then exit;
TcxGridToExcel('<27><><EFBFBD>رó<D8B1><C3B3><EFBFBD>',cxGrid2);
end;
procedure TfrmCLYouKa_CZGCF.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_CZGCF.N1Click(Sender: TObject);
begin
SelOKNo(CDS_Main,True);
end;
procedure TfrmCLYouKa_CZGCF.N2Click(Sender: TObject);
begin
SelOKNo(CDS_Main,False);
end;
procedure TfrmCLYouKa_CZGCF.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_CF 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_CZGCF.TBAddClick(Sender: TObject);
begin
try
frmCLKH_CZLCFSub:=TfrmCLKH_CZLCFSub.Create(Application);
with frmCLKH_CZLCFSub do
begin
FBCId:='';
frmCLKH_CZLCFSub.canshu3:=Trim(Self.canshu3);
if ShowModal=1 then
begin
Self.InitGrid();
end;
end;
finally
frmCLKH_CZLCFSub.Free;
end;
end;
procedure TfrmCLYouKa_CZGCF.TBEditClick(Sender: TObject);
begin
if CDS_Main.IsEmpty then Exit;
try
frmCLKH_CZLCFSub:=TfrmCLKH_CZLCFSub.Create(Application);
with frmCLKH_CZLCFSub 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_CZLCFSub.Free;
end;
end;
procedure TfrmCLYouKa_CZGCF.SPIDChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmCLYouKa_CZGCF.SPSpecChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmCLYouKa_CZGCF.GCNameChange(Sender: TObject);
begin
TBFind.Click;
end;
end.