2025-01-20 13:04:03 +08:00
|
|
|
|
unit U_CPListDML;
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
2025-07-08 09:22:54 +08:00
|
|
|
|
Menus, cxButtonEdit, cxDropDownEdit, cxPC, Buttons, cxTextEdit, cxImage,StrUtils,
|
2025-07-19 16:54:23 +08:00
|
|
|
|
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
|
|
|
|
|
dxSkinDarkRoom,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dxSkinOffice2013White,
|
|
|
|
|
|
dxSkinSharpPlus,
|
|
|
|
|
|
dxSkinSpringTime,
|
|
|
|
|
|
dxSkinsDefaultPainters,
|
|
|
|
|
|
dxSkinscxPCPainter,
|
2025-07-08 09:22:54 +08:00
|
|
|
|
cxNavigator, dxBarBuiltInMenu;
|
2025-01-20 13:04:03 +08:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmCPListDML = class(TForm)
|
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
|
TBRafresh: TToolButton;
|
|
|
|
|
|
TBFind: TToolButton;
|
|
|
|
|
|
TBAdd: TToolButton;
|
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
|
Tv1: TcxGridDBTableView;
|
|
|
|
|
|
cxGrid1Level1: TcxGridLevel;
|
|
|
|
|
|
cxGrid1: TcxGrid;
|
|
|
|
|
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
|
ADOQueryMain: TADOQuery;
|
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
|
DataSource1: TDataSource;
|
|
|
|
|
|
TBExport: TToolButton;
|
|
|
|
|
|
Order_Main: TClientDataSet;
|
|
|
|
|
|
ToolButton1: TToolButton;
|
|
|
|
|
|
Panel11: TPanel;
|
|
|
|
|
|
v1Column1: TcxGridDBColumn;
|
|
|
|
|
|
v1Column7: TcxGridDBColumn;
|
|
|
|
|
|
v1Column9: TcxGridDBColumn;
|
|
|
|
|
|
ToolButton4: TToolButton;
|
|
|
|
|
|
RM1: TRMGridReport;
|
|
|
|
|
|
RMDBMain: TRMDBDataSet;
|
|
|
|
|
|
RMXLSExport2: TRMXLSExport;
|
|
|
|
|
|
CDS_PRT: TClientDataSet;
|
|
|
|
|
|
v1Column4: TcxGridDBColumn;
|
|
|
|
|
|
v1Column6: TcxGridDBColumn;
|
|
|
|
|
|
v1ZICost: TcxGridDBColumn;
|
|
|
|
|
|
v1Column3: TcxGridDBColumn;
|
|
|
|
|
|
v1Column2: TcxGridDBColumn;
|
|
|
|
|
|
v1Column8: TcxGridDBColumn;
|
|
|
|
|
|
PopupMenu1: TPopupMenu;
|
|
|
|
|
|
TBEdit: TMenuItem;
|
|
|
|
|
|
TBDel: TMenuItem;
|
|
|
|
|
|
Panel2: TPanel;
|
|
|
|
|
|
cxTabControl2: TcxTabControl;
|
|
|
|
|
|
v1Column10: TcxGridDBColumn;
|
|
|
|
|
|
v1Column11: TcxGridDBColumn;
|
|
|
|
|
|
v1Column12: TcxGridDBColumn;
|
|
|
|
|
|
Panel3: TPanel;
|
|
|
|
|
|
CheckBox1: TCheckBox;
|
|
|
|
|
|
v1Column13: TcxGridDBColumn;
|
|
|
|
|
|
Panel4: TPanel;
|
|
|
|
|
|
Label9: TLabel;
|
|
|
|
|
|
YeHZ: TEdit;
|
|
|
|
|
|
Label10: TLabel;
|
|
|
|
|
|
CPHZ: TEdit;
|
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
|
GGHZ: TEdit;
|
|
|
|
|
|
Label12: TLabel;
|
|
|
|
|
|
KWView: TMenuItem;
|
|
|
|
|
|
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;
|
|
|
|
|
|
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 TBAddClick(Sender: TObject);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure CheckBox1Click(Sender: TObject);
|
|
|
|
|
|
procedure CheckBox2Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
procedure CustomerNoNameChange(Sender: TObject);
|
|
|
|
|
|
procedure TBDelClick(Sender: TObject);
|
|
|
|
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|
|
|
|
|
procedure ZJStatusChange(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton4Click(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 TBEditClick(Sender: TObject);
|
|
|
|
|
|
procedure KWViewClick(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: TfrmZHCPList;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses
|
|
|
|
|
|
U_DataLink,U_RTFun,U_CPInPutDML,U_KWView;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.FormDestroy(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
//frmZHCPList:=nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.FormClose(Sender: TObject;
|
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Action:=caFree;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.FormCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxgrid1.Align:=alClient;
|
|
|
|
|
|
canshu1:=Trim(DParameters1);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.TBCloseClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>)*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>)',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
end else
|
|
|
|
|
|
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
end else
|
|
|
|
|
|
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
end else
|
|
|
|
|
|
if Trim(Self.Caption)='<27>ҹ<EFBFBD><D2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid('<27>ҹ<EFBFBD><D2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function TfrmCPListDML.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 TfrmCPListDML.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;
|
|
|
|
|
|
if Self.canshu1='<27><><EFBFBD><EFBFBD>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
sql.Add('Select AA.* From(');
|
|
|
|
|
|
sql.Add(' select A.*,Cast(ROW_NUMBER() OVER(order by A.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=KC.GGQty');
|
|
|
|
|
|
sql.Add('From(');
|
|
|
|
|
|
sql.Add(' select ZIID,GGQty=sum(GGQty) from ZH_CP_Info_KC where isnull(GGQty,0)>0 and Valid=''Y'' Group by ZIID) KC');
|
|
|
|
|
|
sql.Add(' inner join ZH_CP_Info A on KC.ZIID=A.ZIID');
|
|
|
|
|
|
sql.Add(' where A.Valid=''Y'' ');
|
|
|
|
|
|
sql.Add(' and A.ZIType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|
|
|
|
|
sql.Add(fsj10);
|
|
|
|
|
|
sql.Add(')AA');
|
|
|
|
|
|
sql.Add(' where RowNum>='+inttostr(cxTabControl2.TabIndex*30+1));
|
|
|
|
|
|
sql.Add(' and RowNum<='+inttostr((cxTabControl2.TabIndex+1)*30));
|
|
|
|
|
|
end else
|
|
|
|
|
|
begin
|
|
|
|
|
|
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 A.ZIType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|
|
|
|
|
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));
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
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'' ');
|
|
|
|
|
|
sql.Add(' and A.ZIType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|
|
|
|
|
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'' ');
|
|
|
|
|
|
sql.Add(' and A.ZIType=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|
|
|
|
|
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 TfrmCPListDML.InitForm();
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date:=SGetServerDateMBeg(ADOQueryTemp);
|
|
|
|
|
|
EndDate.Date:=SGetServerDate(ADOQueryTemp);
|
|
|
|
|
|
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>)*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>(<28><>)',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
TBAdd.Visible:=True;
|
|
|
|
|
|
TBEdit.Visible:=True;
|
|
|
|
|
|
TBDel.Visible:=True;
|
|
|
|
|
|
end else
|
|
|
|
|
|
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
TBAdd.Visible:=True;
|
|
|
|
|
|
TBEdit.Visible:=True;
|
|
|
|
|
|
v1ZICost.Visible:=False;
|
|
|
|
|
|
v1ZICost.Hidden:=True;
|
|
|
|
|
|
end else
|
|
|
|
|
|
if Trim(Self.Caption)='<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>ѯ',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
v1ZICost.Visible:=False;
|
|
|
|
|
|
v1ZICost.Hidden:=True;
|
|
|
|
|
|
end else
|
|
|
|
|
|
if Trim(Self.Caption)='<27>ҹ<EFBFBD><D2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ReadCxGrid('<27>ҹ<EFBFBD><D2B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><CFB9><EFBFBD>');
|
|
|
|
|
|
v1ZICost.Visible:=False;
|
|
|
|
|
|
v1ZICost.Hidden:=True;
|
|
|
|
|
|
canshu1:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
Panel5.Visible:=False;
|
|
|
|
|
|
end;
|
|
|
|
|
|
//InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.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 TfrmCPListDML.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 TfrmCPListDML.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 TfrmCPListDML.TBExportClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ADOQueryMain.IsEmpty then Exit;
|
|
|
|
|
|
TcxGridToExcel(Self.Caption,cxGrid1);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.TBRafreshClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
IntTab();
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure TfrmCPListDML.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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|
|
|
|
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|
|
|
|
|
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 TfrmCPListDML.TBAddClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmCPInPutDML:=TfrmCPInPutDML.Create(Application);
|
|
|
|
|
|
with frmCPInPutDML do
|
|
|
|
|
|
begin
|
|
|
|
|
|
PState:=0;
|
|
|
|
|
|
FMainId:='';
|
|
|
|
|
|
if ShowModal=1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Self.ZIID.Text:=Trim(frmCPInPutDML.FMainId);
|
|
|
|
|
|
IntTab();
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
Self.ZIID.Text:='';
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmCPInPutDML.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
InitForm();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.CheckBox1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.CheckBox2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
TBRafresh.Click;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Order_Main.IsEmpty then Exit;
|
|
|
|
|
|
try
|
|
|
|
|
|
frmCPInPutDML:=TfrmCPInPutDML.Create(Application);
|
|
|
|
|
|
with frmCPInPutDML do
|
|
|
|
|
|
begin
|
|
|
|
|
|
PState:=1;
|
|
|
|
|
|
FMainId:=Trim(Order_Main.fieldbyname('ZIID').AsString);
|
|
|
|
|
|
TBSave.Visible:=False;
|
|
|
|
|
|
if ShowModal=1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
//InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmCPInPutDML.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.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 TfrmCPListDML.TBDelClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Order_Main.IsEmpty then Exit;
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select * from ZH_CP_Info where ZIID like '''+Trim(Order_Main.fieldbyname('ZIID').AsString)+'-%'+''' and valid=''Y'' ');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.IsEmpty=False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27>Ѵ<EFBFBD><D1B4>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|
|
|
|
|
if DelData() then
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Order_Main.Delete;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.cxTabControl1Change(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.ZJStatusChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
TBFind.Click;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.ToolButton4Click(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
fPrintFile,Txt,fImagePath,maxno:string;
|
|
|
|
|
|
i,j:Integer;
|
|
|
|
|
|
Moudle: THandle;
|
|
|
|
|
|
Makebar:TMakebar;
|
|
|
|
|
|
Mixtext:TMixtext;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Order_Main.IsEmpty then Exit;
|
|
|
|
|
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\չ<><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ǩ85.rmf';
|
|
|
|
|
|
if FileExists(fPrintFile)=False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\չ<><D5B9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ǩ85.rmf'),'<27><>ʾ',0);
|
|
|
|
|
|
exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Order_Main.DisableControls;
|
|
|
|
|
|
with Order_Main do
|
|
|
|
|
|
begin
|
|
|
|
|
|
//First;
|
|
|
|
|
|
//while Locate('SSel',True,[]) do
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
sql.Add(' select A.* ,C.ImageFile');
|
|
|
|
|
|
sql.Add(' from ZH_CP_Info A');
|
|
|
|
|
|
sql.Add(' inner join Image_Info B on A.ZIID=B.WBID');
|
|
|
|
|
|
sql.Add(' inner join Image_File C on B.IMID=C.IMID');
|
|
|
|
|
|
sql.Add(' where A.ZIID='''+Trim(Order_Main.fieldbyname('ZIID').AsString)+'''');
|
|
|
|
|
|
sql.Add(' and B.IMNO=''ͼƬ'' and A.Valid=''Y'' and B.Valid=''Y'' and C.Valid=''Y'' ');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
SCreateCDS20(ADOQueryTemp,CDS_PRT);
|
|
|
|
|
|
SInitCDSData20(ADOQueryTemp,CDS_PRT);
|
|
|
|
|
|
try
|
|
|
|
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|
|
|
|
|
if GetLSNo(ADOQueryCmd,maxno,'DYKC','ZH_CP_Info_KC',4,1,)=False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('ȡ<><C8A1>Ʒ<EFBFBD><C6B7>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
SQL.Add('select * from ZH_CP_Info_KC where DYId='''+Trim(maxno)+'''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('ZIId').Value:=Trim(Order_Main.fieldbyname('ZIID').AsString);
|
|
|
|
|
|
FieldByName('DYId').Value:=Trim(maxno);
|
|
|
|
|
|
FieldByName('Filler').Value:=Trim(DName);
|
|
|
|
|
|
FieldByName('FillerCode').Value:=Trim(DCode);
|
|
|
|
|
|
FieldByName('Valid').Value:='Y';
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('Update ZH_CP_Info_KC Set DYXH=isnull((select max(DYXH) from ZH_CP_Info_KC A ');
|
|
|
|
|
|
sql.Add(' where A.ZIID='''+Trim(Order_Main.fieldbyname('ZIID').AsString)+'''),0)+1 ');
|
|
|
|
|
|
sql.Add(' where DYID='''+Trim(maxno)+'''');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|
|
|
|
|
except
|
|
|
|
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
|
|
|
Moudle:=LoadLibrary('MakeQRBarcode.dll');
|
|
|
|
|
|
@Makebar:=GetProcAddress(Moudle,'Make');
|
|
|
|
|
|
@Mixtext:=GetProcAddress(Moudle,'MixText');
|
|
|
|
|
|
Txt:=Trim(maxno);
|
|
|
|
|
|
fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp';
|
|
|
|
|
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then
|
|
|
|
|
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil);
|
|
|
|
|
|
if FileExists(fImagePath) then DeleteFile(fImagePath);
|
|
|
|
|
|
Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3);
|
|
|
|
|
|
except
|
|
|
|
|
|
application.MessageBox('<27><>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONERROR);
|
|
|
|
|
|
exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
RMVariables['QRBARCODE']:=fImagePath;
|
|
|
|
|
|
RMVariables['DYID']:=maxno;
|
|
|
|
|
|
RM1.LoadFromFile(fPrintFile);
|
|
|
|
|
|
// RM1.ShowReport;
|
|
|
|
|
|
RM1.PrintReport;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Order_Main.EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.Tv1DblClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ToolButton1.Click;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.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 TfrmCPListDML.cxTabControl2Change(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.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;
|
|
|
|
|
|
if CheckBox1.Checked=True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ToolButton4.Click;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.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 TfrmCPListDML.TBEditClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Order_Main.IsEmpty then Exit;
|
|
|
|
|
|
try
|
|
|
|
|
|
frmCPInPutDML:=TfrmCPInPutDML.Create(Application);
|
|
|
|
|
|
with frmCPInPutDML do
|
|
|
|
|
|
begin
|
|
|
|
|
|
PState:=1;
|
|
|
|
|
|
FMainId:=Trim(Order_Main.fieldbyname('ZIID').AsString);
|
|
|
|
|
|
if ShowModal=1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Self.ZIID.Text:=Trim(frmCPInPutDML.FMainId);
|
|
|
|
|
|
IntTab();
|
|
|
|
|
|
InitGrid();
|
|
|
|
|
|
Self.ZIID.Text:='';
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmCPInPutDML.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmCPListDML.KWViewClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmKWView:=TfrmKWView.Create(Application);
|
|
|
|
|
|
with frmKWView do
|
|
|
|
|
|
begin
|
|
|
|
|
|
FZIID:=Trim(Self.Order_Main.fieldbyname('ZIID').AsString);
|
|
|
|
|
|
if ShowModal=1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmKWView.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|