1890 lines
53 KiB
ObjectPascal
1890 lines
53 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,
|
||
dxDateRanges, dxBarBuiltInMenu, cxPC, System.ImageList, Vcl.ImgList,
|
||
U_BaseInput, cxImage, cxDBEdit, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, ShellAPI,
|
||
dxScrollbarAnnotations, cxImageList, dxSkinsCore, dxSkinsDefaultPainters,
|
||
cxDBLookupComboBox, cxMRUEdit, dxSkinBasic, dxSkinBlack, dxSkinBlue,
|
||
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom, dxSkinDarkSide,
|
||
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||
dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark,
|
||
dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray,
|
||
dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust,
|
||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine,
|
||
dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark,
|
||
dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint, dxSkinWXI,
|
||
dxSkinXmas2008Blue;
|
||
|
||
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;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
Panel2: TPanel;
|
||
Panel3: TPanel;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
Tv1Column2: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Tv1Column1: TcxGridDBColumn;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
Tv1Column9: TcxGridDBColumn;
|
||
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;
|
||
ScrollBox1: TScrollBox;
|
||
Label3: TLabel;
|
||
Label25: TLabel;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label14: TLabel;
|
||
Label20: TLabel;
|
||
Label37: TLabel;
|
||
Label18: TLabel;
|
||
TMMNo: TcxTextEdit;
|
||
TMMDate: TDateTimePicker;
|
||
DLYDate: TDateTimePicker;
|
||
OrdNote: TMemo;
|
||
OrdType: TComboBox;
|
||
OurCoName: TcxButtonEdit;
|
||
ShippingAddress: TcxButtonEdit;
|
||
ADO_YS: TADOQuery;
|
||
DS_YS: TDataSource;
|
||
DS_RCPM: TDataSource;
|
||
ADO_PM: TADOQuery;
|
||
ADO_RCPM: TADOQuery;
|
||
DS_PM: TDataSource;
|
||
Tv1Column12: TcxGridDBColumn;
|
||
ADO_1: TADOQuery;
|
||
Label4: TLabel;
|
||
BuyOrdNo: TcxTextEdit;
|
||
CustName: TcxMRUEdit;
|
||
CDS_KH: TClientDataSet;
|
||
ADO_KH: TADOQuery;
|
||
Tv1Column15: TcxGridDBColumn;
|
||
Tv1Column16: TcxGridDBColumn;
|
||
Tv1Column17: TcxGridDBColumn;
|
||
Tv1Column18: TcxGridDBColumn;
|
||
GPM_2: TcxGridPopupMenu;
|
||
DS_DanWei: TDataSource;
|
||
ADO_DanWei: TADOQuery;
|
||
PopupMenu1: TPopupMenu;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
N3: TMenuItem;
|
||
N4: TMenuItem;
|
||
N5: TMenuItem;
|
||
Label19: TLabel;
|
||
CONTACT: TcxButtonEdit;
|
||
Tv1Column19: TcxGridDBColumn;
|
||
Tv1Column20: TcxGridDBColumn;
|
||
ToolButton5: TToolButton;
|
||
Tv1Column21: TcxGridDBColumn;
|
||
Tv1Column22: TcxGridDBColumn;
|
||
TBAdd: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
TBEdit: TToolButton;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
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 ToolButton3Click(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 OurCoNameDblClick(Sender: TObject);
|
||
procedure OurCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure ShippingAddressPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure Tv1Column7PropertiesEditValueChanged(Sender: TObject);
|
||
procedure Tv1Column12PropertiesEditValueChanged(Sender: TObject);
|
||
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure StkPositionPropertiesButtonClick(Sender: TObject);
|
||
procedure CustNamePropertiesChange(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure N3Click(Sender: TObject);
|
||
procedure N4Click(Sender: TObject);
|
||
procedure N5Click(Sender: TObject);
|
||
procedure CustNameMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure CustNamePropertiesCloseUp(Sender: TObject);
|
||
procedure Tv1DblClick(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
procedure TBAddClick(Sender: TObject);
|
||
procedure TBEditClick(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 LookImage(FileName: string);
|
||
procedure InitMXGrid(MTMSId: string);
|
||
procedure AddLine();
|
||
{ Private declarations }
|
||
public
|
||
PState, CopyInt, PriceFlag: Integer;
|
||
FTMMID, FTMMNo, MTMSId: string;
|
||
FXS: Integer;
|
||
btnFlag: Integer;
|
||
canshu1, canshu4: string;
|
||
fFlileFlag: string;
|
||
fordtype: string;
|
||
FName, FColor, FColorNo: string;
|
||
FTIMID: string;
|
||
FIncludeTax: Double;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmTradeMarketInPut: TfrmTradeMarketInPut;
|
||
newh: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ZDYHelp, U_ZDYHelpSel, U_RTFun, U_CompanySel, U_PictureUpload,
|
||
U_ProgressUpdate, U_ClothInfoSel, U_ComContactSel, U_TradeMarketList,
|
||
U_LabelPrint, U_TradeMarketQtyInPut;
|
||
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmTradeMarketInPut.AddLine();
|
||
var
|
||
i: Integer;
|
||
maxno: string;
|
||
begin
|
||
|
||
i := cds_1.RecordCount;
|
||
i := i + 1;
|
||
|
||
if GetLSNo(ADOTemp, maxno, 'JS', 'Trade_Market_Sub', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with cds_1 do
|
||
begin
|
||
Append;
|
||
FieldByName('SerialNo').Value := IntToStr(i);
|
||
FieldByName('TMSId').Value := Trim(maxno);
|
||
FieldByName('TMSPiece').Value := 0;
|
||
FieldByName('TMSQty').Value := 0;
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.InitImage1();
|
||
begin
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.InitImage2();
|
||
begin
|
||
|
||
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.TBAddClick(Sender: TObject);
|
||
begin
|
||
{ CDS_1.Close;
|
||
InitData();
|
||
SClearData(ScrollBox1, 2); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пؼ<D0BF><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
CustName.Text := '';
|
||
if CDS_1.IsEmpty then
|
||
begin
|
||
AddLine();
|
||
end; }
|
||
PState := 0;
|
||
FTMMId := '';
|
||
FormShow(Self);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TBEditClick(Sender: TObject);
|
||
begin
|
||
// if TBSave.Visible = False then
|
||
// begin
|
||
PState := 1;
|
||
FTMMId := self.FTMMId;
|
||
|
||
TBSave.Enabled := true;
|
||
ScrollBox1.Enabled := True;
|
||
ToolBar2.Enabled := true;
|
||
ToolButton2.Enabled := True;
|
||
ToolButton1.Enabled := True;
|
||
N2.Visible := true;
|
||
// FormShow(Self);
|
||
// end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.InitData();
|
||
var
|
||
FDate: TDateTime;
|
||
begin
|
||
FDate := SGetServerDateTime(ADOTemp);
|
||
TMMDate.DateTime := FDate;
|
||
DlyDate.DateTime := 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.Hint := Trim(ADOTemp.FieldByName('CustNo').AsString);
|
||
CustName.Text := Trim(ADOTemp.FieldByName('CustName').AsString);
|
||
|
||
with ADO_1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,StkQty =(select sum(isnull(X.StkQty,0)) from Bs_Cloth_IO X where X.C_Code=A.C_Code and X.C_Color=A.C_Color) ');
|
||
sql.Add('from Trade_Market_Sub A ');
|
||
SQL.adD('where 1=1 ');
|
||
if PState = 1 then
|
||
begin
|
||
sql.Add(' and A.TMMID=''' + Trim(FTMMID) + '''');
|
||
end;
|
||
if PState = 0 then
|
||
begin
|
||
sql.Add(' and 1<>1');
|
||
end;
|
||
// ShowMessage(SQL.TEXT);
|
||
Open;
|
||
|
||
end;
|
||
SCreateCDS(ADO_1, CDS_1);
|
||
SInitCDSData(ADO_1, CDS_1);
|
||
|
||
if PState = 0 then
|
||
begin
|
||
TMMDate.DateTime := SGetServerDateTime(ADOTemp);
|
||
DlyDate.DateTime := TMMDate.DateTime;
|
||
TMMNo.Text := '';
|
||
TMMNo.Enabled := True;
|
||
end
|
||
else
|
||
begin
|
||
end;
|
||
if CopyInt = 99 then
|
||
begin
|
||
PState := 0;
|
||
FTMMID := '';
|
||
TMMNo.Text := '';
|
||
TMMNo.Enabled := True;
|
||
|
||
TMMDate.DateTime := FDate;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('TMMID').Value := '';
|
||
FieldByName('TMSId').Value := '';
|
||
FieldByName('TMSPiece').Value := 0;
|
||
FieldByName('TMSQty').Value := 0;
|
||
// FieldByName('GangFee').Value := 0;
|
||
// FieldByName('Transfee').Value := 0;
|
||
// FieldByName('Otherfee').Value := 0;
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
||
var
|
||
FType, ZDYName, FText: string;
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := CAFREE;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
OurCoName.Properties.LookupItems.Text := 'W0001';
|
||
OurCoName.Text := '<27><><EFBFBD><EFBFBD>';
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.FormShow(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
inherited;
|
||
|
||
with ADO_KH do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select CoCode,CoAbbrName from BS_Company where CoType=''<27>ͻ<EFBFBD>'' ');
|
||
|
||
if Trim(canshu4) = '<27><><EFBFBD><EFBFBD>' then
|
||
sql.Add(' and Stores=''<27><><EFBFBD><EFBFBD>'' ');
|
||
|
||
Open;
|
||
|
||
CustName.Properties.LookupItems.Clear;
|
||
while not Eof do
|
||
begin
|
||
CustName.Properties.LookupItems.Add(Trim(ADO_KH.fieldByName('CoAbbrName').AsString));
|
||
Next;
|
||
end;
|
||
CustName.ItemIndex := -1;
|
||
|
||
SCreateCDS(ADO_KH, CDS_KH);
|
||
SInitCDSData(ADO_KH, CDS_KH);
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_BS_CloInfo_Hot ');
|
||
ExecSQL;
|
||
end;
|
||
readCxGrid(TRIM(SELF.Caption), Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
TMMNo.Text := '';
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
InitData();
|
||
|
||
if CDS_1.IsEmpty then
|
||
begin
|
||
AddLine();
|
||
// AddLine();
|
||
// AddLine();
|
||
// AddLine();
|
||
// AddLine();
|
||
end;
|
||
|
||
with ADO_PM do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT distinct A.C_Code,A.C_Name,A.qtyunit,A.HotQty,StkQty = SUM(B.StkQty) ');
|
||
SQL.ADD(' FROM Bs_Cloth_Info A LEFT JOIN Bs_Cloth_Io B on A.C_Code=B.C_Code');
|
||
sql.add(' where B.ioflag=''<27><><EFBFBD><EFBFBD>'' ');
|
||
if Trim(canshu4) = '<27><><EFBFBD><EFBFBD>' then
|
||
sql.Add(' and isnull(STKNAME,'''')=''<27><><EFBFBD><EFBFBD>'' ');
|
||
SQL.add('group by A.C_Code,A.C_Name,A.qtyunit,A.HotQty');
|
||
SQL.ADD('order by A.C_Code ');
|
||
// showmessage(SQL.text);
|
||
Open;
|
||
end;
|
||
with ADO_YS do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT distinct A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price FROM Bs_Cloth_Info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID ');
|
||
sql.Add(' where 1=2 ');
|
||
Open;
|
||
end;
|
||
|
||
with ADO_RCPM do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT distinct C_GYSNAME FROM BS_Cloth_Info_GYSCP ');
|
||
Open;
|
||
end;
|
||
with ADO_DanWei do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT distinct A.C_Code,B.CICUnit FROM Bs_Cloth_Info A inner join Bs_Cloth_Info_Coefficient B on A.BCIID=B.BCIID ');
|
||
sql.Add(' where 2=1 ');
|
||
Open;
|
||
end;
|
||
// frmTradeMarketlist := TfrmTradeMarketlist.Create(Application);
|
||
end;
|
||
|
||
function TfrmTradeMarketInPut.SaveData(): Boolean;
|
||
var
|
||
maxno, Smaxno, maxTMMNo, MaxFNo, MQZ, MTMMNo: string;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
|
||
///////////////////// <20><><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>!');
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>G50313001<-- G50313 001
|
||
//(<28><>G<EFBFBD><47>+ 25<32><35><EFBFBD>ġ<EFBFBD>5<EFBFBD><35>(ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>0-9ѭ<39><D1AD>)+0313(<28><><EFBFBD><EFBFBD>)+<2B><>001<30><31>(<28><><EFBFBD><EFBFBD>,<2C><><EFBFBD>ᳬ<EFBFBD><E1B3AC>999<39><39>))
|
||
|
||
MQZ := 'G' + RightStr(Trim(FormatDateTime('yyMMdd', SGetServerDate(ADOTemp))), 5);
|
||
if GetLSNo(ADOCmd, MTMMNo, MQZ, 'Trade_Market_Main', 3, 0) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
||
TMMNo.Text := MTMMNo;
|
||
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FTMMID);
|
||
end;
|
||
|
||
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);
|
||
if btnFlag = 1 then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FieldByName('status').Value := Trim('10');
|
||
if btnFlag = 5 then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ
|
||
FieldByName('status').Value := Trim('1');
|
||
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.Hint);
|
||
FieldByName('CustName').Value := Trim(CustName.Text);
|
||
FieldByName('Store').Value := Trim(canshu4);
|
||
Post;
|
||
end;
|
||
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ///////////////////////////
|
||
///////////////////// <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);
|
||
//RTSetSaveDataCDS(ADOCmd, Tv1, CDS_1, 'Trade_Market_Sub_Qty', 2);
|
||
//RTSetsavedata(ADOCmd, 'Trade_Market_Sub', ScrollBox1, 7);
|
||
FieldByName('TMMID').Value := Trim(maxno);
|
||
FieldByName('TMSId').Value := Trim(Smaxno);
|
||
Post;
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
///////////////////// <20><><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>!');
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select C_Code,C_Color,C_ColorNo,CF=count(TMSID) from Trade_Market_sub where TMMID=''' + Trim(maxno) + '''');
|
||
sql.Add('group by C_Code,C_Color,C_ColorNo HAVING count(TMSID)>1 ');
|
||
Open;
|
||
end;
|
||
if not ADOCmd.IsEmpty then
|
||
raise Exception.Create('<27><>ɫ<EFBFBD>ظ<EFBFBD>!');
|
||
|
||
FTMMID := Trim(maxno);
|
||
ADOCmd.Connection.CommitTrans;
|
||
|
||
TradeMarketProgressUpdateByTMMID(ADOCmd, FTMMID);
|
||
|
||
with ADO_1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from Trade_Market_Sub where TMMID=''' + Trim(FTMMID) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADO_1, CDS_1);
|
||
SInitCDSData(ADO_1, CDS_1);
|
||
Result := True; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ
|
||
if (btnFlag = 2) or (btnFlag = 4) then
|
||
begin
|
||
try
|
||
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
||
with frmLabelPrint do
|
||
begin
|
||
if canshu4 = '<27><><EFBFBD><EFBFBD>' then
|
||
FLMType := 'TradePlanPrintxy'
|
||
else
|
||
FLMType := 'TradePlanPrint';
|
||
FFiltration1 := Trim(maxno);
|
||
if ShowModal = 1 then
|
||
begin
|
||
// Self.InitGrid();
|
||
end;
|
||
end;
|
||
finally
|
||
frmLabelPrint.Free;
|
||
end;
|
||
end;
|
||
if btnFlag = 3 then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
begin
|
||
PState := 0;
|
||
FTMMId := '';
|
||
FormShow(Self);
|
||
// CDS_1.Close;
|
||
// InitData();
|
||
// SClearData(ScrollBox1, 2); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>пؼ<D0BF><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// CustName.Text := '';
|
||
// if CDS_1.IsEmpty then
|
||
// begin
|
||
// AddLine();
|
||
// end;
|
||
end;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.TBSaveClick(Sender: TObject);
|
||
var
|
||
MAXNO1: string;
|
||
begin
|
||
|
||
ToolBar1.SetFocus;
|
||
with cds_1 do
|
||
begin
|
||
while cds_1.Locate('C_Code', null, []) do
|
||
begin
|
||
cds_1.Delete
|
||
end;
|
||
end;
|
||
|
||
if trim(CustName.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
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 CDS_1.Locate('OrderQty', null, []) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if CDS_1.Locate('OrderUnit', null, []) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if CDS_1.Locate('Price', null, []) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if not CDS_KH.Locate('CoAbbrName', self.CustName.Text, []) then
|
||
begin
|
||
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end
|
||
else
|
||
begin
|
||
self.CustName.Properties.LookupItems.Text := Trim(CDS_KH.fieldbyname('CoCode').AsString);
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
if btnFlag = 4 then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>˳<EFBFBD>
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
|
||
AddLine();
|
||
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;
|
||
try
|
||
frmClothInfoSel := TfrmClothInfoSel.Create(Application);
|
||
with frmClothInfoSel do
|
||
begin
|
||
|
||
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;
|
||
|
||
with CDS_3 do
|
||
begin
|
||
|
||
DisableControls;
|
||
First;
|
||
|
||
while not eof do
|
||
begin
|
||
|
||
if FieldByName('SSEL').AsBoolean then
|
||
begin
|
||
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 := trim(frmClothInfoSel.CDS_1.Fieldbyname('qtyunit').AsString);
|
||
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('C_ColorNo').value := trim(frmClothInfoSel.CDS_3.Fieldbyname('C_ColorNo').AsString);
|
||
Fieldbyname('C_Color').value := trim(frmClothInfoSel.CDS_3.Fieldbyname('C_Color').AsString);
|
||
Fieldbyname('C_Pattern').value := trim(frmClothInfoSel.CDS_3.Fieldbyname('C_Pattern').AsString);
|
||
// Fieldbyname('C_StyleNo').value := trim(frmClothInfoSel.CDS_3.Fieldbyname('C_StyleNo').AsString);
|
||
// Fieldbyname('SerialNo').value := 999;
|
||
end;
|
||
end;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
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);
|
||
//
|
||
// end;
|
||
// CDS_1.Edit;
|
||
// CDS_1.fieldbyname('SSel').value := false;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothInfoSel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
OneKeyPost(Tv1, CDS_1);
|
||
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
|
||
TcxButtonEdit(Sender).Text := '';
|
||
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
||
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.CustNameMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
if not ADO_YS.IsEmpty then
|
||
begin
|
||
if ADO_YS.FieldByName('C_Code').AsString <> CDS_1.FieldByName('C_Code').AsString then
|
||
begin
|
||
with ADO_YS do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT DISTINCT A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price FROM Bs_Cloth_Info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID ');
|
||
sql.Add(' where A.C_Code= ' + QuotedStr(CDS_1.FieldByName('C_Code').AsString));
|
||
SQL.ADD(' order by B.C_ColorNo');
|
||
//ShowMessage(sql.text);
|
||
Open;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADO_YS do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT DISTINCT A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price FROM Bs_Cloth_Info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID ');
|
||
sql.Add(' where A.C_Code= ' + QuotedStr(CDS_1.FieldByName('C_Code').AsString));
|
||
SQL.ADD(' order by B.C_ColorNo');
|
||
Open;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.CustNamePropertiesChange(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
if CDS_KH.Locate('CoAbbrName', Trim(self.CustName.Text), []) then
|
||
begin
|
||
self.CustName.Hint := Trim(CDS_KH.fieldbyname('CoCode').AsString);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.CustNamePropertiesCloseUp(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
with ADOtemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,B.* ');
|
||
sql.Add(',BankName=(select top 1 BankName from Bs_Company_Bank X where X.CoID=A.CoID ) ');
|
||
sql.Add(',ContactsId=(select top 1 UserID from SY_User X where X.UserName=B.Contacts ) ');
|
||
sql.Add('from BS_Company A ');
|
||
sql.Add('left join BS_Company_contact B ON A.COID=B.COID and B.IsDefault=1 ');
|
||
sql.Add('where 1=1 ');
|
||
sql.Add(' and A.CoType=''' + Trim('<27>ͻ<EFBFBD>') + '''');
|
||
// if Trim(FAuthority) = '<27><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>' then
|
||
// begin
|
||
// sql.Add(' and ( SalesId=' + quotedstr(trim(DCode)) + ' or exists (select * from [dbo].[F_Tool_SplitString](TallyId,'','') X where X.RTValue =' + quotedstr(trim(DCode)) + '))');
|
||
// end;
|
||
if canshu4 = '<27><><EFBFBD><EFBFBD>' then
|
||
sql.Add(' and A.Stores=''' + Trim('<27><><EFBFBD><EFBFBD>') + '''');
|
||
sql.Add(' and A.CoAbbrName=''' + Trim(CustName.Text) + '''');
|
||
Open;
|
||
end;
|
||
self.ShippingAddress.Text := Trim(adotemp.fieldbyname('mxaddress').AsString);
|
||
self.CONTACT.Text := Trim(adotemp.fieldbyname('Telephone').AsString);
|
||
|
||
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.N1Click(Sender: TObject);
|
||
begin
|
||
btnFlag := 1;
|
||
TBSaveClick(Sender);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.N2Click(Sender: TObject);
|
||
begin
|
||
btnFlag := 2;
|
||
TBSaveClick(Sender);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.N3Click(Sender: TObject);
|
||
begin
|
||
btnFlag := 3;
|
||
TBSaveClick(Sender);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.N4Click(Sender: TObject);
|
||
begin
|
||
btnFlag := 4;
|
||
TBSaveClick(Sender);
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.N5Click(Sender: TObject);
|
||
begin
|
||
btnFlag := 5;
|
||
TBSaveClick(Sender);
|
||
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.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.ScrollBox1Click(Sender: TObject);
|
||
begin
|
||
TMMDate.SetFocus;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.ShippingAddressPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
|
||
try
|
||
frmComContactSel := TfrmComContactSel.Create(Application);
|
||
with frmComContactSel do
|
||
begin
|
||
FCoCode := Trim(self.CustName.Hint);
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.ShippingAddress.Text := Trim(frmComContactSel.CDS_1.fieldbyname('mxaddress').AsString);
|
||
self.CONTACT.Text := Trim(frmComContactSel.CDS_1.fieldbyname('PhoneNumber').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmComContactSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.StkPositionPropertiesButtonClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27>ͻ<EFBFBD>';
|
||
FStores := Trim(canshu4);
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.CustName.Hint := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.CustName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
self.ShippingAddress.Text := Trim(frmCompanySel.CDS_1.fieldbyname('mxaddress').AsString);
|
||
self.CONTACT.Text := Trim(frmCompanySel.CDS_1.fieldbyname('Telephone').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,TMMID,Qty)');
|
||
sql.Add('values(' + quotedstr(Trim(MaxNo)));
|
||
sql.Add(',' + quotedstr(Trim(MTMSId)));
|
||
sql.Add(',' + quotedstr(Trim(FTMMID)));
|
||
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('TMMId').Value := FTMMId;
|
||
FieldByName('Qty').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.Tv1CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
|
||
var
|
||
AColumn: TcxGridColumn;
|
||
begin
|
||
// <20><>ȡ<EFBFBD><C8A1>˫<EFBFBD><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
AColumn := ACellViewInfo.Item as TcxGridColumn;
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>˫<EFBFBD><CBAB><EFBFBD><EFBFBD> Qty <20>У<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϣ<D0B6>
|
||
if AColumn.Name = 'Tv1Column19' then
|
||
begin
|
||
|
||
if not CDS_1.IsEmpty then
|
||
begin
|
||
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>ID
|
||
Self.MTMSId := CDS_1.FieldByName('TMSId').AsString;
|
||
Self.FTMMID := CDS_1.FieldByName('TMMId').AsString;
|
||
|
||
try
|
||
frmTradeMarketQtyInPut := TfrmTradeMarketQtyInPut.Create(Application);
|
||
with frmTradeMarketQtyInPut do
|
||
begin
|
||
MTMSId := Self.MTMSId;
|
||
FTMMID := Self.FTMMID;
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.InitMXGrid(Self.MTMSID);
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
FreeAndNil(frmTradeMarketQtyInPut);
|
||
end;
|
||
|
||
AHandled := True;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.Tv1Column12PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' select isnull(IncludeTax,0)IncludeTax from Bs_Company a ');
|
||
sql.Add('where CoCode=' + QuotedStr(CustName.hint));
|
||
open;
|
||
end;
|
||
|
||
FIncludeTax := ADOTemp.Fieldbyname('IncludeTax').asfloat;
|
||
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := Trim(mvalue);
|
||
Post;
|
||
ADO_YS.Locate('C_ColorNo', mvalue, []);
|
||
Edit;
|
||
FieldByName('C_Color').Value := ADO_YS.FieldByName('C_Color').Value;
|
||
FieldByName('price').Value := ADO_YS.FieldByName('price').Value * (1 + (FIncludeTax / 100));
|
||
FieldByName('referencePrice').Value := ADO_YS.FieldByName('Price').Value;
|
||
Post;
|
||
end;
|
||
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT top 1 isnull(Price,0) as Lastprice FROM Trade_Market_Main A inner join Trade_Market_Sub B on A.TMMId=B.TMMId ');
|
||
sql.Add('where A.CustName=' + QuotedStr(CustName.Text));
|
||
sql.Add('and B.C_ColorNo=' + QuotedStr(CDS_1.FieldByName('C_ColorNo').AsString));
|
||
sql.add('order by A.filltime desc');
|
||
open;
|
||
end;
|
||
if ADOTemp.IsEmpty = false then
|
||
begin
|
||
with Self.CDS_1 do
|
||
begin
|
||
edit;
|
||
Fieldbyname('Lastprice').AsString := trim(ADOTemp.Fieldbyname('Lastprice').AsString);
|
||
Post;
|
||
end;
|
||
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;
|
||
end;
|
||
|
||
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.Tv1Column7PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
|
||
Edit;
|
||
FieldByName(FFieldName).Value := Trim(mvalue);
|
||
Post;
|
||
ADO_PM.Locate('C_Name', mvalue, []);
|
||
Edit;
|
||
FieldByName('C_Code').Value := ADO_PM.FieldByName('C_Code').Value;
|
||
FieldByName('TMSUnit').Value := ADO_PM.FieldByName('qtyunit').Value;
|
||
|
||
FieldByName('StkQty').Value := ADO_PM.FieldByName('StkQty').Value;
|
||
|
||
Post;
|
||
end;
|
||
|
||
// with ADOTemp do
|
||
// begin
|
||
// close;
|
||
// sql.Clear;
|
||
// sql.Add(' select * from bs_cloth_info a inner join BS_Cloth_Info_GYSCP b on a.bciid=b.bciid ');
|
||
// sql.Add('where c_name=' + QuotedStr(CDS_1.FieldByName('C_name').AsString));
|
||
// sql.Add('and factoryname=' + QuotedStr(CustName.Text));
|
||
//
|
||
// open;
|
||
// end;
|
||
// if ADOTemp.IsEmpty = false then
|
||
// begin
|
||
// with Self.CDS_1 do
|
||
// begin
|
||
// edit;
|
||
// Fieldbyname('C_GYSNAME').AsString := trim(ADOTemp.Fieldbyname('C_GYSNAME').AsString);
|
||
// Post;
|
||
// end;
|
||
//
|
||
// end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradeMarketInPut.Tv1DblClick(Sender: TObject);
|
||
var
|
||
MTMSQID: string;
|
||
begin
|
||
|
||
// try
|
||
// frmTradeMarketQtyInPut := TfrmTradeMarketQtyInPut.Create(Application);
|
||
// with frmTradeMarketQtyInPut do
|
||
// begin
|
||
// MTMSId := self.MTMSId;
|
||
// FTMMID := Self.FTMMID;
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
//// Self.InitMXGrid(Self.MTMSQID);
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmTradeMarketQtyInPut.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.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
|
||
if not ADO_YS.IsEmpty then
|
||
begin
|
||
if ADO_YS.FieldByName('C_Code').AsString <> CDS_1.FieldByName('C_Code').AsString then
|
||
begin
|
||
with ADO_YS do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT DISTINCT A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price FROM Bs_Cloth_Info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID ');
|
||
|
||
sql.Add(' where A.C_Code= ' + QuotedStr(CDS_1.FieldByName('C_Code').AsString));
|
||
SQL.ADD(' order by B.C_ColorNo');
|
||
Open;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADO_YS do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' SELECT DISTINCT A.C_Code,B.C_Color,B.C_ColorNo,B.referencePrice AS Price FROM Bs_Cloth_Info A inner join BS_Cloth_Info_Sub B on A.BCIID=B.BCIID ');
|
||
|
||
sql.Add(' where A.C_Code= ' + QuotedStr(CDS_1.FieldByName('C_Code').AsString));
|
||
SQL.ADD(' order by B.C_ColorNo');
|
||
Open;
|
||
end;
|
||
end;
|
||
|
||
if not ADO_DanWei.IsEmpty then
|
||
begin
|
||
if ADO_DanWei.FieldByName('C_Code').AsString <> CDS_1.FieldByName('C_Code').AsString then
|
||
begin
|
||
with ADO_DanWei do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' EXEC P_Cloth_GetCICUnit @C_Code= ' + QuotedStr(CDS_1.FieldByName('C_Code').AsString));
|
||
Open;
|
||
end;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
with ADO_DanWei do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' EXEC P_Cloth_GetCICUnit @C_Code= ' + QuotedStr(CDS_1.FieldByName('C_Code').AsString));
|
||
Open;
|
||
end;
|
||
end;
|
||
|
||
|
||
// Bs_Cloth_Info_Coefficient
|
||
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.
|
||
|