1103 lines
33 KiB
ObjectPascal
1103 lines
33 KiB
ObjectPascal
![]() |
unit U_ContractListCG;
|
|||
|
|
|||
|
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, cxNavigator,
|
|||
|
dxBarBuiltInMenu;
|
|||
|
|
|||
|
type
|
|||
|
TfrmContractListCG = 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;
|
|||
|
v1ConNo: TcxGridDBColumn;
|
|||
|
CDS_Sub: TClientDataSet;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBDataSet1: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
v1CustomerNoName: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
PopupMenu2: TPopupMenu;
|
|||
|
N11: TMenuItem;
|
|||
|
N21: TMenuItem;
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label8: TLabel;
|
|||
|
Label9: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label13: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
SellName: 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;
|
|||
|
cxGridDBColumn1: TcxGridDBColumn;
|
|||
|
cxGridDBColumn2: TcxGridDBColumn;
|
|||
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
v1PRTPrice: TcxGridDBColumn;
|
|||
|
cxGridDBColumn4: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
btnTijiao: TToolButton;
|
|||
|
btnCXTijiao: TToolButton;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
V2Column2: TcxGridDBColumn;
|
|||
|
V2Column5: TcxGridDBColumn;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
jhnote: TEdit;
|
|||
|
BuyConNo: TEdit;
|
|||
|
Label3: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
cpcode: TEdit;
|
|||
|
Label10: TLabel;
|
|||
|
cpNAME: TEdit;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
TV2Column1: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
ComboBox1: TComboBox;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
TV2Column2: TcxGridDBColumn;
|
|||
|
TWC: TToolButton;
|
|||
|
TNWC: TToolButton;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
TV2Column3: TcxGridDBColumn;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
Tv1Column12: 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 SellNameChange(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 ToolButton3Click(Sender: TObject);
|
|||
|
procedure TWCClick(Sender: TObject);
|
|||
|
procedure TNWCClick(Sender: TObject);
|
|||
|
procedure N11Click(Sender: TObject);
|
|||
|
procedure N21Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure RM1EndPrintPage(var aPageNo: Integer; var aNewPrintJob: Boolean);
|
|||
|
private
|
|||
|
procedure InitGrid();
|
|||
|
procedure InitForm();
|
|||
|
procedure SetStatus();
|
|||
|
procedure InitSub();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FFInt, FCloth: Integer;
|
|||
|
canshu1, FGSTT: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_ConInPutCG, U_Fun, U_ZDYHelp, U_FjList_RZ, U_SysLogHelp,
|
|||
|
U_DHList;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmContractListCG.InitSub();
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select *');
|
|||
|
SQL.Add(' from SalesContract_sub ');
|
|||
|
sql.Add('where mainID =' + quotedstr((CDS_Main.fieldbyname('mainID').AsString)));
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp, CDS_Sub);
|
|||
|
SInitCDSData20(ADOQueryTemp, CDS_Sub);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.SetStatus();
|
|||
|
begin
|
|||
|
TBAdd.Visible := false;
|
|||
|
tbedit.Visible := false;
|
|||
|
ToolButton2.Visible := false;
|
|||
|
tchk.Visible := false;
|
|||
|
tnochk.Visible := false;
|
|||
|
Tqx.Visible := false;
|
|||
|
TNoqx.Visible := false;
|
|||
|
twc.Visible := False;
|
|||
|
tNwc.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
|
|||
|
btnCXTijiao.Visible := True;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
4:
|
|||
|
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
|
|||
|
btnCXTijiao.Visible := True;
|
|||
|
tchk.Visible := True;
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
tnochk.Visible := True;
|
|||
|
TWC.Visible := True;
|
|||
|
end;
|
|||
|
3:
|
|||
|
begin
|
|||
|
TNWC.Visible := True;
|
|||
|
end;
|
|||
|
4:
|
|||
|
begin
|
|||
|
TNoqx.Visible := true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
// frmContractListNX:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
writeCxGrid(self.Caption + tv1.Name, Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
writeCxGrid(self.Caption + tv2.Name, Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered := False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*');
|
|||
|
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(',ZJinE=(select sum(SCSMxMoney) SCSMxMoney from SalesContract_sub B where B.MainId=A.MainId group by B.MainID)');
|
|||
|
sql.Add(',ZJinUnit=(select TOP 1 SCSCurrency from SalesContract_sub B where B.MainId=A.MainId)');
|
|||
|
sql.Add(',ZShuL=(select top 1 SCSQty from SalesContract_sub B where B.MainId=A.MainId)');
|
|||
|
sql.Add(',ZShuUnit=(select TOP 1 SCSUnit from SalesContract_sub B where B.MainId=A.MainId)');
|
|||
|
sql.Add(',ZPBShuL=(select sum(cast(isnull(SCSPBQty,''0'') as decimal(18,2))) SCSQty from SalesContract_sub B where B.MainId=A.MainId group by B.MainID)');
|
|||
|
sql.Add(',ZMoney=(select sum(cast(isnull(SCSMoney,''0'') as decimal(18,2))) SCSMoney from SalesContract_sub B where B.MainId=A.MainId group by B.MainID)');
|
|||
|
sql.Add(',ZPBShuUnit=(select TOP 1 SCSUnit from SalesContract_sub B where B.MainId=A.MainId)');
|
|||
|
SQL.ADD(',CPNAME=(select TOP 1 SCSNAME from SalesContract_sub B where B.MainId=A.MainId )');
|
|||
|
SQL.ADD(',CPCODE=(select TOP 1 SCSCODE from SalesContract_sub B where B.MainId=A.MainId )');
|
|||
|
|
|||
|
sql.Add(',ZPrice=(select top 1 (SCSPrice) ZPrice from SalesContract_sub B where B.MainId=A.MainId)');
|
|||
|
|
|||
|
sql.Add(',DHQty=case when isnull(JHNote,'''')=''<27>۽<EFBFBD><DBBD>ֿ<EFBFBD>'' then (select sum(Qty) from CK_SXPB_CR X where X.CGConNo=A.ConNo and ckname=''<27><><EFBFBD>첼'' and crflag=''<27><><EFBFBD><EFBFBD>'' and CRType=''<27><>Ʒ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'')');
|
|||
|
sql.Add('else (select sum(CRQtyFlag*Qty) from CK_GenDan_CR X where X.conno=A.conno and ckname=''<27><><EFBFBD><EFBFBD>'' and (crflag=''<27><><EFBFBD><EFBFBD>'' or Crtype=''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'')) end');
|
|||
|
|
|||
|
sql.Add(',DHPiQty=case when isnull(JHNote,'''')=''<27>۽<EFBFBD><DBBD>ֿ<EFBFBD>'' then (select sum(PiQty) from CK_SXPB_CR X where X.CGConNo=A.ConNo and ckname=''<27><><EFBFBD>첼'' and crflag=''<27><><EFBFBD><EFBFBD>'' and CRType=''<27><>Ʒ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
sql.Add('else (select sum(CRQtyFlag*PiQty) from CK_GenDan_CR X where X.conno=A.conno and ckname=''<27><><EFBFBD><EFBFBD>'' and (crflag=''<27><><EFBFBD><EFBFBD>'' or Crtype=''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'') ) end ');
|
|||
|
|
|||
|
sql.Add(',DHCS=case when isnull(JHNote,'''')=''<27>۽<EFBFBD><DBBD>ֿ<EFBFBD>'' then (select count(distinct convert(varchar(10),X.crtime,120)) from CK_SXPB_CR X where X.CGConNo=A.ConNo and ckname=''<27><><EFBFBD>첼'' and crflag=''<27><><EFBFBD><EFBFBD>'' and CRType=''<27><>Ʒ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'') ');
|
|||
|
sql.Add('else (select count(distinct convert(varchar(10),XX.logtime,120)) from Ck_GenDan_Log XX inner join CK_GenDan_CR X on XX.spid=X.spid where X.conno=A.conno and X.ckname=''<27><><EFBFBD><EFBFBD>'' and X.crflag=''<27><><EFBFBD><EFBFBD>'') end ');
|
|||
|
|
|||
|
SQL.Add(',Sstatus=case isnull(status,''0'') when -1 then ''<27>ݸ<EFBFBD><DDB8><EFBFBD>'' when 0 then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' when 1 then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' when 3 then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' else ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' end');
|
|||
|
|
|||
|
sql.Add(',DHTime=isnull((select top 1 CRTime from CK_SXPB_CR X where CGMainId=A.mainid order by crtime desc ), ');
|
|||
|
sql.add(' (select top 1 logTime from Ck_GenDan_Log X inner join CK_GenDan_CR XX on X.spid=XX.SPID and X.ActionName=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>'' where XX.ORDMainIdRK=A.mainid order by logTime desc))');
|
|||
|
|
|||
|
sql.Add(',DHMoney=case when isnull(JHNote,'''')=''<27>۽<EFBFBD><DBBD>ֿ<EFBFBD>''');
|
|||
|
sql.Add('then (select sum(DHQty*SCSPrice) from (select SCSPrice,Sum(Qty) as DHQty from CK_SXPB_CR X inner join SalesContract_Sub XX on X.CGSubid=XX.Subid and X.CGConNo=A.ConNO and ckname=''<27><><EFBFBD>첼'' and crflag=''<27><><EFBFBD><EFBFBD>'' and CRType=''<27><>Ʒ<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>'' group by SCSPrice)AA)');
|
|||
|
sql.Add('else (select sum(DHQty*SCSPrice) from (select SCSPrice,sum(CRQtyFlag*Qty) as DHQty from CK_GenDan_CR X ');
|
|||
|
sql.Add('inner join SalesContract_Sub XX on X.CGSubid=XX.Subid and X.ConNo=A.ConNO and ckname=''<27><><EFBFBD><EFBFBD>'' and (crflag=''<27><><EFBFBD><EFBFBD>'' or Crtype=''<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>'') group by SCSPrice)AA) end');
|
|||
|
|
|||
|
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>'' ');
|
|||
|
if Trim(canshu1) = '¼<><C2BC>' then
|
|||
|
begin
|
|||
|
sql.Add('and A.filler=''' + Trim(DName) + '''');
|
|||
|
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'')=''3''');
|
|||
|
end;
|
|||
|
4:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(A.status,''-1'')=''2''');
|
|||
|
end;
|
|||
|
end;
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain, CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain, CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.InitForm();
|
|||
|
begin
|
|||
|
readCxGrid(self.Caption + tv1.Name, Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
readCxGrid(self.Caption + tv2.Name, Tv2, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
|
|||
|
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 TfrmContractListCG.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 TfrmContractListCG.TBEditClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
if (Trim(Self.canshu1) <> '<27><><EFBFBD><EFBFBD>') then
|
|||
|
begin
|
|||
|
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;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
frmConInPutCG := TfrmConInPutCG.Create(Application);
|
|||
|
with frmConInPutCG do
|
|||
|
begin
|
|||
|
PState := '<27><EFBFBD>';
|
|||
|
FMainId := Trim(Self.CDS_Main.fieldbyname('MainId').AsString);
|
|||
|
canshu1 := self.canshu1;
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
FCaption := self.caption;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmConInPutCG.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile: string;
|
|||
|
EngMoney: string;
|
|||
|
Porderno, LBName, SYRName: string;
|
|||
|
i, j: Integer;
|
|||
|
OrderKg: Double;
|
|||
|
FDate: string;
|
|||
|
Txt, fImagePath: string;
|
|||
|
Moudle: THandle;
|
|||
|
Makebar: TMakebar;
|
|||
|
Mixtext: TMixtext;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(combobox1.Text) + '.rmf';
|
|||
|
ExportFtErpFile(Trim(combobox1.Text) + '.rmf', ADOQueryTemp);
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select A.*,B.* ');
|
|||
|
SQL.ADD(',PBCJC=(SELECT TOP 1 zdyNAME FROM KH_Zdy_Attachment C WHERE C.zdyNAME=A.SELLNAME )');
|
|||
|
SQL.ADD(',JHJC=(SELECT TOP 1 ZdyNAME FROM KH_Zdy_Attachment C WHERE C.zdyNAME=A.jhnote )');
|
|||
|
sql.Add(',ZPBQty=(select sum(SCSPBQty) from SalesContract_Sub X where X.mainid=A.mainid)');
|
|||
|
sql.Add(',ZMoney=(select sum(SCSMoney) from SalesContract_Sub X where X.mainid=A.mainid)');
|
|||
|
sql.Add(' from SalesContract_Main A inner join SalesContract_Sub B on A.MainId=B.MainId ');
|
|||
|
sql.Add(' where A.MainId=''' + Trim(CDS_Main.fieldbyname('MainId').AsString) + '''');
|
|||
|
sql.Add(' order by B.XHNo ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
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>ɹ<EFBFBD><C9B9><EFBFBD>')));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('ConNo').AsString) + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + trim(combobox1.Text))));
|
|||
|
sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
sql.Add(')');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
// RMVariables['EngMoney']:=EngMoney;
|
|||
|
//RMVariables['enddate']:=enddate.DateTime;
|
|||
|
try
|
|||
|
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
|||
|
@Makebar := GetProcAddress(Moudle, 'Make');
|
|||
|
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
|||
|
Txt := Trim((trim(CDS_Main.fieldbyname('conno').AsString)));
|
|||
|
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
|
|||
|
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
|
|||
|
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
|
|||
|
if FileExists(fImagePath) then
|
|||
|
DeleteFile(fImagePath);
|
|||
|
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['QRBARCODE'] := fImagePath;
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.TBAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmConInPutCG := TfrmConInPutCG.Create(Application);
|
|||
|
with frmConInPutCG do
|
|||
|
begin
|
|||
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FMainId := '';
|
|||
|
canshu1 := self.canshu1;
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmConInPutCG.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitForm();
|
|||
|
SetStatus();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
// if ToolButton1.Visible = False then
|
|||
|
// Exit;
|
|||
|
// ToolButton1.Click;
|
|||
|
try
|
|||
|
frmDHList := TfrmDHList.Create(Application);
|
|||
|
with frmDHList do
|
|||
|
begin
|
|||
|
FConNo := CDS_Main.fieldbyname('ConNo').AsString;
|
|||
|
FType := CDS_Main.fieldbyname('JHNote').AsString;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmDHList.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.CheckBox2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmConInPutCG := TfrmConInPutCG.Create(Application);
|
|||
|
with frmConInPutCG do
|
|||
|
begin
|
|||
|
PState := '<27>鿴';
|
|||
|
FMainId := Trim(Self.CDS_Main.fieldbyname('MainId').AsString);
|
|||
|
FGSTT := self.FGSTT;
|
|||
|
ToolBar2.Visible := False;
|
|||
|
TBSave.Visible := False;
|
|||
|
ScrollBox1.Enabled := False;
|
|||
|
Tv1.OptionsSelection.CellSelect := False;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmConInPutCG.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.ToolButton2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
frmConInPutCG := TfrmConInPutCG.Create(Application);
|
|||
|
with frmConInPutCG 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
|
|||
|
frmConInPutCG.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.SellNameChange(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 TfrmContractListCG.tchkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with cds_main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('ssel').AsBoolean = True then
|
|||
|
begin
|
|||
|
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><C9B9><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;
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
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 TfrmContractListCG.TnochkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with cds_main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('ssel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update SalesContract_Main SET status=''-1'',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><C9B9><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;
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
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 TfrmContractListCG.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
SetStatus();
|
|||
|
TBRafresh.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitSub();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.TqxClick(Sender: TObject);
|
|||
|
var
|
|||
|
s: string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>OK<4F><4B>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
while True do
|
|||
|
begin
|
|||
|
if InputQuery('<27><>ͬȡ<CDAC><C8A1>ԭ<EFBFBD><D4AD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', s) = False then
|
|||
|
begin
|
|||
|
Exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if s = '' then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>벻Ϊ<EBB2BB><CEAA><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
application.MessageBox('ȡ<><C8A1>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Break;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
try
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update SalesContract_Main SET status=''2'' ');
|
|||
|
SQL.Add(',QuXiaoYYin=' + QuotedStr(Trim(s)));
|
|||
|
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><C9B9><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 TfrmContractListCG.TnoqxClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with cds_main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('ssel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update SalesContract_Main SET status=''-1'' ');
|
|||
|
SQL.Add(',QuXiaoYYin='''' ');
|
|||
|
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><C9B9><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;
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
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 TfrmContractListCG.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 TfrmContractListCG.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[v1Column15.Index] <> null then
|
|||
|
begin
|
|||
|
ACanvas.Brush.Color := StrToIntDef(AViewInfo.GridRecord.Values[v1Column15.Index], $FFFFFF);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.btnTijiaoClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with cds_main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('ssel').AsBoolean = True then
|
|||
|
begin
|
|||
|
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><C9B9><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;
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
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 TfrmContractListCG.btnCXTijiaoClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with cds_main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('ssel').AsBoolean = True then
|
|||
|
begin
|
|||
|
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><C9B9><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;
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
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 TfrmContractListCG.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSysLogHelp := TfrmSysLogHelp.create(self);
|
|||
|
with frmSysLogHelp do
|
|||
|
begin
|
|||
|
fModel := self.caption;
|
|||
|
showmodal;
|
|||
|
free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.TWCClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with cds_main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('ssel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update SalesContract_Main SET status=''3'',WCtime=getdate(),WCer=' + 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><C9B9><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;
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
// TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.TNWCClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then
|
|||
|
exit;
|
|||
|
if CDS_Main.Locate('SSel', True, []) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
with cds_main do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_Main.FieldByName('ssel').AsBoolean = True then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('update SalesContract_Main SET status=''1'',WCtime=null,WCer=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><C9B9><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;
|
|||
|
CDS_Main.Delete;
|
|||
|
end
|
|||
|
else
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
application.MessageBox('<27><><EFBFBD>ɳɹ<C9B3><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
// TBRafresh.Click;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.N11Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, true);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.N21Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main, false);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
SelExportData(Tv1, ADOQueryMain, '<27>ɹ<EFBFBD><C9B9><EFBFBD>ͬ<EFBFBD>б<EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmContractListCG.RM1EndPrintPage(var aPageNo: Integer; var aNewPrintJob: Boolean);
|
|||
|
begin
|
|||
|
// 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><D3A1><EFBFBD><EFBFBD>')));
|
|||
|
// sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>ţ<EFBFBD>' + trim(CDS_Main.FieldByName('ConNo').AsString) + '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + trim(combobox1.Text))));
|
|||
|
// sql.Add(',' + quotedstr(trim('<27>ɹ<EFBFBD>')));
|
|||
|
// sql.Add(')');
|
|||
|
// execsql;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|