1236 lines
35 KiB
ObjectPascal
1236 lines
35 KiB
ObjectPascal
unit U_ClothContractInPut_Tp;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, strUtils, SysUtils, cxTextEdit, 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, cxMaskEdit, cxButtonEdit,
|
||
StdCtrls, ToolWin, DBClient, ADODB, ExtCtrls, BtnEdit, cxDropDownEdit,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator;
|
||
|
||
type
|
||
TfrmClothContractInPut_Tp = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
Label1: TLabel;
|
||
ConNo: TEdit;
|
||
Label4: TLabel;
|
||
DeliveryDate: TDateTimePicker;
|
||
Label5: TLabel;
|
||
ToolBar2: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1PRTSpec: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
v1PRTKZ: TcxGridDBColumn;
|
||
v1ClothUnit: TcxGridDBColumn;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
DataSource2: TDataSource;
|
||
ADOZDY: TADOQuery;
|
||
CDS_ZDY: TClientDataSet;
|
||
FactoryNoName: TcxButtonEdit;
|
||
ADOQueryTmp: TADOQuery;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
PanZDY: TPanel;
|
||
CXGridZDY: TcxGrid;
|
||
TVZDY: TcxGridDBTableView;
|
||
VHelpZDYName: TcxGridDBColumn;
|
||
CXGridZDYLevel1: TcxGridLevel;
|
||
Button1: TButton;
|
||
v1Column4: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
QDTime: TDateTimePicker;
|
||
Label3: TLabel;
|
||
CompanyName: TcxButtonEdit;
|
||
Label6: TLabel;
|
||
QDPalce: TEdit;
|
||
v1Column5: TcxGridDBColumn;
|
||
Label7: TLabel;
|
||
Label8: TLabel;
|
||
Label9: TLabel;
|
||
LXPerson: TEdit;
|
||
LXTel: TEdit;
|
||
JHPlace: TcxButtonEdit;
|
||
Label10: TLabel;
|
||
fromConNo: TcxButtonEdit;
|
||
GxNote1: TEdit;
|
||
Label11: TLabel;
|
||
v1Qty2: TcxGridDBColumn;
|
||
v1C_Color: TcxGridDBColumn;
|
||
Panel1: TPanel;
|
||
Label22: TLabel;
|
||
Label23: TLabel;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TVZDYCellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure Button1Click(Sender: TObject);
|
||
procedure TVZDYKeyPress(Sender: TObject; var Key: Char);
|
||
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 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 JHPlacePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1Column1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure fromConNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure v1ClothUnitPropertiesEditValueChanged(Sender: TObject);
|
||
procedure fromConNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1Column6PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure v1C_ColorPropertiesEditValueChanged(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
private
|
||
FXS: Integer;
|
||
procedure InitData();
|
||
procedure ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
||
function SaveData(): Boolean;
|
||
function YFData(fMainID, FsubID: string): Boolean;
|
||
procedure DoQuery(fkeyNo: string);
|
||
procedure DoKc();
|
||
{ Private declarations }
|
||
public
|
||
PState: Integer;
|
||
FMainId, FConType: string;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmClothContractInPut_Tp: TfrmClothContractInPut_Tp;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ZDYHelp, U_Fun, U_ZdyAttachGYS, U_ClothContractList_help,
|
||
U_ZdyAttachCP;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmClothContractInPut_Tp.DoKc();
|
||
begin
|
||
Label22.Caption := 'ƥ<><C6A5><EFBFBD><EFBFBD>0';
|
||
Label23.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0';
|
||
if Order_Sub.IsEmpty then
|
||
exit;
|
||
if trim(Order_Sub.fieldbyname('C_CodeName').AsString) = '' then
|
||
exit;
|
||
// IF trim(Order_Sub.fieldbyname('C_Color').AsString)='' then exit;
|
||
if trim(FactoryNoName.Text) = '' then
|
||
exit;
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Get_Contract');
|
||
sql.Add('@begdate=''' + Trim(Order_Sub.fieldbyname('C_CodeName').AsString) + ''' ');
|
||
sql.Add(',@enddate=''' + trim(FactoryNoName.Text) + ''' ');
|
||
sql.Add(',@conType=''<27><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(',@status=''' + inttostr(1) + ''' ');
|
||
open;
|
||
end;
|
||
if not ADOTemp.IsEmpty then
|
||
begin
|
||
Label22.Caption := 'ƥ<><C6A5><EFBFBD><EFBFBD>' + trim(ADOTemp.fieldbyname('N_PS').AsString);
|
||
Label23.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + trim(ADOTemp.fieldbyname('N_Qty').AsString);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.DoQuery(fkeyNo: string);
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from Contract_Main ');
|
||
sql.Add('where conNo=' + quotedstr(trim(fkeyNo)));
|
||
open;
|
||
if not IsEmpty then
|
||
begin
|
||
FactoryNoName.Text := fieldbyname('FactoryNoName').AsString;
|
||
LXPerson.Text := fieldbyname('LXPerson').AsString;
|
||
LXPerson.Text := fieldbyname('LXPerson').AsString;
|
||
LXTel.Text := fieldbyname('LXPerson').AsString;
|
||
fromConNo.Hint := fieldbyname('mainID').AsString;
|
||
end
|
||
else
|
||
begin
|
||
application.MessageBox('<27>˲ɹ<CBB2><C9B9>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
end;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * ');
|
||
sql.Add('from Contract_Main A');
|
||
sql.Add('inner join Contract_sub B on B.MainID=A.mainID ');
|
||
sql.Add('where A.conNo=' + quotedstr(trim(fkeyNo)));
|
||
open;
|
||
if not IsEmpty then
|
||
begin
|
||
SCreateCDS20(ADOTemp, Order_Sub);
|
||
SInitCDSData20(ADOTemp, Order_Sub);
|
||
end
|
||
else
|
||
begin
|
||
end;
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
edit;
|
||
fieldbyname('fromMainID').Value := fieldbyname('MainID').AsString;
|
||
fieldbyname('fromsubID').Value := fieldbyname('subID').AsString;
|
||
fieldbyname('MainID').Value := '';
|
||
fieldbyname('subID').Value := '';
|
||
post;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
function TfrmClothContractInPut_Tp.YFData(fMainID, FsubID: string): Boolean;
|
||
var
|
||
CRID, OrdMainId, YFID, FComTaiTou, FCRID, FFactoryName: string;
|
||
begin
|
||
Result := False;
|
||
try
|
||
with ADOQueryTmp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where FactoryName=''' + Trim(FactoryNoName.Text) + '''');
|
||
Open;
|
||
end;
|
||
if not ADOQueryTmp.IsEmpty then
|
||
begin
|
||
CRID := ADOQueryTmp.fieldbyname('CRID').AsString;
|
||
end
|
||
else
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
||
sql.Add('select * from YF_Money_CRID ');
|
||
Open;
|
||
end;
|
||
CRID := ADOCmd.fieldbyname('CRID').AsString;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC ');
|
||
sql.add('where CRID=' + quotedstr(trim(CRID)));
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('CRID').Value := StrToInt(CRID);
|
||
FieldByName('FactoryName').Value := Trim(FactoryNoName.Text);
|
||
FieldByName('ZdyStr1').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
with ADOQueryTmp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR where mainID=''' + Trim(fMainID) + '''');
|
||
sql.Add('and subID=''' + Trim(FsubID) + '''');
|
||
sql.Add('and YFName=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
|
||
Open;
|
||
end;
|
||
if ADOQueryTmp.IsEmpty then
|
||
begin
|
||
if GetLSNo(ADOCmd, YFID, 'YF', 'YF_Money_CR', 3, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
YFID := Trim(ADOQueryTmp.fieldbyname('YFID').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR where YFID=''' + Trim(YFID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if ADOQueryTmp.IsEmpty then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('YFID').Value := Trim(YFID);
|
||
FieldByName('YFTypeId').Value := Trim(ConNo.Text);
|
||
FieldByName('CRID').Value := StrToInt(CRID);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('CRType').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
||
FieldByName('CRFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
FieldByName('QtyFlag').Value := 1;
|
||
FieldByName('FactoryName').Value := Trim(FactoryNoName.Text);
|
||
FieldByName('CRTime').Value := formatDateTime('yyyy-MM-dd', DeliveryDate.Date);
|
||
FieldByName('Qty').Value := Order_Sub.fieldbyname('C_Qty').Value;
|
||
FieldByName('PS').Value := Order_Sub.fieldbyname('Qty1').Value;
|
||
FieldByName('T_Qty').Value := Order_Sub.fieldbyname('T_Qty').Value;
|
||
FieldByName('YFType').Value := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('Price').Value := Order_Sub.fieldbyname('Price').asfloat;
|
||
FieldByName('HuiLv').Value := 1;
|
||
FieldByName('BZType').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('ComTaiTou').Value := Trim(FComTaiTou);
|
||
FieldByName('QtyUnit').Value := Trim(Order_Sub.fieldbyname('C_Unit').AsString);
|
||
FieldByName('YFName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('MainId').Value := Trim(fMainID);
|
||
FieldByName('subID').Value := Trim(FsubID);
|
||
Post;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_CR Set Money=Price*Qty,BBMoney=Price*Qty,T_money=Price*T_Qty ');
|
||
sql.Add(' where YFID=''' + Trim(YFID) + '''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' Update YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(' where CRID=' + CRID);
|
||
ExecSQL;
|
||
end;
|
||
Result := True;
|
||
except
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.InitData();
|
||
begin
|
||
with ADOQueryTmp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * ');
|
||
sql.Add('from Contract_Main A');
|
||
sql.Add('where A.mainID= ''' + Trim(fMainID) + ''' ');
|
||
Open;
|
||
if not ADOQueryTmp.IsEmpty then
|
||
begin
|
||
SCSHData(ADOQueryTmp, ScrollBox1, 0);
|
||
end;
|
||
end;
|
||
|
||
with ADOQueryTmp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select *,Gf=(select factoryNoName from Contract_Main X where X.mainID=A.frommainID), ');
|
||
sql.Add('fdhNO=(select conNo from Contract_Main X where X.mainID=A.frommainID) ');
|
||
sql.Add('from Contract_sub A');
|
||
sql.Add('where A.mainID= ''' + Trim(fMainID) + ''' ');
|
||
Open;
|
||
SCreateCDS20(ADOQueryTmp, Order_Sub);
|
||
SInitCDSData20(ADOQueryTmp, Order_Sub);
|
||
|
||
end;
|
||
|
||
if PState = 0 then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select Top 1* from Contract_Main order by FillTime desc ');
|
||
Open;
|
||
end;
|
||
QDTime.DateTime := SGetServerDate(ADOTemp);
|
||
DeliveryDate.DateTime := SGetServerDate(ADOTemp);
|
||
QDTime.Checked := True;
|
||
DeliveryDate.Checked := False;
|
||
ConNo.Text := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
PanZDY.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
||
var
|
||
FType, ZDYName, FText: string;
|
||
begin
|
||
PanZDY.Visible := True;
|
||
PanZDY.Left := FButn.Left;
|
||
PanZDY.Top := FButn.Top + FButn.Height;
|
||
with ADOZDY do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select RTrim(ZDYNo) ZDYNo,RTrim(ZDYName) ZDYName from KH_ZDY where Type=''' + Trim(LType) + '''');
|
||
Open;
|
||
end;
|
||
FText := Trim(FButn.Text);
|
||
if FText <> '' then
|
||
SDofilter(ADOZDY, ' ZDYName like ' + QuotedStr('%' + Trim(FText) + '%'))
|
||
else
|
||
SDofilter(ADOZDY, '');
|
||
VHelpZDYName.Summary.GroupFormat := Trim(FButn.Name);
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.TVZDYCellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
var
|
||
FName: string;
|
||
begin
|
||
if ADOZDY.IsEmpty then
|
||
Exit;
|
||
FName := Trim(VHelpZDYName.Summary.GroupFormat);
|
||
TcxButtonEdit(FindComponent(FName)).Text := Trim(ADOZDY.fieldbyname('ZDYName').AsString);
|
||
TcxButtonEdit(FindComponent(FName)).Hint := Trim(ADOZDY.fieldbyname('ZDYNO').AsString);
|
||
PanZDY.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.Button1Click(Sender: TObject);
|
||
begin
|
||
PanZDY.Visible := False;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.TVZDYKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if ADOZDY.IsEmpty then
|
||
Exit;
|
||
TcxButtonEdit(FindComponent(VHelpZDYName.Summary.GroupFormat)).Text := Trim(ADOZDY.fieldbyname('ZDYName').AsString);
|
||
TcxButtonEdit(FindComponent(VHelpZDYName.Summary.GroupFormat)).Hint := Trim(ADOZDY.fieldbyname('ZDYNO').AsString);
|
||
PanZDY.Visible := False;
|
||
ADOZDY.Active := False;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.FormShow(Sender: TObject);
|
||
begin
|
||
{ if Trim(DParameters1)='1' then
|
||
begin
|
||
v1Price.Visible:=False;
|
||
v1ClothQty.Visible:=False;
|
||
v1PRTQty.Visible:=False;
|
||
end else
|
||
begin
|
||
v1Price.Visible:=True;
|
||
v1ClothQty.Visible:=True;
|
||
v1PRTQty.Visible:=True;
|
||
end; }
|
||
readCXgrid(self.Caption, tv1);
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmClothContractInPut_Tp.SaveData(): Boolean;
|
||
var
|
||
maxno: string;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Contract_Main where MainId=''' + Trim(fMainID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if FConType = '<27><><EFBFBD><EFBFBD>ԤͶ<D4A4><CDB6>' then
|
||
begin
|
||
if Trim(fMainID) = '' then
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTemp, maxno, 'T', 'Contract_Main', 3, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
conNo.Text := trim(maxno);
|
||
if GetLSNo(ADOTemp, maxno, 'CM', 'Contract_Main', 3, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(fMainID);
|
||
Edit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(fMainID) = '' then
|
||
begin
|
||
Append;
|
||
if GetLSNo(ADOTemp, maxno, 'H', 'Contract_Main', 3, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
conNo.Text := trim(maxno);
|
||
if GetLSNo(ADOTemp, maxno, 'CM', 'Contract_Main', 3, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(fMainID);
|
||
Edit;
|
||
end;
|
||
end;
|
||
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
SSetsaveSql(ADOCmd, 'Contract_Main', ScrollBox1, 0);
|
||
FieldByName('LXPerson').Value := Trim(LXPerson.Text);
|
||
FieldByName('LXTel').Value := Trim(LXTel.Text);
|
||
if Trim(fMainID) = '' then
|
||
begin
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
||
end;
|
||
// FieldByName('ConType').Value := '<27><><EFBFBD><EFBFBD>ԤͶ<D4A4><CDB6>';
|
||
FieldByName('ConType').Value := FConType;
|
||
FieldByName('status').Value := '0';
|
||
FieldByName('fromconNo').Value := Trim(fromConNo.Text);
|
||
FieldByName('fromMainID').Value := Trim(fromConNo.Hint);
|
||
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('C_Unit').AsString) = 'Kg' then
|
||
begin
|
||
end;
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOTemp, maxno, 'CS', 'Contract_Sub', 3, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(Order_Sub.fieldbyname('SubId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Contract_Sub where MainId=''' + Trim(fMainID) + '''');
|
||
sql.Add(' and SubId=''' + Trim(maxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString) = '' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value := Trim(fMainID);
|
||
FieldByName('SubId').Value := Trim(maxno);
|
||
FieldByName('ConNo').Value := Trim(ConNo.Text);
|
||
RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'Contract_Sub', 0);
|
||
FieldByName('fromMainID').Value := Trim(Order_Sub.fieldbyname('fromMainID').AsString);
|
||
FieldByName('fromsubID').Value := Trim(Order_Sub.fieldbyname('fromsubID').AsString);
|
||
FieldByName('C_Status').Value := '0';
|
||
FieldByName('Qty2').Value := Order_Sub.fieldbyname('Qty2').AsFloat;
|
||
FieldByName('Qty1').Value := Order_Sub.fieldbyname('Qty1').AsFloat;
|
||
FieldByName('C_Qty').Value := Order_Sub.fieldbyname('C_Qty').AsFloat;
|
||
if Trim(Order_Sub.fieldbyname('C_Qty').AsString) = '' then
|
||
begin
|
||
FieldByName('C_Qty').Value := 0;
|
||
end;
|
||
|
||
if Trim(Order_Sub.fieldbyname('Price').AsString) = '' then
|
||
begin
|
||
FieldByName('Price').Value := 0;
|
||
end;
|
||
Post;
|
||
end;
|
||
Order_Sub.Edit;
|
||
Order_Sub.FieldByName('SubId').Value := Trim(maxno);
|
||
|
||
//Order_Sub.Post;
|
||
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 TfrmClothContractInPut_Tp.TBSaveClick(Sender: TObject);
|
||
begin
|
||
DeliveryDate.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><EFBFBD><EFBFBD><EFBFBD><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_CodeName', null, []) = True then
|
||
begin
|
||
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('C_CodeName', '', []) = True then
|
||
begin
|
||
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('C_Color', null, []) = True then
|
||
begin
|
||
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('C_Color', '', []) = True then
|
||
begin
|
||
Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<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('KZQty',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('MFQty',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Zdy_Attachment A where Type=''GYS''');
|
||
sql.Add('and zdyName=''' + trim(FactoryNoName.text) + ''' ');
|
||
open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
exit;
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
ConNo.Text := '';
|
||
FactoryNoName.Text := '';
|
||
CompanyName.Text := '';
|
||
LXPerson.Text := '';
|
||
LXTel.Text := '';
|
||
JHPlace.Text := '';
|
||
Order_Sub.EmptyDataSet;
|
||
PState := 0;
|
||
fMainID := '';
|
||
ConNo.Text := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
Exit;
|
||
if Trim(Order_Sub.fieldbyname('SubId').AsString) <> '' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from JYOrder_Sub_AnPai ');
|
||
sql.Add('where subID=''' + Trim(Order_Sub.fieldbyname('subID').AsString) + '''');
|
||
open;
|
||
end;
|
||
if not ADOCmd.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>ѻز֣<D8B2><D6A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>Ͷ<EFBFBD><CDB6><EFBFBD>ƻ<EFBFBD><C6BB><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 TfrmClothContractInPut_Tp.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 Contract_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
|
||
frmZdyAttachGYS := TfrmZdyAttachGYS.Create(Application);
|
||
with frmZdyAttachGYS do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
FactoryNoName.Text := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
FactoryNoName.Hint := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
LXTel.Text := Trim(CDS_HZ.fieldbyname('DEFstr2').AsString);
|
||
LXPerson.Text := Trim(CDS_HZ.fieldbyname('DEFstr4').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachGYS.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.v1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZdyAttachCP := TfrmZdyAttachCP.Create(Application);
|
||
with frmZdyAttachCP do
|
||
begin
|
||
FType := '<27><>Ʒ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.Order_Sub.Edit;
|
||
Self.Order_Sub.FieldByName('C_Code').Value := Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
Self.Order_Sub.FieldByName('C_CodeName').Value := Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
Self.Order_Sub.FieldByName('C_Color').Value := Trim(CDS_HZ.fieldbyname('DEFstr3').AsString);
|
||
// Self.Order_Sub.FieldByName('SOrddefstr4').Value:=Trim(ClientDataSet1.fieldbyname('Note').AsString);
|
||
Self.Order_Sub.Post;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachCP.Free;
|
||
end;
|
||
self.tv1.Controller.EditingController.ShowEdit();
|
||
DoKc();
|
||
{ try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='MPRTCodeName';
|
||
flagname:='<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
V1Name.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption:='Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
// MainType:=Trim(DName);
|
||
fnote:=FALSE;
|
||
// flag:='Cloth';
|
||
// 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)+'#';
|
||
Self.Order_Sub.FieldByName('C_Code').Value:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.FactoryNoNamePropertiesChange(Sender: TObject);
|
||
begin
|
||
{if FXS=99 then
|
||
begin
|
||
PanZDY.Visible:=False;
|
||
FXS:=0;
|
||
Exit;
|
||
end;
|
||
ZDYHelp(FactoryNoName,'FactoryNo1Name'); }
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.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 TfrmClothContractInPut_Tp.JHPlacePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
{try
|
||
frmZdyAttachGYS:=TfrmZdyAttachGYS.Create(Application);
|
||
with frmZdyAttachGYS do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
JHPlace.Text:=Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
// FactoryNoName.Text:=Trim(CDS_HZ.fieldbyname('ZDYName').AsString);
|
||
// FactoryNoName.Hint:=Trim(CDS_HZ.fieldbyname('ZdyCode').AsString);
|
||
// LXTel.Text:=Trim(CDS_HZ.fieldbyname('DEFstr2').AsString);
|
||
// LXPerson.Text:=Trim(CDS_HZ.fieldbyname('DEFstr4').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZdyAttachGYS.Free;
|
||
end;
|
||
}
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.v1Column1PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
if trim(mvalue) = '' then
|
||
exit;
|
||
|
||
if rightBstr(trim(mvalue), 1) <> '#' then
|
||
begin
|
||
mvalue := trim(mvalue) + '#';
|
||
end;
|
||
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('C_CodeName').Value := Trim(mvalue);
|
||
Post;
|
||
end;
|
||
self.tv1.Controller.EditingController.ShowEdit();
|
||
DoKc();
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.fromConNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
DoQuery(fromConNo.text);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.v1ClothUnitPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, fieldname: string;
|
||
begin
|
||
if Trim(TcxTextEdit(Sender).EditingText) <> '' then
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
end
|
||
else
|
||
begin
|
||
mvalue := '0';
|
||
end;
|
||
fieldname := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName(Trim(fieldname)).Value := mvalue;
|
||
Post;
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('money').Value := strtofloat(format('%.2f', [FieldByName('C_Qty').AsFloat * FieldByName('Price').AsFloat]));
|
||
Post;
|
||
end;
|
||
self.tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.fromConNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
{try
|
||
frmClothContractList_CG_help:=TfrmClothContractList_CG_help.Create(Application);
|
||
with frmClothContractList_CG_help do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
fromConNO.Text:=Trim(Order_Main.fieldbyname('ConNO').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothContractList_CG_help.Free;
|
||
end;
|
||
DoQuery(fromConNo.text);}
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.v1Column6PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, fieldname: string;
|
||
begin
|
||
if Trim(TcxTextEdit(Sender).EditingText) <> '' then
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
end
|
||
else
|
||
begin
|
||
mvalue := '0';
|
||
end;
|
||
fieldname := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName(Trim(fieldname)).Value := mvalue;
|
||
Post;
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('T_money').Value := strtofloat(format('%.2f', [FieldByName('T_Qty').AsFloat * FieldByName('Price').AsFloat]));
|
||
Post;
|
||
end;
|
||
self.tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Append;
|
||
fieldbyname('PriceUnit').Value := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fieldbyname('C_UNit').Value := 'M';
|
||
Post;
|
||
end;
|
||
{ frmClothContractList_Help:=TfrmClothContractList_Help.create(self);
|
||
with frmClothContractList_Help do
|
||
begin
|
||
if showmodal=1 then
|
||
begin
|
||
with Order_Main do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not eof do
|
||
begin
|
||
IF fieldbyname('ssel').AsBoolean then
|
||
begin
|
||
Order_Sub.Append;
|
||
Order_Sub.Fieldbyname('gf').Value:=trim(Fieldbyname('FactoryNoName').AsString);
|
||
Order_Sub.Fieldbyname('fdhNO').Value:=trim(Fieldbyname('conNo').AsString);
|
||
Order_Sub.Fieldbyname('fromMainID').Value:=trim(Fieldbyname('MainID').AsString);
|
||
Order_Sub.Fieldbyname('fromsubID').Value:=trim(Fieldbyname('subID').AsString);
|
||
Order_Sub.Fieldbyname('C_CodeName').Value:=trim(Fieldbyname('C_CodeName').AsString);
|
||
Order_Sub.Fieldbyname('C_spec').Value:=trim(Fieldbyname('C_spec').AsString);
|
||
// Order_Sub.Fieldbyname('KZQty').Value:=Fieldbyname('KZQty').AsFloat;
|
||
// Order_Sub.Fieldbyname('MFQty').Value:=Fieldbyname('MFQty').AsFloat;
|
||
// Order_Sub.Fieldbyname('Qty1').Value:=Fieldbyname('N_ps').AsFloat ;
|
||
// Order_Sub.Fieldbyname('C_Qty').Value:=Fieldbyname('N_Qty').AsFloat ;
|
||
Order_Sub.Fieldbyname('C_Unit').Value:=trim(Fieldbyname('C_Unit').AsString);
|
||
Order_Sub.Post;
|
||
end;
|
||
next;
|
||
end;
|
||
First;
|
||
EnableControls;
|
||
end;
|
||
end;
|
||
end; }
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.v1C_ColorPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
if trim(mvalue) = '' then
|
||
exit;
|
||
|
||
if rightBstr(trim(mvalue), 1) <> '#' then
|
||
begin
|
||
mvalue := trim(mvalue) + '#';
|
||
end;
|
||
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('C_Color').Value := Trim(mvalue);
|
||
Post;
|
||
end;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from KH_Zdy_Attachment A ');
|
||
sql.Add('where zdyName=' + quotedstr(trim(Order_Sub.fieldbyname('C_CodeName').AsString)));
|
||
sql.Add('and DEFstr3=' + quotedstr(trim(Order_Sub.fieldbyname('C_Color').AsString)));
|
||
open;
|
||
end;
|
||
if ADOTemp.IsEmpty then
|
||
begin
|
||
application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('C_Color').Value := '';
|
||
Post;
|
||
end;
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('C_Code').Value := trim(ADOTemp.fieldbyname('ZDYCode').AsString);
|
||
Post;
|
||
end;
|
||
|
||
self.tv1.Controller.EditingController.ShowEdit();
|
||
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.FormCreate(Sender: TObject);
|
||
begin
|
||
cxGrid1.Align := Alclient;
|
||
end;
|
||
|
||
procedure TfrmClothContractInPut_Tp.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
writeCXgrid(self.Caption, tv1);
|
||
end;
|
||
|
||
end.
|
||
|