774 lines
21 KiB
ObjectPascal
774 lines
21 KiB
ObjectPascal
unit U_ClothInquiryInPut;
|
||
|
||
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,
|
||
cxDropDownEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
|
||
cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters, cxNavigator,
|
||
dxDateRanges, dxBarBuiltInMenu, dxDateTimeWheelPicker, dxGDIPlusClasses,
|
||
Vcl.Menus, MovePanel, cxCheckBox, cxImage, cxDBEdit, Vcl.DBCtrls, U_BaseInput,
|
||
System.ImageList, Vcl.ImgList, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, ShellAPI;
|
||
|
||
type
|
||
TfrmClothInquiryInPut = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
Label3: TLabel;
|
||
MVCDate: TDateTimePicker;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DS_1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
Label10: TLabel;
|
||
MVCNo: TEdit;
|
||
Label14: TLabel;
|
||
Label20: TLabel;
|
||
BuyName: TBtnEditC;
|
||
GPM_1: TcxGridPopupMenu;
|
||
Sellname: TBtnEditC;
|
||
Label27: TLabel;
|
||
IsTax: TComboBox;
|
||
Label29: TLabel;
|
||
Label30: TLabel;
|
||
QiYun: TBtnEditC;
|
||
MuDi: TBtnEditC;
|
||
Label5: TLabel;
|
||
Currency: TComboBox;
|
||
Label11: TLabel;
|
||
Label12: TLabel;
|
||
YunShu: TBtnEditC;
|
||
Payment: TBtnEditC;
|
||
Label4: TLabel;
|
||
GSChuanYangNote: TBtnEditC;
|
||
Label13: TLabel;
|
||
JiaGeSY: TBtnEditC;
|
||
Label1: TLabel;
|
||
CKChuanYangNote: TBtnEditC;
|
||
Label8: TLabel;
|
||
Packing: TBtnEditC;
|
||
Label15: TLabel;
|
||
Label16: TLabel;
|
||
DlyDate: TDateTimePicker;
|
||
ShippMent: TEdit;
|
||
ToolButton3: TToolButton;
|
||
lblSalesId: TLabel;
|
||
Label25: TLabel;
|
||
SalesId: TEdit;
|
||
TallyId: TEdit;
|
||
Panel1: TPanel;
|
||
Panel2: TPanel;
|
||
GroupBox5: TGroupBox;
|
||
cxGrid2: TcxGrid;
|
||
TV2: TcxGridDBTableView;
|
||
TV2Column1: TcxGridDBColumn;
|
||
TV2Column2: TcxGridDBColumn;
|
||
TV2Column3: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
ToolBar2: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
v1XHNo: TcxGridDBColumn;
|
||
VC_SCSCode: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
v1Column8: TcxGridDBColumn;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1OrderUnit: TcxGridDBColumn;
|
||
v1PRTPrice: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
TV2Column4: TcxGridDBColumn;
|
||
CDS_2: TClientDataSet;
|
||
DS_2: TDataSource;
|
||
GPM_2: TcxGridPopupMenu;
|
||
ToolButton4: TToolButton;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure BuyNameBtnUpClick(Sender: TObject);
|
||
procedure BuyNameBtnDnClick(Sender: TObject);
|
||
procedure v1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1Column7PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure SalesmanBtnUpClick(Sender: TObject);
|
||
procedure v1Column15PropertiesEditValueChanged(Sender: TObject);
|
||
procedure SellNameBtnUpClick(Sender: TObject);
|
||
procedure QiYunBtnUpClick(Sender: TObject);
|
||
procedure ShippMentKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
private
|
||
FLeft, FTop: Integer;
|
||
fuserName, Fstatus: string;
|
||
procedure InitData();
|
||
procedure InitHistoricalPrice();
|
||
function TestData(): Boolean;
|
||
function SaveData(): Boolean;
|
||
procedure SetXH();
|
||
{ Private declarations }
|
||
public
|
||
CopyInt: Integer;
|
||
PState: string;
|
||
fFlileFlag: string;
|
||
FMVCMID: string;
|
||
FAuthority, FGSTT: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmClothInquiryInPut: TfrmClothInquiryInPut;
|
||
newh: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_ClothInfoSel, U_PictureUpload;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmClothInquiryInPut.InitHistoricalPrice();
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select TOP 30 * ');
|
||
sql.Add('from MV_Cloth_Main A inner join MV_Cloth_Sub B on A.MVCMId=B.MVCMId ');
|
||
sql.Add('where B.C_Code=''' + Trim(Order_Sub.FieldByName('C_Code').AsString) + '''');
|
||
sql.Add('and isnull(A.status,''0'')<>''-1''');
|
||
sql.Add('and MVCType=''ѯ<><D1AF>''');
|
||
sql.Add('order by A.MVCDate ');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOTemp, CDS_2);
|
||
SInitCDSData(ADOTemp, CDS_2);
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.SetXH();
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
i := 1;
|
||
while not Eof do
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('XHNoTemp').Value := i;
|
||
Post;
|
||
end;
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
with Order_Sub do
|
||
begin
|
||
Order_Sub.IndexFieldNames := '';
|
||
First;
|
||
i := 1;
|
||
while not Eof do
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('SerialNo').Value := FieldByName('XHNoTemp').AsInteger;
|
||
Post;
|
||
end;
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
Order_Sub.IndexFieldNames := 'SerialNo';
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.ShippMentKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
|
||
if not (((Key >= '0') and (Key <= '9')) or (Key = '.') or (Key = #8)) then
|
||
begin
|
||
Key := #0;
|
||
end
|
||
else if (pos('.', TEdit(Sender).text) <> 0) then
|
||
begin
|
||
if Key = '.' then
|
||
begin
|
||
Key := #0;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
function TfrmClothInquiryInPut.TestData(): Boolean;
|
||
begin
|
||
try
|
||
if Trim(MVCNo.Text) = '' then
|
||
raise Exception.Create('<27><><EFBFBD>ۺŲ<DBBA><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Trim(SellName.Text) = '' then
|
||
raise Exception.Create('<27>ҷ<EFBFBD><D2B7><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Trim(BuyName.Text) = '' then
|
||
raise Exception.Create('<27>Է<EFBFBD><D4B7><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
|
||
if Order_Sub.IsEmpty then
|
||
raise Exception.Create('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Order_Sub.Locate('C_Code', null, []) then
|
||
raise Exception.Create('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Order_Sub.Locate('C_Code', '', []) then
|
||
raise Exception.Create('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Order_Sub.Locate('C_Name', null, []) then
|
||
raise Exception.Create('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Order_Sub.Locate('C_Name', '', []) then
|
||
raise Exception.Create('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Order_Sub.Locate('C_Color', null, []) then
|
||
raise Exception.Create('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Order_Sub.Locate('C_Color', '', []) then
|
||
raise Exception.Create('<27><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
|
||
if Order_Sub.Locate('QtyUnit', null, []) then
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
if Order_Sub.Locate('QtyUnit', '', []) then
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.InitData();
|
||
var
|
||
maxno: string;
|
||
begin
|
||
//ˢ<>²<EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from MV_Cloth_Sub ');
|
||
sql.Add('where MVCMID=''' + Trim(FMVCMID) + '''');
|
||
sql.Add(' order by SerialNo ');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOTemp, Order_Sub);
|
||
SInitCDSData(ADOTemp, Order_Sub);
|
||
//ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from MV_Cloth_Main where MVCMID=''' + Trim(FMVCMID) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOTemp, ScrollBox1, 2);
|
||
BuyName.TxtCode := Trim(ADOTemp.FieldByName('BuyNo').AsString);
|
||
Sellname.TxtCode := Trim(ADOTemp.FieldByName('SellNo').AsString);
|
||
Fstatus := Trim(ADOTemp.FieldByName('status').AsString);
|
||
|
||
if PState = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
MVCDate.DateTime := SGetServerDateTime(ADOTemp);
|
||
DlyDate.DateTime := MVCDate.DateTime;
|
||
MVCNo.Text := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
|
||
end;
|
||
|
||
if PState = '<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
|
||
PState := '<27><><EFBFBD><EFBFBD>';
|
||
FMVCMID := '';
|
||
MVCNo.Text := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
||
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if GetLSNo(ADOCmd, maxno, 'MVS', 'MV_Cloth_Sub', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
Edit;
|
||
FieldByName('MVCMID').Value := '';
|
||
FieldByName('MVCSID').Value := maxno;
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.QiYunBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TEdit(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
|
||
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
readCxGrid(trim(self.Caption) + 'Tv1', Tv1, 'ѯ<>۹<EFBFBD><DBB9><EFBFBD>');
|
||
readCxGrid(trim(self.Caption) + 'Tv2', Tv2, 'ѯ<>۹<EFBFBD><DBB9><EFBFBD>');
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmClothInquiryInPut.SaveData(): Boolean;
|
||
var
|
||
maxno: string;
|
||
fMVCNo, fmxType, fDate: string;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
||
if Trim(FMVCMID) = '' then
|
||
begin
|
||
if GetLSNo(ADOTemp, maxno, 'MVM', 'MV_Cloth_Main', 3, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
|
||
fDate := 'XJ' + FormatDateTime('yy', SGetServerDate(ADOTemp));
|
||
|
||
if trim(MVCNo.Text) = '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
if GetLSNo(ADOTemp, fMVCNo, fDate, 'MV_Cloth_Main', 4, 0) = False then
|
||
raise Exception.Create('ȡ<><EFBFBD>۱<EFBFBD><DBB1><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
|
||
MVCNo.Text := fMVCNo;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FMVCMID);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from MV_Cloth_Main where MVCMID=''' + Trim(FMVCMID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMVCMID) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('status').Value := '0';
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('MVCMID').Value := Trim(maxno);
|
||
RTSetsavedata(ADOCmd, 'MV_Cloth_Main', ScrollBox1, 2);
|
||
FieldByName('BuyNo').Value := Trim(BuyName.TxtCode);
|
||
FieldByName('SellNo').Value := Sellname.TxtCode;
|
||
FieldByName('MVCType').Value := 'ѯ<><D1AF>';
|
||
Post;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from MV_Cloth_Main where MVCNo=''' + Trim(MVCNo.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOCmd.RecordCount > 1 then
|
||
raise Exception.Create('<27><><EFBFBD>۵<EFBFBD><DBB5><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>');
|
||
|
||
FMVCMID := Trim(maxno);
|
||
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
||
///
|
||
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
|
||
maxno := Trim(Order_Sub.fieldbyname('MVCSID').AsString);
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from MV_Cloth_Sub ');
|
||
sql.Add(' where MVCMID=''' + Trim(FMVCMID) + '''');
|
||
sql.Add(' and MVCSID=''' + Trim(maxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if ADOCmd.IsEmpty then
|
||
Append
|
||
else
|
||
Edit;
|
||
RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'MV_Cloth_Sub', 0);
|
||
FieldByName('MVCMID').Value := Trim(FMVCMID);
|
||
FieldByName('MVCSID').Value := Trim(maxno);
|
||
Post;
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('MVCSID').Value := Trim(maxno);
|
||
Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////
|
||
///
|
||
//////////////// <20><><EFBFBD>±<EFBFBD><C2B1><EFBFBD> //////////////////////
|
||
// with ADOCmd do
|
||
// begin
|
||
// close;
|
||
// sql.Clear;
|
||
// sql.Add('EXEC P_Con_Up_PiQty ');
|
||
// sql.Add('@DataID=' + quotedstr(Trim(FMVCMID)));
|
||
// execsql;
|
||
// end;
|
||
//////////////// <20><><EFBFBD>±<EFBFBD><C2B1><EFBFBD> //////////////////////
|
||
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
|
||
ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
Result := False;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.TBSaveClick(Sender: TObject);
|
||
begin
|
||
MVCDate.SetFocus;
|
||
|
||
if TestData() = false then
|
||
exit;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.ToolButton1Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
maxno: string;
|
||
begin
|
||
if GetLSNo(ADOCmd, maxno, 'MVS', 'MV_Cloth_Sub', 4, 1) = False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(MVCNo.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ۺŲ<DBBA><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
i := Order_Sub.RecordCount; //<2F><>ǰ<EFBFBD><C7B0>dataset<65>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>м<EFBFBD>¼
|
||
i := i + 1;
|
||
CopyAddRow(Tv1, Order_Sub);
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSEL').Value := FALSE;
|
||
FieldByName('SerialNo').Value := i;
|
||
FieldByName('MVCSID').Value := maxno;
|
||
FieldByName('C_Color').Value := '';
|
||
FieldByName('Price').Value := null;
|
||
Post;
|
||
end;
|
||
SetXH();
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then
|
||
Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
while Order_Sub.Locate('SSel', True, []) do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Trade_Plan_Sub where MVCSID=''' + Trim(Order_Sub.fieldbyname('MVCSID').AsString) + '''');
|
||
open;
|
||
end;
|
||
if ADOTemp.IsEmpty = false then
|
||
begin
|
||
exit;
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>ϸ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
||
end;
|
||
if Trim(Order_Sub.fieldbyname('MVCSID').AsString) <> '' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete MV_Cloth_Sub where MVCSID=''' + Trim(Order_Sub.fieldbyname('MVCSID').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Order_Sub.Delete;
|
||
end;
|
||
|
||
SetXH();
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, 'ѯ<>۹<EFBFBD><DBB9><EFBFBD>');
|
||
WriteCxGrid(trim(self.Caption) + 'Tv2', Tv2, 'ѯ<>۹<EFBFBD><DBB9><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
GroupBox5.Visible := not GroupBox5.Visible;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||
begin
|
||
InitHistoricalPrice();
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.BuyNameBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>˾';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.BuyName.TxtCode := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.BuyName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.BuyNameBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.v1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'MPRTCodeName';
|
||
flagname := '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Order_Sub.Edit;
|
||
Order_Sub.fieldbyname('PRTCodeName').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
Order_Sub.fieldbyname('PRTCode').Value := Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
Order_Sub.Post;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.v1Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'C_MF';
|
||
flagname := '<27>ŷ<EFBFBD><C5B7><EFBFBD>Ϣ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Order_Sub.Edit;
|
||
Order_Sub.fieldbyname('C_MF').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
// Order_Sub.fieldbyname('PRTCode').Value:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
Order_Sub.Post;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.v1Column7PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'C_KZ';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Order_Sub.Edit;
|
||
Order_Sub.fieldbyname('C_KZ').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
// Order_Sub.fieldbyname('PRTCode').Value:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||
Order_Sub.Post;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.v1Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
var
|
||
MCYNo: string;
|
||
begin
|
||
frmClothInfoSel := TfrmClothInfoSel.Create(self);
|
||
with frmClothInfoSel do
|
||
begin
|
||
if showmodal = 1 then
|
||
begin
|
||
Order_Sub.Edit;
|
||
Order_Sub.fieldbyname('C_Code').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Code').asstring;
|
||
|
||
Order_Sub.fieldbyname('C_Name').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Name').asstring;
|
||
Order_Sub.fieldbyname('C_EName').Value := frmClothInfoSel.CDS_1.fieldbyname('C_EName').asstring;
|
||
Order_Sub.fieldbyname('C_Spec').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Spec').asstring;
|
||
Order_Sub.fieldbyname('C_Composition').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Composition').asstring;
|
||
Order_Sub.fieldbyname('C_Color').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Color').asstring;
|
||
Order_Sub.fieldbyname('C_Width').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Width').asstring;
|
||
Order_Sub.fieldbyname('C_GramWeight').Value := frmClothInfoSel.CDS_1.fieldbyname('C_GramWeight').asstring;
|
||
Order_Sub.Post;
|
||
end;
|
||
free;
|
||
end;
|
||
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.SalesmanBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TEdit(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
|
||
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.v1Column15PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
if Trim(mvalue) = '' then
|
||
begin
|
||
mvalue := '0';
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('YongJinPrice').Value := mvalue;
|
||
FieldByName('YongJin').Value := FieldByName('YongJinPrice').AsFloat * FieldByName('PRTOrderQty').AsFloat;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmClothInquiryInPut.SellNameBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.Sellname.TxtCode := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.Sellname.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|