1968 lines
55 KiB
ObjectPascal
1968 lines
55 KiB
ObjectPascal
|
|
unit U_SalesContractList2;
|
|||
|
|
|
|||
|
|
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, cxPC, cxButtonEdit,
|
|||
|
|
cxTextEdit, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
|||
|
|
dxSkinsDefaultPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
|
|||
|
|
U_BaseList, RM_e_Graphic, RM_e_Jpeg, RM_E_llPDF, Vcl.Clipbrd, cxMemo,
|
|||
|
|
dxSkinOffice2013White, dxSkinWXI, dxScrollbarAnnotations, cxContainer,
|
|||
|
|
cxCurrencyEdit, cxMaskEdit;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmSalesContractList2 = class(TfrmBaseList)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
TBFind: TToolButton;
|
|||
|
|
TBPrint: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
GPM_1: TcxGridPopupMenu;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
DS_1: TDataSource;
|
|||
|
|
v1OrdDate: TcxGridDBColumn;
|
|||
|
|
v1DeliveryDate: TcxGridDBColumn;
|
|||
|
|
v1OrdPerson1: TcxGridDBColumn;
|
|||
|
|
v1ConNo: TcxGridDBColumn;
|
|||
|
|
CDS_2: TClientDataSet;
|
|||
|
|
v1CustomerNoName: TcxGridDBColumn;
|
|||
|
|
v1Column1: TcxGridDBColumn;
|
|||
|
|
v1Column4: TcxGridDBColumn;
|
|||
|
|
pm2: TPopupMenu;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
BuyName: TEdit;
|
|||
|
|
HZSCSName: TEdit;
|
|||
|
|
MPRTCodeName: TEdit;
|
|||
|
|
ConNo: TEdit;
|
|||
|
|
MPRTKZ: TEdit;
|
|||
|
|
MPRTMF: TEdit;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
DS_2: TDataSource;
|
|||
|
|
v1Column8: TcxGridDBColumn;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
v1Column10: TcxGridDBColumn;
|
|||
|
|
v1Column12: TcxGridDBColumn;
|
|||
|
|
v1Column9: TcxGridDBColumn;
|
|||
|
|
GPM_2: TcxGridPopupMenu;
|
|||
|
|
CDS_1: TClientDataSet;
|
|||
|
|
v1Column13: TcxGridDBColumn;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
BuyConNo: TEdit;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
|
pm1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
ADOQueryImage: TADOQuery;
|
|||
|
|
Tv1Column19: TcxGridDBColumn;
|
|||
|
|
IsJYTime: TCheckBox;
|
|||
|
|
ToolButton7: TToolButton;
|
|||
|
|
N3: TMenuItem;
|
|||
|
|
N4: TMenuItem;
|
|||
|
|
Tv1Column25: TcxGridDBColumn;
|
|||
|
|
Tv1Column27: TcxGridDBColumn;
|
|||
|
|
N5: TMenuItem;
|
|||
|
|
N6: TMenuItem;
|
|||
|
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
|
Tv1Column15: TcxGridDBColumn;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
Filler: TEdit;
|
|||
|
|
Tv1Column16: TcxGridDBColumn;
|
|||
|
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
|
Tv1Column18: TcxGridDBColumn;
|
|||
|
|
Tv1Column20: TcxGridDBColumn;
|
|||
|
|
Tv1Column21: TcxGridDBColumn;
|
|||
|
|
Tv1Column22: TcxGridDBColumn;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
Panel3: TPanel;
|
|||
|
|
ToolBar2: TToolBar;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
ToolButton5: TToolButton;
|
|||
|
|
pnlkpkk: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Label15: TLabel;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
PCTime: TDateTimePicker;
|
|||
|
|
carnum: TcxCurrencyEdit;
|
|||
|
|
PCPiece: TcxCurrencyEdit;
|
|||
|
|
PCType: TComboBox;
|
|||
|
|
PCQty: TEdit;
|
|||
|
|
Button2: TButton;
|
|||
|
|
cxGrid3: TcxGrid;
|
|||
|
|
tv3: TcxGridDBTableView;
|
|||
|
|
V1SSel: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
|
TV1Column23: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn10: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn11: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn12: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn13: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn14: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn15: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn16: TcxGridDBColumn;
|
|||
|
|
V1Column3: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn17: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn18: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn19: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn20: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn21: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn22: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn23: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn24: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn25: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn27: TcxGridDBColumn;
|
|||
|
|
cxGridLevel2: TcxGridLevel;
|
|||
|
|
ADO_Car: TADOQuery;
|
|||
|
|
GPM_3: TcxGridPopupMenu;
|
|||
|
|
CDS_3: TClientDataSet;
|
|||
|
|
DS_3: TDataSource;
|
|||
|
|
ToolButton6: TToolButton;
|
|||
|
|
CDS_4: TClientDataSet;
|
|||
|
|
DS_4: TDataSource;
|
|||
|
|
ToolButton8: TToolButton;
|
|||
|
|
cxSplitter1: TcxSplitter;
|
|||
|
|
Panel4: TPanel;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
TV2: TcxGridDBTableView;
|
|||
|
|
TV2Column1: TcxGridDBColumn;
|
|||
|
|
v1XHNo: TcxGridDBColumn;
|
|||
|
|
VC_SCSCode: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn3: TcxGridDBColumn;
|
|||
|
|
v1Column5: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn5: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn6: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn7: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn8: TcxGridDBColumn;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
v1Column7: TcxGridDBColumn;
|
|||
|
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
|
v1PRTPrice: TcxGridDBColumn;
|
|||
|
|
cxGridDBColumn9: TcxGridDBColumn;
|
|||
|
|
v1Column2: TcxGridDBColumn;
|
|||
|
|
TV2Column10: TcxGridDBColumn;
|
|||
|
|
TV2Column4: TcxGridDBColumn;
|
|||
|
|
TV2Column8: TcxGridDBColumn;
|
|||
|
|
TV2Column2: TcxGridDBColumn;
|
|||
|
|
TV2Column3: TcxGridDBColumn;
|
|||
|
|
TV2Column5: TcxGridDBColumn;
|
|||
|
|
TV2Column6: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
Panel5: TPanel;
|
|||
|
|
Label18: TLabel;
|
|||
|
|
Label22: TLabel;
|
|||
|
|
C_Code: TEdit;
|
|||
|
|
C_Name: TEdit;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
C_Color: TEdit;
|
|||
|
|
C_CJsize: TEdit;
|
|||
|
|
cds_5: TClientDataSet;
|
|||
|
|
ds_5: TDataSource;
|
|||
|
|
ToolButton9: TToolButton;
|
|||
|
|
ADOQuery1: TADOQuery;
|
|||
|
|
PM3: TPopupMenu;
|
|||
|
|
MenuItem1: TMenuItem;
|
|||
|
|
MenuItem2: TMenuItem;
|
|||
|
|
MenuItem3: TMenuItem;
|
|||
|
|
RMDB_1: TRMDBDataSet;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
DYGS: TcxButtonEdit;
|
|||
|
|
RM1: TRMGridReport;
|
|||
|
|
ToolButton10: TToolButton;
|
|||
|
|
TV2Column7: TcxGridDBColumn;
|
|||
|
|
TV2Column9: TcxGridDBColumn;
|
|||
|
|
TV2Column11: TcxGridDBColumn;
|
|||
|
|
TV2Column12: TcxGridDBColumn;
|
|||
|
|
TV2Column13: TcxGridDBColumn;
|
|||
|
|
TV2Column14: TcxGridDBColumn;
|
|||
|
|
TV2Column15: TcxGridDBColumn;
|
|||
|
|
Label19: TLabel;
|
|||
|
|
zpcid: TEdit;
|
|||
|
|
ToolButton11: TToolButton;
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBFindClick(Sender: TObject);
|
|||
|
|
procedure TBEditClick(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 ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure BuyNameChange(Sender: TObject);
|
|||
|
|
procedure tchkClick(Sender: TObject);
|
|||
|
|
procedure TnochkClick(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
procedure TqxClick(Sender: TObject);
|
|||
|
|
procedure TnoqxClick(Sender: TObject);
|
|||
|
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
|
procedure Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
procedure btnTijiaoClick(Sender: TObject);
|
|||
|
|
procedure btnCXTijiaoClick(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure btnWCClick(Sender: TObject);
|
|||
|
|
procedure btnWCCXClick(Sender: TObject);
|
|||
|
|
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure ToolButton7Click(Sender: TObject);
|
|||
|
|
procedure N3Click(Sender: TObject);
|
|||
|
|
procedure N4Click(Sender: TObject);
|
|||
|
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
procedure N5Click(Sender: TObject);
|
|||
|
|
procedure N6Click(Sender: TObject);
|
|||
|
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
|
procedure ConNoChange(Sender: TObject);
|
|||
|
|
procedure BuyConNoChange(Sender: TObject);
|
|||
|
|
procedure CurrencyChange(Sender: TObject);
|
|||
|
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
|
procedure Button2Click(Sender: TObject);
|
|||
|
|
procedure TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
procedure TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
procedure ToolButton8Click(Sender: TObject);
|
|||
|
|
procedure FormResize(Sender: TObject);
|
|||
|
|
procedure C_CodeChange(Sender: TObject);
|
|||
|
|
procedure ToolButton9Click(Sender: TObject);
|
|||
|
|
procedure MenuItem1Click(Sender: TObject);
|
|||
|
|
procedure MenuItem2Click(Sender: TObject);
|
|||
|
|
procedure MenuItem3Click(Sender: TObject);
|
|||
|
|
procedure DYGSPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure ToolButton10Click(Sender: TObject);
|
|||
|
|
procedure ToolButton11Click(Sender: TObject);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
fFlileFlag: string;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
procedure SetStatus();
|
|||
|
|
procedure InitSub();
|
|||
|
|
procedure InitImage();
|
|||
|
|
procedure Initcard();
|
|||
|
|
procedure PrintCar(MPCID: string);
|
|||
|
|
procedure RefreshCardCount();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FFInt, FCloth: Integer;
|
|||
|
|
FAuthority, FGSTT, FSubIdS, FPCIDS: string;
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_SalesConInPut, U_RTFun, U_AttachmentUpload, U_LabelPrint,
|
|||
|
|
U_RZCK1, U_DyeCardGlideEdit, U_DyeCardGlideEdit2, U_ZDYHelp, U_cdzdy;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
procedure TfrmSalesContractList2.PrintCar(MPCID: string);
|
|||
|
|
var
|
|||
|
|
fPrintFile: string;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
Filtered := False;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Trade_Card_Prt1 ');
|
|||
|
|
sql.Add(' @Filtration=' + quotedstr(trim(MPCID)));
|
|||
|
|
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryTemp, CDS_4);
|
|||
|
|
SInitCDSData(ADOQueryTemp, CDS_4);
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
Filtered := False;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('exec P_Trade_Card_Prt2 ');
|
|||
|
|
sql.Add(' @Filtration=' + quotedstr(trim(MPCID)));
|
|||
|
|
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryTemp, CDS_5);
|
|||
|
|
SInitCDSData(ADOQueryTemp, CDS_5);
|
|||
|
|
ExportFtErpFile(trim(dygs.text) + '.rmf', ADOQueryTemp);
|
|||
|
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + trim(dygs.text) + '.rmf';
|
|||
|
|
|
|||
|
|
if FileExists(fPrintFile) then
|
|||
|
|
begin
|
|||
|
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
|
RMVariables['FILLTIME'] := CDS_4.FieldByName('FILLTIME').AsString;
|
|||
|
|
RM1.PrintReport;
|
|||
|
|
sleep(200);
|
|||
|
|
// if canshu1 <> '<27><>ѯ' then
|
|||
|
|
// begin
|
|||
|
|
// with ADOQueryCmd do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('update Dye_Plan_Card SET status=''9'' ');
|
|||
|
|
// sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString)));
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD>ҵ<EFBFBD>' + trim(fPrintFile)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.InitImage();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
ADOQueryImage.Close;
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
with ADOQueryImage do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from TP_File A');
|
|||
|
|
sql.Add('where WBID=' + quotedstr(trim(CDS_1.fieldbyname('SubId').AsString)));
|
|||
|
|
sql.Add('and TFType=' + quotedstr(trim('HX')));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.InitSub();
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
with ADOQUERY1 do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * ');
|
|||
|
|
sql.Add(',GlideList=[dbo].[F_Trade_Card_GlideList](A.consid) ');
|
|||
|
|
sql.Add(',IsCard=cast(case when exists(select 1 from Trade_Plan_Card B where B.SubId=A.consid) then 1 else 0 end as bit) ');
|
|||
|
|
sql.Add(',CardCount=(select count(1) from Trade_Plan_Card B where B.SubId=A.consid) ');
|
|||
|
|
sql.Add('from BS_Contract_sub A where ConMID =' + quotedstr((CDS_1.fieldbyname('ConMID').AsString)));
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQUERY1, CDS_2);
|
|||
|
|
SInitCDSData(ADOQUERY1, CDS_2);
|
|||
|
|
// TV2.DataController.Filter.Clear;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.MenuItem1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNoFiler(Tv3, True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.MenuItem2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNoFiler(Tv3, FALSE);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.MenuItem3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Clipboard.SetTextBuf(PChar(Trim(CDS_3.fieldbyname(TV3.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.Initcard();
|
|||
|
|
begin
|
|||
|
|
if CDS_2.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
// sql.Add('select * from BS_Contract_sub A ');
|
|||
|
|
// sql.Add('where ConMID =' + quotedstr((CDS_2.fieldbyname('ConMID').AsString)));
|
|||
|
|
|
|||
|
|
sql.Add('select A.*');
|
|||
|
|
sql.Add(',GlideList=[dbo].[F_Trade_Card_GlideList](A.PCID) ');
|
|||
|
|
sql.Add('from Trade_Plan_Card A ');
|
|||
|
|
// sql.Add('inner join Dye_Plan_Glide B on B.PCID=A.PCID');
|
|||
|
|
sql.Add('where subid= ' + quotedstr((CDS_2.fieldbyname('ConsID').AsString)));
|
|||
|
|
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryTemp, CDS_3);
|
|||
|
|
SInitCDSData(ADOQueryTemp, CDS_3);
|
|||
|
|
// TV3.DataController.Filter.Clear;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.RefreshCardCount();
|
|||
|
|
var
|
|||
|
|
mIds: string;
|
|||
|
|
Bmk: TBookmark;
|
|||
|
|
begin
|
|||
|
|
if CDS_2.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
CDS_2.DisableControls;
|
|||
|
|
Bmk := CDS_2.GetBookmark;
|
|||
|
|
mIds := '';
|
|||
|
|
CDS_2.First;
|
|||
|
|
while not CDS_2.Eof do
|
|||
|
|
begin
|
|||
|
|
mIds := mIds + trim(CDS_2.FieldByName('ConsID').AsString) + ';';
|
|||
|
|
CDS_2.Next;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select A.ConsID, CardCount=(select count(1) from Trade_Plan_Card B where B.SubId=A.ConsID) ');
|
|||
|
|
sql.Add('from BS_Contract_sub A ');
|
|||
|
|
sql.Add('where exists(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(mIds) + ','';'') X where X.RTValue=A.ConsID) ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
CDS_2.First;
|
|||
|
|
while not CDS_2.Eof do
|
|||
|
|
begin
|
|||
|
|
if ADOQueryTemp.Locate('ConsID', trim(CDS_2.FieldByName('ConsID').AsString), []) then
|
|||
|
|
begin
|
|||
|
|
CDS_2.Edit;
|
|||
|
|
CDS_2.FieldByName('IsCard').AsBoolean := ADOQueryTemp.FieldByName('CardCount').AsInteger > 0;
|
|||
|
|
CDS_2.FieldByName('CardCount').AsInteger := ADOQueryTemp.FieldByName('CardCount').AsInteger;
|
|||
|
|
CDS_2.Post;
|
|||
|
|
end;
|
|||
|
|
CDS_2.Next;
|
|||
|
|
end;
|
|||
|
|
ADOQueryTemp.Close;
|
|||
|
|
CDS_2.GotoBookmark(Bmk);
|
|||
|
|
CDS_2.FreeBookmark(Bmk);
|
|||
|
|
CDS_2.EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNoFiler(Tv2, True); //ȫѡ
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNoFiler(Tv2, False); //ȫ<><C8AB>
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.N3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Clipboard.SetTextBuf(PChar(Trim(CDS_2.fieldbyname(TV2.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.N4Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Clipboard.SetTextBuf(PChar(Trim(CDS_2.fieldbyname(TV2.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.N5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_1, True);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.N6Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_1, False);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.SetStatus();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
// frmContractListNX:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.FormResize(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
w: Integer;
|
|||
|
|
begin
|
|||
|
|
if Panel2.Width > 0 then
|
|||
|
|
begin
|
|||
|
|
w := Round(Panel2.Width / 5 * 2);
|
|||
|
|
if w < 80 then
|
|||
|
|
w := 80; //<2F><>С<EFBFBD><D0A1><EFBFBD><EFBFBD>80<38><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
Panel3.Width := w;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
Panel3.Width := 80;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
|
BegDate.DateTime := EndDate.DateTime - 90;
|
|||
|
|
PCTIME.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.InitGrid();
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
WSql := SGetFilters(Panel1, 1, 2);
|
|||
|
|
if trim(WSql) <> '' then
|
|||
|
|
begin
|
|||
|
|
WSql := ' and ' + trim(WSql);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if IsJYTime.Checked then
|
|||
|
|
begin
|
|||
|
|
WSql := WSql + ' and ConDate>' + quotedstr(FormatDateTime('yyyy-MM-dd', BegDate.DateTime));
|
|||
|
|
WSql := WSql + ' and ConDate<=' + quotedstr(FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
if trim(WSql) <> '' then
|
|||
|
|
WSql := ' and 1=1' + trim(WSql)
|
|||
|
|
else
|
|||
|
|
WSql := WSql + ' and 1=2 ';
|
|||
|
|
end;
|
|||
|
|
if trim(WSql) = 'and 1=2' then
|
|||
|
|
Application.MessageBox('<27><>ѡ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
|
|||
|
|
sql.Add('select AA.* ,row_number() over(order by ConDate) as XH ');
|
|||
|
|
sql.Add(',DJStatus=case when THstatus =''1'' then 1 else 0 end');
|
|||
|
|
sql.Add('from (select A.*');
|
|||
|
|
sql.Add(',ZJSJC=(select top 1 CoAbbrName from BS_Company B where B.CoCode=A.MiddleNo and B.Valid=''Y'' )');
|
|||
|
|
sql.Add(',ISSC=cast((case when (select COUNT(T.WBID) from FJ_File T where T.WBID=A.ConMID and T.TFType=''<27><>ͬ'')=0 then 0 else 1 end) as bit )');
|
|||
|
|
sql.Add(',XGYJ=cast((case when (select COUNT(T.WBID) from FJ_File T where T.WBID=A.ConMID and T.TFType=''<27><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>'')=0 then 0 else 1 end) as bit )');
|
|||
|
|
sql.Add(',amount=isnull((select sum(C.ConTotalAmount) from BS_Contract_Sub C where C.conmid=A.conmid),0)-isnull(A.Inspection,0)');
|
|||
|
|
sql.Add(',Qty=(select sum(C.ConQty) from BS_Contract_Sub C where C.conmid=A.conmid)');
|
|||
|
|
sql.Add(',HZSCSName= STUFF(( SELECT '','' +convert(VARCHAR, C_Name) FROM BS_Contract_Sub c where C.conmid=A.conmid FOR XML PATH('''')), 1, 1, '''') ');
|
|||
|
|
sql.Add(',ZPCID= STUFF(( SELECT '','' +convert(VARCHAR, pcid) FROM TRADE_PLAN_CARD d where d.mainid=A.conmid FOR XML PATH('''')), 1, 1, '''') ');
|
|||
|
|
|
|||
|
|
sql.Add(' from BS_Contract_Main A ) AA ');
|
|||
|
|
sql.Add('where 1=1 ' + (WSql));
|
|||
|
|
sql.Add(' and AA.ConType in (''<27><><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD>'') ');
|
|||
|
|
|
|||
|
|
// if Trim(FAuthority) = '¼<><C2BC>' then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add(' and ( SalesId=' + quotedstr(trim(DCode)) + ' or exists (select * from [dbo].[F_Tool_SplitString](TallyId,'','') X where X.RTValue =' + quotedstr(trim(DCode)) + '))');
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''0''');
|
|||
|
|
end;
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''1''');
|
|||
|
|
end;
|
|||
|
|
2:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''9''');
|
|||
|
|
end;
|
|||
|
|
3:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''10''');
|
|||
|
|
end;
|
|||
|
|
4:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and isnull(AA.status,''0'')=''-1''');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
// if Trim(DName) <> 'ADMIN' then
|
|||
|
|
// begin
|
|||
|
|
// sql.Add('and Filler=''' + Trim(DName) + ''' ');
|
|||
|
|
// end;
|
|||
|
|
sql.Add(' order by ZDDate desc ');
|
|||
|
|
// showmessage(sql.text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
TV1.DataController.Filter.Clear;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TBFindClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TBPrintClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'SalesConPrint';
|
|||
|
|
if Self.CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
FFiltration1 := QuotedStr(Trim(Self.CDS_1.fieldbyname('ConMID').AsString));
|
|||
|
|
FFiltration2 := QuotedStr(Trim(Self.CDS_1.fieldbyname('ConMID').AsString));
|
|||
|
|
FFiltration3 := QuotedStr(Trim(Self.CDS_1.fieldbyname('ConMID').AsString));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// Self.InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TBEditClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
// ShowMessage(Trim(CDS_1.fieldbyname('Filler').AsString));
|
|||
|
|
// ShowMessage(Trim(DName));
|
|||
|
|
if Trim(CDS_1.fieldbyname('Filler').AsString) <> Trim(DName) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
|
with frmSalesConInPut do
|
|||
|
|
begin
|
|||
|
|
PState := '<27><EFBFBD>';
|
|||
|
|
FConMId := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
|
FAuthority := self.FAuthority;
|
|||
|
|
FGSTT := self.FGSTT;
|
|||
|
|
fFlileFlag := self.fFlileFlag;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmSalesConInPut.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TBAddClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
maxno: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
|
with frmSalesConInPut do
|
|||
|
|
begin
|
|||
|
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FConMId := '';
|
|||
|
|
FAuthority := self.FAuthority;
|
|||
|
|
FGSTT := self.FGSTT;
|
|||
|
|
fFlileFlag := self.fFlileFlag;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmSalesConInPut.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
fFlileFlag := UserDataFlag + 'HX';
|
|||
|
|
FAuthority := self.fParameters1;
|
|||
|
|
readCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
|
readCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
|
|
|||
|
|
SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.CheckBox1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.CheckBox2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ConNoChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ConNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton10Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
CurRow: Integer;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
WSql := '';
|
|||
|
|
if CDS_3.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_3.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_3 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
printcar(CDS_3.fieldbyname('PCID').AsString);
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton11Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'CDNAME';
|
|||
|
|
flagname := '<27>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
fnote := true;
|
|||
|
|
fnote1 := true;
|
|||
|
|
v1note.Caption := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
v1note1.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
// try
|
|||
|
|
// frmCDZDY := tfrmCDZDY.Create(Application);
|
|||
|
|
// with frmCDZDY do
|
|||
|
|
// begin
|
|||
|
|
//
|
|||
|
|
// if ShowModal = 1 then
|
|||
|
|
// begin
|
|||
|
|
//// TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
// finally
|
|||
|
|
// frmCDZDY.Free;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
|
with frmSalesConInPut do
|
|||
|
|
begin
|
|||
|
|
PState := '<27>鿴';
|
|||
|
|
FConMId := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
|
FGSTT := self.FGSTT;
|
|||
|
|
ToolBar2.Visible := False;
|
|||
|
|
TBSave.Visible := False;
|
|||
|
|
// ScrollBox1.Enabled := False;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmSalesConInPut.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
frmSalesConInPut := TfrmSalesConInPut.Create(Application);
|
|||
|
|
with frmSalesConInPut do
|
|||
|
|
begin
|
|||
|
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FConMId := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
|
FAuthority := self.FAuthority;
|
|||
|
|
fFlileFlag := self.fFlileFlag;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmSalesConInPut.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton3Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
CurRow: Integer;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
WSql := '';
|
|||
|
|
if CDS_3.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_3.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
// with CDS_3 do
|
|||
|
|
// begin
|
|||
|
|
// DisableControls;
|
|||
|
|
// First;
|
|||
|
|
// while not Eof do
|
|||
|
|
// begin
|
|||
|
|
// if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
// begin
|
|||
|
|
// CurRow := Tv1.Controller.FocusedRowIndex;
|
|||
|
|
// if WSql <> '' then
|
|||
|
|
// begin
|
|||
|
|
// WSql := WSql + ',' + (Trim(CDS_3.fieldbyname('PCID').AsString));
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// WSql := (Trim(CDS_3.fieldbyname('PCID').AsString));
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// end;
|
|||
|
|
// Next;
|
|||
|
|
// end;
|
|||
|
|
// EnableControls;
|
|||
|
|
// end;
|
|||
|
|
WSql := (Trim(CDS_3.fieldbyname('PCID').AsString));
|
|||
|
|
// showmessage(WSql);
|
|||
|
|
Tv3.Controller.FocusedRowIndex := CurRow;
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'DyeCardPrint';
|
|||
|
|
FFiltration1 := WSql;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton4Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
frmRZCK1 := TfrmRZCK1.create(self);
|
|||
|
|
// ForderNO:=trim(CDS_1.FieldByName('orderNO').AsString);
|
|||
|
|
with frmRZCK1 do
|
|||
|
|
begin
|
|||
|
|
FOrderNo1 := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
|
|
|||
|
|
// fModel := self.caption;
|
|||
|
|
// frmSysLogOrderzsd.FMainId := Trim(Self.FMainId);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
showmodal;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.btnWCClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(DName) <> 'ADMIN' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27>Ǹ<EFBFBD>Ȩ<EFBFBD><EFBFBD><DEB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('<27><><EFBFBD>ɳɹ<C9B3>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.Button2Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i, k, fhxInt, x: integer;
|
|||
|
|
maxId, sqlstr, MaxmaxId, fconmid, fconsid: string;
|
|||
|
|
FPCQTY: string;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if (StrToFloatDef(PCPiece.Text, 0) + StrToFloatDef(PCQty.Text, 0)) = 0 then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ<EFBFBD>㣡', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_2.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
CDS_2.Locate('SSel', True, []);
|
|||
|
|
if strtointdef(trim(carNum.text), 0) <= 1 then
|
|||
|
|
k := 1
|
|||
|
|
else
|
|||
|
|
k := strtointdef(trim(carNum.text), 0);
|
|||
|
|
|
|||
|
|
CDS_3.Last;
|
|||
|
|
sqlstr := '';
|
|||
|
|
FPCQTY := (PCQty.TexT);
|
|||
|
|
fconmid := Trim(CDS_2.FieldByName('conmid').AsString);
|
|||
|
|
fconsid := Trim(CDS_2.FieldByName('consid').AsString);
|
|||
|
|
cds_2.disableControls;
|
|||
|
|
cds_1.disableControls;
|
|||
|
|
toolbar2.enabled := false;
|
|||
|
|
cxGrid1.enabled := false;
|
|||
|
|
panel4.enabled := false;
|
|||
|
|
for i := 1 to k do
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd, maxId, 'CZ', 'Trade_Plan_Card', 5, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
// FPCIDS := FPCIDS + maxId + ',';
|
|||
|
|
sqlstr := '';
|
|||
|
|
FPCIDS := maxId;
|
|||
|
|
|
|||
|
|
// MaxmaxId := inttostr(strtoint(Trim(maxId)) + x);
|
|||
|
|
sqlstr := sqlstr + 'insert into Trade_Plan_Card(KUNNO,SubId,Mainid,Filler,PCType,PCID,PCTime,CustNo,CustName,Saleser,C_Name,C_Code,C_Pattern,C_GramWeight,C_Width,C_Color,PCUnit,C_ColorNo,BuyConNo,C_StyleNo,PCPiece,PCQty,carnum,crop) ';
|
|||
|
|
sqlstr := sqlstr + ' values( ';
|
|||
|
|
sqlstr := sqlstr + ' cast( ''' + trim(INTTOSTR(i)) + '''as INT), ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + Trim(OrderNo.Text) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + Trim(fconsid) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + Trim(fconmid) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(DName) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim('') + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(PCType.Text) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(maxId) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + formatdateTime('yyyy-MM-dd', PCTime.DateTime) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(FGC_BatchNo) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(FGC_Piece) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(FGC_STKID) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(FGC_Position) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_1.FieldByName('BuyNO').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_1.FieldByName('BuyNAME').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_1.FieldByName('Salesman').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_NAME').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_CODE').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_Pattern').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_GramWeight').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_Width').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_COLOR').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('ConUnit').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_ColorNo').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_1.FieldByName('BUYCONNO').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_StyleNo').AsString) + ''', ';
|
|||
|
|
sqlstr := sqlstr + ' cast( ''' + trim(PCpiece.Text) + '''as float), ';
|
|||
|
|
sqlstr := sqlstr + ' cast(''' + FPCQTY + '''as float), ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(crop.Text) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(sewing.Text) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(C_BZmanner.Text) + ''' ,';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(carnum.Text) + ''',';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(C_CLName.Text) + ''', ';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(C_CLwrap.Text) + ''' ,';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(C_CPCode.Text) + ''' ,';
|
|||
|
|
// sqlstr := sqlstr + ' ''' + trim(Processprice.Text) + ''' ,';
|
|||
|
|
sqlstr := sqlstr + ' ''' + trim(CDS_2.FieldByName('C_CJSIZE').AsString) + ''' ';
|
|||
|
|
sqlstr := sqlstr + ' ) ';
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(sqlstr);
|
|||
|
|
// showmessage(sql.Text);
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
printcar(FPCIDS);
|
|||
|
|
// x := x + 1;
|
|||
|
|
end;
|
|||
|
|
initcard();
|
|||
|
|
RefreshCardCount(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>TV2<56>Ƿ<C7B7><F1BFAABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
cds_2.enableControls;
|
|||
|
|
cds_1.enableControls;
|
|||
|
|
toolbar2.enabled := true;
|
|||
|
|
panel4.enabled := true;
|
|||
|
|
carnum.Text := '';
|
|||
|
|
PCQTY.Text := '';
|
|||
|
|
// CDS_2.Locate('SSel', True, []);
|
|||
|
|
cxGrid1.enabled := true;
|
|||
|
|
CDS_2.Locate('consid', fconsid, []);
|
|||
|
|
// with Ado_car do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select A.*');
|
|||
|
|
// sql.Add(',GlideList=[dbo].[F_Trade_Card_GlideList](A.PCID) ');
|
|||
|
|
// sql.Add('from Trade_Plan_Card A ');
|
|||
|
|
//// sql.Add('inner join Dye_Plan_Glide B on B.PCID=A.PCID');
|
|||
|
|
// sql.Add('where EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + Quotedstr(trim(FPCIDS)) + ', '','' ) X where X.RTValue=A.PCID ) ');
|
|||
|
|
//
|
|||
|
|
// open;
|
|||
|
|
// end;
|
|||
|
|
// SCreateCDS(Ado_car, CDS_3);
|
|||
|
|
// SInitCDSData(Ado_car, CDS_3);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.BuyConNoChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.BuyNameChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if ADOQueryMain.Active = False then
|
|||
|
|
Exit;
|
|||
|
|
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.tchkClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(DName) <> 'ADMIN' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27>Ǹ<EFBFBD>Ȩ<EFBFBD><EFBFBD><DEB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TnochkClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(DName) <> 'ADMIN' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27>Ǹ<EFBFBD>Ȩ<EFBFBD><EFBFBD><DEB2>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SetStatus();
|
|||
|
|
TBRafresh.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.C_CodeChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
SDofilter(ADOQUERY1, SGetFilters(Panel5, 1, 2));
|
|||
|
|
SCreateCDS(ADOQUERY1, CDS_2);
|
|||
|
|
SInitCDSData(ADOQUERY1, CDS_2);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.DYGSPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'dygs';
|
|||
|
|
flagname := '<27><>ӡ<EFBFBD><D3A1>ʽ';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
begin
|
|||
|
|
InitSub();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TV2FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
|
begin
|
|||
|
|
initcard();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TV2CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
begin
|
|||
|
|
if TV2.GetColumnByFieldName('IsCard') = nil then
|
|||
|
|
exit;
|
|||
|
|
if AViewInfo.GridRecord.Values[TV2.GetColumnByFieldName('IsCard').Index] = True then
|
|||
|
|
ACanvas.Brush.Color := $0080FF80;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TqxClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''ȡ<><C8A1>'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬȡ<CDAC><C8A1>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('ȡ<><C8A1><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.TnoqxClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
// ShowMessage(sql.Text);
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton5Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
try
|
|||
|
|
frmAttachmentUpload := TfrmAttachmentUpload.Create(Application);
|
|||
|
|
with frmAttachmentUpload do
|
|||
|
|
begin
|
|||
|
|
fkeyNO := Trim(Self.CDS_1.fieldbyname('ConMID').AsString);
|
|||
|
|
fType := '<27><>ͬ';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmAttachmentUpload.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton6Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_3.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><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;
|
|||
|
|
try
|
|||
|
|
with CDS_3 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Trade_Plan_Glide_OutPut where PCID=''' + Trim(CDS_3.fieldbyname('PCID').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryTemp.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
CDS_3.EnableControls;
|
|||
|
|
Application.MessageBox('<27>Ѳ<EFBFBD><D1B2><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><CFB8><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
// else
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
Sql.Clear;
|
|||
|
|
Sql.Add('exec P_Trade_Card_Del ');
|
|||
|
|
Sql.Add('@PCIDS=' + quotedstr(Trim(CDS_3.fieldbyname('PCID').AsString)));
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
except
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
raise Exception.Create(PChar(Exception(ExceptObject).Message));
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
initcard();
|
|||
|
|
RefreshCardCount(); // ɾ<><C9BE><EFBFBD><EFBFBD>ˢ<EFBFBD><CBA2>TV2<56>Ƿ<C7B7><F1BFAABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
except
|
|||
|
|
CDS_3.EnableControls;
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton7Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
writeCxGrid(trim(Self.Caption) + 'tv1', Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
|
writeCxGrid(trim(Self.Caption) + 'tv2', Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton8Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MPCIDS, WSql: string;
|
|||
|
|
Bmk: TBookmark; // <20><><EFBFBD><EFBFBD>ԭʼѡ<CABC><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǩ
|
|||
|
|
begin
|
|||
|
|
if CDS_2.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// ========== <20><><EFBFBD>浱ǰ<E6B5B1><C7B0><EFBFBD><EFBFBD>ǩ<EFBFBD><C7A9><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ס<EFBFBD><D7A1><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ==========
|
|||
|
|
Bmk := CDS_2.GetBookmark;
|
|||
|
|
|
|||
|
|
with CDS_2 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MPCIDS := MPCIDS + trim(CDS_2.FieldByName('consid').AsString) + ';';
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select distinct GX=[dbo].[F_Trade_Card_GlideList](A.RTValue) from [dbo].[F_Tool_SplitString](' + quotedstr(MPCIDS) + ','';'') A ');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.RecordCount > 1 then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>༭!', '<27><>ʾ', 0);
|
|||
|
|
CDS_2.GotoBookmark(Bmk); // У<><D0A3>ʧ<EFBFBD><CAA7>ҲҪ<D2B2><D2AA>ȥ
|
|||
|
|
CDS_2.FreeBookmark(Bmk);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmDyeCardGlideEdit2 := TfrmDyeCardGlideEdit2.Create(Application);
|
|||
|
|
with frmDyeCardGlideEdit2 do
|
|||
|
|
begin
|
|||
|
|
FPCIDS := MPCIDS;
|
|||
|
|
FWSql := MPCIDS;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
InitCard(); // ˢ<><CBA2>CDS_2<5F><32><EFBFBD><EFBFBD>
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmDyeCardGlideEdit2.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// ========== ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݺ<DDBA>λ<EFBFBD><CEBB>ԭʼѡ<CABC><D1A1><EFBFBD><EFBFBD> ==========
|
|||
|
|
CDS_2.GotoBookmark(Bmk);
|
|||
|
|
CDS_2.FreeBookmark(Bmk); // <20>ͷ<EFBFBD><CDB7><EFBFBD>ǩ
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// if CDS_3.Locate('SSel', True, []) = False then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// with CDS_3 do
|
|||
|
|
// begin
|
|||
|
|
// DisableControls;
|
|||
|
|
// First;
|
|||
|
|
// while not Eof do
|
|||
|
|
// begin
|
|||
|
|
// if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
// begin
|
|||
|
|
// MPCIDS := MPCIDS + trim(CDS_3.FieldByName('PCID').AsString) + ';';
|
|||
|
|
// end;
|
|||
|
|
// Next;
|
|||
|
|
// end;
|
|||
|
|
// EnableControls;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// with CDS_3 do
|
|||
|
|
// begin
|
|||
|
|
// DisableControls;
|
|||
|
|
// First;
|
|||
|
|
// while not Eof do
|
|||
|
|
// begin
|
|||
|
|
// if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
// begin
|
|||
|
|
// if WSql <> '' then
|
|||
|
|
// begin
|
|||
|
|
// WSql := WSql + ',' + quotedstr(Trim(CDS_3.fieldbyname('PCID').AsString));
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// WSql := quotedstr(Trim(CDS_3.fieldbyname('PCID').AsString));
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// end;
|
|||
|
|
// Next;
|
|||
|
|
// end;
|
|||
|
|
// EnableControls;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select distinct GX=[dbo].[F_Trade_Card_GlideList](A.RTValue) from [dbo].[F_Tool_SplitString](' + quotedstr(MPCIDS) + ','';'') A ');
|
|||
|
|
// open;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// if ADOQueryTemp.RecordCount > 1 then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>༭!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// try
|
|||
|
|
// frmDyeCardGlideEdit := TfrmDyeCardGlideEdit.Create(Application);
|
|||
|
|
// with frmDyeCardGlideEdit do
|
|||
|
|
// begin
|
|||
|
|
// FPCIDS := MPCIDS;
|
|||
|
|
// FWSql := WSql;
|
|||
|
|
//
|
|||
|
|
// if ShowModal = 1 then
|
|||
|
|
// begin
|
|||
|
|
// InitCard();
|
|||
|
|
// end;
|
|||
|
|
// end;
|
|||
|
|
// finally
|
|||
|
|
// frmDyeCardGlideEdit.Free;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.ToolButton9Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
WSql: string;
|
|||
|
|
CurRow: Integer;
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
WSql := '';
|
|||
|
|
if CDS_2.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_2.Locate('SSel', True, []) = False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_2 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if Fieldbyname('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
CurRow := Tv1.Controller.FocusedRowIndex;
|
|||
|
|
if WSql <> '' then
|
|||
|
|
begin
|
|||
|
|
WSql := WSql + ',' + (Trim(CDS_2.fieldbyname('consid').AsString));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
WSql := (Trim(CDS_2.fieldbyname('consid').AsString));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
// WSql := (Trim(CDS_2.fieldbyname('PCID').AsString));
|
|||
|
|
// showmessage(WSql);
|
|||
|
|
Tv2.Controller.FocusedRowIndex := CurRow;
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'contractsubPrint';
|
|||
|
|
FFiltration1 := WSql;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.btnWCCXClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(DName) <> 'ADMIN' then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27>Ǹ<EFBFBD>Ȩ<EFBFBD><EFBFBD><DEB2>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳɹ<C9B3>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.Tv1CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
begin
|
|||
|
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('status').Index] = '2' then
|
|||
|
|
ACanvas.Brush.Color := clLime;
|
|||
|
|
if AViewInfo.GridRecord.Values[tv1.GetColumnByFieldName('DJstatus').Index] = '1' then
|
|||
|
|
ACanvas.Brush.Color := clAQUA;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.btnTijiaoClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''<27>ύ'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD>ύ')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('<27>ύ<EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.CurrencyChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// inherited;
|
|||
|
|
TBFind.Click;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmSalesContractList2.btnCXTijiaoClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
MConMIDS: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
if not CDS_1.Locate('SSel', True, []) then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ');
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
DisableControls;
|
|||
|
|
First;
|
|||
|
|
MConMIDS := '';
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
if fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
MConMIDS := MConMIDS + trim(fieldbyname('ConMID').AsString) + ',';
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
MConMIDS := copy(MConMIDS, 1, Length(MConMIDS) - 1);
|
|||
|
|
EnableControls;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_BS_Contract_SetStatus ');
|
|||
|
|
sql.Add(' @ConMIDS=' + QuotedStr(MConMIDS));
|
|||
|
|
sql.Add(',@Operation=''<27><><EFBFBD><EFBFBD><EFBFBD>ύ'' ');
|
|||
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|||
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|||
|
|
|
|||
|
|
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
|||
|
|
sql.Add(' ' + quotedstr(trim(DName)));
|
|||
|
|
sql.Add(',getdate() ');
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ύ')));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27><>ͬID<49><44>' + trim(MConMIDS))));
|
|||
|
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
|
sql.Add(')');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
|||
|
|
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD>ɹ<EFBFBD>', '<27><>ʾ');
|
|||
|
|
InitGrid();
|
|||
|
|
except
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|