1493 lines
38 KiB
ObjectPascal
1493 lines
38 KiB
ObjectPascal
![]() |
unit U_CWYFList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
|||
|
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
|||
|
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
|||
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
|||
|
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
|||
|
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
|||
|
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
|||
|
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
|||
|
cxTextEdit, cxPC, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
|||
|
cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters,
|
|||
|
dxDateRanges, U_BaseList, Vcl.Menus, RM_e_Xls, Clipbrd, StrUtils, ComObj,
|
|||
|
cxContainer;
|
|||
|
|
|||
|
type
|
|||
|
FdDy = record
|
|||
|
inc: integer; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD>־<EFBFBD><D6BE><EFBFBD>
|
|||
|
FDdys: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
FdDysName: string[32]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
|||
|
end;
|
|||
|
|
|||
|
TfrmCWYFList = class(TfrmBaseList)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
btnDel: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDB_Main: TRMDBDataSet;
|
|||
|
Label3: TLabel;
|
|||
|
FactoryName: TEdit;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v2CRTime: TcxGridDBColumn;
|
|||
|
v2Qty: TcxGridDBColumn;
|
|||
|
v2QtyUnit: TcxGridDBColumn;
|
|||
|
cxGridLevel1: TcxGridLevel;
|
|||
|
begdate: TDateTimePicker;
|
|||
|
Enddate: TDateTimePicker;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
DS_1: TDataSource;
|
|||
|
CDS_1: TClientDataSet;
|
|||
|
btnAdd: TToolButton;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
VYB: TcxGridDBColumn;
|
|||
|
v2FactoryName: TcxGridDBColumn;
|
|||
|
v2Note: TcxGridDBColumn;
|
|||
|
v2P_CodeName: TcxGridDBColumn;
|
|||
|
v2ps: TcxGridDBColumn;
|
|||
|
v2P_Color: TcxGridDBColumn;
|
|||
|
P_CodeName: TEdit;
|
|||
|
Label4: TLabel;
|
|||
|
Button1: TButton;
|
|||
|
Label8: TLabel;
|
|||
|
P_Color: TEdit;
|
|||
|
v2P_Code: TcxGridDBColumn;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
Label9: TLabel;
|
|||
|
BatchNo: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
P_Code: TEdit;
|
|||
|
v2OrderNo: TcxGridDBColumn;
|
|||
|
v2Column14: TcxGridDBColumn;
|
|||
|
v2P_HX: TcxGridDBColumn;
|
|||
|
Label1: TLabel;
|
|||
|
P_HX: TEdit;
|
|||
|
cxTabControl1: TcxTabControl;
|
|||
|
Label11: TLabel;
|
|||
|
OrderNo: TEdit;
|
|||
|
v2BZType: TcxGridDBColumn;
|
|||
|
v2Column2: TcxGridDBColumn;
|
|||
|
v2P_Spec: TcxGridDBColumn;
|
|||
|
v2BatchNo: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
btnChk: TToolButton;
|
|||
|
btnNoChk: TToolButton;
|
|||
|
VC_chkstatus: TcxGridDBColumn;
|
|||
|
v2Column4: TcxGridDBColumn;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
RMDB_Grid: TRMDBDataSet;
|
|||
|
RMGrid: TRMGridReport;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
N2: TMenuItem;
|
|||
|
Label2: TLabel;
|
|||
|
FromDataID1: TEdit;
|
|||
|
N3: TMenuItem;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
h1: TMenuItem;
|
|||
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
Tv1Column15: TcxGridDBColumn;
|
|||
|
Tv1Column16: TcxGridDBColumn;
|
|||
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
ToolButton6: TToolButton;
|
|||
|
OpenDialog1: TOpenDialog;
|
|||
|
Panel2: TPanel;
|
|||
|
Label5: TLabel;
|
|||
|
factoryname1: TcxButtonEdit;
|
|||
|
Button2: TButton;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
N4: TMenuItem;
|
|||
|
N5: TMenuItem;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure btnDelClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure btnAddClick(Sender: TObject);
|
|||
|
procedure cxGridDBColumn6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
procedure btnChkClick(Sender: TObject);
|
|||
|
procedure btnNoChkClick(Sender: TObject);
|
|||
|
procedure FactoryNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure v2Column3PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Tv1Column3PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure N3Click(Sender: TObject);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure v2QtyUnitPropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure h1Click(Sender: TObject);
|
|||
|
procedure Tv2DZYuePropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Tv1Column16PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v2Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure v2Column14PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure VYBPropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton6Click(Sender: TObject);
|
|||
|
procedure factoryname1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
procedure N4Click(Sender: TObject);
|
|||
|
procedure N5Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
|
|||
|
procedure InitGrid();
|
|||
|
public
|
|||
|
fFlag: integer;
|
|||
|
dFdDy: array[0..20] of FdDy; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{ Public declarations }
|
|||
|
RKFlag, FCYID, fmanage, FZKType, canshu1: string;
|
|||
|
end;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_GYSSel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmCWYFList.InitGrid();
|
|||
|
var
|
|||
|
WSql: string;
|
|||
|
begin
|
|||
|
WSql := SGetFilters(Panel1, 1, 2);
|
|||
|
if Trim(WSql) <> '' then
|
|||
|
WSql := ' and ' + WSql;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
Filtered := False;
|
|||
|
sql.Add(' select A.*');
|
|||
|
// sql.Add(' ,GcHuaNo=(select GcHuaNo from V_CP_CPBP Y where Y.CYNo=A.P_Code)');
|
|||
|
// sql.Add(' ,FaType=(select FactType from Company X where X.CoCode=A.FactoryNo and X.Valid=''Y'')');
|
|||
|
sql.Add(' from CW_Money_CR A');
|
|||
|
sql.Add(' where A.CRType=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' ');
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(BZType,'''')=''$'' ');
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(BZType,'''')=''<27><>'' ');
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(BZType,'''')=''<27>'' ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
if CheckBox1.Checked then
|
|||
|
begin
|
|||
|
sql.Add(' and A.CRTime>=''' + FormatDateTime('yyyy-MM-dd', begdate.DateTime) + ''' ');
|
|||
|
sql.Add(' and CRTime<''' + FormatDateTime('yyyy-MM-dd', Enddate.DateTime + 1) + ''' ');
|
|||
|
end;
|
|||
|
sql.Add(WSql);
|
|||
|
// showmessage(sql.text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.N1Click(Sender: TObject);
|
|||
|
var
|
|||
|
FValue, FFValue, FColumn, FFColumn, FCWID: string;
|
|||
|
begin
|
|||
|
FCWID := CDS_1.FieldByName('CWID').AsString;
|
|||
|
|
|||
|
FColumn := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
FValue := Trim(CDS_1.fieldbyname(FColumn).AsString);
|
|||
|
if FColumn <> 'Price' then
|
|||
|
begin
|
|||
|
Application.MessageBox('Ŀǰֻ<C7B0><D6BB><EFBFBD>滻<EFBFBD><E6BBBB><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean and (FieldByName('status').AsString = '0') and (FieldByName('DZFlag').AsBoolean = False) then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
if FValue = '' then
|
|||
|
begin
|
|||
|
CDS_1.FieldByName(FColumn).Value := null;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CDS_1.FieldByName(FColumn).Value := FValue;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
|
|||
|
if FColumn = 'Price' then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set Price=' + FValue);
|
|||
|
sql.Add(', Money= Qty * ' + FValue + ' + isnull(QTFee,0)');
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Money').Value := FieldByName('Price').AsFloat * FieldByName('Qty').AsFloat + FieldByName('QTFee').AsFloat;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Next;
|
|||
|
end;
|
|||
|
CDS_1.Locate('CWID', FCWID, []);
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.N3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
|
|||
|
CDS_1.FieldByName('DZFlag').Value := True;
|
|||
|
|
|||
|
Post;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set DZFlag=1');
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.N4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
SelOKNoFiler(TV1, TRUE);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.N5Click(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
SelOKNoFiler(TV1, false);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.FactoryNameKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>GY1', TV1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.btnDelClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
Exit;
|
|||
|
if Trim(CDS_1.fieldbyname('FromDataID1').AsString) <> '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CW_Money_CR');
|
|||
|
sql.Add(' where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
SQL.Add(' and status=''1''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryCmd.IsEmpty = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>!', '<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
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' insert into ZDel_CW_Money_CR ');
|
|||
|
sql.Add(' select * from CW_Money_CR where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
sql.Add(' Update ZDel_CW_Money_CR Set DelTime=getdate(),DelName=''' + Trim(DName) + ''',DelCode=''' + Trim(DCode) + '''');
|
|||
|
sql.Add(' where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
sql.Add(' delete CW_Money_CR where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
CDS_1.Delete;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
ReadCxGrid('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>GY1', TV1, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
Enddate.DateTime := SGetServerDate(ADOQueryTemp);
|
|||
|
begdate.DateTime := Enddate.DateTime;
|
|||
|
InitGrid();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.h1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
CDS_1.FieldByName('DZFlagHZ').Value := True;
|
|||
|
Post;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set DZFlagHZ=1');
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
begdate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then
|
|||
|
Exit;
|
|||
|
TcxGridToExcel(self.Caption, cxgrid1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.ToolButton2Click(Sender: TObject);
|
|||
|
var
|
|||
|
filepath: string;
|
|||
|
mBegdate, mEnddate: string;
|
|||
|
begin
|
|||
|
mBegdate := FormatDateTime('yyyy-MM-dd', begdate.Date);
|
|||
|
mEnddate := FormatDateTime('yyyy-MM-dd', enddate.Date);
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
ExportFtErpFile('Ӧ<><D3A6><EFBFBD>嵥.rmf', ADOQueryTemp);
|
|||
|
filepath := ExtractFilePath(Application.ExeName) + 'report\Ӧ<><D3A6><EFBFBD>嵥.rmf';
|
|||
|
if not FileExists(Pchar(filepath)) then
|
|||
|
begin
|
|||
|
application.MessageBox(pchar('<27>ļ<EFBFBD>[' + filepath + ']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_IConError);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
RmVariables['begDate'] := FormatDateTime('yyyy-mm-dd', begDate.Date);
|
|||
|
RmVariables['enddate'] := FormatDateTime('yyyy-mm-dd', enddate.Date);
|
|||
|
RMVariables['ZDR'] := trim(DName);
|
|||
|
RMGrid.LoadFromFile(filepath);
|
|||
|
RMGrid.ShowReport;
|
|||
|
finally
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
filepath, maxId, FCWIDS: string;
|
|||
|
mBegdate, mEnddate: string;
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, maxId, 'PJ', 'CW_Money_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
FCWIDS := '';
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
if FCWIDS = '' then
|
|||
|
FCWIDS := QuotedStr(Trim(CDS_1.fieldbyname('CWID').AsString))
|
|||
|
else
|
|||
|
FCWIDS := FCWIDS + ',' + QuotedStr(Trim(CDS_1.fieldbyname('CWID').AsString));
|
|||
|
|
|||
|
Edit;
|
|||
|
FieldByName('ZPID').Value := maxId;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('UPDATE CW_Money_CR set ZPID=' + QuotedStr(maxId));
|
|||
|
sql.Add('where isnull(ZPID,'''')='''' and CWID in (' + FCWIDS + ') ');
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
filepath, maxId, FCWIDS: string;
|
|||
|
mBegdate, mEnddate: string;
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('exec P_CW_Print_HBPJ @ZPID=' + QuotedStr(Trim(CDS_1.fieldbyname('ZPID').AsString)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
ExportFtErpFile('<27>ϲ<EFBFBD>Ʊ<EFBFBD><C6B1>.rmf', ADOQueryTemp);
|
|||
|
filepath := ExtractFilePath(Application.ExeName) + 'report\<5C>ϲ<EFBFBD>Ʊ<EFBFBD><C6B1>.rmf';
|
|||
|
if not FileExists(Pchar(filepath)) then
|
|||
|
begin
|
|||
|
application.MessageBox(pchar('<27>ļ<EFBFBD>[' + filepath + ']<5D><><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_IConError);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
RmVariables['begDate'] := FormatDateTime('yyyy-mm-dd', begDate.Date);
|
|||
|
RmVariables['enddate'] := FormatDateTime('yyyy-mm-dd', enddate.Date);
|
|||
|
RMVariables['ZDR'] := trim(DName);
|
|||
|
RM1.LoadFromFile(filepath);
|
|||
|
RM1.ShowReport;
|
|||
|
finally
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.ToolButton5Click(Sender: TObject);
|
|||
|
var
|
|||
|
filepath, maxId, FCWIDS: string;
|
|||
|
mBegdate, mEnddate: string;
|
|||
|
begin
|
|||
|
|
|||
|
FCWIDS := '';
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
if FCWIDS = '' then
|
|||
|
FCWIDS := QuotedStr(Trim(CDS_1.fieldbyname('CWID').AsString))
|
|||
|
else
|
|||
|
FCWIDS := FCWIDS + ',' + QuotedStr(Trim(CDS_1.fieldbyname('CWID').AsString));
|
|||
|
|
|||
|
Edit;
|
|||
|
FieldByName('ZPID').Value := '';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('UPDATE CW_Money_CR set ZPID=null');
|
|||
|
sql.Add('where CWID in (' + FCWIDS + ') ');
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.ToolButton6Click(Sender: TObject);
|
|||
|
var
|
|||
|
excelApp, WorkBook: Variant;
|
|||
|
i, j, k, LX, ExcelRowCount: integer;
|
|||
|
maxId, FCPID, FCPName, MAXNO, t1, t2, t3, MBZType: string;
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
excelApp := CreateOleObject('Excel.Application');
|
|||
|
openDialog1.Filter := '*.CSV;*.xls';
|
|||
|
if opendialog1.Execute then
|
|||
|
begin
|
|||
|
WorkBook := excelApp.WorkBooks.Open(OpenDialog1.FileName);
|
|||
|
end
|
|||
|
else
|
|||
|
exit;
|
|||
|
|
|||
|
excelApp.Visible := false;
|
|||
|
ExcelRowCount := WorkBook.WorkSheets[1].UsedRange.Rows.Count;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>EXCEL<45><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
try
|
|||
|
k := 0;
|
|||
|
for i := 1 to 50 do
|
|||
|
begin
|
|||
|
if trim(excelApp.Cells[1, i].value) = '' then
|
|||
|
continue;
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3B6A8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ֶκ<D6B6><CEBA><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
for j := 0 to Tv1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
if trim(excelApp.Cells[1, i].value) = trim(Tv1.Columns[j].Caption) then
|
|||
|
begin
|
|||
|
dFdDy[k].inc := i;
|
|||
|
dFdDy[k].FDdys := trim(Tv1.Columns[j].DataBinding.FieldName);
|
|||
|
dFdDy[k].FdDysName := trim(Tv1.Columns[j].Caption);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
k := k + 1;
|
|||
|
end;
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
MBZType := '$';
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
MBZType := '<27><>';
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
MBZType := '<27>';
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
panel2.Visible := true;
|
|||
|
try
|
|||
|
for i := 2 to ExcelRowCount do
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from CW_Money_CR where 1=2');
|
|||
|
open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
ADOQueryCmd.Append;
|
|||
|
if GetLSNo(ADOQuerytemp, maxId, 'YFDR', 'CW_Money_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
FieldByName('CWID').Value := Trim(maxId);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
FieldByName('CRType').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value := 1;
|
|||
|
|
|||
|
FieldByName('BZType').Value := MBZType;
|
|||
|
FieldByName('CWType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
for j := 0 to k - 1 do
|
|||
|
begin
|
|||
|
|
|||
|
if (trim(dFdDy[j].FDdys) <> '') then
|
|||
|
begin
|
|||
|
|
|||
|
ADOQueryCmd.fieldbyname(dFdDy[j].FDdys).Value := excelApp.Cells[i, dFdDy[j].inc].Value;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
ADOQueryCmd.Post;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
panel2.Visible := false;
|
|||
|
InitGrid();
|
|||
|
except
|
|||
|
WorkBook.Close;
|
|||
|
excelApp.Quit;
|
|||
|
excelApp := Unassigned;
|
|||
|
WorkBook := Unassigned;
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
|||
|
panel2.Visible := false;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.btnAddClick(Sender: TObject);
|
|||
|
var
|
|||
|
MFactoryNo, MFactoryName, MBZType, maxId: string;
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd, maxId, 'YF', 'CW_Money_CR', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
case cxTabControl1.TabIndex of
|
|||
|
0:
|
|||
|
begin
|
|||
|
MBZType := '$';
|
|||
|
end;
|
|||
|
1:
|
|||
|
begin
|
|||
|
MBZType := '<27><>';
|
|||
|
end;
|
|||
|
2:
|
|||
|
begin
|
|||
|
MBZType := '<27>';
|
|||
|
end;
|
|||
|
end;
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'GYSNAME';
|
|||
|
flagname := '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
with ClientDataSet1 do
|
|||
|
begin
|
|||
|
// MFactoryNo := Trim(Order_Main.fieldbyname('CoCode').AsString);
|
|||
|
MFactoryName := FieldByName('ZDYName').AsString;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
// try
|
|||
|
// frmGYSSel := TfrmGYSSel.Create(Application);
|
|||
|
// with frmGYSSel do
|
|||
|
// begin
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
// MFactoryNo := Trim(Order_Main.fieldbyname('CoCode').AsString);
|
|||
|
// MFactoryName := Trim(Order_Main.fieldbyname('CoName').AsString);
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmGYSSel.Free;
|
|||
|
// end;
|
|||
|
if trim(MFactoryName) = '' then
|
|||
|
Exit;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from CW_Money_CR where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CWID').Value := Trim(maxId);
|
|||
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
FieldByName('CRType').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|||
|
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
FieldByName('QtyFlag').Value := 1;
|
|||
|
FieldByName('FactoryNo').Value := MFactoryNo;
|
|||
|
FieldByName('FactoryName').Value := MFactoryName;
|
|||
|
FieldByName('HZFactoryNo').Value := MFactoryNo;
|
|||
|
FieldByName('HZFactoryName').Value := MFactoryName;
|
|||
|
FieldByName('CRTime').Value := formatdateTIme('yyyy-MM-dd', SGetServerDate(ADOQueryTemp));
|
|||
|
FieldByName('BZType').Value := MBZType;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with Self.CDS_1 do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CWID').Value := Trim(maxId);
|
|||
|
FieldByName('FactoryNo').Value := MFactoryNo;
|
|||
|
FieldByName('FactoryName').Value := MFactoryName;
|
|||
|
FieldByName('HZFactoryNo').Value := MFactoryNo;
|
|||
|
FieldByName('HZFactoryName').Value := MFactoryName;
|
|||
|
FieldByName('CRTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
FieldByName('BZType').Value := MBZType;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.cxGridDBColumn6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
FQtyUnit: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'OrderUnit';
|
|||
|
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
Self.CDS_1.Edit;
|
|||
|
FQtyUnit := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
|
|||
|
with Self.CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('QtyUnit').Value := Trim(FQtyUnit);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set QtyUnit=' + quotedstr(Trim(FQtyUnit)));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.Tv1Column16PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
FJSQty, FQty, FQtyCha, FPrice, FQTFee, FMoney: Double;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
|||
|
if Trim(mvalue) = '' then //<2F><>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF><EFBFBD><EFBFBD>㱨<EFBFBD><E3B1A8>
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
FJSQty := CDS_1.fieldbyname('Qty').AsFloat; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>Qty
|
|||
|
FQty := CDS_1.fieldbyname('FSQty').AsFloat; //<2F><><EFBFBD><EFBFBD>
|
|||
|
FQtyCha := CDS_1.fieldbyname('QTyCha').AsFloat; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
FQTFee := CDS_1.fieldbyname('QTFee').AsFloat; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
FPrice := CDS_1.fieldbyname('Price').AsFloat;
|
|||
|
FMoney := CDS_1.fieldbyname('Money').AsFloat;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(FFieldName) <> 'Qty' then
|
|||
|
begin
|
|||
|
FJSQty := FQty - FQtyCha;
|
|||
|
end;
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
begin
|
|||
|
FMoney := FJSQty * FPrice + FQTFee;
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Qty').Value := FJSQty; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
FieldByName('Money').Value := FMoney;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=' + quotedstr(Trim(mvalue)));
|
|||
|
if Trim(FFieldName) <> 'Qty' then
|
|||
|
sql.Add(' ,Qty=' + FloatToStr(FJSQty));
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
sql.Add(' ,Money=' + FloatToStr(FMoney));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.Tv1Column3PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue: Boolean;
|
|||
|
FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxCheckBox(Sender).Checked;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
if mvalue then
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=1')
|
|||
|
else
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=0');
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
if factoryname1.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CW_Money_CR');
|
|||
|
sql.Add(' where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
SQL.Add(' and status=''1'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryCmd.IsEmpty = False then
|
|||
|
begin
|
|||
|
CDS_1.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('update CW_Money_CR set FactoryName=''' + trim(FactoryName1.Text) + ''' ');
|
|||
|
sql.Add(',FactoryNo=''''');
|
|||
|
sql.add('where CWID=''' + trim(CDS_1.fieldbyname('CWID').asstring) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
CDS_1.Edit;
|
|||
|
|
|||
|
CDS_1.FieldByName('FactoryName').Value := trim(FactoryName1.Text);
|
|||
|
CDS_1.FieldByName('FactoryNo').Value := trim('''');
|
|||
|
CDS_1.Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_1.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
|
|||
|
except
|
|||
|
CDS_1.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>', '<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
FComTaiTou: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'GSTTDZ';
|
|||
|
flagname := '<27><>˾̧ͷ';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
FComTaiTou := Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
with Self.CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('ComTaiTou').Value := Trim(FComTaiTou);
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ComTaiTou=' + quotedstr(Trim(FComTaiTou)));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
var
|
|||
|
i: integer;
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CW_Money_CR');
|
|||
|
sql.Add(' where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
SQL.Add(' and status=''1'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if not ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
|
|||
|
for i := 0 to TV1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
if uppercase(TV1.Columns[i].DataBinding.FieldName) <> 'SSEL' then
|
|||
|
TV1.Columns[i].Options.Editing := false;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
for i := 0 to TV1.ColumnCount - 1 do
|
|||
|
begin
|
|||
|
if uppercase(TV1.Columns[i].DataBinding.FieldName) <> 'SSEL' then
|
|||
|
TV1.Columns[i].Options.Editing := True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(CDS_1.fieldbyname('FromDataID1').AsString) <> '' then
|
|||
|
begin
|
|||
|
v2CRTime.Options.Editing := False;
|
|||
|
v2FactoryName.Options.Editing := False;
|
|||
|
v2OrderNo.Options.Editing := False;
|
|||
|
v2P_Code.Options.Editing := False;
|
|||
|
v2P_CodeName.Options.Editing := False;
|
|||
|
v2P_Color.Options.Editing := False;
|
|||
|
v2P_HX.Options.Editing := False;
|
|||
|
v2ps.Options.Editing := False;
|
|||
|
v2Qty.Options.Editing := False;
|
|||
|
v2QtyUnit.Options.Editing := False;
|
|||
|
v2BZType.Options.Editing := False;
|
|||
|
|
|||
|
v2P_Spec.Options.Editing := False;
|
|||
|
v2BatchNo.Options.Editing := False;
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
v2CRTime.Options.Editing := True;
|
|||
|
v2FactoryName.Options.Editing := True;
|
|||
|
v2OrderNo.Options.Editing := True;
|
|||
|
v2P_Code.Options.Editing := True;
|
|||
|
v2P_CodeName.Options.Editing := True;
|
|||
|
v2P_Color.Options.Editing := True;
|
|||
|
v2P_HX.Options.Editing := True;
|
|||
|
v2ps.Options.Editing := True;
|
|||
|
v2Qty.Options.Editing := True;
|
|||
|
v2QtyUnit.Options.Editing := True;
|
|||
|
v2BZType.Options.Editing := True;
|
|||
|
|
|||
|
v2P_Spec.Options.Editing := True;
|
|||
|
v2BatchNo.Options.Editing := True;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.Tv2DZYuePropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName, a, b, c, d: string;
|
|||
|
i, j: integer;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
a := LeftStr(mvalue, 4);
|
|||
|
b := Copy(mvalue, 5, 1);
|
|||
|
c := Copy(mvalue, 6, 2);
|
|||
|
// d := lenght(mvalue);
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
if TryStrToInt(a, i) or TryStrToInt(c, j) or (b = '-') then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=' + quotedstr(Trim(mvalue)));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
ShowMessage('<27><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>');
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.v2Column14PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
FQty, FPrice, FQTFee, FMoney: Double;
|
|||
|
begin
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
FQty := CDS_1.fieldbyname('Qty').AsFloat;
|
|||
|
FQTFee := CDS_1.fieldbyname('QTFee').AsFloat;
|
|||
|
FPrice := CDS_1.fieldbyname('Price').AsFloat;
|
|||
|
FMoney := CDS_1.fieldbyname('Money').AsFloat;
|
|||
|
end;
|
|||
|
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
begin
|
|||
|
FMoney := FQty * FPrice + FQTFee;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Money').Value := FMoney;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=' + Trim(mvalue));
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
sql.Add(' ,Money=' + FloatToStr(FMoney));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
|
|||
|
Tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.v2Column1PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
FQty, FPrice, FQTFee, FMoney: Double;
|
|||
|
begin
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
FQty := CDS_1.fieldbyname('Qty').AsFloat;
|
|||
|
if FloatToStr(CDS_1.fieldbyname('QTFee').AsFloat) <> '' then
|
|||
|
FQTFee := CDS_1.fieldbyname('QTFee').AsFloat
|
|||
|
else
|
|||
|
FQTFee := 0;
|
|||
|
FPrice := CDS_1.fieldbyname('Price').AsFloat;
|
|||
|
FMoney := CDS_1.fieldbyname('Money').AsFloat;
|
|||
|
end;
|
|||
|
|
|||
|
if FFieldName = 'Price' then
|
|||
|
FPrice := strtofloatdef(mvalue, 0);
|
|||
|
if FFieldName = 'Qty' then
|
|||
|
FQty := strtofloatdef(mvalue, 0);
|
|||
|
if FFieldName = 'QTFee' then
|
|||
|
FQTFee := strtofloatdef(mvalue, 0);
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
FMoney := FQty * FPrice + FQTFee;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Money').Value := FMoney;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=' + Trim(mvalue));
|
|||
|
if Trim(FFieldName) <> 'Money' then
|
|||
|
sql.Add(' ,Money=' + FloatToStr(FMoney));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.v2Column3PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=' + quotedstr(Trim(mvalue)));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.v2QtyUnitPropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=' + quotedstr(Trim(mvalue)));
|
|||
|
sql.Add('where CWID=' + quotedstr(Trim(CDS_1.fieldbyname('CWID').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.VYBPropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('update CW_Money_CR set ' + FFieldName + '=' + quotedstr(Trim(mvalue)));
|
|||
|
sql.Add('where CWId=' + quotedstr(Trim(CDS_1.fieldbyname('CWId').AsString)));
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.cxTabControl1Change(Sender: TObject);
|
|||
|
begin
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.factoryname1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := 'GYSNAME';
|
|||
|
flagname := '<27><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
with ClientDataSet1 do
|
|||
|
begin
|
|||
|
// MFactoryNo := Trim(Order_Main.fieldbyname('CoCode').AsString);
|
|||
|
FactoryName1.Text := FieldByName('ZDYName').AsString;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.btnChkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
|
|||
|
try
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CW_Money_CR');
|
|||
|
sql.Add(' where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
SQL.Add(' and status=''1'' ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryCmd.IsEmpty = False then
|
|||
|
begin
|
|||
|
CDS_1.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('update CW_Money_CR set Chker=''' + trim(DName) + ''',Chktime=getdate(),status=''1'' ');
|
|||
|
sql.add('where CWID=''' + trim(CDS_1.fieldbyname('CWID').asstring) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
CDS_1.Edit;
|
|||
|
CDS_1.FieldByName('status').Value := '1';
|
|||
|
CDS_1.FieldByName('Chker').Value := DName;
|
|||
|
CDS_1.Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_1.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
|
|||
|
except
|
|||
|
CDS_1.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>', '<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmCWYFList.btnNoChkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if CDS_1.IsEmpty then
|
|||
|
exit;
|
|||
|
try
|
|||
|
with CDS_1 do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from CW_Money_CR');
|
|||
|
sql.Add(' where CWID=''' + Trim(CDS_1.fieldbyname('CWID').AsString) + '''');
|
|||
|
SQL.Add(' and Chker=' + QuotedStr(trim(DName)));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
if ADOQueryCmd.IsEmpty then
|
|||
|
begin
|
|||
|
CDS_1.EnableControls;
|
|||
|
Application.MessageBox('<27><><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('update CW_Money_CR set Chker=null,Chktime=null,status=''0'' ');
|
|||
|
sql.add('where CWID=''' + trim(CDS_1.fieldbyname('CWID').asstring) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
CDS_1.Edit;
|
|||
|
CDS_1.FieldByName('status').Value := '0';
|
|||
|
CDS_1.FieldByName('Chker').Value := '';
|
|||
|
CDS_1.Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
CDS_1.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<CBB3>', '<27><>ʾ');
|
|||
|
|
|||
|
except
|
|||
|
CDS_1.EnableControls;
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>', '<27><>ʾ');
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|