986 lines
30 KiB
ObjectPascal
986 lines
30 KiB
ObjectPascal
|
unit U_ClothQuotationInPut;
|
|||
|
|
|||
|
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, dxCore,
|
|||
|
cxDateUtils, 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, dxScrollbarAnnotations, cxSplitter, cxLookupEdit,
|
|||
|
cxDBLookupEdit, cxDBLookupComboBox, cxCalc;
|
|||
|
|
|||
|
type
|
|||
|
TfrmClothQuotationInPut = class(TfrmBaseInput)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBSave: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
Label3: TLabel;
|
|||
|
ADOTemp: TADOQuery;
|
|||
|
ADOCmd: TADOQuery;
|
|||
|
DS_1: TDataSource;
|
|||
|
Order_Sub: TClientDataSet;
|
|||
|
Label9: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
MVCNo: TcxTextEdit;
|
|||
|
Label14: TLabel;
|
|||
|
Label20: TLabel;
|
|||
|
GPM_1: TcxGridPopupMenu;
|
|||
|
Label27: TLabel;
|
|||
|
Label29: TLabel;
|
|||
|
Label30: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label11: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
Label13: TLabel;
|
|||
|
Label16: TLabel;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
Saleser: TcxTextEdit;
|
|||
|
lblSalesId: TLabel;
|
|||
|
Label25: TLabel;
|
|||
|
SalesId: TcxTextEdit;
|
|||
|
TallyId: TcxTextEdit;
|
|||
|
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;
|
|||
|
Payment: TcxButtonEdit;
|
|||
|
SellName: TcxButtonEdit;
|
|||
|
BuyName: TcxButtonEdit;
|
|||
|
JiaGeSY: TcxButtonEdit;
|
|||
|
YunShu: TcxButtonEdit;
|
|||
|
QiYun: TcxButtonEdit;
|
|||
|
MuDi: TcxButtonEdit;
|
|||
|
MVCDate: TcxDateEdit;
|
|||
|
Currency: TcxComboBox;
|
|||
|
IsTax: TcxComboBox;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Label2: TLabel;
|
|||
|
Label6: TLabel;
|
|||
|
Label7: TLabel;
|
|||
|
BuyAddress: TcxButtonEdit;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
Tv1Column13: TcxGridDBColumn;
|
|||
|
ToolButton5: TToolButton;
|
|||
|
Tv1Column14: TcxGridDBColumn;
|
|||
|
Label23: TLabel;
|
|||
|
Note: TcxMemo;
|
|||
|
BuyTel: TcxButtonEdit;
|
|||
|
Label1: TLabel;
|
|||
|
SellTel: TcxTextEdit;
|
|||
|
SellEmail: TcxButtonEdit;
|
|||
|
Label4: TLabel;
|
|||
|
BuyRepresentative: TcxButtonEdit;
|
|||
|
Tv1Column15: TcxGridDBColumn;
|
|||
|
DlyNote: TcxTextEdit;
|
|||
|
cxSplitter1: TcxSplitter;
|
|||
|
Tv1Column16: TcxGridDBColumn;
|
|||
|
Tv1Column17: TcxGridDBColumn;
|
|||
|
Tv1Column18: TcxGridDBColumn;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
Tv1Column19: TcxGridDBColumn;
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure v1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v1Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v1Column7PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure SalesmanBtnUpClick(Sender: TObject);
|
|||
|
procedure v1Column15PropertiesEditValueChanged(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);
|
|||
|
procedure SellNameDblClick(Sender: TObject);
|
|||
|
procedure SellNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure BuyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure PaymentPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure BuyAddressPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure ToolButton5Click(Sender: TObject);
|
|||
|
procedure cxLookupComboBox1KeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Tv1Column15PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure Tv1Column15PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
private
|
|||
|
FLeft, FTop: Integer;
|
|||
|
fuserName, Fstatus: string;
|
|||
|
procedure InitData();
|
|||
|
procedure InitHistoricalPrice();
|
|||
|
function TestData(): Boolean;
|
|||
|
function SaveData(): Boolean;
|
|||
|
procedure SetXH();
|
|||
|
procedure JSBJ();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
CopyInt: Integer;
|
|||
|
PState: string;
|
|||
|
fFlileFlag: string;
|
|||
|
FMVCMID: string;
|
|||
|
FAuthority, FGSTT: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmClothQuotationInPut: TfrmClothQuotationInPut;
|
|||
|
newh: hwnd;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_ClothInfoSel, U_PictureUpload,
|
|||
|
U_InputBoxCostPrice;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmClothQuotationInPut.JSBJ();
|
|||
|
var
|
|||
|
FCostPrice, FCostAdd, FCostRate, FPrice: Double;
|
|||
|
begin
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
FCostPrice := Fieldbyname('CostPrice').AsFloat;
|
|||
|
FCostAdd := Fieldbyname('CostAdd').AsFloat;
|
|||
|
FCostRate := Fieldbyname('CostRate').AsFloat;
|
|||
|
end;
|
|||
|
FPrice := RoundFloat(FCostPrice * FCostRate + FCostAdd, 2);
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('Price').Value := FPrice;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.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=''<27><><EFBFBD><EFBFBD>''');
|
|||
|
sql.Add('order by A.MVCDate ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOTemp, CDS_2);
|
|||
|
SInitCDSData(ADOTemp, CDS_2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.PaymentPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TcxButtonEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
MainType := 'MarketValue';
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TcxButtonEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.SellNameDblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TcxButtonEdit(Sender).Text := '';
|
|||
|
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.SellNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
with frmCompanySel do
|
|||
|
begin
|
|||
|
FCoType := '<27><>˾';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
self.Sellname.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
self.Sellname.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.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 TfrmClothQuotationInPut.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('.', TcxTextEdit(Sender).text) <> 0) then
|
|||
|
// begin
|
|||
|
// if Key = '.' then
|
|||
|
// begin
|
|||
|
// Key := #0;
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmClothQuotationInPut.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 TfrmClothQuotationInPut.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.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.Properties.LookupItems.Text := Trim(ADOTemp.FieldByName('BuyNo').AsString);
|
|||
|
Sellname.Properties.LookupItems.Text := Trim(ADOTemp.FieldByName('SellNo').AsString);
|
|||
|
Fstatus := Trim(ADOTemp.FieldByName('status').AsString);
|
|||
|
|
|||
|
if PState = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
MVCDate.Date := SGetServerDateTime(ADOTemp);
|
|||
|
// DlyDate.Date := MVCDate.Date;
|
|||
|
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 TfrmClothQuotationInPut.BuyAddressPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
if BuyAddress.Hint = '' then
|
|||
|
Exit;
|
|||
|
|
|||
|
fsj := Trim(TcxButtonEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
MainType := 'MarketValue';
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
V1Name.Caption := '<27><>ַ';
|
|||
|
V1Name.Width := 325;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TcxButtonEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.BuyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
with frmCompanySel do
|
|||
|
begin
|
|||
|
FCoType := '<27>ͻ<EFBFBD>';
|
|||
|
if Self.FAuthority = '¼<><C2BC>' then
|
|||
|
FAuthority := '<27><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
self.BuyName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
self.BuyName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
self.SalesId.Text := Trim(frmCompanySel.CDS_1.fieldbyname('SalesId').AsString);
|
|||
|
self.Saleser.Text := Trim(frmCompanySel.CDS_1.fieldbyname('Saleser').AsString);
|
|||
|
self.BuyTel.Text := Trim(frmCompanySel.CDS_1.fieldbyname('Telephone').AsString);
|
|||
|
self.BuyRepresentative.Text := Trim(frmCompanySel.CDS_1.fieldbyname('Contacts').AsString);
|
|||
|
|
|||
|
BuyAddress.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAddress').AsString);
|
|||
|
BuyAddress.Hint := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString) + '/' + Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString) + '<27><>ַ';
|
|||
|
|
|||
|
// fsj := 'select Name = Telephone from Bs_Company_contact where CoID=''' + Trim(frmCompanySel.CDS_1.fieldbyname('COID').AsString) + ''' ';
|
|||
|
// SInitTcxComBoxBySql(ADOQueryTemp, BuyTel, True, fsj);
|
|||
|
// fsj := 'select Name = Email from Bs_Company_contact where CoID=''' + Trim(frmCompanySel.CDS_1.fieldbyname('COID').AsString) + ''' ';
|
|||
|
// SInitTcxComBoxBySql(ADOQueryTemp, BuyEmail, True, fsj);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.cxLookupComboBox1KeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
with ADOTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select TOP 30 * ');
|
|||
|
sql.Add('from Bs_Cloth_Info A ');
|
|||
|
sql.Add('where A.GC_Name LIKE ' + QuotedStr(Trim(Order_Sub.FieldByName('C_Code').AsString) + '%'));
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADOTemp, CDS_2);
|
|||
|
SInitCDSData(ADOTemp, CDS_2);
|
|||
|
end;
|
|||
|
// cxLookupComboBox1.Text;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
|
|||
|
readCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD>۱<EFBFBD><DBB1>۹<EFBFBD><DBB9><EFBFBD>');
|
|||
|
readCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD>۱<EFBFBD><DBB1>۹<EFBFBD><DBB9><EFBFBD>');
|
|||
|
fFlileFlag := UserDataFlag + 'HX';
|
|||
|
InitData();
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmClothQuotationInPut.SaveData(): Boolean;
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
fMVCNo, fmxType, fDate: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
Order_Sub.DisableControls;
|
|||
|
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 := 'BJ' + 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.Properties.LookupItems.Text);
|
|||
|
FieldByName('SellNo').Value := Sellname.Properties.LookupItems.Text;
|
|||
|
FieldByName('MVCType').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
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;
|
|||
|
Order_Sub.EnableControls;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Order_Sub.EnableControls;
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
Result := False;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.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 TfrmClothQuotationInPut.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('CostRate').Value := 1.3;
|
|||
|
FieldByName('MVCSID').Value := maxno;
|
|||
|
FieldByName('C_Color').Value := '';
|
|||
|
FieldByName('Price').Value := null;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
SetXH();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.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 TfrmClothQuotationInPut.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv1', Tv1, '<27><><EFBFBD>۱<EFBFBD><DBB1>۹<EFBFBD><DBB9><EFBFBD>');
|
|||
|
WriteCxGrid(trim(self.Caption) + 'Tv2', Tv2, '<27><><EFBFBD>۱<EFBFBD><DBB1>۹<EFBFBD><DBB9><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.ToolButton4Click(Sender: TObject);
|
|||
|
begin
|
|||
|
GroupBox5.Visible := not GroupBox5.Visible;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.ToolButton5Click(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
Order_Sub.EnableControls;
|
|||
|
i := Order_Sub.RecordCount + 1;
|
|||
|
frmClothInfoSel := TfrmClothInfoSel.Create(self);
|
|||
|
with frmClothInfoSel do
|
|||
|
begin
|
|||
|
IsMultipleSelection := True;
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
with CDS_Selok do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
Order_Sub.DisableControls;
|
|||
|
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;
|
|||
|
Order_Sub.Append;
|
|||
|
Order_Sub.FieldByName('MVCSID').Value := maxno;
|
|||
|
Order_Sub.FieldByName('SerialNo').Value := i;
|
|||
|
Order_Sub.fieldbyname('CostRate').Value := 1.3;
|
|||
|
Order_Sub.fieldbyname('C_Code').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_Code').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Name').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_Name').asstring;
|
|||
|
Order_Sub.fieldbyname('C_EName').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_EName').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Spec').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_Spec').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Composition').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_Composition').asstring;
|
|||
|
Order_Sub.fieldbyname('C_EComposition').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_EComposition').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Color').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_Color').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Width').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_Width').asstring;
|
|||
|
Order_Sub.fieldbyname('C_GramWeight').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_GramWeight').asstring;
|
|||
|
Order_Sub.fieldbyname('GC_Name').Value := frmClothInfoSel.CDS_Selok.fieldbyname('GC_Name').asstring;
|
|||
|
Order_Sub.fieldbyname('CraftCode').Value := frmClothInfoSel.CDS_Selok.fieldbyname('CraftCode').asstring;
|
|||
|
Order_Sub.fieldbyname('CraftName').Value := frmClothInfoSel.CDS_Selok.fieldbyname('CraftName').asstring;
|
|||
|
Order_Sub.fieldbyname('CraftEName').Value := frmClothInfoSel.CDS_Selok.fieldbyname('CraftEName').asstring;
|
|||
|
Order_Sub.fieldbyname('FtyName').Value := frmClothInfoSel.CDS_Selok.fieldbyname('FtyName').asstring;
|
|||
|
Order_Sub.fieldbyname('FtyNo').Value := frmClothInfoSel.CDS_Selok.fieldbyname('FtyNo').asstring;
|
|||
|
Order_Sub.fieldbyname('C_YarnSpec').Value := frmClothInfoSel.CDS_Selok.fieldbyname('C_YarnSpec').asstring;
|
|||
|
Order_Sub.Post;
|
|||
|
i := i + 1;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
Order_Sub.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.Tv1Column15PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmInputBoxCostPrice := TfrmInputBoxCostPrice.Create(Application);
|
|||
|
with frmInputBoxCostPrice do
|
|||
|
begin
|
|||
|
CostPrice.Text := Order_Sub.FieldByName('CostPrice').AsString;
|
|||
|
CostPriceEquation.Text := Order_Sub.FieldByName('CostPriceEquation').AsString;
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('CostPrice').Value := CostPrice.Text;
|
|||
|
FieldByName('CostPriceEquation').Value := CostPriceEquation.Text;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
JSBJ();
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmInputBoxCostPrice.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.Tv1Column15PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName(FFieldName).Value := Trim(mvalue);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
JSBJ();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
|||
|
begin
|
|||
|
InitHistoricalPrice();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmClothQuotationInPut.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 TfrmClothQuotationInPut.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 TfrmClothQuotationInPut.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 TfrmClothQuotationInPut.SalesmanBtnUpClick(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 TfrmClothQuotationInPut.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;
|
|||
|
|
|||
|
end.
|
|||
|
|