D7wmguihua/坯布码单待检(PBMDDJ.dll)/U_KDOKList.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

741 lines
21 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_KDOKList;
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, cxCalendar, cxButtonEdit, cxSplitter,
RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport,
cxTextEdit, cxPC, cxCheckBox, Menus;
type
TfrmKDOKList = class(TForm)
ToolBar1: TToolBar;
TBRafresh: TToolButton;
TBAdd: TToolButton;
TBEdit: TToolButton;
TBClose: TToolButton;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
DataSource1: TDataSource;
TBExport: TToolButton;
Order_Main: TClientDataSet;
RM1: TRMGridReport;
RMDBMain: TRMDBDataSet;
RMXLSExport1: TRMXLSExport;
CDS_PRT: TClientDataSet;
ToolButton3: TToolButton;
cxGridPopupMenu2: TcxGridPopupMenu;
Panel1: TPanel;
Label2: TLabel;
BegDate: TDateTimePicker;
EndDate: TDateTimePicker;
ComboBox2: TComboBox;
Label3: TLabel;
Label1: TLabel;
ToolButton1: TToolButton;
ToolButton4: TToolButton;
ADOQueryPrint: TADOQuery;
cxTabControl1: TcxTabControl;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
Label8: TLabel;
Label5: TLabel;
Label7: TLabel;
Label9: TLabel;
KDNO: TEdit;
Country: TEdit;
KHName: TEdit;
KDType: TEdit;
Label4: TLabel;
KDFangShi: TEdit;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1Column11: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1Column6: TcxGridDBColumn;
v1Column18: TcxGridDBColumn;
v1Column9: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column20: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1Column16: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
v1Column15: TcxGridDBColumn;
v1Column17: TcxGridDBColumn;
v1Column19: TcxGridDBColumn;
ToolButton2: TToolButton;
Label6: TLabel;
KDComName: TEdit;
v1Column21: TcxGridDBColumn;
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject);
procedure TBDelClick(Sender: TObject);
procedure TBExportClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure cxPageControl1Change(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cxTabControl1Change(Sender: TObject);
procedure WorkerChange(Sender: TObject);
procedure v1Column15CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure v1Column9CustomDrawCell(Sender: TcxCustomGridTableView;
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
var ADone: Boolean);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
procedure TBAddClick(Sender: TObject);
procedure TBEditClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure v1Column13PropertiesEditValueChanged(Sender: TObject);
procedure KDNOKeyPress(Sender: TObject; var Key: Char);
procedure ToolButton2Click(Sender: TObject);
private
FInt,PFInt:Integer;
canshu1,canshu2:string;
FNowDate:TDateTime;
procedure InitGrid();
procedure InitForm();
function DelData():Boolean;
procedure InitGridWsql(fsj:string);
function SaveData():Boolean;
{ Private declarations }
public
{ Public declarations }
end;
var
frmKDOKList: TfrmKDOKList;
implementation
uses
U_DataLink,U_RTFun,U_FHInPut,U_ModuleNote,U_ZDYHelp,U_FHJJInPut;
{$R *.dfm}
procedure TfrmKDOKList.FormDestroy(Sender: TObject);
begin
frmKDOKList:=nil;
end;
procedure TfrmKDOKList.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmKDOKList.TBCloseClick(Sender: TObject);
begin
Close;
WriteCxGrid('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>˵<EFBFBD>',Tv1,'<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmKDOKList.InitGrid();
var
fsj:String;
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add(' select A.* ');
SQL.Add(' from KuaiDi_Money A');
sql.Add(' where 1=1 ');
if cxTabControl1.TabIndex<>0 then
begin
fsj:=TA(ComboBox2.Items.Objects[ComboBox2.Items.IndexOf(Trim(ComboBox2.Text))]).S;
sql.Add(' and A.'+Trim(fsj)+'>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.Date))+'''');
sql.Add(' and A.'+Trim(fsj)+'<'''+Trim(FormatDateTime('yyyy-MM-dd',EndDate.Date+1))+'''');
end;
if cxTabControl1.TabIndex=0 then
begin
sql.Add(' and isnull(A.Status,'''')<>'''' and isnull(A.MoneyPerson,'''')='''' ');
end else
if cxTabControl1.TabIndex=1 then
begin
sql.Add(' and isnull(A.Status,'''')<>'''' and isnull(A.MoneyPerson,'''')<>''''');
end;
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmKDOKList.InitForm();
begin
EndDate.Date:=SGetServerDateMEnd(ADOQueryTemp);
BegDate.Date:=SGetServerDateMBeg(ADOQueryTemp);
ReadCxGrid('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>˵<EFBFBD>',Tv1,'<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>');
//InitGrid();
end;
procedure TfrmKDOKList.TBDelClick(Sender: TObject);
begin
if Order_Main.IsEmpty then Exit;
if cxTabControl1.TabIndex<>0 then Exit;
if Trim(DName)<>Trim(Order_Main.fieldbyname('Filler').AsString) then
begin
Application.MessageBox('<27><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Ϣ!','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
if DelData() then
begin
Order_Main.Delete;
end;
end;
function TfrmKDOKList.DelData():Boolean;
begin
try
Result:=false;
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete JYOrder_FH where FHId='''+Trim(Order_Main.fieldbyname('FHId').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
Result:=True;
except
ADOQueryCmd.Connection.RollbackTrans;
Result:=False;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
end;
end;
procedure TfrmKDOKList.TBExportClick(Sender: TObject);
begin
if Order_Main.IsEmpty then Exit;
TcxGridToExcel('<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid1);
end;
procedure TfrmKDOKList.TBRafreshClick(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmKDOKList.FormShow(Sender: TObject);
var
i:Integer;
begin
InitForm();
SInitComBoxByTvColumns(ComboBox2,Tv1,999,True,True);
end;
procedure TfrmKDOKList.cxPageControl1Change(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmKDOKList.ToolButton3Click(Sender: TObject);
begin
try
frmModuleNote:=TfrmModuleNote.Create(Application);
with frmModuleNote do
begin
flag:='<27>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal=1 then
begin
end;
end;
finally
frmModuleNote.Free;
end;
end;
procedure TfrmKDOKList.FormCreate(Sender: TObject);
begin
canshu1:=Trim(DParameters1);
canshu2:=Trim(DParameters2);
end;
procedure TfrmKDOKList.InitGridWsql(fsj:string);
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
sql.Add(' select A.* ');
SQL.Add(' from KuaiDi_Money A');
sql.Add(' where 1=1 ');
if cxTabControl1.TabIndex=0 then
begin
sql.Add(' and isnull(A.Status,'''')<>'''' and isnull(A.MoneyPerson,'''')='''' ');
end else
if cxTabControl1.TabIndex=1 then
begin
sql.Add(' and isnull(A.Status,'''')<>'''' and isnull(A.MoneyPerson,'''')<>''''');
end;
sql.Add(fsj);
Open;
end;
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
function TfrmKDOKList.SaveData():Boolean;
var
maxno,maxSubNo:String;
begin
try
Result:=False;
ADOQueryCmd.Connection.BeginTrans;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Trim(Order_Main.fieldbyname('MRID').AsString)='' then
begin
if GetLSNo(ADOQueryCmd,maxno,'MR','Module_Prompt_Result',4,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(Order_Main.fieldbyname('MRID').AsString);
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from Module_Prompt_Result where MRId='''+Trim(Order_Main.fieldbyname('MRID').AsString)+'''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(Order_Main.fieldbyname('MRID').AsString)='' then
begin
Append;
end
else begin
Edit;
end;
FieldByName('MPId').Value:=Trim(Order_Main.fieldbyname('MPId').AsString);
FieldByName('MRId').Value:=Trim(maxno);
FieldByName('MRStatus').Value:='<27>Ѵ<EFBFBD><D1B4><EFBFBD>';
FieldByName('MRDate').Value:=SGetServerDateTime(ADOQueryTemp);
if Trim(Order_Main.fieldbyname('MRId').AsString)='' then
begin
FieldByName('Filler').Value:=Trim(DName);
end else
begin
FieldByName('Editer').Value:=Trim(DName);
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
end;
Post;
end;
ADOQueryCmd.Connection.CommitTrans;
Result:=True;
except
Result:=False;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
end;
end;
procedure TfrmKDOKList.cxTabControl1Change(Sender: TObject);
begin
InitGrid();
end;
procedure TfrmKDOKList.WorkerChange(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmKDOKList.v1Column15CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id,Id10:Integer;
begin
Id:=TV1.GetColumnByFieldName('YuJinagDate1').Index;//
Id10:=TV1.GetColumnByFieldName('MoneyKC').Index;
if Id<0 then Exit;
//$008000FF <20>Ⱥ<EFBFBD>ɫ <20><>ɫ $000D55FF $00B9EE9F dz<><C7B3>
if AViewInfo.GridRecord.Values[Id10]>0 then
begin
if AViewInfo.GridRecord.Values[Id]-FNowDate<=0 then
begin
ACanvas.Brush.Color:=clYellow;
end else
if AViewInfo.GridRecord.Values[Id]=null then
begin
// ACanvas.Brush.Color:=clWhite;
end;
end else
begin
//ACanvas.Brush.Color:=clWhite;
end;
end;
procedure TfrmKDOKList.v1Column9CustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
Id,Id10:Integer;
begin
Id:=TV1.GetColumnByFieldName('YuJinagDate2').Index;//
Id10:=TV1.GetColumnByFieldName('MoneyKC').Index;
if Id<0 then Exit;
//$008000FF <20>Ⱥ<EFBFBD>ɫ <20><>ɫ $000D55FF $00B9EE9F dz<><C7B3>
if AViewInfo.GridRecord.Values[Id10]>0 then
begin
if AViewInfo.GridRecord.Values[Id]-FNowDate<=0 then
begin
ACanvas.Brush.Color:=clRed;
end else
if AViewInfo.GridRecord.Values[Id]=null then
begin
//ACanvas.Brush.Color:=clWhite;
end;
end else
begin
//ACanvas.Brush.Color:=clWhite;
end;
end;
procedure TfrmKDOKList.ToolButton1Click(Sender: TObject);
begin
if ADOQueryMain.Active=False then Exit;
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
SCreateCDS20(ADOQueryMain,Order_Main);
SInitCDSData20(ADOQueryMain,Order_Main);
end;
procedure TfrmKDOKList.ToolButton4Click(Sender: TObject);
var
fPrintFile:String;
begin
if Order_Main.IsEmpty then Exit;
if Order_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf' ;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while not eof do
begin
if Order_Main.FieldByName('SSel').AsBoolean=True then
begin
{with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from JYOrder_Main_MD where MDID='''+Trim(Order_Main.fieldbyname('MDID').AsString)+'''');
Open;
end;
if ADOQueryTemp.FieldByName('NotPrint').AsBoolean=True then
begin
Order_Main.EnableControls;
Application.MessageBox('<27><><EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end; }
if FileExists(fPrintFile) then
begin
with ADOQueryPrint do
begin
Close;
sql.Clear;
sql.Add('select B.OrderNo,B.MPRTCodeName,B.MPRTMF,B.MPRTKZ,C.PRTHX,C.PRTColorNo,C.PRTColor,GangNo=A.GangNo,A.PS,A.Qty,A.QtyUnit,A.MDID ');
SQL.Add(',B.MPRTCode,B.MPRTGY,C.PRTColorEng,A.SelfGangNo');
sql.Add('from JYOrder_Main_MD A');
sql.Add('inner join JYOrder_Main B on A.OrdMainid=B.Mainid');
sql.Add(' inner join JYOrder_Sub C on A.OrdSubid=C.SubId');
sql.Add(' where A.MDID='''+Trim(Order_Main.fieldbyname('MDID').AsString)+'''');
Open;
end;
RM1.LoadFromFile(fPrintFile);
//RM1.ShowReport;
RM1.PrintReport;
end else
begin
Order_Main.DisableControls;
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD>ǩ.rmf'),'<27><>ʾ',0);
Exit;
end;
end;
Next;
end;
end;
Order_Main.EnableControls;
end;
procedure TfrmKDOKList.OrderNoKeyPress(Sender: TObject; var Key: Char);
var
fsj:String;
begin
if Key<>#13 then Exit;
if Length(Trim(KDNO.Text))<3 then Exit;
fsj:=' and A.KDNO like '''+'%'+Trim(KDNO.Text)+'%'+'''';
InitGridWsql(fsj);
end;
procedure TfrmKDOKList.TBAddClick(Sender: TObject);
begin
if Order_Main.IsEmpty then exit;
if cxTabControl1.TabIndex<>0 then Exit;
if Order_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
if Order_Main.Locate('SSel;KDMoney',VarArrayOf([True,null]),[loPartialKey])=True then
begin
Application.MessageBox('<27>ϼƲ<CFBC><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
try
ADOQueryCmd.Connection.BeginTrans;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while Locate('SSel',True,[]) do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from KuaiDi_Money where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
Open;
end;
with ADOQueryCmd do
begin
Edit;
FieldByName('MoneyPerson').Value:=Trim(DName);
FieldByName('MoneyTime').Value:=SGetServerDateTime(ADOQueryTemp);
FieldByName('ZheKouMoney').Value:=Order_Main.fieldbyname('ZheKouMoney').Value;
FieldByName('PaiSongMoney').Value:=Order_Main.fieldbyname('PaiSongMoney').Value;
FieldByName('RanYou').Value:=Order_Main.fieldbyname('RanYou').Value;
FieldByName('RanYouMoney').Value:=Order_Main.fieldbyname('RanYouMoney').Value;
FieldByName('KDMoney').Value:=Order_Main.fieldbyname('KDMoney').Value;
FieldByName('DuiZhangNote').Value:=Order_Main.fieldbyname('DuiZhangNote').Value;
Post;
end;
Order_Main.Delete;
end;
end;
Order_Main.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
end;
end;
procedure TfrmKDOKList.TBEditClick(Sender: TObject);
begin
if Order_Main.IsEmpty then exit;
if cxTabControl1.TabIndex<>1 then Exit;
if Order_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
try
ADOQueryCmd.Connection.BeginTrans;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while Locate('SSel',True,[]) do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from KuaiDi_Money where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
Open;
end;
with ADOQueryCmd do
begin
Edit;
FieldByName('MoneyPerson').Value:=Null;
FieldByName('MoneyTime').Value:=Null;
//FieldByName('ZheKouMoney').Value:=Null;
//FieldByName('PaiSongMoney').Value:=Null;
//FieldByName('RanYou').Value:=Null;
//FieldByName('RanYouMoney').Value:=Null;
//FieldByName('KDMoney').Value:=Null;
Post;
end;
Order_Main.Delete;
end;
end;
Order_Main.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
end;
end;
procedure TfrmKDOKList.N1Click(Sender: TObject);
begin
SelOKNo(Order_Main,True);
end;
procedure TfrmKDOKList.N2Click(Sender: TObject);
begin
SelOKNo(Order_Main,false);
end;
procedure TfrmKDOKList.v1Column13PropertiesEditValueChanged(
Sender: TObject);
var
mvalue,FName,ZheKouMoney,PaiSongMoney,RanYou,RanYouMoney,KDMoney:string;
begin
FName:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
mvalue:=TcxTextEdit(Sender).EditingValue;
{if Trim(mvalue)='' then
begin
mvalue:='0';
end; }
with Order_Main do
begin
Edit;
if Trim(mvalue)<>'' then
FieldByName(FName).Value:= mvalue
else
FieldByName(FName).Value:=Null;
Post;
end;
ZheKouMoney:=Order_Main.fieldbyname('ZheKouMoney').AsString;
if Trim(ZheKouMoney)='' then ZheKouMoney:='0';
PaiSongMoney:=Order_Main.fieldbyname('PaiSongMoney').AsString;
if Trim(PaiSongMoney)='' then PaiSongMoney:='0';
RanYou:=Order_Main.fieldbyname('RanYou').AsString;
if Trim(RanYou)='' then RanYou:='0';
with Order_Main do
begin
Edit;
if (StrToFloat(ZheKouMoney)+StrToFloat(PaiSongMoney))*StrToFloat(RanYou)*0.01<>0 then
FieldByName('RanYouMoney').Value:=(StrToFloat(ZheKouMoney)+StrToFloat(PaiSongMoney))*StrToFloat(RanYou)*0.01
else
FieldByName('RanYouMoney').Value:=Null;
if StrToFloat(ZheKouMoney)+StrToFloat(PaiSongMoney)+(StrToFloat(ZheKouMoney)+StrToFloat(PaiSongMoney))*StrToFloat(RanYou)*0.01<>0 then
FieldByName('KDMoney').Value:=StrToFloat(ZheKouMoney)+StrToFloat(PaiSongMoney)+(StrToFloat(ZheKouMoney)+StrToFloat(PaiSongMoney))*StrToFloat(RanYou)*0.01
else
FieldByName('KDMoney').Value:=Null;
Post;
end;
end;
procedure TfrmKDOKList.KDNOKeyPress(Sender: TObject; var Key: Char);
var
fsj:String;
begin
if Key<>#13 then Exit;
if Length(Trim(KDNO.Text))<3 then Exit;
fsj:=' and A.KDNO like '''+'%'+Trim(KDNO.Text)+'%'+'''';
InitGridWsql(fsj);
end;
procedure TfrmKDOKList.ToolButton2Click(Sender: TObject);
begin
if Order_Main.IsEmpty then exit;
if cxTabControl1.TabIndex<>0 then Exit;
if Order_Main.Locate('SSel',True,[])=False then
begin
Application.MessageBox(<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
{if Order_Main.Locate('SSel;KDMoney',VarArrayOf([True,null]),[loPartialKey])=True then
begin
Application.MessageBox('<27>ϼƲ<CFBC><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
Exit;
end; }
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
try
ADOQueryCmd.Connection.BeginTrans;
Order_Main.DisableControls;
with Order_Main do
begin
First;
while Locate('SSel',True,[]) do
begin
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from KuaiDi_Money where KDID='''+Trim(Order_Main.fieldbyname('KDID').AsString)+'''');
Open;
end;
with ADOQueryCmd do
begin
Edit;
//FieldByName('MoneyPerson').Value:=Trim(DName);
//FieldByName('MoneyTime').Value:=SGetServerDateTime(ADOQueryTemp);
FieldByName('ZheKouMoney').Value:=Order_Main.fieldbyname('ZheKouMoney').Value;
FieldByName('PaiSongMoney').Value:=Order_Main.fieldbyname('PaiSongMoney').Value;
FieldByName('RanYou').Value:=Order_Main.fieldbyname('RanYou').Value;
FieldByName('RanYouMoney').Value:=Order_Main.fieldbyname('RanYouMoney').Value;
FieldByName('KDMoney').Value:=Order_Main.fieldbyname('KDMoney').Value;
FieldByName('DuiZhangNote').Value:=Order_Main.fieldbyname('DuiZhangNote').Value;
Post;
end;
Edit;
FieldByName('SSel').Value:=False;
Post;
end;
end;
Order_Main.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
end;
end;
end.