1620 lines
43 KiB
ObjectPascal
1620 lines
43 KiB
ObjectPascal
unit U_TradeMarketInPut;
|
||
|
||
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, cxCalendar, StrUtils,
|
||
cxCurrencyEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxDropDownEdit,
|
||
RM_Common, RM_Preview, RM_System, RM_Class, RM_GridReport, RM_Dataset, Menus,
|
||
cxSplitter, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, cxCheckBox,
|
||
dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, cxPC,
|
||
System.ImageList, Vcl.ImgList, U_BaseInput, cxImage, cxDBEdit, IdBaseComponent,
|
||
IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase,
|
||
IdFTP, ShellAPI, dxSkinWXI, dxScrollbarAnnotations, dxCore, cxDateUtils;
|
||
|
||
type
|
||
TfrmTradeMarketInPut = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DS_1: TDataSource;
|
||
CDS_1: TClientDataSet;
|
||
GPM_1: TcxGridPopupMenu;
|
||
ADOQueryLabel: TADOQuery;
|
||
ADO_I1: TADOQuery;
|
||
DS_I1: TDataSource;
|
||
ToolButton3: TToolButton;
|
||
IdFTP1: TIdFTP;
|
||
ADO_I2: TADOQuery;
|
||
DS_I2: TDataSource;
|
||
ToolBar2: TToolBar;
|
||
ToolButton4: TToolButton;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
Panel2: TPanel;
|
||
Panel3: TPanel;
|
||
Panel1: TPanel;
|
||
Label22: TLabel;
|
||
Label23: TLabel;
|
||
Label29: TLabel;
|
||
Label34: TLabel;
|
||
Label35: TLabel;
|
||
ScrollBox1: TScrollBox;
|
||
Label3: TLabel;
|
||
Label25: TLabel;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label14: TLabel;
|
||
Label20: TLabel;
|
||
TMMNo: TcxTextEdit;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
VC_PRTPs: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
Tv1Column9: TcxGridDBColumn;
|
||
Label19: TLabel;
|
||
Label37: TLabel;
|
||
Label18: TLabel;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
Tv1Column13: TcxGridDBColumn;
|
||
Tv1Column14: TcxGridDBColumn;
|
||
Panel4: TPanel;
|
||
Panel5: TPanel;
|
||
Label33: TLabel;
|
||
Label38: TLabel;
|
||
QtyMX: TcxTextEdit;
|
||
GroupBox2: TGroupBox;
|
||
cxGrid2: TcxGrid;
|
||
TvMX: TcxGridDBTableView;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
DS_MX: TDataSource;
|
||
CDS_MX: TClientDataSet;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Tv1Column10: TcxGridDBColumn;
|
||
Tv1Column11: TcxGridDBColumn;
|
||
DLYDate: TcxDateEdit;
|
||
TMMDate: TcxDateEdit;
|
||
OurCoName: TcxButtonEdit;
|
||
CustName: TcxButtonEdit;
|
||
ShippingAddress: TcxButtonEdit;
|
||
CONTACT: TcxButtonEdit;
|
||
OrdType: TcxComboBox;
|
||
OrdNote: TcxMemo;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure CustomerNoNameBtnDnClick(Sender: TObject);
|
||
procedure v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure YCLFactoryBtnUpClick(Sender: TObject);
|
||
procedure ScrollBox1Click(Sender: TObject);
|
||
procedure v1Column5PropertiesEditValueChanged(Sender: TObject);
|
||
procedure HYTTBtnUpClick(Sender: TObject);
|
||
procedure KYTTBtnUpClick(Sender: TObject);
|
||
procedure edtGYBtnUpClick(Sender: TObject);
|
||
procedure v1OrderUnitPropertiesEditValueChanged(Sender: TObject);
|
||
procedure Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure cxDBImage1DblClick(Sender: TObject);
|
||
procedure SYRNameBtnUpClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure CustName1BtnUpClick(Sender: TObject);
|
||
procedure OurCoName1BtnUpClick(Sender: TObject);
|
||
procedure OurCoName1BtnDnClick(Sender: TObject);
|
||
procedure TechnicsBtnUpClick(Sender: TObject);
|
||
procedure TechnicsBtnDnClick(Sender: TObject);
|
||
procedure PackNoteDblClick(Sender: TObject);
|
||
procedure Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure QtyMXKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
procedure TvMXCellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure ShippingAddress1BtnUpClick(Sender: TObject);
|
||
procedure CONTACT1BtnUpClick(Sender: TObject);
|
||
procedure Tv1Column1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure OurCoNamePropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure OurCoNameDblClick(Sender: TObject);
|
||
procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure cxButtonEdit2PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure CONTACTPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure OrdNotePropertiesChange(Sender: TObject);
|
||
procedure OrdNoteDblClick(Sender: TObject);
|
||
private
|
||
FSCXDH: string;
|
||
procedure InitData();
|
||
procedure ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
||
function SaveData(): Boolean;
|
||
function getTMMNo(fconNo: string): string;
|
||
procedure InitImage1();
|
||
procedure InitImage2();
|
||
procedure InitPrice();
|
||
procedure LookImage(FileName: string);
|
||
procedure InitMXGrid(MTMSId: string);
|
||
{ Private declarations }
|
||
public
|
||
PState, CopyInt, PriceFlag: Integer;
|
||
FTMMID, FFTMMID, FTMMNo, MTMSId: string;
|
||
FXS: Integer;
|
||
canshu1: string;
|
||
fFlileFlag: string;
|
||
fordtype: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmTradeMarketInPut: TfrmTradeMarketInPut;
|
||
newh: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ZDYHelp, U_ZDYHelpSel, U_RTFun, U_CompanySel, U_PictureUpload,
|
||
U_ClothInfoSel;
|
||
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmTradeMarketInPut.InitImage1();
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.InitImage2();
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.InitPrice();
|
||
var
|
||
FCustName, FName, FPattern: string;
|
||
begin
|
||
inherited;
|
||
FCustName := CustName.Text;
|
||
FName := cds_1.FieldByName('C_Name').AsString;
|
||
FPattern := cds_1.FieldByName('C_Pattern').AsString;
|
||
if cds_1.FieldByName('Price').AsString = '' then
|
||
begin
|
||
if (FCustName = '') or (FName = '') or (FPattern = '') then
|
||
exit;
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select top 1 * from Trade_Market_Sub A ');
|
||
sql.Add(' inner join Trade_Market_Main B on A.TMMID=B.TMMID ');
|
||
sql.Add(' where B.CustName=''' + CustName.Text + ''' ');
|
||
sql.Add(' and A.C_Name=''' + FName + ''' ');
|
||
sql.Add(' and A.C_Pattern=''' + FPattern + ''' ');
|
||
sql.Add(' and isnull(Price,0)<>0 ');
|
||
sql.Add(' order by TMMDate desc ');
|
||
open;
|
||
end;
|
||
|
||
if ADOTemp.IsEmpty then
|
||
exit;
|
||
with CDS_1 do
|
||
begin
|
||
edit;
|
||
FieldByName('price').Value := adotemp.FieldByName('price').AsString;
|
||
post;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
function TfrmTradeMarketInPut.getTMMNo(fconNo: string): string;
|
||
var
|
||
str1: string;
|
||
i: integer;
|
||
begin
|
||
str1 := trim(fconNo) + '01';
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select TMMID from Trade_Plan_Main where TMMNo=' + quotedstr(trim(str1)));
|
||
open;
|
||
end;
|
||
if not ADOTemp.IsEmpty then
|
||
begin
|
||
for i := 1 to 99 do
|
||
begin
|
||
str1 := trim(fconNo) + rightstr(inttostr(100 + i), 2);
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select TMMID from Trade_Plan_Main where TMMNo=' + quotedstr(trim(str1)));
|
||
open;
|
||
end;
|
||
if ADOCmd.IsEmpty then
|
||
break;
|
||
end;
|
||
end;
|
||
result := str1;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.InitData();
|
||
var
|
||
FDate: TDate;
|
||
begin
|
||
FDate := SGetServerDate(ADOTemp);
|
||
TMMDate.Date := FDate;
|
||
DlyDate.Date := FDate;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Trade_Market_Main where TMMID=''' + Trim(FTMMID) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOTemp, ScrollBox1, 2);
|
||
SCSHData(ADOTemp, ScrollBox1, 5);
|
||
SCSHData(ADOTemp, ScrollBox1, 9);
|
||
SCSHData(ADOTemp, ScrollBox1, 7);
|
||
OurCoName.Properties.LookupItems.Text := Trim(ADOTemp.FieldByName('OurCoNo').AsString);
|
||
CustName.Properties.LookupItems.Text := Trim(ADOTemp.FieldByName('CustNo').AsString);
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from Trade_Market_Sub where 1=1 ');
|
||
if PState = 1 then
|
||
begin
|
||
sql.Add(' and TMMID=''' + Trim(FTMMID) + '''');
|
||
end;
|
||
if PState = 0 then
|
||
begin
|
||
sql.Add(' and 1<>1');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOTemp, CDS_1);
|
||
SInitCDSData(ADOTemp, CDS_1);
|
||
|
||
if PState = 0 then
|
||
begin
|
||
TMMDate.Date := SGetServerDateTime(ADOTemp);
|
||
DlyDate.Date := TMMDate.Date;
|
||
TMMNo.Text := '';
|
||
TMMNo.Enabled := True;
|
||
end
|
||
else
|
||
begin
|
||
end;
|
||
if CopyInt = 99 then
|
||
begin
|
||
PState := 0;
|
||
FTMMID := '';
|
||
TMMNo.Text := '';
|
||
TMMNo.Enabled := True;
|
||
|
||
TMMDate.Date := FDate;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('TMMID').Value := '';
|
||
FieldByName('TMSId').Value := '';
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
||
var
|
||
FType, ZDYName, FText: string;
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.FormShow(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
inherited;
|
||
readCxGrid(TRIM(SELF.Caption), Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
TMMNo.Text := '';
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
InitData();
|
||
ordtype.Properties.Items.Clear;
|
||
ordtype.Properties.Items.Add(fordtype);
|
||
ordtype.ItemIndex := 0;
|
||
InitImage1();
|
||
InitImage2();
|
||
end;
|
||
|
||
function TfrmTradeMarketInPut.SaveData(): Boolean;
|
||
var
|
||
maxno, Smaxno, maxTMMNo, MaxFNo: string;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FTMMID) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, maxno, 'JM', 'Trade_Market_Main', 3, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FTMMID);
|
||
end;
|
||
|
||
if TMMNo.Text = '' then
|
||
TMMNo.Text := maxno;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Trade_Market_Main where TMMID=''' + Trim(FTMMID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FTMMID) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('FillId').Value := Trim(DCode);
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('EditId').Value := Trim(DCode);
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
||
end;
|
||
RTSetsavedata(ADOCmd, 'Trade_Market_Main', ScrollBox1, 2);
|
||
FieldByName('TMMID').Value := Trim(maxno);
|
||
FieldByName('OurCoNo').Value := Trim(OurCoName.Properties.LookupItems.Text);
|
||
FieldByName('CustNo').Value := Trim(CustName.Properties.LookupItems.Text);
|
||
|
||
Post;
|
||
end;
|
||
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> ///////////////////////////
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('TMSId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, Smaxno, 'JS', 'Trade_Market_Sub', 4, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!');
|
||
end
|
||
else
|
||
begin
|
||
Smaxno := Trim(CDS_1.fieldbyname('TMSId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Trade_Market_Sub where TMMID=''' + Trim(maxno) + '''');
|
||
sql.Add(' and TMSId=''' + Trim(Smaxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('TMSId').AsString) = '' then
|
||
Append
|
||
else
|
||
Edit;
|
||
RTSetSaveDataCDS(ADOCmd, Tv1, CDS_1, 'Trade_Market_Sub', 0);
|
||
|
||
RTSetsavedata(ADOCmd, 'Trade_Market_Sub', ScrollBox1, 7);
|
||
FieldByName('TMMID').Value := Trim(maxno);
|
||
FieldByName('TMSId').Value := Trim(Smaxno);
|
||
// FieldByName('ConSId').Value := Trim(CDS_1.fieldbyname('ConSId').AsString);
|
||
// FieldByName('ConMId').Value := Trim(CDS_1.fieldbyname('ConMId').AsString);
|
||
Post;
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
fieldbyname('TMSId').Value := Trim(Smaxno);
|
||
Post;
|
||
end;
|
||
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> ///////////////////////////
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD> ///////////////////////////
|
||
// with ADOCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// SQL.Add('select * from Trade_Plan_Fty where TPFId=''' + Trim(FTMMID) + '''');
|
||
// Open;
|
||
// end;
|
||
// with ADOCmd do
|
||
// begin
|
||
// if ADOCmd.IsEmpty then
|
||
// begin
|
||
// Append;
|
||
// end
|
||
// else
|
||
// Edit;
|
||
// RTSetsavedata(ADOCmd, 'Trade_Plan_Fty', ScrollBox1, 5);
|
||
// FieldByName('TMMID').Value := Trim(FTMMID);
|
||
// FieldByName('TPFId').Value := Trim(FTMMID);
|
||
// Post;
|
||
// end;
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD> ///////////////////////////
|
||
///
|
||
/////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ///////////////
|
||
// with ADOCmd do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// SQL.Add('select * from Trade_Cloth_Inspect_Rule where RuleID=''' + Trim(FTMMID) + '''');
|
||
// Open;
|
||
// end;
|
||
// with ADOCmd do
|
||
// begin
|
||
// if ADOCmd.IsEmpty then
|
||
// begin
|
||
// Append;
|
||
// end
|
||
// else
|
||
// Edit;
|
||
// RTSetsavedata(ADOCmd, 'Trade_Cloth_Inspect_Rule', ScrollBox1, 9);
|
||
// FieldByName('RuleID').Value := Trim(FTMMID);
|
||
// Post;
|
||
// end;
|
||
/////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ///////////////
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Trade_Market_Main where TMMNo=''' + Trim(TMMNo.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOCmd.RecordCount > 1 then
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!');
|
||
|
||
FTMMID := Trim(maxno);
|
||
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
|
||
if pos('KEY Լ<><D4BC>', Exception(ExceptObject).Message) > 0 then
|
||
begin
|
||
if GetLSNo(ADOCmd, Smaxno, 'JS', 'Trade_Market_Sub', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TBSaveClick(Sender: TObject);
|
||
var
|
||
MAXNO1: string;
|
||
begin
|
||
if PState <> 1 then
|
||
begin
|
||
TMMDate.SetFocus;
|
||
end;
|
||
|
||
if CDS_1.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if CDS_1.Locate('TMSUnit', null, []) then
|
||
begin
|
||
Application.MessageBox('<27><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if CDS_1.Locate('TMSQty', null, []) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
// if CDS_1.Locate('C_Color', null, []) then
|
||
// begin
|
||
// Application.MessageBox('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
// Exit;
|
||
// end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
// ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ToolButton1Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
maxno: string;
|
||
begin
|
||
if Trim(TMMNo.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if CustName.Text = '' then
|
||
begin
|
||
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
i := cds_1.RecordCount;
|
||
i := i + 1;
|
||
CopyAddRow(Tv1, cds_1);
|
||
|
||
if GetLSNo(ADOTemp, maxno, 'JS', 'Trade_Market_Sub', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with cds_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('SerialNo').Value := IntToStr(i);
|
||
FieldByName('TMSId').Value := Trim(maxno);
|
||
FieldByName('TMSUnit').Value := 'M';
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
if CDS_1.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
exit;
|
||
CDS_1.DisableControls;
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('TMSId').AsString) <> '' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Trade_Market_Sub where TMSId=''' + Trim(CDS_1.fieldbyname('TMSId').AsString) + '''');
|
||
sql.Add('delete Trade_Market_Sub_Qty where TMSId=''' + Trim(CDS_1.fieldbyname('TMSId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Delete;
|
||
end;
|
||
end;
|
||
CDS_1.EnableControls;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(TRIM(SELF.Caption), Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ToolButton4Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
maxno: string;
|
||
begin
|
||
inherited;
|
||
|
||
if CustName.Text = '' then
|
||
begin
|
||
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
frmClothInfoSel := TfrmClothInfoSel.Create(Application);
|
||
with frmClothInfoSel do
|
||
begin
|
||
xzflag := 1;
|
||
// kcflag := 1;
|
||
if ShowModal = 1 then
|
||
begin
|
||
while CDS_1.locate('SSel', true, []) do
|
||
begin
|
||
|
||
if self.CDS_1.locate('C_Code', trim(CDS_1.Fieldbyname('C_Code').AsString), []) then
|
||
begin
|
||
CDS_1.Edit;
|
||
CDS_1.fieldbyname('SSel').value := false;
|
||
continue;
|
||
end;
|
||
|
||
i := cds_1.RecordCount;
|
||
i := i + 1;
|
||
|
||
if GetLSNo(ADOTemp, maxno, 'JS', 'Trade_Market_Sub', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
with self.CDS_1 do
|
||
begin
|
||
append;
|
||
FieldByName('SSel').Value := false;
|
||
FieldByName('SerialNo').Value := IntToStr(i);
|
||
FieldByName('TMSId').Value := Trim(maxno);
|
||
FieldByName('TMSUnit').Value := 'M';
|
||
Fieldbyname('C_Code').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Code').AsString);
|
||
Fieldbyname('C_Name').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Name').AsString);
|
||
Fieldbyname('C_Spec').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Spec').AsString);
|
||
Fieldbyname('C_Composition').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Composition').AsString);
|
||
Fieldbyname('C_Width').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Width').AsString);
|
||
Fieldbyname('C_GramWeight').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_GramWeight').AsString);
|
||
|
||
Fieldbyname('C_ColorNo').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_ColorNo').AsString);
|
||
Fieldbyname('C_Color').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Color').AsString);
|
||
Fieldbyname('C_Pattern').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Pattern').AsString);
|
||
|
||
// Fieldbyname('TMSQty').value := frmClothInfoSel.CDS_1.Fieldbyname('ConQty').AsFloat;
|
||
//
|
||
// Fieldbyname('DDQtyUnit').value := frmClothInfoSel.CDS_1.Fieldbyname('SCSUnit').AsString;
|
||
// Fieldbyname('OrderUnit').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('SCSUnit').AsString);
|
||
|
||
end;
|
||
CDS_1.Edit;
|
||
CDS_1.fieldbyname('SSel').value := false;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothInfoSel.Free;
|
||
InitPrice();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.edtGYBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
i: integer;
|
||
begin
|
||
// fsj := Trim(TBtnEditC(Sender).Hint);
|
||
// FWZ := Pos('/', fsj);
|
||
// i := 0;
|
||
// try
|
||
// frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
||
// with frmZDYHelpSel do
|
||
// begin
|
||
// flag := Copy(fsj, 1, FWZ - 1);
|
||
// flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
// TBtnEditC(Sender).text := '';
|
||
// with ClientDataSet1 do
|
||
// begin
|
||
// First;
|
||
// while not Eof do
|
||
// begin
|
||
// if FieldByName('SSel').AsBoolean = True then
|
||
// begin
|
||
// i := i + 1;
|
||
// if TBtnEditC(Sender).text = '' then
|
||
// TBtnEditC(Sender).text := FieldByName('ZDYName').AsString
|
||
// else
|
||
// TBtnEditC(Sender).text := TBtnEditC(Sender).text + ',' + FieldByName('ZDYName').AsString; //inttostr(i)+'.'+
|
||
// end;
|
||
// Next;
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmZDYHelpSel.Free;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TechnicsBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TechnicsBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.CONTACT1BtnUpClick(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'FHTel';
|
||
flagname := '<27><>ϵ<EFBFBD><CFB5>ʽ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).text := ClientDataSet1.FieldByName('ZDYName').AsString;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.CONTACTPropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
inherited;
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'FHTel';
|
||
flagname := '<27><>ϵ<EFBFBD><CFB5>ʽ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).text := ClientDataSet1.FieldByName('ZDYName').AsString;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.CustName1BtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27>ͻ<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.CustName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.CustName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
self.ShippingAddress.Text := frmCompanySel.CDS_1.FieldByName('CoAddress').AsString;
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select top 1 * from Trade_Market_Main where CustName=''' + CustName.Text + ''' ');
|
||
sql.Add(' and (isnull(ShippingAddress,'''')<>'''' or isnull(CONTACT,'''')<>'''' ) ');
|
||
sql.Add(' order by TMMDate desc ');
|
||
open;
|
||
end;
|
||
|
||
if ADOTemp.IsEmpty = False then
|
||
begin
|
||
ShippingAddress.Text := ADOTemp.FieldByName('ShippingAddress').AsString;
|
||
CONTACT.Text := ADOTemp.FieldByName('CONTACT').AsString;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.CustomerNoNameBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.cxButtonEdit1PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27>ͻ<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.CustName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.CustName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
self.ShippingAddress.Text := frmCompanySel.CDS_1.FieldByName('CoAddress').AsString;
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select top 1 * from Trade_Market_Main where CustName=''' + CustName.Text + ''' ');
|
||
sql.Add(' and (isnull(ShippingAddress,'''')<>'''' or isnull(CONTACT,'''')<>'''' ) ');
|
||
sql.Add(' order by TMMDate desc ');
|
||
open;
|
||
end;
|
||
|
||
if ADOTemp.IsEmpty = False then
|
||
begin
|
||
ShippingAddress.Text := ADOTemp.FieldByName('ShippingAddress').AsString;
|
||
CONTACT.Text := ADOTemp.FieldByName('CONTACT').AsString;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.cxButtonEdit2PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
inherited;
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'FHAdress';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).text := ClientDataSet1.FieldByName('ZDYName').AsString;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.cxDBImage1DblClick(Sender: TObject);
|
||
begin
|
||
if TcxDBImage(Sender).Picture.Height = 0 then
|
||
exit;
|
||
LookImage(ADO_I1.fieldbyname(TcxDBImage(Sender).Hint).asstring);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.LookImage(FileName: string);
|
||
var
|
||
sFieldName: string;
|
||
begin
|
||
|
||
sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\ͼƬ<CDBC>鿴';
|
||
|
||
if not DirectoryExists(pchar(sFieldName)) then
|
||
CreateDirectory(pchar(sFieldName), nil);
|
||
|
||
sFieldName := sFieldName + '\' + trim(FileName);
|
||
|
||
try
|
||
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
|
||
IdFTP1.Username := 'three';
|
||
IdFTP1.Password := '641010';
|
||
IdFTP1.Connect();
|
||
except
|
||
;
|
||
end;
|
||
|
||
if IdFTP1.Connected then
|
||
begin
|
||
try
|
||
IdFTP1.Get(fFlileFlag + '\' + Trim(FileName), sFieldName, true, false);
|
||
except
|
||
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
||
IdFTP1.Quit;
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
||
IdFTP1.Quit;
|
||
Exit;
|
||
end;
|
||
if IdFTP1.Connected then
|
||
IdFTP1.Quit;
|
||
ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
var
|
||
mvalues: string;
|
||
begin
|
||
mvalues := tv1.Columns[tv1.Controller.FocusedColumn.index].DataBinding.FieldName;
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'OrderUnit';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_1.Edit;
|
||
Self.CDS_1.FieldByName(mvalues).Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.v1OrderUnitPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName, YValue: string;
|
||
FDDQty, FCPCDXS, FQty, FDKCQty: Double;
|
||
begin
|
||
mvalue := TcxComboBox(Sender).EditingText; //<2F>仯<EFBFBD><E4BBAF><EFBFBD><EFBFBD>λ
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_1 do
|
||
begin
|
||
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
Post;
|
||
YValue := FieldByName('DDQtyUnit').AsString; //ԭ<><D4AD>λ=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
||
FDDQty := FieldByName('DDQty').AsFloat; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FCPCDXS := FieldByName('CPCDXS').AsFloat;
|
||
FDKCQty := FieldByName('DKCQty').AsFloat;
|
||
FQty := FieldByName('PRTOrderQty').AsFloat;
|
||
end;
|
||
if mvalue = 'Kg' then
|
||
begin
|
||
if YValue = 'Y' then
|
||
begin
|
||
FQty := FDDQty * 0.9144 / FCPCDXS;
|
||
end;
|
||
if YValue = 'M' then
|
||
begin
|
||
FQty := FDDQty / FCPCDXS;
|
||
end;
|
||
if YValue = 'Kg' then
|
||
begin
|
||
FQty := FDDQty;
|
||
end;
|
||
end;
|
||
|
||
if mvalue = 'M' then
|
||
begin
|
||
if YValue = 'Y' then
|
||
begin
|
||
FQty := FDDQty * 0.9144;
|
||
end;
|
||
if YValue = 'Kg' then
|
||
begin
|
||
FQty := FDDQty * FCPCDXS;
|
||
end;
|
||
if YValue = 'M' then
|
||
begin
|
||
FQty := FDDQty;
|
||
end;
|
||
end;
|
||
if mvalue = 'Y' then
|
||
begin
|
||
if YValue = 'M' then
|
||
begin
|
||
FQty := FDDQty / 0.9144;
|
||
end;
|
||
if YValue = 'Kg' then
|
||
begin
|
||
FQty := FDDQty * FCPCDXS / 0.9144;
|
||
end;
|
||
if YValue = 'Y' then
|
||
begin
|
||
FQty := FDDQty;
|
||
end;
|
||
end;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('PRTOrderQty').Value := FQty - FDKCQty;
|
||
Post;
|
||
end;
|
||
|
||
Tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'PriceUnit';
|
||
flagname := '<27>۸<EFBFBD><DBB8><EFBFBD>λ';
|
||
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
TBAdd.Visible := False;
|
||
TBEdit.Visible := False;
|
||
TBDel.Visible := False;
|
||
end;
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_1.Edit;
|
||
Self.CDS_1.FieldByName('PriceUnit').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.YCLFactoryBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ScrollBox1Click(Sender: TObject);
|
||
begin
|
||
TMMDate.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ShippingAddress1BtnUpClick(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'FHAdress';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).text := ClientDataSet1.FieldByName('ZDYName').AsString;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.OrdNoteDblClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
i: integer;
|
||
begin
|
||
fsj := Trim(TMemo(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
i := 0;
|
||
try
|
||
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TCXMemo(Sender).Lines.Clear;
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
i := i + 1;
|
||
TCXMemo(Sender).Lines.Add(FieldByName('ZDYName').AsString) //inttostr(i)+'.'+
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.OrdNotePropertiesChange(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
i: integer;
|
||
begin
|
||
fsj := Trim(TMemo(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
i := 0;
|
||
try
|
||
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TMemo(Sender).Lines.Clear;
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
i := i + 1;
|
||
TMemo(Sender).Lines.Add(FieldByName('ZDYName').AsString) //inttostr(i)+'.'+
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.OurCoName1BtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.OurCoName1BtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>˾';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.OurCoName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.OurCoName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.OurCoNameDblClick(Sender: TObject);
|
||
begin
|
||
TcxButtonEdit(Sender).Text := '';
|
||
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.OurCoNamePropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>˾';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.OurCoName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.OurCoName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.PackNoteDblClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
i: integer;
|
||
begin
|
||
fsj := Trim(TMemo(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
i := 0;
|
||
try
|
||
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TMemo(Sender).Lines.Clear;
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
i := i + 1;
|
||
TMemo(Sender).Lines.Add(FieldByName('ZDYName').AsString) //inttostr(i)+'.'+
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.QtyMXKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
MaxNo: string;
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
if Label38.Caption = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if StrTofloatDef(QtyMX.Text, 0) = 0 then
|
||
Exit;
|
||
if GetLSNo(ADOTemp, MaxNo, 'MX', 'Trade_Market_Sub_Qty', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('insert into Trade_Market_Sub_Qty (TMSQID,TMSId,Meter)');
|
||
sql.Add('values(' + quotedstr(Trim(MaxNo)));
|
||
sql.Add(',' + quotedstr(Trim(MTMSId)));
|
||
sql.Add(',' + QtyMX.Text);
|
||
sql.Add(')');
|
||
ExecSQL;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
|
||
with CDS_MX do
|
||
begin
|
||
Append;
|
||
FieldByName('TMSQID').Value := MaxNo;
|
||
FieldByName('TMSId').Value := MTMSId;
|
||
FieldByName('Meter').Value := QtyMX.Text;
|
||
post;
|
||
end;
|
||
except
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
QtyMX.Text := '';
|
||
TvMX.Controller.EditingController.ShowEdit();
|
||
end;
|
||
with cds_1 do
|
||
begin
|
||
edit;
|
||
if CDS_MX.IsEmpty then
|
||
begin
|
||
Fieldbyname('TMSPiece').Value := 0;
|
||
Fieldbyname('TMSQty').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Fieldbyname('TMSPiece').Value := TvMX.DataController.Summary.FooterSummaryValues[1];
|
||
Fieldbyname('TMSQty').Value := TvMX.DataController.Summary.FooterSummaryValues[0];
|
||
end;
|
||
|
||
post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.SYRNameBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
fnote := True;
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
inherited;
|
||
try
|
||
frmClothInfoSel := TfrmClothInfoSel.Create(Application);
|
||
with frmClothInfoSel do
|
||
begin
|
||
xzflag := 0;
|
||
// kcflag := 1;
|
||
if ShowModal = 1 then
|
||
begin
|
||
with Self.CDS_1 do
|
||
begin
|
||
edit;
|
||
Fieldbyname('C_Code').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Code').AsString);
|
||
Fieldbyname('C_Name').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Name').AsString);
|
||
Fieldbyname('C_Spec').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Spec').AsString);
|
||
Fieldbyname('C_Composition').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Composition').AsString);
|
||
Fieldbyname('C_Width').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Width').AsString);
|
||
Fieldbyname('C_GramWeight').AsString := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_GramWeight').AsString);
|
||
|
||
Fieldbyname('C_ColorNo').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_ColorNo').AsString);
|
||
Fieldbyname('C_Color').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Color').AsString);
|
||
Fieldbyname('C_Pattern').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Pattern').AsString);
|
||
post;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothInfoSel.Free;
|
||
|
||
InitPrice();
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.Tv1Column1PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with cds_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
Post;
|
||
end;
|
||
|
||
InitPrice();
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
|
||
try
|
||
frmPictureUpload := TfrmPictureUpload.create(self);
|
||
with frmPictureUpload do
|
||
begin
|
||
fFlileFlag := self.fFlileFlag;
|
||
FDataId := Trim(self.CDS_1.fieldbyname('AttName').AsString);
|
||
FPictureName := Trim(self.CDS_1.fieldbyname('AttName').AsString);
|
||
FWidth := 450;
|
||
FHeight := 600;
|
||
FTFType := 'HX';
|
||
if showmodal = 1 then
|
||
begin
|
||
with self.CDS_1 do
|
||
begin
|
||
Edit;
|
||
Fieldbyname('AttName').Value := frmPictureUpload.FPictureName;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmPictureUpload.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
inherited;
|
||
Label38.Caption := '<27><><EFBFBD>ţ<EFBFBD>' + Trim(cds_1.fieldbyname('SerialNo').AsString);
|
||
MTMSId := Trim(cds_1.fieldbyname('TMSId').AsString);
|
||
InitMXGrid(MTMSId);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TvMXCellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
inherited;
|
||
if ToolBar2.Enabled = False then
|
||
Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete Trade_Market_Sub_Qty where TMSQID=' + quotedstr(Trim(CDS_MX.FieldByName('TMSQID').AsString)));
|
||
ExecSQL;
|
||
end;
|
||
|
||
// with ADOCmd do
|
||
// begin
|
||
// close;
|
||
// sql.Clear;
|
||
// sql.Add(' exec P_KCSD_AllNew ');
|
||
// sql.Add(' @Operation=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸɾ<CFB8><C9BE>'' ');
|
||
// sql.Add(' ,@TMMNo=' + quotedstr(trim(TMMNo.Text)));
|
||
// ExecSQL;
|
||
// end;
|
||
CDS_MX.Delete;
|
||
with cds_1 do
|
||
begin
|
||
edit;
|
||
if CDS_MX.IsEmpty then
|
||
begin
|
||
Fieldbyname('TMSPiece').Value := 0;
|
||
Fieldbyname('TMSQty').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Fieldbyname('TMSPiece').Value := TvMX.DataController.Summary.FooterSummaryValues[1];
|
||
Fieldbyname('TMSQty').Value := TvMX.DataController.Summary.FooterSummaryValues[0];
|
||
end;
|
||
|
||
post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.InitMXGrid(MTMSId: string);
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select A.* from Trade_Market_Sub_Qty A ');
|
||
sql.Add('where TMSId=''' + Trim(MTMSId) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOTemp, CDS_MX);
|
||
SInitCDSData(ADOTemp, CDS_MX);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.v1Column5PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
FieldByName('MGTMMID').Value := '';
|
||
Post;
|
||
end;
|
||
Tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.HYTTBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.KYTTBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if Trim(flag) = 'OrdDefStr2' then
|
||
begin
|
||
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote := True;
|
||
end;
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|