1052 lines
26 KiB
ObjectPascal
1052 lines
26 KiB
ObjectPascal
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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ¼<CDAC><C2BC>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ¼<CDAC><C2BC>',Tv1,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
||
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;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'CM','Contract_Main',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>ͬ<EFBFBD><CDAC>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',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('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD>
|
||
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('<27><><EFBFBD>ɺ<EFBFBD>ͬ<EFBFBD><CDAC>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',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('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPutSXMX.TBSaveClick(Sender: TObject);
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
{if Trim(ConNo.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><>ͬ<EFBFBD><CDAC><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
if Trim(FactoryNoName.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
if Order_Sub.Locate('C_Qty',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('C_Unit',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('JYConNo',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('JYStyleNo',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('C_Spec',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ͺŲ<CDBA><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.RecordCount>6 then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD>ݲ<EFBFBD><DDB2>ܶ<EFBFBD><DCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><'+Trim(Order_Sub.fieldbyname('JYConNo').AsString)+'><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'),'<27><>ʾ',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('<27><><EFBFBD><EFBFBD><'+Trim(Order_Sub.fieldbyname('JYStyleNo').AsString)+'><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!'),'<27><>ʾ',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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<'+Trim(Order_Sub.fieldbyname('JYConNo').AsString)+
|
||
'><3E>в<EFBFBD><D0B2><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><'+Trim(Order_Sub.fieldbyname('JYStyleNo').AsString)+'>!'),'<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
Order_Sub.EnableControls;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',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:='<27><>λ';
|
||
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:='<27><>λ';
|
||
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:='<27><>ɫ';
|
||
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('<27>Ѿ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><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;
|
||
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('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EEB2BB><EFBFBD>Ĺ<DEB8>Ӧ<EFBFBD><D3A6>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='Factory';
|
||
flagname:='<27><><EFBFBD><EFBFBD>';
|
||
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:='<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
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:='<27><><EFBFBD>ص<EFBFBD>λ';
|
||
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:='<27>ŷ<EFBFBD><C5B7><EFBFBD>λ';
|
||
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:='<27>Ƽ۵<C6BC>λ';
|
||
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:='<27><>λ';
|
||
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:='<27>跽';
|
||
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('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EEB2BB><EFBFBD>Ĺ<DEB8>Ӧ<EFBFBD><D3A6>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='Factory';
|
||
flagname:='<27><><EFBFBD><EFBFBD>';
|
||
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:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
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:='<27>跽';
|
||
V1ZdyStr1.Visible:=True;
|
||
V1ZdyStr2.Visible:=True;
|
||
V1ZdyStr3.Visible:=True;
|
||
V1ZdyStr4.Visible:=True;
|
||
V1ZdyStr1.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr2.Caption:='<27>绰';
|
||
V1ZdyStr3.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr4.Caption:='<27><>ַ';
|
||
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:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr1.Visible:=True;
|
||
V1ZdyStr2.Visible:=True;
|
||
V1ZdyStr3.Visible:=True;
|
||
V1ZdyStr4.Visible:=True;
|
||
V1ZdyStr1.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr2.Caption:='<27>绰';
|
||
V1ZdyStr3.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr4.Caption:='<27><>ַ';
|
||
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:='<27><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD>';
|
||
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:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
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:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>';
|
||
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:='<27><><EFBFBD>շ<EFBFBD><D5B7><EFBFBD>';
|
||
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:='<27><>װ<EFBFBD><D7B0>װ<EFBFBD>꼰<EFBFBD><EABCB0><EFBFBD><EFBFBD>';
|
||
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:='<27><><EFBFBD>䷽ʽ';
|
||
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:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
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:='<27>ͺš<CDBA><C5A1><EFBFBD><EFBFBD><EFBFBD>';
|
||
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.
|