617 lines
16 KiB
ObjectPascal
617 lines
16 KiB
ObjectPascal
unit U_YpBaoJiaInput;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
||
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
|
||
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
|
||
ExtCtrls, BtnEdit, cxDropDownEdit;
|
||
|
||
type
|
||
TfrmYpBaoJiaInput = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
ADOQuery1: TADOQuery;
|
||
ScrollBox1: TScrollBox;
|
||
Label1: TLabel;
|
||
Label4: TLabel;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
Label6: TLabel;
|
||
Label20: TLabel;
|
||
Label22: TLabel;
|
||
Label23: TLabel;
|
||
Label27: TLabel;
|
||
Label28: TLabel;
|
||
BjNo: TEdit;
|
||
Jhtime: TDateTimePicker;
|
||
Bjtime: TDateTimePicker;
|
||
CustomerName: TcxButtonEdit;
|
||
BjCode: TcxButtonEdit;
|
||
BjName: TEdit;
|
||
BjMF: TEdit;
|
||
BjKZ: TEdit;
|
||
BJer: TcxButtonEdit;
|
||
BJPhone: TEdit;
|
||
ScrollBox2: TScrollBox;
|
||
Label37: TLabel;
|
||
Label39: TLabel;
|
||
Label40: TLabel;
|
||
Label51: TLabel;
|
||
Label52: TLabel;
|
||
Label53: TLabel;
|
||
Label54: TLabel;
|
||
YfCost: TEdit;
|
||
DjBzCost: TEdit;
|
||
Price: TEdit;
|
||
CbPrice: TEdit;
|
||
Lr: TEdit;
|
||
Lrd: TEdit;
|
||
ZzCost: TEdit;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1Column5: TcxGridDBColumn;
|
||
BjNote: TMemo;
|
||
Label24: TLabel;
|
||
Qty: TEdit;
|
||
Label5: TLabel;
|
||
zhenxing: TEdit;
|
||
Label7: TLabel;
|
||
huohao: TEdit;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure cxButtonEdit3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ZzCostKeyPress(Sender: TObject; var Key: Char);
|
||
procedure HclCostExit(Sender: TObject);
|
||
procedure v1Column1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure CustomerNamePropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure BjZKSExit(Sender: TObject);
|
||
procedure ScrollBox2Click(Sender: TObject);
|
||
procedure ScrollBox1Click(Sender: TObject);
|
||
private
|
||
FXS:Integer;
|
||
procedure InitData();
|
||
procedure InitWlPb();
|
||
procedure upWlPb();
|
||
procedure InitYLQty();
|
||
|
||
function SaveData():Boolean;
|
||
function RoundFloat(f:double;i:integer):double;
|
||
procedure CBHJ();
|
||
Function Setstring(cString:string):string;
|
||
{ Private declarations }
|
||
public
|
||
PState,PCopyInt:Integer;
|
||
FMainId,FConNo:String;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmYpBaoJiaInput: TfrmYpBaoJiaInput;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_Fun,
|
||
U_CPManageFMSel;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmYpBaoJiaInput.InitYLQty();
|
||
var
|
||
MMmkz,MYlShb:double;
|
||
begin
|
||
|
||
|
||
with Order_Sub do
|
||
begin
|
||
first;
|
||
while not eof do
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
MMmkz:=FieldByName('Mmkz').AsFloat;
|
||
MYlShb:=FieldByName('YlShb').AsFloat;
|
||
edit;
|
||
FieldByName('YLQty').Value:=RoundFloat(MMmkz*StrToFloatDef(Setstring(Qty.Text),0)/1000*(MYlShb+100)/100,2);
|
||
|
||
post;
|
||
end;
|
||
|
||
next;
|
||
end;
|
||
end;
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
|
||
end;
|
||
function TfrmYpBaoJiaInput.Setstring(cString:string):string; {<7B><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>}
|
||
var
|
||
i:integer;
|
||
str:string;
|
||
begin
|
||
str:='';
|
||
For i:=1 to length(cString) do
|
||
begin
|
||
if Pos(cString[i],'0123456789.')<=0 then
|
||
break
|
||
else
|
||
Case cString[i] of
|
||
'.': str:=Str+'.';
|
||
|
||
'0': str:=Str+'0'; '1': str:=Str+'1'; '2': str:=Str+'2';
|
||
'3': str:=Str+'3'; '4': str:=Str+'4'; '5': str:=Str+'5';
|
||
'6': str:=Str+'6'; '7': str:=Str+'7';
|
||
'8': str:=Str+'8'; '9': str:=Str+'9';
|
||
end;
|
||
end;
|
||
Setstring:=str;
|
||
end;
|
||
|
||
|
||
procedure TfrmYpBaoJiaInput.upWlPb();
|
||
var
|
||
MBiLi,MYlShb,MWlPrice,MWlMoney:Double;
|
||
begin
|
||
if Order_Sub.IsEmpty then Exit;
|
||
|
||
with Order_Sub do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
MBiLi:= fieldbyname('BiLi').AsFloat;
|
||
MYlShb:= fieldbyname('YlShb').AsFloat;
|
||
MWlPrice:= fieldbyname('WlPrice').AsFloat;
|
||
|
||
MWlMoney:=RoundFloat(MWlPrice*(MYlShb+100)*MBiLi/10000,2);
|
||
Edit;
|
||
fieldbyname('WlMoney').Value:=MWlMoney;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
procedure TfrmYpBaoJiaInput.InitWlPb();
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select BjMainID='''',BjSubID='''',Mmkz=0.00,WlMoney=0.00, YLQty=0.00,YLbl BiLi,WLID='''', YLName WLName, YlShb=0.00, WlPrice=0.00 ');
|
||
sql.Add('from CP_YDangSpec A ');
|
||
sql.Add(' where A.CYID=(select top 1 CYID from CP_YDang where CYNo='+Quotedstr(Trim(BjCode.Text))+')');
|
||
sql.Add(' and isnull(YLName,'''')<>'''' and isnull(YLbl,0)<>0 ');
|
||
// ShowMessage(SQL.Text);
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOTemp,Order_Sub);
|
||
SInitCDSData20(ADOTemp,Order_Sub);
|
||
end;
|
||
function TfrmYpBaoJiaInput.RoundFloat(f:double;i:integer):double;
|
||
var
|
||
s:string;
|
||
ef:extended;
|
||
begin
|
||
s:='#.'+ StringOfChar('0',i);
|
||
ef:=StrToFloat(FloatToStr(f));//<2F><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
result:=StrToFloat(FormatFloat(s,ef));
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.CBHJ();
|
||
var
|
||
MWlCost,MHclPrice,MZzCost,MHclCost,MDjBzCost
|
||
,MQty
|
||
,MKfCost,MBlKfCost,MYfCost,MLxCost,MBlLxCost
|
||
,MYwCost,MBlYwCost,MSdCost,MBlSdCost
|
||
,MBlZshCost,MZshCost
|
||
,MBjZKS,MCbPrice,MPrice,MLr,MLrd:Double;
|
||
begin
|
||
if TV1.DataController.Summary.FooterSummaryValues[0]<>NULL then
|
||
MWlCost:=TV1.DataController.Summary.FooterSummaryValues[0]
|
||
else
|
||
MWlCost:=0;
|
||
//<2F><><EFBFBD><EFBFBD>
|
||
MQty:=StrToFloatDef(Qty.Text,0);
|
||
|
||
//<2F><>̨<EFBFBD><CCA8>
|
||
MDjBzCost:=StrToFloatDef(DjBzCost.Text,0);
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD>
|
||
if MQty>0 then
|
||
begin
|
||
MZzCost:=RoundFloat(MDjBzCost/MQty,2);
|
||
ZzCost.Text:=FloatToStr(MZzCost);
|
||
end
|
||
else
|
||
begin
|
||
ZzCost.Text:='0';
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD>
|
||
MPrice:=StrToFloatDef(Price.Text,0);
|
||
//<2F>˷<EFBFBD>
|
||
MYfCost:=StrToFloatDef(YfCost.Text,0);
|
||
|
||
|
||
//<2F>ɱ<EFBFBD>
|
||
MCbPrice:=MWlCost+MZzCost+MYfCost;
|
||
|
||
MCbPrice:=RoundFloat(MCbPrice,2);
|
||
|
||
CbPrice.Text:=FloatToStr(MCbPrice);
|
||
|
||
if MPrice>0 then
|
||
begin
|
||
|
||
MLr:=RoundFloat(MPrice-MCbPrice,2);
|
||
MLrd:=RoundFloat(MLr/MPrice*100,2);
|
||
Lr.Text:=FloatToStr(MLr);
|
||
Lrd.Text:=FloatToStr(MLrd);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.InitData();
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*');
|
||
sql.Add('from BaoJiaSub A');
|
||
sql.Add('where A.BjMainID='''+FMainId+'''') ;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,Order_Sub);
|
||
SInitCDSData20(ADOQuery1,Order_Sub);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*');
|
||
sql.Add('from BaoJiaMain A');
|
||
sql.Add('where A.BJMainID='''+FMainId+'''') ;
|
||
Open;
|
||
end;
|
||
SCSHData(ADOQuery1,ScrollBox1,0);
|
||
SCSHData(ADOQuery1,ScrollBox2,0);
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.FormShow(Sender: TObject);
|
||
begin
|
||
InitData();
|
||
if PState=0 then
|
||
begin
|
||
|
||
end;
|
||
|
||
if PState=2 then
|
||
begin
|
||
ScrollBox1.Enabled:=False;
|
||
ScrollBox2.Enabled:=False;
|
||
TBSave.Visible:=False;
|
||
cxGrid1.Enabled:=False;
|
||
end;
|
||
|
||
if PCopyInt=1 then
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
first;
|
||
while not eof do
|
||
begin
|
||
Edit;
|
||
fieldbyname('BjSubID').value:='';
|
||
Next;
|
||
end;
|
||
end;
|
||
FMainId:='';
|
||
PState:=0;
|
||
bjno.Text:='<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
end;
|
||
|
||
function TfrmYpBaoJiaInput.SaveData():Boolean;
|
||
var
|
||
maxno,maxSubNo:String;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'BJ','BaoJiaMain',2,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
BjNo.Text:=maxno;
|
||
end
|
||
else
|
||
begin
|
||
maxno:=Trim(FMainId);
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from BaoJiaMain where BjMainID='''+Trim(maxno)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if ADOCmd.IsEmpty then Append else edit;
|
||
FieldByName('ZzType').Value:='<27><>֯';
|
||
FieldByName('BjMainID').Value:=Trim(maxno);
|
||
SSetsaveSql(ADOCmd,'Contract_Main',ScrollBox1,0);
|
||
SSetsaveSql(ADOCmd,'Contract_Main',ScrollBox2,0);
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
FieldByName('FillTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
Post;
|
||
end;
|
||
FMainId:=Trim(maxno);
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('BjSubID').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxSubNo,'BJS','BaoJiaSub',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxSubNo:=Trim(Order_Sub.fieldbyname('BjSubID').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from BaoJiaSub where BjMainId='''+Trim(FMainId)+'''');
|
||
sql.Add(' and BjSubId='''+Trim(maxSubNo)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if ADOCmd.IsEmpty then
|
||
Append
|
||
else
|
||
edit;
|
||
// SSetSaveDataCDSNew(ADOCmd,Tv1,Order_Sub,'BaoJiaSub',1);
|
||
FieldByName('WLID').Value:=Order_Sub.FieldByName('WLID').Value;
|
||
FieldByName('WLName').Value:=Order_Sub.FieldByName('WLName').Value;
|
||
FieldByName('BiLi').Value:=Order_Sub.FieldByName('BiLi').Value;
|
||
FieldByName('WlMoney').Value:=Order_Sub.FieldByName('WlMoney').Value;
|
||
FieldByName('Mmkz').Value:=Order_Sub.FieldByName('Mmkz').Value;
|
||
FieldByName('WlPrice').Value:=Order_Sub.FieldByName('WlPrice').Value;
|
||
FieldByName('YlShb').Value:=Order_Sub.FieldByName('YlShb').Value;
|
||
FieldByName('YLQty').Value:=Order_Sub.FieldByName('YLQty').Value;
|
||
FieldByName('BjMainId').Value:=Trim(maxno);
|
||
FieldByName('BjSubId').Value:=Trim(maxSubNo);
|
||
Post;
|
||
end;
|
||
Order_Sub.Edit;
|
||
Order_Sub.FieldByName('BjSubId').Value:=Trim(maxSubNo);
|
||
Next;
|
||
end;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.TBSaveClick(Sender: TObject);
|
||
begin
|
||
lrd.SetFocus;
|
||
// if Trim(CustomerName.Text)='' then
|
||
// begin
|
||
// Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
// Exit;
|
||
// end;
|
||
//
|
||
// if TV1.DataController.Summary.FooterSummaryValues[1]<>100 then
|
||
// begin
|
||
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ϼƱ<CFBC><C6B1><EFBFBD>Ϊ100<30><30>','<27><>ʾ',0);
|
||
// Exit;
|
||
// end;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.FormCreate(Sender: TObject);
|
||
begin
|
||
SetWindowLong(Qty.Handle, GWL_STYLE, GetWindowLong(Qty.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
SetWindowLong(ZzCost.Handle, GWL_STYLE, GetWindowLong(ZzCost.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
SetWindowLong(DjBzCost.Handle, GWL_STYLE, GetWindowLong(DjBzCost.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
SetWindowLong(YfCost.Handle, GWL_STYLE, GetWindowLong(YfCost.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
SetWindowLong(CbPrice.Handle, GWL_STYLE, GetWindowLong(CbPrice.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
SetWindowLong(Price.Handle, GWL_STYLE, GetWindowLong(Price.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
SetWindowLong(Lr.Handle, GWL_STYLE, GetWindowLong(Lr.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
SetWindowLong(Lrd.Handle, GWL_STYLE, GetWindowLong(Lrd.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
|
||
|
||
Bjtime.DateTime:=SGetServerDate(ADOTemp);
|
||
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.cxButtonEdit3PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:=TcxButtonEdit(Sender).Name;
|
||
flagname:=TcxButtonEdit(Sender).Hint;
|
||
V1Name.Caption:='<27><>ϵ<EFBFBD><CFB5>';
|
||
fnote:=True;
|
||
V1Note.Caption:='<27><>ϵ<EFBFBD>绰';
|
||
if ShowModal=1 then
|
||
begin
|
||
BJer.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
BJPhone.Text:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.cxButtonEdit1PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCPManageFMSel:=TfrmCPManageFMSel.Create(Application);
|
||
with frmCPManageFMSel do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
BjCode.Text:=Trim(CDS_Main.fieldbyname('CYNo').AsString);
|
||
BjName.Text:=Trim(CDS_Main.fieldbyname('CYName').AsString);
|
||
BjMF.Text:=Trim(CDS_Main.fieldbyname('CYMF').AsString);
|
||
BjKZ.Text:=Trim(CDS_Main.fieldbyname('CYKZ').AsString);
|
||
ZhenXing.Text:=Trim(CDS_Main.fieldbyname('ZhenXing').AsString);
|
||
Qty.Text:=Trim(CDS_Main.fieldbyname('CYCL').AsString);
|
||
InitWlPb();
|
||
CBHJ();
|
||
end;
|
||
end;
|
||
finally
|
||
frmCPManageFMSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.ZzCostKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if not (((key>='0') and (key<='9')) or (key='.') or (key=#8)) then
|
||
begin
|
||
key:=#0;
|
||
end
|
||
else if (pos('.', TEdit(Sender).text)<>0) then
|
||
begin
|
||
if key='.' then
|
||
begin
|
||
key:=#0;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.HclCostExit(Sender: TObject);
|
||
begin
|
||
CBHJ();
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.v1Column1PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mavlue,FFieldName:string;
|
||
MBiLi,MYlShb,MWlPrice:Double;
|
||
begin
|
||
mavlue:=TcxTextEdit(Sender).EditingText;
|
||
FFieldName:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
if mavlue='' then mavlue:='0';
|
||
with Order_Sub do
|
||
begin
|
||
edit;
|
||
FieldByName(FFieldName).Value:=mavlue;
|
||
post;
|
||
MBiLi:=FieldByName('BiLi').AsFloat;
|
||
MWlPrice:=FieldByName('WlPrice').AsFloat;
|
||
MYlShb:=FieldByName('YlShb').AsFloat;
|
||
end;
|
||
|
||
with Order_Sub do
|
||
begin
|
||
edit;
|
||
FieldByName('WlMoney').Value:=RoundFloat(MWlPrice*(MYlShb+100)*MBiLi/10000,2);
|
||
post;
|
||
end;
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
CBHJ();
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.CustomerNamePropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
// try
|
||
// frmZdyAttachment:=TfrmZdyAttachment.Create(Application);
|
||
// with frmZdyAttachment do
|
||
// begin
|
||
// if ShowModal=1 then
|
||
// begin
|
||
// CustomerName.Text:=Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
// CustomerLevel.Text:=Trim(CDS_HZ.fieldbyname('DEFStr6').AsString);
|
||
// if Trim(CustomerLevel.Text)='A' then
|
||
// begin
|
||
// ZzCost.Text:='1.5';
|
||
// CBHJ();
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmZdyAttachment.Free;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.BjZKSExit(Sender: TObject);
|
||
begin
|
||
upWlPb();
|
||
CBHJ();
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.ScrollBox2Click(Sender: TObject);
|
||
begin
|
||
lrd.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmYpBaoJiaInput.ScrollBox1Click(Sender: TObject);
|
||
begin
|
||
lrd.SetFocus;
|
||
end;
|
||
|
||
end.
|