1257 lines
35 KiB
ObjectPascal
1257 lines
35 KiB
ObjectPascal
![]() |
unit U_SalesConInPut;
|
|||
|
|
|||
|
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, math, 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,
|
|||
|
cxCurrencyEdit;
|
|||
|
|
|||
|
type
|
|||
|
TfrmSalesConInPut = class(TfrmBaseInput)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBSave: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
Label3: TLabel;
|
|||
|
ConDate: TDateTimePicker;
|
|||
|
ToolBar2: TToolBar;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
ToolButton2: TToolButton;
|
|||
|
cxGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
v1PRTPrice: TcxGridDBColumn;
|
|||
|
ADOTemp: TADOQuery;
|
|||
|
ADOCmd: TADOQuery;
|
|||
|
DS_1: TDataSource;
|
|||
|
Order_Sub: TClientDataSet;
|
|||
|
v1PRTOrderQty: TcxGridDBColumn;
|
|||
|
Label9: TLabel;
|
|||
|
Label10: TLabel;
|
|||
|
ConNo: TEdit;
|
|||
|
Label14: TLabel;
|
|||
|
Label20: TLabel;
|
|||
|
BuyName: TBtnEditC;
|
|||
|
v1XHNo: TcxGridDBColumn;
|
|||
|
v1OrderUnit: TcxGridDBColumn;
|
|||
|
Label6: TLabel;
|
|||
|
Label34: TLabel;
|
|||
|
BuyConNo: TEdit;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
VC_SCSCode: TcxGridDBColumn;
|
|||
|
cxgrdpmn1: TcxGridPopupMenu;
|
|||
|
QtyNote: TBtnEditC;
|
|||
|
Sellname: TBtnEditC;
|
|||
|
MiddleName: TBtnEditC;
|
|||
|
Label26: TLabel;
|
|||
|
Label27: TLabel;
|
|||
|
IsTax: TComboBox;
|
|||
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
Label29: TLabel;
|
|||
|
Label30: TLabel;
|
|||
|
QiYun: TBtnEditC;
|
|||
|
MuDi: TBtnEditC;
|
|||
|
Label2: TLabel;
|
|||
|
ExchangeRate: TEdit;
|
|||
|
Label5: TLabel;
|
|||
|
Currency: TComboBox;
|
|||
|
Label7: TLabel;
|
|||
|
YongJin: TEdit;
|
|||
|
Label11: TLabel;
|
|||
|
Label12: TLabel;
|
|||
|
YunShu: TBtnEditC;
|
|||
|
Payment: TBtnEditC;
|
|||
|
Label4: TLabel;
|
|||
|
GSChuanYangNote: TBtnEditC;
|
|||
|
Label13: TLabel;
|
|||
|
JiaGeSY: TBtnEditC;
|
|||
|
Label1: TLabel;
|
|||
|
CKChuanYangNote: TBtnEditC;
|
|||
|
pm_sub: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
Pic_Image1: TcxDBImage;
|
|||
|
DataSource1: TDataSource;
|
|||
|
ADOQueryImage: TADOQuery;
|
|||
|
MTieJing: TRichEdit;
|
|||
|
cxDBImage1: TcxDBImage;
|
|||
|
DS_ImgHX: TDataSource;
|
|||
|
Qry_ImgHX: TADOQuery;
|
|||
|
IdFTP1: TIdFTP;
|
|||
|
Label8: TLabel;
|
|||
|
Packing: TBtnEditC;
|
|||
|
Label15: TLabel;
|
|||
|
Label16: TLabel;
|
|||
|
DlyDate: TDateTimePicker;
|
|||
|
YFTPName: TBtnEditC;
|
|||
|
Label17: TLabel;
|
|||
|
N2: TMenuItem;
|
|||
|
ShippMent: TEdit;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
Label23: TLabel;
|
|||
|
ConType: TComboBox;
|
|||
|
Label24: TLabel;
|
|||
|
Saleser: TEdit;
|
|||
|
Tallyer: TEdit;
|
|||
|
lblSalesId: TLabel;
|
|||
|
Label25: TLabel;
|
|||
|
SalesId: TEdit;
|
|||
|
TallyId: TEdit;
|
|||
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
Tv1Column12: TcxGridDBColumn;
|
|||
|
btn1: TToolButton;
|
|||
|
btn2: TToolButton;
|
|||
|
cxgrdbclmnTv1Column13: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTv1Column14: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTv1Column15: TcxGridDBColumn;
|
|||
|
lbl1: TLabel;
|
|||
|
SellAddress: TBtnEditC;
|
|||
|
cxgrdbclmnTv1Column16: TcxGridDBColumn;
|
|||
|
cxgrdbclmnTv1Column17: TcxGridDBColumn;
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
procedure BuyNameBtnUpClick(Sender: TObject);
|
|||
|
procedure BuyNameBtnDnClick(Sender: TObject);
|
|||
|
procedure v1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v1Column6PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v1Column7PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure v1Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure SalesmanBtnUpClick(Sender: TObject);
|
|||
|
procedure v1Column15PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure SellNameBtnUpClick(Sender: TObject);
|
|||
|
procedure MiddleNameBtnUpClick(Sender: TObject);
|
|||
|
procedure v1PRTOrderQtyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure QiYunBtnUpClick(Sender: TObject);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure Pic_Image1DblClick(Sender: TObject);
|
|||
|
procedure cxDBImage1DblClick(Sender: TObject);
|
|||
|
procedure YFTPNameBtnUpClick(Sender: TObject);
|
|||
|
procedure MTieJingDblClick(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure ShippMentKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure Tv1Column12PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
procedure btn1Click(Sender: TObject);
|
|||
|
procedure btn2Click(Sender: TObject);
|
|||
|
private
|
|||
|
FLeft, FTop: Integer;
|
|||
|
fuserName, Fstatus: string;
|
|||
|
procedure InitImage();
|
|||
|
procedure JSMoney();
|
|||
|
procedure InitData();
|
|||
|
procedure ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
|||
|
function TestData(): Boolean;
|
|||
|
function SaveData(): Boolean;
|
|||
|
procedure SetXH();
|
|||
|
procedure LookImage(FileName: string);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
CopyInt: Integer;
|
|||
|
PState: string;
|
|||
|
fFlileFlag: string;
|
|||
|
FConMId: string;
|
|||
|
FAuthority, FGSTT: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmSalesConInPut: TfrmSalesConInPut;
|
|||
|
newh: hwnd;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_ClothInfoSel, U_PictureUpload,
|
|||
|
U_LabSet, U_ClothInfoInput, U_Customer, U_ClothInfo;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.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 TfrmSalesConInPut.ShippMentKeyPress(Sender: TObject; var Key: Char);
|
|||
|
begin
|
|||
|
|
|||
|
if not (((Key >= '0') and (Key <= '9')) or (Key = '.') or (Key = #8)) then
|
|||
|
begin
|
|||
|
Key := #0;
|
|||
|
end
|
|||
|
else if (pos('.', TEdit(Sender).text) <> 0) then
|
|||
|
begin
|
|||
|
if Key = '.' then
|
|||
|
begin
|
|||
|
Key := #0;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.InitImage();
|
|||
|
begin
|
|||
|
with ADOQueryImage do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from TP_File A');
|
|||
|
sql.Add('where isnull(WBID,'''')<>'''' and FileName=' + quotedstr(Trim(YFTPName.Text)));
|
|||
|
// showmessage(sql.text); Self..Text
|
|||
|
open;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.JSMoney();
|
|||
|
var
|
|||
|
FConQty, FConPrice, FC_Money: Double;
|
|||
|
begin
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
FConQty := Fieldbyname('ConQty').AsFloat;
|
|||
|
FConPrice := Fieldbyname('ConPrice').AsFloat;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEA3AC><EFBFBD><EFBFBD>2λС<CEBB><D0A1>
|
|||
|
FC_Money := RoundFloat(FConQty * FConPrice, 2);
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('ConTotalAmount').Value := FC_Money;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmSalesConInPut.TestData(): Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
if Trim(ConNo.Text) = '' then
|
|||
|
raise Exception.Create('<27><>ͬ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(SellName.Text) = '' then
|
|||
|
raise Exception.Create('<27><>Ӫ<EFBFBD><D3AA>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(BuyConNo.Text) = '' then
|
|||
|
raise Exception.Create('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(BuyName.Text) = '' then
|
|||
|
raise Exception.Create('<27>Է<EFBFBD><D4B7><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Trim(ConType.Text) = '' then
|
|||
|
raise Exception.Create('<27><><EFBFBD>Ͳ<EFBFBD><CDB2><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('ConQty', null, []) then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Order_Sub.Locate('ConQty', 0, []) then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30>');
|
|||
|
|
|||
|
// if Order_Sub.Locate('ConPrice', null, []) then
|
|||
|
// raise Exception.Create('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
// if Order_Sub.Locate('ConPrice', 0, []) then
|
|||
|
// raise Exception.Create('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ0<CEAA><30>');
|
|||
|
|
|||
|
if Order_Sub.Locate('ConUnit', null, []) then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Order_Sub.Locate('ConUnit', '', []) then
|
|||
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
|
|||
|
// if Order_Sub.Locate('ConSNote', null, []) then
|
|||
|
// raise Exception.Create('<27><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
// if Order_Sub.Locate('ConSNote', '', []) then
|
|||
|
// raise Exception.Create('<27><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Order_Sub.Locate('LabName', null, []) then
|
|||
|
raise Exception.Create('<27><>ǩ<EFBFBD><C7A9><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
if Order_Sub.Locate('LabName', '', []) then
|
|||
|
raise Exception.Create('<27><>ǩ<EFBFBD><C7A9><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.InitData();
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
//ˢ<>²<EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ
|
|||
|
with ADOTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(' select * from BS_Contract_Sub ');
|
|||
|
sql.Add('where ConMId=''' + Trim(FConMId) + '''');
|
|||
|
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 BS_Contract_Main where ConMId=''' + Trim(FConMId) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCSHData(ADOTemp, ScrollBox1, 2);
|
|||
|
BuyName.TxtCode := Trim(ADOTemp.FieldByName('BuyNo').AsString);
|
|||
|
Sellname.TxtCode := Trim(ADOTemp.FieldByName('SellNo').AsString);
|
|||
|
MiddleName.TxtCode := Trim(ADOTemp.FieldByName('MiddleNo').AsString);
|
|||
|
Fstatus := Trim(ADOTemp.FieldByName('status').AsString);
|
|||
|
|
|||
|
if PState = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
ConDate.DateTime := SGetServerDateTime(ADOTemp);
|
|||
|
DlyDate.DateTime := ConDate.DateTime;
|
|||
|
ConNo.Text := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if PState = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
|
|||
|
PState := '<27><><EFBFBD><EFBFBD>';
|
|||
|
FConMId := '';
|
|||
|
ConNo.Text := '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if GetLSNo(ADOCmd, maxno, 'SCS', 'BS_Contract_Sub', 4, 1) = False then
|
|||
|
begin
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
Edit;
|
|||
|
FieldByName('ConMId').Value := '';
|
|||
|
FieldByName('ConSId').Value := maxno;
|
|||
|
Post;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.MiddleNameBtnUpClick(Sender: TObject);
|
|||
|
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.MiddleName.TxtCode := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
self.MiddleName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.MTieJingDblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
// flag := 'TJ' + TRIM(Order_Sub.fieldbyname('C_Code').AsString) + TRIM(BuyName.TxtCode);
|
|||
|
flag := 'TJ';
|
|||
|
flagname := '<27><><EFBFBD><EFBFBD>';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
MTieJing.Text := StringReplace(Trim(ClientDataSet1.fieldbyname('ZDYName').AsString), '#', #$D#$A, [rfReplaceAll]);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.N1Click(Sender: TObject);
|
|||
|
var
|
|||
|
FValue, FFValue, FColumn, FFColumn, MHXSID: string;
|
|||
|
MXHNO: Integer;
|
|||
|
begin
|
|||
|
if Fstatus = '1' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
MXHNO := Order_Sub.FieldByName('XHNo').ASInteger;
|
|||
|
FColumn := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
FValue := Trim(Order_Sub.fieldbyname(FColumn).AsString);
|
|||
|
MHXSID := Trim(Order_Sub.fieldbyname('HXSID').AsString);
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
|
|||
|
if FValue = '' then
|
|||
|
begin
|
|||
|
Order_Sub.FieldByName(FColumn).Value := null;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Order_Sub.FieldByName(FColumn).Value := FValue;
|
|||
|
end;
|
|||
|
if FColumn = 'C_HX' then
|
|||
|
begin
|
|||
|
Order_Sub.FieldByName('HXSID').Value := MHXSID;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
JSMoney();
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
Order_Sub.Locate('XHNO', MXHNO, []);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.N2Click(Sender: TObject);
|
|||
|
var
|
|||
|
FValue, MC_Code, MC_Craft, MC_Name, MC_Spec, MC_CF, MC_Color, MC_MF, MC_KZ, MC_Note, MC_Unit, MGcHuaNo, MSuoLv, MC_EName: string;
|
|||
|
MXHNO: Integer;
|
|||
|
begin
|
|||
|
if Fstatus = '1' then
|
|||
|
begin
|
|||
|
application.MessageBox('<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
MXHNO := Order_Sub.FieldByName('XHNo').ASInteger;
|
|||
|
MC_Code := Order_Sub.fieldbyname('C_Code').AsString;
|
|||
|
MC_Craft := Order_Sub.fieldbyname('C_Craft').AsString;
|
|||
|
MC_Name := Order_Sub.fieldbyname('C_Name').AsString;
|
|||
|
MC_Spec := Order_Sub.fieldbyname('C_Spec').AsString;
|
|||
|
MC_CF := Order_Sub.fieldbyname('C_CF').AsString;
|
|||
|
MC_Color := Order_Sub.fieldbyname('C_Color').AsString;
|
|||
|
MC_MF := Order_Sub.fieldbyname('C_MF').AsString;
|
|||
|
MC_KZ := Order_Sub.fieldbyname('C_KZ').AsString;
|
|||
|
MC_Note := Order_Sub.fieldbyname('C_Note').AsString;
|
|||
|
MC_Unit := Order_Sub.fieldbyname('C_Unit').AsString;
|
|||
|
MSuoLv := Order_Sub.fieldbyname('SuoLv').AsString;
|
|||
|
MGcHuaNo := Order_Sub.fieldbyname('GcHuaNo').AsString;
|
|||
|
MC_EName := Order_Sub.fieldbyname('C_EName').AsString;
|
|||
|
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
Order_Sub.fieldbyname('C_Code').Value := MC_Code;
|
|||
|
Order_Sub.fieldbyname('C_Craft').Value := MC_Craft;
|
|||
|
Order_Sub.fieldbyname('C_Name').Value := MC_Name;
|
|||
|
Order_Sub.fieldbyname('C_Spec').Value := MC_Spec;
|
|||
|
Order_Sub.fieldbyname('C_CF').Value := MC_CF;
|
|||
|
Order_Sub.fieldbyname('C_Color').Value := MC_Color;
|
|||
|
Order_Sub.fieldbyname('C_MF').Value := MC_MF;
|
|||
|
Order_Sub.fieldbyname('C_KZ').Value := MC_KZ;
|
|||
|
Order_Sub.fieldbyname('C_Note').Value := MC_Note;
|
|||
|
Order_Sub.fieldbyname('C_Unit').Value := MC_Unit;
|
|||
|
Order_Sub.fieldbyname('SuoLv').Value := MSuoLv;
|
|||
|
Order_Sub.fieldbyname('GcHuaNo').Value := MGcHuaNo;
|
|||
|
Order_Sub.fieldbyname('C_EName').Value := MC_EName;
|
|||
|
Post;
|
|||
|
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
Order_Sub.Locate('XHNO', MXHNO, []);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.Pic_Image1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if TcxDBImage(Sender).Picture.Height = 0 then
|
|||
|
exit;
|
|||
|
|
|||
|
LookImage(ADOQueryImage.fieldbyname(TcxDBImage(Sender).Hint).asstring);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.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 TfrmSalesConInPut.QiYunBtnUpClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
|||
|
var
|
|||
|
FType, ZDYName, FText: string;
|
|||
|
begin
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
readCxGrid(trim(self.Caption), Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
fFlileFlag := UserDataFlag + 'HX';
|
|||
|
// if Trim(FConMId) <> '' then
|
|||
|
// begin
|
|||
|
// VC_SCSCode.Options.Editing := false;
|
|||
|
// v1Column4.Options.Editing := false;
|
|||
|
// end;
|
|||
|
InitData();
|
|||
|
InitImage();
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmSalesConInPut.SaveData(): Boolean;
|
|||
|
var
|
|||
|
maxno: string;
|
|||
|
fconNO, fmxType, fDate: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOCmd.Connection.BeginTrans;
|
|||
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////
|
|||
|
if Trim(FConMId) = '' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOTemp, maxno, 'SCM', 'BS_Contract_Main', 3, 1) = False then
|
|||
|
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
|
|||
|
fDate := FormatDateTime('yy', SGetServerDate(ADOTemp));
|
|||
|
|
|||
|
if trim(ConNo.Text) = '<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOTemp, fconNO, fDate, 'BS_Contract_Main', 4, 0) = False then
|
|||
|
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
if ConType.Text = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
fconNO := 'N' + fconNO
|
|||
|
else
|
|||
|
fconNO := 'W' + fconNO;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Contract_Main where ConNo=''' + Trim(fconNO) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOCmd.RecordCount > 0 then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOTemp, fconNO, fDate, 'BS_Contract_Main', 4, 0) = False then
|
|||
|
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
if ConType.Text = '<27><><EFBFBD><EFBFBD>' then
|
|||
|
fconNO := 'N' + fconNO
|
|||
|
else
|
|||
|
fconNO := 'W' + fconNO;
|
|||
|
end;
|
|||
|
|
|||
|
ConNo.Text := fconNO;
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
maxno := Trim(FConMId);
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from BS_Contract_Main where ConMId=''' + Trim(FConMId) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
if Trim(FConMId) = '' 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('ConMId').Value := Trim(maxno);
|
|||
|
RTSetsavedata(ADOCmd, 'BS_Contract_Main', ScrollBox1, 2);
|
|||
|
FieldByName('BuyNo').Value := Trim(BuyName.TxtCode);
|
|||
|
FieldByName('SellNo').Value := Sellname.TxtCode;
|
|||
|
FieldByName('MiddleNo').Value := MiddleName.TxtCode;
|
|||
|
FieldByName('status').Value := '9';
|
|||
|
FieldByName('ChkId').Value := Trim(DCode);
|
|||
|
FieldByName('Chker').Value := Trim(DName);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from BS_Contract_Main where ConNo=''' + Trim(ConNo.Text) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOCmd.RecordCount > 1 then
|
|||
|
raise Exception.Create('<27><>ͬ<EFBFBD><CDAC><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>');
|
|||
|
|
|||
|
FConMId := 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('ConSId').AsString);
|
|||
|
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select * from BS_Contract_Sub where ConSId=''' + Trim(maxno) + '''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
if ADOCmd.IsEmpty then
|
|||
|
Append
|
|||
|
else
|
|||
|
Edit;
|
|||
|
RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'BS_Contract_Sub', 0);
|
|||
|
FieldByName('ConMId').Value := Trim(FConMId);
|
|||
|
FieldByName('ConSId').Value := Trim(maxno);
|
|||
|
|
|||
|
Post;
|
|||
|
end;
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('ConSId').Value := Trim(maxno);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////
|
|||
|
///
|
|||
|
//////////////// <20><><EFBFBD>º<EFBFBD>ͬ //////////////////////
|
|||
|
// with ADOCmd do
|
|||
|
// begin
|
|||
|
// close;
|
|||
|
// sql.Clear;
|
|||
|
// sql.Add('EXEC P_Con_Up_PiQty ');
|
|||
|
// sql.Add('@DataID=' + quotedstr(Trim(FConMId)));
|
|||
|
// execsql;
|
|||
|
// end;
|
|||
|
//////////////// <20><><EFBFBD>º<EFBFBD>ͬ //////////////////////
|
|||
|
|
|||
|
ADOCmd.Connection.CommitTrans;
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
Result := False;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.TBSaveClick(Sender: TObject);
|
|||
|
begin
|
|||
|
ConDate.SetFocus;
|
|||
|
|
|||
|
if TestData() = false then
|
|||
|
exit;
|
|||
|
|
|||
|
if SaveData() then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.v1PRTOrderQtyPropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue, FFieldName: string;
|
|||
|
FConQty, FConPrice, FC_Money, FCB, FLR, FPS, FPC: Double; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۣ<EFBFBD><DBA3><EFBFBD><EFBFBD><EFBFBD> ,<2C>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ƥ<><C6A5><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
|
|||
|
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;
|
|||
|
FConQty := Fieldbyname('ConQty').AsFloat;
|
|||
|
FConPrice := Fieldbyname('ConPrice').AsFloat;
|
|||
|
FCB := Fieldbyname('CBPrice').AsFloat;
|
|||
|
// FPC := Fieldbyname('ConPieceWeight').AsFloat;
|
|||
|
end;
|
|||
|
|
|||
|
FC_Money := RoundFloat(FConQty * FConPrice, 2);
|
|||
|
FLR := RoundFloat((FConPrice - FCB) * FConQty, 2);
|
|||
|
// if (FPC <> null) and (FPC <> 0) then
|
|||
|
// begin
|
|||
|
// FPS := Ceil(FConQty / FPC);
|
|||
|
// end
|
|||
|
// else
|
|||
|
// begin
|
|||
|
// FPS := 0;
|
|||
|
// end;
|
|||
|
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('ConQty').Value := FConQty;
|
|||
|
FieldByName('ConPrice').Value := FConPrice;
|
|||
|
FieldByName('CBPrice').Value := FCB;
|
|||
|
FieldByName('ConTotalAmount').Value := FC_Money;
|
|||
|
FieldByName('LRPrice').Value := FLR;
|
|||
|
// FieldByName('ConPieceWeight').Value := FPC;
|
|||
|
// FieldByName('ConPiece').Value := FPS;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.YFTPNameBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if FConMId = '' then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
try
|
|||
|
frmPictureUpload := TfrmPictureUpload.create(self);
|
|||
|
with frmPictureUpload do
|
|||
|
begin
|
|||
|
fFlileFlag := self.fFlileFlag;
|
|||
|
FDataId := trim(Self.FConMId);
|
|||
|
FPictureName := TRIM(YFTPName.Text);
|
|||
|
FWidth := 450;
|
|||
|
FHeight := 600;
|
|||
|
// FTFType := 'HX';
|
|||
|
FTFType := 'YP';
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
Self.YFTPName.Text := frmPictureUpload.FPictureName;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmPictureUpload.free;
|
|||
|
end;
|
|||
|
InitImage();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
maxno: string;
|
|||
|
begin
|
|||
|
if GetLSNo(ADOCmd, maxno, 'C_', 'BS_Contract_Sub', 4, 1) = False then
|
|||
|
begin
|
|||
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Trim(ConNo.Text) = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><>ͬ<EFBFBD>Ų<EFBFBD><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('ConSId').Value := maxno;
|
|||
|
FieldByName('C_Color').Value := '';
|
|||
|
FieldByName('LabName').Value := '';
|
|||
|
FieldByName('ConQty').Value := null;
|
|||
|
FieldByName('LengthNumber').Value := 1;
|
|||
|
FieldByName('DlyDate').Value := ConDate.Date;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
SetXH();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.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 Knit_Plan_Sub where ConSId=''' + Trim(Order_Sub.fieldbyname('ConSId').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('ConSId').AsString) <> '' then
|
|||
|
begin
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('delete BS_Contract_Sub where ConSId=''' + Trim(Order_Sub.fieldbyname('ConSId').AsString) + '''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Order_Sub.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
SetXH();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.ToolButton3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid(trim(self.Caption), Tv1, '<27><><EFBFBD>ۺ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>');
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.Tv1Column12PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
MCYNo: string;
|
|||
|
begin
|
|||
|
ExportFtErpFile('ģ<><C4A3><EFBFBD><EFBFBD>ǩ.rmf', ADOTemp);
|
|||
|
frmLabSet := TfrmLabSet.Create(self);
|
|||
|
with frmLabSet do
|
|||
|
begin
|
|||
|
if Self.FAuthority = '¼<><C2BC>' then
|
|||
|
FAuthority := '<27><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>';
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
Order_Sub.Edit;
|
|||
|
Order_Sub.fieldbyname('LabName').Value := frmLabSet.CDS_Label.fieldbyname('labelCaption').asstring;
|
|||
|
Order_Sub.Post;
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.BuyNameBtnUpClick(Sender: TObject);
|
|||
|
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.TxtCode := 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.TallyId.Text := Trim(frmCompanySel.CDS_1.fieldbyname('TallyId').AsString);
|
|||
|
self.Tallyer.Text := Trim(frmCompanySel.CDS_1.fieldbyname('Tallyer').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.cxDBImage1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if TcxDBImage(Sender).Picture.Height = 0 then
|
|||
|
exit;
|
|||
|
|
|||
|
LookImage(Qry_ImgHX.fieldbyname(TcxDBImage(Sender).Hint).asstring);
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.btn1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCustomer := TfrmCustomer.Create(Application);
|
|||
|
with frmCustomer do
|
|||
|
begin
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmCustomer.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.btn2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
// try
|
|||
|
// frmClothInfo := TfrmClothInfo.create(application);
|
|||
|
// with frmClothInfo do
|
|||
|
// begin
|
|||
|
//
|
|||
|
// if ShowModal = 1 then
|
|||
|
// begin
|
|||
|
//
|
|||
|
// end;
|
|||
|
// end;
|
|||
|
// finally
|
|||
|
// frmClothInfo.Free;
|
|||
|
// end;
|
|||
|
try
|
|||
|
frmClothInfo := TfrmClothInfo.Create(Application);
|
|||
|
with frmClothInfo do
|
|||
|
begin
|
|||
|
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmClothInfo.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.BuyNameBtnDnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TBtnEditC(Sender).Text := '';
|
|||
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.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 TfrmSalesConInPut.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 TfrmSalesConInPut.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 TfrmSalesConInPut.v1Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
var
|
|||
|
MCYNo: string;
|
|||
|
begin
|
|||
|
frmClothInfoSel := TfrmClothInfoSel.Create(self);
|
|||
|
with frmClothInfoSel do
|
|||
|
begin
|
|||
|
if Self.FAuthority = '¼<><C2BC>' then
|
|||
|
FAuthority := '<27><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>';
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
Order_Sub.Edit;
|
|||
|
Order_Sub.fieldbyname('C_Code').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Code').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Name').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Name').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Width').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Width').asstring;
|
|||
|
Order_Sub.fieldbyname('C_KnitGramWeight').Value := frmClothInfoSel.CDS_1.fieldbyname('C_KnitGramWeight').asstring;
|
|||
|
Order_Sub.fieldbyname('C_GramWeight').Value := frmClothInfoSel.CDS_1.fieldbyname('C_GramWeight').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Color').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Color').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Composition').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Composition').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Deal').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Deal').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Spec').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Spec').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Figure').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Figure').asstring;
|
|||
|
Order_Sub.fieldbyname('C_Yarn').Value := frmClothInfoSel.CDS_1.fieldbyname('C_Yarn').asstring;
|
|||
|
Order_Sub.fieldbyname('ConSNote').Value := frmClothInfoSel.CDS_1.fieldbyname('Note').asstring;
|
|||
|
Order_Sub.fieldbyname('C_KHCode').Value := frmClothInfoSel.CDS_1.fieldbyname('C_KHCode').asstring;
|
|||
|
Order_Sub.fieldbyname('ConUnit').Value := 'M';
|
|||
|
Order_Sub.Post;
|
|||
|
end;
|
|||
|
free;
|
|||
|
end;
|
|||
|
|
|||
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.SalesmanBtnUpClick(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
FWZ: Integer;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(Sender).Hint);
|
|||
|
FWZ := Pos('/', fsj);
|
|||
|
try
|
|||
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag := Copy(fsj, 1, FWZ - 1);
|
|||
|
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.v1Column15PropertiesEditValueChanged(Sender: TObject);
|
|||
|
var
|
|||
|
mvalue: string;
|
|||
|
begin
|
|||
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
|||
|
if Trim(mvalue) = '' then
|
|||
|
begin
|
|||
|
mvalue := '0';
|
|||
|
end;
|
|||
|
with Order_Sub do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('YongJinPrice').Value := mvalue;
|
|||
|
FieldByName('YongJin').Value := FieldByName('YongJinPrice').AsFloat * FieldByName('PRTOrderQty').AsFloat;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSalesConInPut.SellNameBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
with frmCompanySel do
|
|||
|
begin
|
|||
|
FCoType := '<27><>˾';
|
|||
|
if ShowModal = 1 then
|
|||
|
begin
|
|||
|
self.Sellname.TxtCode := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
self.Sellname.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
finally
|
|||
|
frmCompanySel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|