unit U_ContractBCInPut; 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, cxCalendar, cxGridCustomPopupMenu, cxGridPopupMenu; type TfrmClothContractInPutSXMX = class(TForm) ToolBar1: TToolBar; TBSave: TToolButton; TBClose: TToolButton; ScrollBox1: TScrollBox; Label1: TLabel; ConNo: TEdit; Label5: TLabel; ToolBar2: TToolBar; ToolButton1: TToolButton; ToolButton2: TToolButton; cxGrid1: TcxGrid; Tv1: TcxGridDBTableView; v1PRTSpec: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; v1Price: TcxGridDBColumn; v1ClothUnit: TcxGridDBColumn; ADOTemp: TADOQuery; ADOCmd: TADOQuery; DataSource1: TDataSource; Order_Sub: TClientDataSet; DataSource2: TDataSource; ADOZDY: TADOQuery; CDS_ZDY: TClientDataSet; ADOQuery1: TADOQuery; v1Column1: TcxGridDBColumn; Label2: TLabel; QDTime: TDateTimePicker; Label3: TLabel; Label11: TLabel; Label12: TLabel; v1Column2: TcxGridDBColumn; Label6: TLabel; Label7: TLabel; BaoZuangNote: TRichEdit; Label8: TLabel; Label9: TLabel; YunShuType: TRichEdit; FactoryNoName: TBtnEditA; CompanyName: TBtnEditA; FeeNote: TBtnEditA; PRTZhiLiang: TBtnEditA; JiaoHuoNote: TBtnEditA; YanShouNote: TBtnEditA; v1Column3: TcxGridDBColumn; v1Column6: TcxGridDBColumn; v1Column9: TcxGridDBColumn; v1Column13: TcxGridDBColumn; v1Column14: TcxGridDBColumn; Label4: TLabel; SunHaoNote: TBtnEditA; ConFenShu: TEdit; ConFuBen: TEdit; Label10: TLabel; Label13: TLabel; Label14: TLabel; DayBegFK: TEdit; Label15: TLabel; Label16: TLabel; Note: TEdit; cxGridPopupMenu1: TcxGridPopupMenu; procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure TBSaveClick(Sender: TObject); procedure v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1PRTUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1PRTColorPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure ToolButton1Click(Sender: TObject); procedure ToolButton2Click(Sender: TObject); procedure FactoryNoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1PRTMFPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1OrderQtyPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1ClothQtyPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure FactoryNoNamePropertiesChange(Sender: TObject); procedure CompanyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure ConNoKeyPress(Sender: TObject; var Key: Char); procedure v1Column3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure PRTZhiLiangPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure CompanyNameBtnClick(Sender: TObject); procedure FactoryNoNameBtnClick(Sender: TObject); procedure FeeNoteBtnClick(Sender: TObject); procedure PRTZhiLiangBtnClick(Sender: TObject); procedure JiaoHuoNoteBtnClick(Sender: TObject); procedure YanShouNoteBtnClick(Sender: TObject); procedure Label7DblClick(Sender: TObject); procedure Label9DblClick(Sender: TObject); procedure SunHaoNoteBtnClick(Sender: TObject); procedure v1PRTSpecPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1ClothUnitPropertiesEditValueChanged(Sender: TObject); private FXS:Integer; procedure InitData(); procedure ZDYHelp(FButn:TcxButtonEdit;LType:string); function SaveData():Boolean; procedure GetMaxConNO(); { Private declarations } public PState,PCopyInt:Integer; FMainId,FConNo,FConType:String; { Public declarations } end; var frmClothContractInPutSXMX: TfrmClothContractInPutSXMX; implementation uses U_DataLink,U_ZDYHelp,U_RTFun,U_GYSList,U_ZDYHelpSel; {$R *.dfm} procedure TfrmClothContractInPutSXMX.TBCloseClick(Sender: TObject); begin Close; WriteCxGrid('内销合同录入',Tv1,'内销合同管理'); end; procedure TfrmClothContractInPutSXMX.InitData(); begin with ADOQuery1 do begin Close; SQL.Clear; sql.Add(' select * from Contract_Main A inner join Contract_Sub B on A.MainId=B.MainId'); sql.Add(' where A.MainId='''+Trim(FMainId)+''''); Open; end; SCreateCDS20(ADOQuery1,Order_Sub); SInitCDSData20(ADOQuery1,Order_Sub); if PCopyInt=1 then begin FMainId:=''; with Order_Sub do begin First; while not Eof do begin Edit; FieldByName('SubId').Value:=''; Post; Next; end; end; end; SCSHDataNew(ADOQuery1,ScrollBox1,0); FactoryNoName.TxtCode:=Trim(ADOQuery1.FieldByName('FactoryNo').AsString); if PState=0 then begin QDTime.DateTime:=SGetServerDate(ADOTemp); QDTime.Checked:=True; end; end; procedure TfrmClothContractInPutSXMX.ZDYHelp(FButn:TcxButtonEdit;LType:string); begin end; procedure TfrmClothContractInPutSXMX.FormShow(Sender: TObject); begin ReadCxGrid('内销合同录入',Tv1,'内销合同管理'); InitData(); if PCopyInt=1 then begin FMainId:=''; FConNo:=''; ConNo.Text:=''; with Order_Sub do begin First; while not Eof do begin Edit; FieldByName('SubId').Value:=''; Post; Next; end; end; end; end; procedure TfrmClothContractInPutSXMX.GetMaxConNO(); begin end; function TfrmClothContractInPutSXMX.SaveData():Boolean; var maxno,maxSubNo:String; begin try Result:=False; ADOCmd.Connection.BeginTrans; //保存主表 if Trim(FMainId)='' then begin if GetLSNo(ADOCmd,maxno,'CM','Contract_Main',3,1)=False then begin ADOCmd.Connection.RollbackTrans; Application.MessageBox('取合同流水号失败!','提示',0); Exit; end; end else begin maxno:=Trim(FMainId); end; with ADOCmd do begin Close; sql.Clear; SQL.Add('select * from Contract_Main where MainId='''+Trim(FMainId)+''''); Open; end; with ADOCmd do begin if Trim(FMainId)='' then begin Append; end else begin Edit; end; FieldByName('MainId').Value:=Trim(maxno); RTSetsavedata(ADOCmd,'Contract_Main',ScrollBox1,0); FieldByName('FactoryNo').Value:=Trim(FactoryNoName.TxtCode); if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then begin FieldByName('Filler').Value:=Trim(DName); end else begin FieldByName('Editer').Value:=Trim(DName); FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp); end; Post; end; with ADOTemp do begin Close; sql.Clear; sql.Add('select * from Contract_Main where ConNo='''+Trim(ConNo.Text)+''''); Open; end; if ADOTemp.RecordCount>1 then begin ADOCmd.Connection.RollbackTrans; Application.MessageBox('合同编号重复!','提示',0); Exit; end; ///保存子表 with Order_Sub do begin First; while not Eof do begin if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then begin if GetLSNo(ADOCmd,maxSubNo,'CS','Contract_Sub',2,1)=False then begin ADOCmd.Connection.RollbackTrans; Application.MessageBox('生成合同明细表流水号异常!','提示',0); exit; end; end else begin maxSubNo:=Trim(Order_Sub.fieldbyname('SubId').AsString); end; with ADOCmd do begin Close; SQL.Clear; sql.Add('select * from Contract_Sub where '); sql.Add(' SubId='''+Trim(maxSubNo)+''''); Open; end; with ADOCmd do begin if Trim(Order_Sub.fieldbyname('SubId').AsString)='' then Append else Edit; FieldByName('MainId').Value:=Trim(maxno); FieldByName('SubId').Value:=Trim(maxSubNo); RTSetSaveDataCDS(ADOCmd,Tv1,Order_Sub,'Contract_Sub',0); Post; end; Order_Sub.Edit; Order_Sub.FieldByName('SubId').Value:=Trim(maxSubNo); Next; end; end; if Trim(ConNo.Text)='' then begin with ADOCmd do begin Close; sql.Clear; sql.Add(' exec P_Update_NXConNo :MainId'); Parameters.ParamByName('MainId').Value:=Trim(maxno); ExecSQL; end; end; ADOCmd.Connection.CommitTrans; FMainId:=Trim(maxno); Result:=True; except Result:=False; ADOCmd.Connection.RollbackTrans; Application.MessageBox('保存失败!','提示',0); end; end; procedure TfrmClothContractInPutSXMX.TBSaveClick(Sender: TObject); begin ToolBar1.SetFocus; {if Trim(ConNo.Text)='' then begin Application.MessageBox('合同编号不能为空!','提示',0); Exit; end; } if Trim(FactoryNoName.Text)='' then begin Application.MessageBox('供应商不能为空!','提示',0); Exit; end; if Order_Sub.IsEmpty then begin Application.MessageBox('明细不能为空!','提示',0); exit; end; if Order_Sub.Locate('C_Qty',null,[]) then begin Application.MessageBox('数量不能为空!','提示',0); Exit; end; if Order_Sub.Locate('C_Unit',null,[]) then begin Application.MessageBox('数量单位不能为空!','提示',0); Exit; end; if Order_Sub.Locate('JYConNo',null,[]) then begin Application.MessageBox('外销合同号不能为空!','提示',0); Exit; end; if Order_Sub.Locate('JYStyleNo',null,[]) then begin Application.MessageBox('款号不能为空!','提示',0); Exit; end; if Order_Sub.Locate('C_Spec',null,[]) then begin Application.MessageBox('规格型号不能为空!','提示',0); Exit; end; if Order_Sub.RecordCount>6 then begin Application.MessageBox('明细数据不能多于六条!','提示',0); Exit; end; Order_Sub.DisableControls; with Order_Sub do begin First; while not Eof do begin with ADOTemp do begin Close; sql.Clear; sql.Add('select * from JYOrderCon_Main where ConNo='''+Trim(Order_Sub.fieldbyname('JYConNo').AsString)+''''); Open; end; if ADOTemp.IsEmpty then begin Order_Sub.EnableControls; Application.MessageBox(PChar('外销合同号<'+Trim(Order_Sub.fieldbyname('JYConNo').AsString)+'>不存在!'),'提示',0); Exit; end; with ADOTemp do begin Close; sql.Clear; sql.Add('select * from JYOrderCon_Sub A'); sql.Add(' where A.StyleNo='''+Trim(Order_Sub.fieldbyname('JYStyleNo').AsString)+''''); Open; end; if ADOTemp.IsEmpty then begin Order_Sub.EnableControls; Application.MessageBox(PChar('款号<'+Trim(Order_Sub.fieldbyname('JYStyleNo').AsString)+'>不存在!'),'提示',0); Exit; end; with ADOTemp do begin Close; sql.Clear; sql.Add('select * from JYOrderCon_Sub A'); sql.Add(' inner join JYorderCon_Main B on A.Mainid=B.Mainid'); sql.Add(' where A.StyleNo='''+Trim(Order_Sub.fieldbyname('JYStyleNo').AsString)+''''); sql.Add(' and B.ConNo='''+Trim(Order_Sub.fieldbyname('JYConNo').AsString)+''''); Open; end; if ADOTemp.IsEmpty then begin Order_Sub.EnableControls; Application.MessageBox(PChar('外销合同<'+Trim(Order_Sub.fieldbyname('JYConNo').AsString)+ '>中不存在款号<'+Trim(Order_Sub.fieldbyname('JYStyleNo').AsString)+'>!'),'提示',0); Exit; end; Next; end; end; Order_Sub.EnableControls; if SaveData() then begin Application.MessageBox('保存成功!','提示',0); ModalResult:=1; end; end; procedure TfrmClothContractInPutSXMX.v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='OrdUnit'; flagname:='单位'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('OrderUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1PRTUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='OrdUnit'; flagname:='单位'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('PRTUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1PRTColorPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='OrdColor'; flagname:='颜色'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('PRTColor').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.ToolButton1Click(Sender: TObject); begin CopyAddRow(Tv1,Order_Sub); with Order_Sub do begin Edit; FieldByName('SubId').Value:=''; Post; end; end; procedure TfrmClothContractInPutSXMX.ToolButton2Click(Sender: TObject); begin if Order_Sub.IsEmpty then Exit; if Trim(Order_Sub.fieldbyname('SubId').AsString)<>'' then begin with ADOTemp do begin Close; sql.Clear; sql.Add('select * from JYOrder_Main_MD where COnSubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+''''); Open; end; if ADOTemp.IsEmpty=false then begin Application.MessageBox('已经录入码单不能删除数据!','提示',0); Exit; end; if Application.MessageBox('确定要删除数据吗?','提示',32+4)<>IDYES then Exit; with ADOCmd do begin Close; sql.Clear; sql.Add('delete Contract_Sub where SubId='''+Trim(Order_Sub.fieldbyname('SubId').AsString)+''''); ExecSQL; end; end; Order_Sub.Delete; end; procedure TfrmClothContractInPutSXMX.FactoryNoNamePropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin if Trim(FMainId)<>'' then begin with ADOTemp do begin Close; sql.Clear; sql.Add('select * from YF_Money_CR A where exists('); sql.Add('select * from ContractSX_Sub_MX B inner join Contract_Sub C on B.SubId=C.SubId '); sql.Add(' where C.Mainid='''+Trim(FMainId)+''''); sql.Add(' and B.MXID=A.YFTypeId)'); Open; end; if ADOTemp.IsEmpty=False then begin Application.MessageBox('已经产生应付款不能修改供应商!','提示',0); Exit; end; end; try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='Factory'; flagname:='供方'; MainType:='YCLFactory'; if ShowModal=1 then begin FXS:=99; FactoryNoName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); FactoryNoName.Hint:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1Column1PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='ClothHT'; flagname:='产品名称'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('C_CodeName').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1PRTMFPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='KZ'; flagname:='克重单位'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('KZUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1OrderQtyPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='MF'; flagname:='门幅单位'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('MFUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1ClothQtyPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='PriceUnit'; flagname:='计价单位'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('PriceUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1Column2PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='OrderUnit'; flagname:='单位'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('C_Unit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.FactoryNoNamePropertiesChange( Sender: TObject); begin {if FXS=99 then begin PanZDY.Visible:=False; FXS:=0; Exit; end; ZDYHelp(FactoryNoName,'FactoryNo1Name'); } end; procedure TfrmClothContractInPutSXMX.CompanyNamePropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='OrdDefStr2'; flagname:='需方'; if ShowModal=1 then begin FXS:=99; CompanyName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.ConNoKeyPress(Sender: TObject; var Key: Char); begin {if Key=#13 then begin if Trim(ConNo.Text)<>'' then begin with ADOTemp do begin Close; sql.Clear; sql.Add('select Top 1* from JYOrder_Main where OrderNo='''+Trim(ConNo.Text)+''''); Open; end; FactoryNoName.Text:=Trim(ADOTemp.fieldbyname('YCLFactory').AsString); end; end; } end; procedure TfrmClothContractInPutSXMX.v1Column3PropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin if Trim(FMainId)<>'' then begin with ADOTemp do begin Close; sql.Clear; sql.Add('select * from YF_Money_CR A where exists('); sql.Add('select * from ContractSX_Sub_MX B inner join Contract_Sub C on B.SubId=C.SubId '); sql.Add(' where C.Mainid='''+Trim(FMainId)+''''); sql.Add(' and B.MXID=A.YFTypeId)'); Open; end; if ADOTemp.IsEmpty=False then begin Application.MessageBox('已经产生应付款不能修改供应商!','提示',0); Exit; end; end; try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='Factory'; flagname:='供方'; MainType:='YCLFactory'; if ShowModal=1 then begin with Order_Sub do begin Edit; FieldByName('FactoryNoName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.PRTZhiLiangPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='PRTZhiLiang'; flagname:='质量标准'; if ShowModal=1 then begin PRTZhiLiang.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.CompanyNameBtnClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='GSTT'; flagname:='需方'; V1ZdyStr1.Visible:=True; V1ZdyStr2.Visible:=True; V1ZdyStr3.Visible:=True; V1ZdyStr4.Visible:=True; V1ZdyStr1.Caption:='简称'; V1ZdyStr2.Caption:='电话'; V1ZdyStr3.Caption:='传真'; V1ZdyStr4.Caption:='地址'; frmZDYHelp.Align:=alClient; if ShowModal=1 then begin CompanyName.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.FactoryNoNameBtnClick( Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='GYS'; flagname:='供方'; V1ZdyStr1.Visible:=True; V1ZdyStr2.Visible:=True; V1ZdyStr3.Visible:=True; V1ZdyStr4.Visible:=True; V1ZdyStr1.Caption:='简称'; V1ZdyStr2.Caption:='电话'; V1ZdyStr3.Caption:='传真'; V1ZdyStr4.Caption:='地址'; frmZDYHelp.Align:=alClient; if ShowModal=1 then begin FactoryNoName.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.FeeNoteBtnClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='FeeNote'; flagname:='费用负担'; if ShowModal=1 then begin FeeNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.PRTZhiLiangBtnClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='PRTZhiLiang'; flagname:='质量标准'; if ShowModal=1 then begin PRTZhiLiang.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.JiaoHuoNoteBtnClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='JiaoHuoNote'; flagname:='交货方法及地点'; if ShowModal=1 then begin JiaoHuoNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.YanShouNoteBtnClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='YanShouNote'; flagname:='验收方法'; if ShowModal=1 then begin YanShouNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.Label7DblClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='BaoZuangNote'; flagname:='包装、装潢及标记'; if ShowModal=1 then begin BaoZuangNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.Label9DblClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='YunShuType'; flagname:='运输方式'; if ShowModal=1 then begin YunShuType.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.SunHaoNoteBtnClick(Sender: TObject); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='SunHaoNote'; flagname:='损耗责任'; if ShowModal=1 then begin SunHaoNote.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1PRTSpecPropertiesButtonClick( Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp:=TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag:='C_Spec'; flagname:='型号、规格'; if ShowModal=1 then begin Self.Order_Sub.Edit; Self.Order_Sub.FieldByName('C_Spec').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmClothContractInPutSXMX.v1ClothUnitPropertiesEditValueChanged( Sender: TObject); var mvalue,FName,FPrice,FQty:string; begin FName:=Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName); mvalue:=TcxTextEdit(Sender).EditingText; if Trim(mvalue)='' then begin mvalue:='0'; end; with Order_Sub do begin Edit; FieldByName(FName).Value:=mvalue; Post; end; FPrice:=Trim(Order_Sub.fieldbyname('Price').AsString); FQty:=Trim(Order_Sub.fieldbyname('C_Qty').AsString); if Trim(FPrice)='' then begin FPrice:='0'; end; if Trim(FQty)='' then begin FQty:='0'; end; if Trim(FName)<>'Money' then begin with Order_Sub do begin Edit; FieldByName('Money').Value:=StrToFloat(FPrice)*StrToFloat(FQty); Post; end; end{ else begin with Order_Sub do begin Edit; FieldByName('Money').Value:=mvalue; Post; end; end}; end; end.