593 lines
17 KiB
ObjectPascal
593 lines
17 KiB
ObjectPascal
|
|
unit U_ZHCPList_BJCX;
|
|||
|
|
|
|||
|
|
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, cxPC, Buttons, cxTextEdit, cxImage,StrUtils;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmZHCPList_BJCX = 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;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
Panel11: TPanel;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
v1Column7: TcxGridDBColumn;
|
|||
|
|
v1Column9: TcxGridDBColumn;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
RMDBMain: TRMDBDataSet;
|
|||
|
|
RMXLSExport2: TRMXLSExport;
|
|||
|
|
CDS_PRT: TClientDataSet;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
v1ZICost: TcxGridDBColumn;
|
|||
|
|
v1Column3: TcxGridDBColumn;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
v1Column8: TcxGridDBColumn;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
cxTabControl2: TcxTabControl;
|
|||
|
|
v1Column10: TcxGridDBColumn;
|
|||
|
|
v1Column11: TcxGridDBColumn;
|
|||
|
|
v1Column12: TcxGridDBColumn;
|
|||
|
|
v1GS: TcxGridDBColumn;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
YeHZ: TEdit;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
CPHZ: TEdit;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
GGHZ: TEdit;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
Panel5: TPanel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
ZIID: TEdit;
|
|||
|
|
ZIName: TEdit;
|
|||
|
|
ZIGY: TEdit;
|
|||
|
|
Editer: TEdit;
|
|||
|
|
Filler: TEdit;
|
|||
|
|
Note: TEdit;
|
|||
|
|
v1Column14: TcxGridDBColumn;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
KHNameHZ: TEdit;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
ZIType: TComboBox;
|
|||
|
|
v1Column15: TcxGridDBColumn;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
|
procedure CheckBox2Click(Sender: TObject);
|
|||
|
|
procedure CustomerNoNameChange(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure ZJStatusChange(Sender: TObject);
|
|||
|
|
procedure Tv1DblClick(Sender: TObject);
|
|||
|
|
procedure v1Column2PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure cxTabControl2Change(Sender: TObject);
|
|||
|
|
procedure ZIIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure ZITypeChange(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
canshu1:string;
|
|||
|
|
DQdate:TDateTime;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure InitForm();
|
|||
|
|
function DelData():Boolean;
|
|||
|
|
procedure IntTab();
|
|||
|
|
function GetFiltersGY(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
|
function StrFenHang(FStr:string;var FHStr:String):Boolean;
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FFInt,FCloth:Integer;
|
|||
|
|
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmZHCPList_BJCX: TfrmZHCPList_BJCX;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
uses
|
|||
|
|
U_DataLink,U_RTFun;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
frmZHCPList_BJCX:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
cxgrid1.Align:=alClient;
|
|||
|
|
canshu1:=Trim(DParameters1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('<27><>˾չ<CBBE><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ѯ',Tv1,'չ<><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
function TfrmZHCPList_BJCX.GetFiltersGY(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
|
var
|
|||
|
|
i,j,k:Integer;
|
|||
|
|
fsj,fsj1:String;
|
|||
|
|
begin
|
|||
|
|
Result:='';
|
|||
|
|
with TMPanel do
|
|||
|
|
begin
|
|||
|
|
for i:=0 to ControlCount-1 do
|
|||
|
|
begin
|
|||
|
|
if Controls[i] is TLabel then Continue;
|
|||
|
|
if Controls[i] is TEdit then
|
|||
|
|
begin
|
|||
|
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
|
begin
|
|||
|
|
if Trim(TEdit(Controls[i]).Name)='ZIID' then
|
|||
|
|
begin
|
|||
|
|
if Copy(Trim(TEdit(Controls[i]).Text),1,2)='DY' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from ZH_CP_Info_KC where DYID='''+Trim(TEdit(Controls[i]).Text)+'''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
TEdit(Controls[i]).Text:=Trim(ADOQueryTemp.fieldbyname('ZIID').AsString);
|
|||
|
|
Controls[i].Tag:=1;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Controls[i].Tag:=2;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Controls[i].Tag=EquTag then
|
|||
|
|
Result:=Result+'and A.'+Controls[i].Hint+Controls[i].Name+'='+QuotedStr(Trim(TEdit(Controls[i]).Text))
|
|||
|
|
else if Controls[i].Tag=LikeTag then
|
|||
|
|
begin
|
|||
|
|
j:=Pos(' ',Trim(TEdit(Controls[i]).Text));
|
|||
|
|
if j>0 then
|
|||
|
|
begin
|
|||
|
|
Result:=Result+'and A.'+Controls[i].Hint+Controls[i].Name+' like '+QuotedStr('%'+Copy(Trim(TEdit(Controls[i]).Text),1,j-1 )+'%');
|
|||
|
|
fsj1:=Copy(Trim(TEdit(Controls[i]).Text),j+1,Length(Trim(TEdit(Controls[i]).Text)));
|
|||
|
|
while Trim(fsj1)<>'' do
|
|||
|
|
begin
|
|||
|
|
j:=Pos(' ',Trim(fsj1));
|
|||
|
|
if j>0 then
|
|||
|
|
begin
|
|||
|
|
Result:=Result+'and A.'+Controls[i].Hint+Controls[i].Name+' like '+QuotedStr('%'+Copy(Trim(fsj1),1,j-1 )+'%');
|
|||
|
|
fsj1:=Copy(Trim(fsj1),j+1,Length(Trim(fsj1)));
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
Result:=Result+'and A.'+Controls[i].Hint+Controls[i].Name+' like '+QuotedStr('%'+Trim(fsj1)+'%');
|
|||
|
|
fsj1:='';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
Result:=Result+'and A.'+Controls[i].Hint+Controls[i].Name+' like '+QuotedStr('%'+Trim(TEdit(Controls[i]).Text)+'%');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end else
|
|||
|
|
if Controls[i] is TComboBox then
|
|||
|
|
begin
|
|||
|
|
if Trim(TComboBox(Controls[i]).Text)<>'' then
|
|||
|
|
if Controls[i].Tag=EquTag then
|
|||
|
|
Result:=Result+'and A.'+Controls[i].Hint+Controls[i].Name+'='+QuotedStr(Trim(TComboBox(Controls[i]).Text))
|
|||
|
|
else if Controls[i].Tag=LikeTag then
|
|||
|
|
Result:=Result+'and A.'+Controls[i].Hint+Controls[i].Name+' like '+QuotedStr('%'+Trim(TComboBox(Controls[i]).Text)+'%');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Trim(Result)<>'' then
|
|||
|
|
Result:=Trim(RightBStr(Result,Length(Result)-4));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.InitGrid();
|
|||
|
|
var
|
|||
|
|
fsj10:String;
|
|||
|
|
begin
|
|||
|
|
fsj10:=GetFiltersGY(Panel1,1,2);
|
|||
|
|
if Trim(fsj10)<>'' then
|
|||
|
|
begin
|
|||
|
|
fsj10:=' and '+fsj10;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
fsj10:='';
|
|||
|
|
end;
|
|||
|
|
Panel2.Visible:=True;
|
|||
|
|
Panel2.Refresh;
|
|||
|
|
cxTabControl2.Enabled:=False;
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered:=False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Select AA.* From(');
|
|||
|
|
sql.Add(' select A.*,Cast(ROW_NUMBER() OVER(order by ZIID) as int) as RowNum ');
|
|||
|
|
sql.Add(' ,ImageFileTP=(select ImageFile from Image_Info B inner join Image_File C on B.IMID=C.IMID ');
|
|||
|
|
sql.Add(' where B.WBID=A.ZIID and B.IMNO=''ͼƬ'' and B.Valid=''Y'' and C.Valid=''Y'' and C.IFType=''С'' )');
|
|||
|
|
sql.Add(' ,ImageFileNR=(select ImageFile from Image_Info B inner join Image_File C on B.IMID=C.IMID ');
|
|||
|
|
sql.Add(' where B.WBID=A.ZIID and B.IMNO=''<27><><EFBFBD><EFBFBD>'' and B.Valid=''Y'' and C.Valid=''Y'' and C.IFType=''С'' )');
|
|||
|
|
sql.Add(',GS=(select Sum(GGQty) from ZH_CP_Info_KC KC where KC.ZIID=A.ZIID )');
|
|||
|
|
sql.Add(' from ZH_CP_Info A ');
|
|||
|
|
sql.Add(' where Valid=''Y'' ');
|
|||
|
|
sql.Add(' and ZIDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
|||
|
|
sql.Add(' and ZIDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
|||
|
|
sql.Add(fsj10);
|
|||
|
|
sql.Add(' )AA');
|
|||
|
|
sql.Add(' where RowNum>='+inttostr(cxTabControl2.TabIndex*30+1));
|
|||
|
|
sql.Add(' and RowNum<='+inttostr((cxTabControl2.TabIndex+1)*30));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select AA=count(*) ');
|
|||
|
|
sql.Add(' from ZH_CP_Info A ');
|
|||
|
|
sql.Add(' where Valid=''Y'' ');
|
|||
|
|
if Trim(canshu1)<>'<27><><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and ZIDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
|||
|
|
sql.Add(' and ZIDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and exists(select ZIID from ZH_CP_Info_KC KC where KC.ZIID=A.ZIID and isnull(KC.GGQty,0)>0 and KC.Valid=''Y'' )');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
sql.Add(fsj10);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
CPHZ.Text:=Trim(ADOQueryTemp.fieldbyname('AA').AsString);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select AA=sum(GGQty) ');
|
|||
|
|
sql.Add(' from ZH_CP_Info A ');
|
|||
|
|
sql.Add(' inner join ZH_CP_Info_KC KC on A.ZIID=KC.ZIID');
|
|||
|
|
sql.Add(' where A.Valid=''Y'' and KC.Valid=''Y'' ');
|
|||
|
|
if Trim(canshu1)<>'<27><><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and A.ZIDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
|||
|
|
sql.Add(' and A.ZIDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(fsj10);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
GGHZ.Text:=Trim(ADOQueryTemp.fieldbyname('AA').AsString);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
Panel2.Visible:=False;
|
|||
|
|
cxTabControl2.Enabled:=True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.InitForm();
|
|||
|
|
begin
|
|||
|
|
BegDate.Date:=SGetServerDateMBeg(ADOQueryTemp);
|
|||
|
|
EndDate.Date:=SGetServerDate(ADOQueryTemp);
|
|||
|
|
ReadCxGrid('<27><>˾չ<CBBE><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ѯ',Tv1,'չ<><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
|||
|
|
//InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.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 TfrmZHCPList_BJCX.DelData():Boolean;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
Result:=false;
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
Order_Main.DisableControls;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
//First;
|
|||
|
|
// while Order_Main.Locate('SSel',True,[]) do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' UPdate ZH_CP_Info Set DelTime=getdate(),DelerCode='''+Trim(DCode)+''',Deler='''+Trim(DName)+''', Valid=''N'' ');
|
|||
|
|
sql.Add(' where ZIID='''+Trim(Order_Main.fieldbyname('ZIID').AsString)+'''');
|
|||
|
|
sql.Add(' delete Image_File where IMID in(select IMID from Image_Info where WBID='''+Trim(Order_Main.fieldbyname('ZIID').AsString)+''')');
|
|||
|
|
sql.Add(' delete Image_Info where WBID='''+Trim(Order_Main.fieldbyname('ZIID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Order_Main.EnableControls;
|
|||
|
|
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
function TfrmZHCPList_BJCX.StrFenHang(FStr:string;var FHStr:String):Boolean;
|
|||
|
|
var
|
|||
|
|
i,j:Integer;
|
|||
|
|
LSStr:String;
|
|||
|
|
begin
|
|||
|
|
Result:=False;
|
|||
|
|
FStr:=Trim(FStr);
|
|||
|
|
FHStr:='';
|
|||
|
|
j:=1;
|
|||
|
|
i:=Pos(' ',FStr);
|
|||
|
|
while i>0 do
|
|||
|
|
begin
|
|||
|
|
if j=1 then
|
|||
|
|
begin
|
|||
|
|
LSStr:=Copy(FStr,1,i-1); //'1234 5678 456'
|
|||
|
|
FHStr:='1:'+LSStr;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
LSStr:=Copy(FStr,1,i-1);
|
|||
|
|
if Trim(LSStr)='' then
|
|||
|
|
begin
|
|||
|
|
Fstr:=Copy(Fstr,i+1,Length(Fstr)-i);
|
|||
|
|
end else
|
|||
|
|
FHStr:=FHStr+#13+#10+inttostr(j)+':'+LSStr;
|
|||
|
|
end;
|
|||
|
|
if Trim(LSStr)<>'' then
|
|||
|
|
begin
|
|||
|
|
j:=j+1;
|
|||
|
|
Fstr:=Copy(Fstr,i+1,Length(Fstr)-i);
|
|||
|
|
end;
|
|||
|
|
i:=Pos(' ',FStr);
|
|||
|
|
end;
|
|||
|
|
if j=1 then
|
|||
|
|
begin
|
|||
|
|
FHStr:=FStr;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
if Trim(FStr)<>'' then
|
|||
|
|
begin
|
|||
|
|
FHStr:=FHStr+#13+#10+inttostr(j)+':'+FStr;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Result:=True;
|
|||
|
|
end;
|
|||
|
|
procedure TfrmZHCPList_BJCX.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
|
TcxGridToExcel(Self.Caption,cxGrid1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
IntTab();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
procedure TfrmZHCPList_BJCX.IntTab();
|
|||
|
|
var
|
|||
|
|
JLInt,YeInt,i:Integer;
|
|||
|
|
fsj,fsj10:String;
|
|||
|
|
begin
|
|||
|
|
fsj10:=GetFiltersGY(Panel1,1,2);
|
|||
|
|
if Trim(fsj10)<>'' then
|
|||
|
|
begin
|
|||
|
|
fsj10:=' and '+fsj10;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
fsj10:='';
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
if Trim(canshu1)='<27><><EFBFBD><EFBFBD>' then
|
|||
|
|
begin
|
|||
|
|
sql.Add('select JLInt=isnull(Count(*),0) ');
|
|||
|
|
sql.Add(' from ZH_CP_Info A ');
|
|||
|
|
sql.Add(' where Valid=''Y'' ');
|
|||
|
|
//sql.Add(' and ZIType=''<27><>Ʒ'' ');
|
|||
|
|
sql.Add(' and exists(select ZIID from ZH_CP_Info_KC KC where KC.ZIID=A.ZIID and isnull(KC.GGQty,0)>0 and KC.Valid=''Y'' )');
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
sql.Add(' select JLInt=isnull(Count(*),0) ');
|
|||
|
|
sql.Add(' from ZH_CP_Info A ');
|
|||
|
|
sql.Add(' where Valid=''Y'' ');
|
|||
|
|
//sql.Add(' and ZIType=''<27><>Ʒ'' ');
|
|||
|
|
sql.Add(' and ZIDate>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
|
|||
|
|
sql.Add(' and ZIDate<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
|
|||
|
|
end;
|
|||
|
|
sql.Add(fsj10);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
JLInt:=ADOQueryTemp.fieldbyname('JLInt').AsInteger;
|
|||
|
|
YeInt:=JLInt div 30;
|
|||
|
|
YeInt:=YeInt+1;
|
|||
|
|
cxTabControl2.Tabs.Clear;
|
|||
|
|
for i:=1 to YeInt do
|
|||
|
|
begin
|
|||
|
|
fsj:='<27><>'+IntToStr(i)+'ҳ';
|
|||
|
|
cxTabControl2.Tabs.Add(fsj);
|
|||
|
|
end;
|
|||
|
|
YeHZ.Text:=IntToStr(YeInt);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitForm();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.CheckBox2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.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 TfrmZHCPList_BJCX.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.ZJStatusChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.Tv1DblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ModalResult:=1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.v1Column2PropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue:String;
|
|||
|
|
begin
|
|||
|
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
if Trim(mvalue)='' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('ZICost').Value:=Null;
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
FieldByName('ZICost').Value:=mvalue;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
if Trim(mvalue)<>'' then
|
|||
|
|
begin
|
|||
|
|
sql.Add('Update ZH_CP_Info Set ZICost='+mvalue);
|
|||
|
|
end else
|
|||
|
|
begin
|
|||
|
|
sql.Add('Update ZH_CP_Info Set ZICost=Null');
|
|||
|
|
end;
|
|||
|
|
sql.Add(' where ZIID='''+Trim(Order_Main.fieldbyname('ZIID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.cxTabControl2Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.ZIIDKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key=#13 then
|
|||
|
|
begin
|
|||
|
|
BegDate.Date:=StrToDate('2000-01-01');
|
|||
|
|
EndDate.Date:=StrToDate('2500-01-01');
|
|||
|
|
IntTab();
|
|||
|
|
InitGrid();
|
|||
|
|
if Trim(TEdit(Sender).Name)='ZIID' then
|
|||
|
|
begin
|
|||
|
|
ZIID.Text:='';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.Tv1MouseDown(Sender: TObject; Button: TMouseButton;
|
|||
|
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
|
//var
|
|||
|
|
//fsj:String;
|
|||
|
|
begin
|
|||
|
|
{ StrFenHang(Order_Main.fieldbyname('ZIGY').AsString,fsj);
|
|||
|
|
if Trim(Order_Main.fieldbyname('ZIGY').AsString)<>fsj then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update ZH_CP_Info Set ZIGY='''+fsj+'''');
|
|||
|
|
sql.Add(' where ZIID='''+Trim(Order_Main.fieldbyname('ZIID').AsString)+'''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('ZIGY').Value:=fsj;
|
|||
|
|
//Post;
|
|||
|
|
end; }
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmZHCPList_BJCX.ZITypeChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
BegDate.Date:=StrToDate('2000-01-01');
|
|||
|
|
EndDate.Date:=StrToDate('2500-01-01');
|
|||
|
|
IntTab();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|