D7wmguihua/坯布码单待检(PBMDDJ.dll)/U_ZHKHListNewCX.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

360 lines
10 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_ZHKHListNewCX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter,
RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, RM_e_Xls,
Menus, cxButtonEdit, cxDropDownEdit;
type
TfrmZHKHListNewCX = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBFind: TToolButton;
TBClose: TToolButton;
Tv1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
Order_Main: TClientDataSet;
ToolButton3: TToolButton;
Panel1: TPanel;
Label1: TLabel;
Label9: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
KHNameJC: TEdit;
v1Column5: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
CheckBox1: TCheckBox;
Label2: TLabel;
KHCode: TEdit;
v1Column1: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
Label3: TLabel;
HZEmail: TEdit;
v1Column7: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure TBCloseClick(Sender: TObject);
procedure TBFindClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure Tv1StylesGetContentStyle(Sender: TcxCustomGridTableView;
ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem;
out AStyle: TcxStyle);
procedure v1DeliveryDateCustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure ToolButton3Click(Sender: TObject);
procedure CustomerNoNameChange(Sender: TObject);
procedure KHNameJCKeyPress(Sender: TObject; var Key: Char);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
procedure Tv1DblClick(Sender: TObject);
private
CanShu1:String;
DQdate:TDateTime;
procedure InitGrid();
procedure InitForm();
function DelData():Boolean;
{ Private declarations }
public
FFInt,FCloth:Integer;
{ Public declarations }
end;
var
frmZHKHListNewCX: TfrmZHKHListNewCX;
implementation
uses
U_DataLink,U_RTFun;
{$R *.dfm}
procedure TfrmZHKHListNewCX.FormDestroy(Sender: TObject);
begin
frmZHKHListNewCX:=nil;
end;
procedure TfrmZHKHListNewCX.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmZHKHListNewCX.FormCreate(Sender: TObject);
begin
CanShu1:=Trim(DParameters1);
cxgrid1.Align:=alClient;
//BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp)-7;
//EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
DQdate:=SGetServerDate(ADOQueryTemp);
end;
procedure TfrmZHKHListNewCX.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid(<><D5B9><EFBFBD>ͻ<EFBFBD><CDBB>Ǽ<EFBFBD>N',Tv1,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmZHKHListNewCX.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add('select A.*,HZEmail=dbo.F_Get_KHInfo(A.ZKID,''Email'') ');
sql.Add(' from ZH_KH_Info A ');
if CheckBox1.Checked then
begin
SQL.Add('where ZKDate>='''+FormatDateTime('yyyy-MM-dd',BegDate.DateTime)+'''');
SQL.Add('and ZKDate<'''+FormatDateTime('yyyy-MM-dd',enddate.DateTime+1)+'''');
end else
begin
SQL.Add(' where 1=1 ');
end;
if Trim(CanShu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
begin
//sql.Add(' and A.Filler in (select UserName from SY_User SU where SU.DPID in(select DPID from SY_User where UserName='''+Trim(DName)+'''))');
sql.Add(' and (A.Filler='''+Trim(DName)+''' or A.YWY='''+Trim(DName)+''')');
end;
sql.Add(' and Type=''KH'' ');
sql.Add(' and Valid=''Y'' ');
{if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
begin
sql.Add('and (A.Filler='''+Trim(DName)+'''');
sql.Add(' or YWY='''+Trim(DName)+''')');
end;}
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmZHKHListNewCX.InitForm();
begin
ReadCxGrid(<><D5B9><EFBFBD>ͻ<EFBFBD><CDBB>Ǽ<EFBFBD>N',Tv1,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
BegDate.DateTime:=SGetServerDate10(ADOQueryTemp)-7;
EndDate.DateTime:=SGetServerDate10(ADOQueryTemp);
if Trim(CanShu1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
begin
v1Column7.Visible:=False;
v1Column7.Hidden:=True;
end;
InitGrid();
end;
procedure TfrmZHKHListNewCX.TBFindClick(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
function TfrmZHKHListNewCX.DelData():Boolean;
begin
try
Result:=false;
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update ZH_KH_Info Set Valid=''N'' where ZKId='''+Trim(Order_Main.fieldbyname('ZKId').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
Result:=True;
except
ADOQueryCmd.Connection.RollbackTrans;
Result:=False;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
end;
end;
procedure TfrmZHKHListNewCX.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmZHKHListNewCX.FormShow(Sender: TObject);
begin
InitForm();
end;
procedure TfrmZHKHListNewCX.CheckBox1Click(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmZHKHListNewCX.CheckBox2Click(Sender: TObject);
begin
TBRafresh.Click;
end;
procedure TfrmZHKHListNewCX.Tv1StylesGetContentStyle(
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
id,id10:Integer;
begin
{try
if Tv1.GroupedItemCount=0 then
begin
Id:=Tv1.GetColumnByFieldName('DeliveryDate').Index-tv1.GroupedItemCount;
Id10:=Tv1.GetColumnByFieldName('SubStatus').Index-tv1.GroupedItemCount;
if Trim(VarToStr(ARecord.Values[id]))='' then Exit;
if Id<0 then Exit;
if ARecord.Values[id10]='<27><><EFBFBD><EFBFBD>' then exit;
if (ARecord.Values[id]-DQdate)>=4 then Exit;
if ((ARecord.Values[id]-DQdate)>=0) and ((ARecord.Values[id]-DQdate)<4) then
AStyle:=DataLink_.QHuangSe
else
if ARecord.Values[id]-DQdate<0 then
begin
AStyle:=DataLink_OrderManage.FenHongS;
end;
end else
begin
end;
except
end; }
end;
procedure TfrmZHKHListNewCX.v1DeliveryDateCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
{ Id:=TV1.GetColumnByFieldName('DeliveryDate').Index;//;-TV1.GroupedItemCount;
Id10:=TV1.GetColumnByFieldName('SubStatus').Index;
if Id<0 then Exit;
if AViewInfo.GridRecord.Values[Id10]='<27><><EFBFBD><EFBFBD>' then Exit;
if AViewInfo.GridRecord.Values[Id]-SGetServerDate(ADOQueryTemp)>=4 then Exit;
if ((AViewInfo.GridRecord.Values[id]-SGetServerDate10(ADOQueryTemp))>=0) and ((AViewInfo.GridRecord.Values[id]-SGetServerDate(ADOQueryTemp))<4) then
ACanvas.Brush.Color:=clYellow
else
if (AViewInfo.GridRecord.Values[id])-(SGetServerDate10(ADOQueryTemp)<0) then
begin
ACanvas.Brush.Color:=clRed;
end;
begin
ACanvas.Brush.Color:=clRed;
end else
if AViewInfo.GridRecord.Values[Id]='Purple' then
begin
ACanvas.Brush.Color:=clPurple;
end else
if AViewInfo.GridRecord.Values[Id]='Olive' then
begin
ACanvas.Brush.Color:=clOlive;
end else
if AViewInfo.GridRecord.Values[Id]='Teal' then
begin
ACanvas.Brush.Color:=clTeal;
end else
if AViewInfo.GridRecord.Values[Id]='Background' then
begin
ACanvas.Brush.Color:=clBackground;
end; }
end;
procedure TfrmZHKHListNewCX.ToolButton3Click(Sender: TObject);
begin
ModalResult:=1;
end;
procedure TfrmZHKHListNewCX.CustomerNoNameChange(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmZHKHListNewCX.KHNameJCKeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
{if Length(conno.Text)<3 then Exit;
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
SQL.Clear;
sql.Add('select A.* ');
sql.Add(' from JYOrderCon_TT A where 1=1 ');
if Trim(DParameters1)<>'<27><>Ȩ<EFBFBD><C8A8>' then
begin
sql.Add('and A.Filler='''+Trim(DName)+'''');
end;
sql.Add(' and ConNo like '''+'%'+Trim(ConNo.Text)+'%'+'''');
sql.Add(' and TTType='''+Trim(DParameters2)+'''');
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end; }
end;
end;
procedure TfrmZHKHListNewCX.Tv2CellDblClick(Sender: TcxCustomGridTableView;
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
AShift: TShiftState; var AHandled: Boolean);
begin
{if Order_Main.FieldByName('ConFlag1').AsBoolean=False then
begin
if CDS_Chk.IsEmpty then Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete OrdCon_Chk where CKID='''+Trim(CDS_Chk.fieldbyname('CKID').AsString)+'''');
ExecSQL;
end;
CDS_Chk.Delete;
end; }
end;
procedure TfrmZHKHListNewCX.Tv1DblClick(Sender: TObject);
begin
ToolButton3.Click;
end;
end.