838 lines
24 KiB
ObjectPascal
838 lines
24 KiB
ObjectPascal
unit U_ContractListWX;
|
||
|
||
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, cxContainer, cxMaskEdit, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu;
|
||
|
||
type
|
||
TfrmContractListWX = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBFind: TToolButton;
|
||
TBAdd: TToolButton;
|
||
TBEdit: TToolButton;
|
||
TBPrint: TToolButton;
|
||
TBClose: TToolButton;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DS_Main: TDataSource;
|
||
v1OrdDate: TcxGridDBColumn;
|
||
v1DeliveryDate: TcxGridDBColumn;
|
||
v1OrdPerson1: TcxGridDBColumn;
|
||
v1ConNo: TcxGridDBColumn;
|
||
CDS_Sub: TClientDataSet;
|
||
RM1: TRMGridReport;
|
||
RMDB_MX: TRMDBDataSet;
|
||
RMXLSExport1: TRMXLSExport;
|
||
v1CustomerNoName: TcxGridDBColumn;
|
||
ToolButton1: TToolButton;
|
||
v1Column1: TcxGridDBColumn;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryPrint: TADOQuery;
|
||
v1Column4: TcxGridDBColumn;
|
||
PopupMenu2: TPopupMenu;
|
||
N11: TMenuItem;
|
||
N21: TMenuItem;
|
||
N31: TMenuItem;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
Label4: TLabel;
|
||
Label5: TLabel;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
Label12: TLabel;
|
||
Label13: TLabel;
|
||
BegDate: TDateTimePicker;
|
||
EndDate: TDateTimePicker;
|
||
BuyName: TEdit;
|
||
Salesman: TEdit;
|
||
MPRTCodeName: TEdit;
|
||
ConNo: TEdit;
|
||
MPRTKZ: TEdit;
|
||
MPRTMF: TEdit;
|
||
cxTabControl1: TcxTabControl;
|
||
tchk: TToolButton;
|
||
Tnochk: TToolButton;
|
||
cxSplitter1: TcxSplitter;
|
||
DS_Sub: TDataSource;
|
||
v1Column8: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
Tqx: TToolButton;
|
||
Tnoqx: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
CDS_Main: TClientDataSet;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
v1XHNo: TcxGridDBColumn;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
v1PRTPrice: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
V2Column1: TcxGridDBColumn;
|
||
btnTijiao: TToolButton;
|
||
btnCXTijiao: TToolButton;
|
||
V2Column2: TcxGridDBColumn;
|
||
BBMC: TcxButtonEdit;
|
||
V2Column3: TcxGridDBColumn;
|
||
V2Column4: TcxGridDBColumn;
|
||
V2Column5: TcxGridDBColumn;
|
||
V2Column6: TcxGridDBColumn;
|
||
V2Column7: TcxGridDBColumn;
|
||
V2Column8: TcxGridDBColumn;
|
||
V2Column9: TcxGridDBColumn;
|
||
TV2Column1: TcxGridDBColumn;
|
||
CDS_MX: TClientDataSet;
|
||
CDS_HZ: TClientDataSet;
|
||
RMDB_HZ: TRMDBDataSet;
|
||
ToolButton3: TToolButton;
|
||
RMDB_DC: TRMDBDataSet;
|
||
TV2Column2: TcxGridDBColumn;
|
||
TV2Column3: TcxGridDBColumn;
|
||
Label3: TLabel;
|
||
HZSCSCode: TEdit;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBEditClick(Sender: TObject);
|
||
procedure TBPrintClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
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 BBMCPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure BuyNameKeyPress(Sender: TObject; var Key: Char);
|
||
private
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
procedure SetStatus();
|
||
procedure InitSub();
|
||
{ Private declarations }
|
||
public
|
||
FFInt, FCloth: Integer;
|
||
canshu1: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
//var
|
||
// frmContractListNX: TfrmContractListNX;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ConInPutWX, U_Fun, U_ZDYHelp, U_FjList_RZ;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmContractListWX.InitSub();
|
||
begin
|
||
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from SalesContract_sub ');
|
||
sql.Add('where mainID =' + quotedstr((CDS_Main.fieldbyname('mainID').AsString)));
|
||
open;
|
||
end;
|
||
SCreateCDS20(ADOQueryTemp, CDS_Sub);
|
||
SInitCDSData20(ADOQueryTemp, CDS_Sub);
|
||
end;
|
||
|
||
procedure TfrmContractListWX.SetStatus();
|
||
begin
|
||
TBAdd.Visible := false;
|
||
tbedit.Visible := false;
|
||
ToolButton2.Visible := false;
|
||
tchk.Visible := false;
|
||
tnochk.Visible := false;
|
||
Tqx.Visible := false;
|
||
TNoqx.Visible := false;
|
||
TBPrint.Visible := False;
|
||
btnTijiao.Visible := False;
|
||
btnCXTijiao.Visible := False;
|
||
if Trim(canshu1) = '¼<><C2BC>' then
|
||
begin
|
||
ToolButton2.Visible := true;
|
||
TBAdd.Visible := true;
|
||
TBPrint.Visible := True;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
tbedit.Visible := true;
|
||
Tqx.Visible := True;
|
||
btnTijiao.Visible := True;
|
||
end;
|
||
1:
|
||
begin
|
||
tbedit.Visible := true;
|
||
btnCXTijiao.Visible := True;
|
||
end;
|
||
2:
|
||
begin
|
||
|
||
end;
|
||
3:
|
||
begin
|
||
TNoqx.Visible := true;
|
||
end;
|
||
end;
|
||
end;
|
||
if Trim(canshu1) = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
ToolButton2.Visible := true;
|
||
TBAdd.Visible := true;
|
||
TBPrint.Visible := True;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
tbedit.Visible := true;
|
||
Tqx.Visible := true;
|
||
btnTijiao.Visible := True;
|
||
end;
|
||
1:
|
||
begin
|
||
tbedit.Visible := true;
|
||
btnCXTijiao.Visible := True;
|
||
tchk.Visible := True;
|
||
end;
|
||
2:
|
||
begin
|
||
tnochk.Visible := True;
|
||
end;
|
||
3:
|
||
begin
|
||
TNoqx.Visible := true;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmContractListWX.FormDestroy(Sender: TObject);
|
||
begin
|
||
// frmContractListNX:=nil;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
writeCxGrid(self.Caption + tv1.Name, Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>1');
|
||
writeCxGrid(self.Caption + tv2.Name, Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>2');
|
||
end;
|
||
|
||
procedure TfrmContractListWX.InitGrid();
|
||
var
|
||
PWHERE: string;
|
||
begin
|
||
PWHERE := SGetFilters(Panel1, 1, 2);
|
||
|
||
if SGetFilters(Panel1, 1, 2) <> '' then
|
||
PWHERE := ' and ' + SGetFilters(Panel1, 1, 2);
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*');
|
||
// Sql.Add(' ,HZSCSCode=CAST((select distinct(SCSCode) + '' '' from SalesContract_Sub X where A.MAINID=X.MAINID for xml path('''') ) AS VARCHAR(1000))');
|
||
sql.Add(',CoHRName=( select CoHRName from Company X where X.CoType=''<27>ͻ<EFBFBD>'' and X.Valid=''Y'' and X.CoCode=A.BuyNo)');
|
||
sql.Add(',ISSC=cast((case when isnull((select count(WBID) from TP_File X where X.WBID=A.maiNID and X.TFType=''<27><>ͬ''),0)>0 then 1 else 0 end) as bit)');
|
||
SQL.Add(',AMOUNT=(SELECT SUM(SCSQty*SCSPrice) FROM SalesContract_SUB B WHERE B.MAINID=A.MAINID )');
|
||
|
||
sql.Add(' from SalesContract_Main A ');
|
||
SQL.Add('where A.OrdDate>=''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + '''');
|
||
SQL.Add('and A.OrdDate<''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + '''');
|
||
sql.Add(' and A.SCMType=''<27><><EFBFBD><EFBFBD>'' ');
|
||
SQL.Add(PWHERE);
|
||
|
||
if Trim(canshu1) = '¼<><C2BC>' then
|
||
begin
|
||
sql.Add('and A.Filler=''' + Trim(DName) + '''');
|
||
end;
|
||
if HZSCSCode.Text <> '' then
|
||
begin
|
||
SQL.Add('AND CAST((select distinct(SCSCode) + '' '' from SalesContract_Sub X where A.MAINID=X.MAINID for xml path('''') ) AS VARCHAR(1000)) LIKE' + QuotedStr('%' + Trim(HZSCSCode.Text) + '%'));
|
||
end;
|
||
case cxTabControl1.TabIndex of
|
||
0:
|
||
begin
|
||
sql.Add(' and isnull(A.status,''-1'')=''-1''');
|
||
end;
|
||
1:
|
||
begin
|
||
sql.Add(' and isnull(A.status,''-1'')=''0''');
|
||
end;
|
||
2:
|
||
begin
|
||
sql.Add(' and isnull(A.status,''-1'')=''1''');
|
||
end;
|
||
3:
|
||
begin
|
||
sql.Add(' and isnull(A.status,''-1'')=''2''');
|
||
end;
|
||
end;
|
||
sql.Add('order by OrdDate desc');
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.InitForm();
|
||
begin
|
||
readCxGrid(self.Caption + tv1.Name, Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>1');
|
||
readCxGrid(self.Caption + tv2.Name, Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>2');
|
||
|
||
if FCloth = 1 then
|
||
begin
|
||
v1Column4.Visible := True;
|
||
end
|
||
else
|
||
begin
|
||
v1Column4.Visible := False;
|
||
end;
|
||
EndDate.DateTime := SGetServerDate10(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime - 90;
|
||
InitGrid();
|
||
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TBEditClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select FILLER from SalesContract_Main A ');
|
||
SQL.Add('where MAINID=''' + Trim(CDS_Main.fieldbyname('MainId').AsString) + ''' ');
|
||
SQL.Add('and (salesman in ( select username from SY_User where UType=(select UType from SY_User where UserName=' + quotedstr(Trim(dname)));
|
||
SQL.Add(')) OR FILLER =' + QuotedStr(Trim(DName)));
|
||
sql.Add(')');
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.ISEMPTY = True then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
// if Trim(CDS_Main.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
|
||
frmConInPutWX := TfrmConInPutWX.Create(Application);
|
||
with frmConInPutWX do
|
||
begin
|
||
PState := '<27><EFBFBD>';
|
||
FMainId := Trim(Self.CDS_Main.fieldbyname('MainId').AsString);
|
||
canshu1 := self.canshu1;
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmConInPutWX.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TBPrintClick(Sender: TObject);
|
||
var
|
||
fPrintFile: string;
|
||
EngMoney: string;
|
||
begin
|
||
|
||
if bbmc.Text = '' then
|
||
Exit;
|
||
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
ExportFtErpFile(Trim(BBMC.Text) + '.rmf', ADOQueryTemp);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(BBMC.Text) + '.rmf';
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Con_Print_WXMX @MainId=''' + Trim(CDS_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, CDS_MX);
|
||
SInitCDSData20(ADOQueryPrint, CDS_MX);
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Con_Print_WXHZ @MainId=''' + Trim(CDS_Main.fieldbyname('MainId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, CDS_HZ);
|
||
SInitCDSData20(ADOQueryPrint, CDS_HZ);
|
||
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
RM1.ShowReport;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TBAddClick(Sender: TObject);
|
||
var
|
||
maxno: string;
|
||
begin
|
||
try
|
||
frmConInPutWX := TfrmConInPutWX.Create(application);
|
||
with frmConInPutWX do
|
||
begin
|
||
PState := '<27><><EFBFBD><EFBFBD>';
|
||
FMainId := '';
|
||
|
||
canshu1 := self.canshu1;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmConInPutWX.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
SetStatus();
|
||
end;
|
||
|
||
procedure TfrmContractListWX.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
if ToolButton1.Visible = False then
|
||
Exit;
|
||
ToolButton1.Click;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmContractListWX.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmConInPutWX := TfrmConInPutWX.Create(Application);
|
||
with frmConInPutWX do
|
||
begin
|
||
PState := '<27>鿴';
|
||
|
||
FMainId := Trim(Self.CDS_Main.fieldbyname('MainId').AsString);
|
||
ToolBar2.Visible := False;
|
||
TBSave.Visible := False;
|
||
// ScrollBox1.Enabled := False;
|
||
Tv1.OptionsSelection.CellSelect := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmConInPutWX.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmConInPutWX := TfrmConInPutWX.Create(Application);
|
||
with frmConInPutWX do
|
||
begin
|
||
PState := '<27><><EFBFBD><EFBFBD>';
|
||
FMainId := Trim(Self.CDS_Main.fieldbyname('MainId').AsString);
|
||
canshu1 := self.canshu1;
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmConInPutWX.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.BuyNameChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active = False then
|
||
Exit;
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS20(ADOQueryMain, CDS_Main);
|
||
SInitCDSData20(ADOQueryMain, CDS_Main);
|
||
end;
|
||
|
||
procedure TfrmContractListWX.tchkClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SalesContract_Main SET status=''1'' ,Chktime=getdate(),Chker=' + quotedstr(trim(DName)));
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_Main.fieldbyname('mainID').AsString)));
|
||
|
||
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>')));
|
||
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TnochkClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SalesContract_Main SET status=''0'',Chktime=null,Chker=null ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_Main.fieldbyname('mainID').AsString)));
|
||
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><EFBFBD><EFBFBD><EFBFBD>')));
|
||
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
SetStatus();
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
InitSub();
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TqxClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SalesContract_Main SET status=''2'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_Main.fieldbyname('mainID').AsString)));
|
||
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>ͬȡ<CDAC><C8A1>')));
|
||
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><>ͬȡ<CDAC><C8A1><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><>ͬȡ<CDAC><C8A1>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.TnoqxClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SalesContract_Main SET status=''-1'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_Main.fieldbyname('mainID').AsString)));
|
||
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><C8A1>')));
|
||
sql.Add(',' + quotedstr(trim('<27><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬȡ<CDAC><C8A1><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬȡ<CDAC><C8A1>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
try
|
||
frmFjList_RZ := TfrmFjList_RZ.Create(Application);
|
||
with frmFjList_RZ do
|
||
begin
|
||
fkeyNO := Trim(Self.CDS_Main.fieldbyname('MainId').AsString);
|
||
fType := '<27><>ͬ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmFjList_RZ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.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;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.btnTijiaoClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SalesContract_Main SET status=''0'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_Main.fieldbyname('mainID').AsString)));
|
||
|
||
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><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.btnCXTijiaoClick(Sender: TObject);
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
exit;
|
||
try
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('update SalesContract_Main SET status=''-1'' ');
|
||
sql.Add('where mainID=' + quotedstr(trim(CDS_Main.fieldbyname('mainID').AsString)));
|
||
|
||
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><>ͬ<EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('conNo').AsString))));
|
||
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
TBRafresh.Click;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ύʧ<E1BDBB>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.BBMCPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'WXBBNAME';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
BBMC.Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.ToolButton3Click(Sender: TObject);
|
||
var
|
||
fPrintFile, fImagePath2: string;
|
||
Porderno, LBName, SYRName: string;
|
||
i, j: Integer;
|
||
OrderKg: Double;
|
||
begin
|
||
if CDS_Main.IsEmpty then
|
||
Exit;
|
||
|
||
LBName := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
ExportFtErpFile(Trim(LBName) + '.rmf', ADOQueryTemp);
|
||
with ADOQueryPrint do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Con_Print_WXDC ');
|
||
SQL.Add(' @BegDate=''' + FormatDateTime('yyyy-MM-dd', BegDate.DateTime) + '''');
|
||
SQL.Add(' ,@Enddate=''' + FormatDateTime('yyyy-MM-dd', enddate.DateTime + 1) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryPrint, CDS_MX);
|
||
SInitCDSData20(ADOQueryPrint, CDS_MX);
|
||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf';
|
||
if FileExists(fPrintFile) then
|
||
begin
|
||
RM1.LoadFromFile(fPrintFile);
|
||
|
||
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label0001.xls';
|
||
if FileExists(fImagePath2) then
|
||
DeleteFile(fImagePath2);
|
||
fImagePath2 := ExtractFilePath(Application.ExeName) + 'image\label.xls';
|
||
RM1.PrepareReport;
|
||
RM1.ExportTo(RMXLSExport1, fImagePath2);
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + ExtractFilePath(Application.ExeName) + 'Report\' + Trim(LBName) + '.rmf'), '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmContractListWX.BuyNameKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|