1162 lines
31 KiB
ObjectPascal
1162 lines
31 KiB
ObjectPascal
|
|
unit U_OrderHSInPut;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
|
cxEdit, DB, cxDBData, ADODB, DBClient, cxGridLevel, cxGridCustomTableView,
|
|||
|
|
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
|||
|
|
cxGrid, ComCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, cxTextEdit,
|
|||
|
|
cxButtonEdit, StdCtrls, ExtCtrls, cxCurrencyEdit, BtnEdit, cxLookAndFeels,
|
|||
|
|
cxLookAndFeelPainters, cxNavigator, cxDropDownEdit, Menus, cxButtons,
|
|||
|
|
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdFTP, ImgList,
|
|||
|
|
ShellAPI, StrUtils;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmOrderHSInPut = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
CDS_Sub: TClientDataSet;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
ScrollBox1: TScrollBox;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
PBPS: TEdit;
|
|||
|
|
Label23: TLabel;
|
|||
|
|
PBNote: TMemo;
|
|||
|
|
XDDate: TDateTimePicker;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v2Column12: TcxGridDBColumn;
|
|||
|
|
v2Column15: TcxGridDBColumn;
|
|||
|
|
v2Column7: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
PBQty: TEdit;
|
|||
|
|
PBUnit: TComboBox;
|
|||
|
|
PBMoney: TEdit;
|
|||
|
|
Label19: TLabel;
|
|||
|
|
RSPS: TEdit;
|
|||
|
|
RSQty: TEdit;
|
|||
|
|
RSMoney: TEdit;
|
|||
|
|
Label25: TLabel;
|
|||
|
|
HGYPS: TEdit;
|
|||
|
|
HGYQty: TEdit;
|
|||
|
|
HGYMoney: TEdit;
|
|||
|
|
Label29: TLabel;
|
|||
|
|
CPPS: TEdit;
|
|||
|
|
CPQty: TEdit;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
RSNote: TMemo;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
HGYNote: TMemo;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
BXFee: TEdit;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
ShuiLv: TComboBox;
|
|||
|
|
KPFee: TEdit;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
DJPrice: TEdit;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
KLFee: TEdit;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
HYFee: TEdit;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
ZaFee: TEdit;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
XSQty: TEdit;
|
|||
|
|
Label15: TLabel;
|
|||
|
|
XSPrice: TEdit;
|
|||
|
|
Label22: TLabel;
|
|||
|
|
PriceType: TComboBox;
|
|||
|
|
HuiLv: TEdit;
|
|||
|
|
Label32: TLabel;
|
|||
|
|
TBSel: TToolButton;
|
|||
|
|
Tv1Column1: TcxGridDBColumn;
|
|||
|
|
Tv1Column2: TcxGridDBColumn;
|
|||
|
|
XDXS: TComboBox;
|
|||
|
|
PBPriceAvg: TEdit;
|
|||
|
|
RSPriceAvg: TEdit;
|
|||
|
|
HGYPriceAvg: TEdit;
|
|||
|
|
CPMoney: TEdit;
|
|||
|
|
CPPriceAvg: TEdit;
|
|||
|
|
Tv1Column3: TcxGridDBColumn;
|
|||
|
|
Tv1Column4: TcxGridDBColumn;
|
|||
|
|
Tv1Column5: TcxGridDBColumn;
|
|||
|
|
Label38: TLabel;
|
|||
|
|
TuiShui: TEdit;
|
|||
|
|
Label39: TLabel;
|
|||
|
|
ShuiFee: TEdit;
|
|||
|
|
Label40: TLabel;
|
|||
|
|
XDFee: TEdit;
|
|||
|
|
Label41: TLabel;
|
|||
|
|
DJFee: TEdit;
|
|||
|
|
HYFeeUnit: TComboBox;
|
|||
|
|
Tv1Column9: TcxGridDBColumn;
|
|||
|
|
Tv1Column10: TcxGridDBColumn;
|
|||
|
|
Label42: TLabel;
|
|||
|
|
Label43: TLabel;
|
|||
|
|
Label44: TLabel;
|
|||
|
|
Label45: TLabel;
|
|||
|
|
Label46: TLabel;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
FOBFee: TEdit;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
FKType: TBtnEditC;
|
|||
|
|
Label18: TLabel;
|
|||
|
|
XSMoney: TEdit;
|
|||
|
|
Label20: TLabel;
|
|||
|
|
XSMoneyRMB: TEdit;
|
|||
|
|
Label21: TLabel;
|
|||
|
|
Label24: TLabel;
|
|||
|
|
LiRun: TEdit;
|
|||
|
|
LiRunLv: TEdit;
|
|||
|
|
Label26: TLabel;
|
|||
|
|
Label27: TLabel;
|
|||
|
|
RSSHQty: TEdit;
|
|||
|
|
Label28: TLabel;
|
|||
|
|
Label30: TLabel;
|
|||
|
|
HGYSHQty: TEdit;
|
|||
|
|
Label31: TLabel;
|
|||
|
|
Label33: TLabel;
|
|||
|
|
CKSHQty: TEdit;
|
|||
|
|
Label34: TLabel;
|
|||
|
|
Label35: TLabel;
|
|||
|
|
HZSHQty: TEdit;
|
|||
|
|
Label36: TLabel;
|
|||
|
|
Label37: TLabel;
|
|||
|
|
Label47: TLabel;
|
|||
|
|
Label48: TLabel;
|
|||
|
|
HSGongShi: TEdit;
|
|||
|
|
ListView1: TListView;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
cxButton1: TcxButton;
|
|||
|
|
Label49: TLabel;
|
|||
|
|
ImageList1: TImageList;
|
|||
|
|
IdFTP1: TIdFTP;
|
|||
|
|
ADOQueryTmp: TADOQuery;
|
|||
|
|
Tv1Column6: TcxGridDBColumn;
|
|||
|
|
Tv1Column7: TcxGridDBColumn;
|
|||
|
|
Tv1Column8: TcxGridDBColumn;
|
|||
|
|
BZType: TEdit;
|
|||
|
|
XSUnit: TEdit;
|
|||
|
|
TuiShuiFlag: TCheckBox;
|
|||
|
|
Label50: TLabel;
|
|||
|
|
BXXS: TComboBox;
|
|||
|
|
Label51: TLabel;
|
|||
|
|
KPXS: TComboBox;
|
|||
|
|
Label52: TLabel;
|
|||
|
|
YongJin: TEdit;
|
|||
|
|
Label53: TLabel;
|
|||
|
|
YJUnit: TEdit;
|
|||
|
|
Label54: TLabel;
|
|||
|
|
SXFee: TEdit;
|
|||
|
|
Label55: TLabel;
|
|||
|
|
KuaiDiFee: TEdit;
|
|||
|
|
Tv1Column11: TcxGridDBColumn;
|
|||
|
|
Label56: TLabel;
|
|||
|
|
YunShuFee: TEdit;
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure TBSelClick(Sender: TObject);
|
|||
|
|
procedure Tv1DblClick(Sender: TObject);
|
|||
|
|
procedure PBQtyChange(Sender: TObject);
|
|||
|
|
procedure Tv1Column3PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure FKTypeBtnUpClick(Sender: TObject);
|
|||
|
|
procedure FKTypeBtnDnClick(Sender: TObject);
|
|||
|
|
procedure cxButton1Click(Sender: TObject);
|
|||
|
|
procedure ListView1DblClick(Sender: TObject);
|
|||
|
|
procedure Tv1Column6PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure Tv1Column7PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure Tv1Column10PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure TuiShuiFlagClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure InitSubGrid();
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
procedure GetData();
|
|||
|
|
procedure InitFJData();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
FCYID, GDFalg: string;
|
|||
|
|
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmOrderHSInPut: TfrmOrderHSInPut;
|
|||
|
|
newh: hwnd;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_iniParam, U_ZDYHelp, U_ContractListSel, U_FjList;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.InitSubGrid();
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add('select * from Order_HS where HSID=''' + Trim(FCYID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCSHDataNew(ADOQueryMain, ScrollBox1, 2);
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Order_HS_OrderNo where HSID=''' + Trim(FCYID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain, CDS_Sub);
|
|||
|
|
SInitCDSData20(ADOQueryMain, CDS_Sub);
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
XDDate.Date := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
GDFalg := '';
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
InitSubGrid();
|
|||
|
|
if Trim(FCYID) <> '' then
|
|||
|
|
begin
|
|||
|
|
InitFJData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmOrderHSInPut.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
maxId, Maxno, FHOID: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
if Trim(FCYID) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNoHZ(ADOQueryCmd, maxId, 'HS', 'Order_HS', 4, 1, 3) = False then
|
|||
|
|
begin
|
|||
|
|
Result := False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxId := Trim(FCYID);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('select * from Order_HS where HSID=''' + Trim(FCYID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(FCYID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
FieldByName('Valid').Value := 'Y';
|
|||
|
|
FieldByName('HZStatus').Value := '<27><><EFBFBD>ύ';
|
|||
|
|
FieldByName('HSTYpe').Value := 'ϸ<><CFB8>';
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
FieldByName('HSID').Value := Trim(maxId);
|
|||
|
|
RTSetsavedata(ADOQueryCmd, 'Order_HS', ScrollBox1, 2);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
FCYID := Trim(maxId);
|
|||
|
|
CDS_Sub.DisableControls;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Order_HS_OrderNo where HOID=''' + Trim(CDS_Sub.fieldbyname('HOID').AsString) + '''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
FHOID := Trim(ADOQueryCmd.fieldbyname('HOID').AsString);
|
|||
|
|
if Trim(FHOID) = '' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryCmd, Maxno, 'HO', 'Order_HS_OrderNo', 3, 1) = False then
|
|||
|
|
begin
|
|||
|
|
Result := False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Maxno := Trim(FHOID);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Order_HS_OrderNo where HOID=''' + Trim(Maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(FHOID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
end;
|
|||
|
|
FieldByName('HOID').Value := Trim(Maxno);
|
|||
|
|
FieldByName('HSID').Value := Trim(maxId);
|
|||
|
|
FieldByName('MainId').Value := Trim(CDS_Sub.fieldbyname('MainId').AsString);
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'Order_HS_OrderNo', 2);
|
|||
|
|
if Trim(FHOID) = '' then
|
|||
|
|
FieldByName('Filler').Value := Trim(DName)
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('HOID').Value := Trim(Maxno);
|
|||
|
|
FieldByName('HSID').Value := Trim(maxId);
|
|||
|
|
Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_Update_HSInfo_JD :HSID');
|
|||
|
|
Parameters.ParamByName('HSID').Value := Trim(maxId);
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.TBSaveClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FKHName, FYWY, FSPName, FLiDan, FDate: string;
|
|||
|
|
begin
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
FDate := FormatDateTime('yyyy-MM-dd', SGetServerDate(ADOQueryTmp));
|
|||
|
|
if Trim(FDate) = Trim(FormatDateTime('yyyy-MM-dd', XDDate.Date)) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>µ<EFBFBD>ʱ<EFBFBD><CAB1>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(BZType.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(FOBFee.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('FOB<4F><42><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(KuaiDiFee.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD>ݷѲ<DDB7><D1B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if Trim(YunShuFee.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ѳ<EFBFBD><D1B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
FKHName := Trim(CDS_Sub.fieldbyname('KHName').AsString);
|
|||
|
|
FYWY := Trim(CDS_Sub.fieldbyname('YWY').AsString);
|
|||
|
|
FSPName := Trim(CDS_Sub.fieldbyname('SPName').AsString);
|
|||
|
|
FLiDan := Trim(CDS_Sub.fieldbyname('LiDan').AsString);
|
|||
|
|
CDS_Sub.DisableControls;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if FKHName <> trim(CDS_Sub.fieldbyname('KHName').AsString) then
|
|||
|
|
begin
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if FYWY <> trim(CDS_Sub.fieldbyname('YWY').AsString) then
|
|||
|
|
begin
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>Ա<EFBFBD><D4B1>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if FSPName <> trim(CDS_Sub.fieldbyname('SPName').AsString) then
|
|||
|
|
begin
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if FLiDan <> trim(CDS_Sub.fieldbyname('LiDan').AsString) then
|
|||
|
|
begin
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
//ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.TBSelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmContractListSel := TfrmContractListSel.Create(Application);
|
|||
|
|
with frmContractListSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while Order_Main.locate('SSel', true, []) do
|
|||
|
|
begin
|
|||
|
|
if self.CDS_Sub.Locate('OrderNo', Trim(Order_Main.Fieldbyname('OrderNo').AsString), []) = False then
|
|||
|
|
begin
|
|||
|
|
with Self.ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select Top 1 SCSUnit');
|
|||
|
|
sql.Add(',CPUnit=(select Top 1 CK.QtyUnit from CK_SXPB_CR CK inner join JYOrder_Main JM on CK.ORDMainIdRK=JM.Mainid where JM.ConNo=A.ConNo)');
|
|||
|
|
sql.Add(' from SalesContract_Main A ');
|
|||
|
|
sql.Add(' inner join SalesContract_Sub B on A.MainId=B.MainId');
|
|||
|
|
sql.Add(' where A.MainId=''' + Trim(frmContractListSel.Order_Main.Fieldbyname('MainId').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
append;
|
|||
|
|
Fieldbyname('MainId').value := trim(frmContractListSel.Order_Main.Fieldbyname('MainId').AsString);
|
|||
|
|
Fieldbyname('OrderNo').value := trim(frmContractListSel.Order_Main.Fieldbyname('OrderNo').AsString);
|
|||
|
|
Fieldbyname('KHName').value := trim(frmContractListSel.Order_Main.Fieldbyname('BuyName').AsString);
|
|||
|
|
Fieldbyname('YWY').value := trim(frmContractListSel.Order_Main.Fieldbyname('Salesman').AsString);
|
|||
|
|
Fieldbyname('LiDan').value := trim(frmContractListSel.Order_Main.Fieldbyname('LiDan').AsString);
|
|||
|
|
Fieldbyname('SPName').value := trim(frmContractListSel.Order_Main.Fieldbyname('MPRTCodeName').AsString);
|
|||
|
|
Fieldbyname('XSUnit').value := trim(Self.ADOQueryTemp.Fieldbyname('SCSUnit').AsString);
|
|||
|
|
if Trim(Self.ADOQueryTemp.Fieldbyname('CPUnit').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('CPUnit').value := trim(Self.ADOQueryTemp.Fieldbyname('CPUnit').AsString);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Fieldbyname('CPUnit').value := 'Kg';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
if Trim(PBUnit.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
PBUnit.Text := trim(Self.ADOQueryTemp.Fieldbyname('CPUnit').AsString);
|
|||
|
|
end;
|
|||
|
|
if Trim(XSUnit.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
XSUnit.Text := trim(Self.ADOQueryTemp.Fieldbyname('SCSUnit').AsString);
|
|||
|
|
end;
|
|||
|
|
with Self.ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select KuLing=(KuLin2-KuLin1)/RKPS from(');
|
|||
|
|
sql.Add('select Kulin1=sum(Kulin1),KuLin2=sum(KuLin2),RKPS=sum(RKPS) from ');
|
|||
|
|
SQL.Add('CK_BanCP_KCKL where Mainid='''+Trim(frmContractListSel.Order_Main.Fieldbyname('MainId').AsString)+'''');
|
|||
|
|
sql.Add(')AA where AA.RKPS>0');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
Fieldbyname('KuLing').value := Self.ADOQueryTemp.Fieldbyname('KuLing').Value;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmContractListSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.GetData();
|
|||
|
|
var
|
|||
|
|
FPBQty, FPBMoney, FRSQty, FRSMoney, FHGYQty, FHGYMoney, FCPPS, FCPQty, FCPMoney, FTuiShui, FShuilv, FShuiFee, FXDXS, FXDFee, FBXXS, FBXFee, FFOBFee, FKPXS, FKPFee, FDJPrice, FDJFee, FKLFee, FHYFee, FYongJin, FSXFee, FZaFee, FKuaiDiFee,FYunShuFee, FXSQty, FXSPrice, FXSMoney, FHuiLv, FXSMoneyRMB, FLiRun, FLiRunLv, FXSMoneyHJ: string;
|
|||
|
|
begin
|
|||
|
|
if GDFalg <> '' then
|
|||
|
|
Exit;
|
|||
|
|
FPBQty := Trim(PBQty.Text);
|
|||
|
|
if FPBQty = '' then
|
|||
|
|
FPBQty := '0';
|
|||
|
|
FPBMoney := Trim(PBMoney.Text);
|
|||
|
|
if FPBMoney = '' then
|
|||
|
|
FPBMoney := '0';
|
|||
|
|
FRSQty := Trim(RSQty.Text);
|
|||
|
|
if FRSQty = '' then
|
|||
|
|
FRSQty := '0';
|
|||
|
|
FRSMoney := Trim(RSMoney.Text);
|
|||
|
|
if FRSMoney = '' then
|
|||
|
|
FRSMoney := '0';
|
|||
|
|
FHGYQty := Trim(HGYQty.Text);
|
|||
|
|
if FHGYQty = '' then
|
|||
|
|
FHGYQty := '0';
|
|||
|
|
FHGYMoney := Trim(HGYMoney.Text);
|
|||
|
|
if FHGYMoney = '' then
|
|||
|
|
FHGYMoney := '0';
|
|||
|
|
if StrToFloat(FPBQty) <> 0 then
|
|||
|
|
PBPriceAvg.Text := FloatToStr(RoundFloat(StrToFloat(FPBMoney) / StrToFloat(FPBQty), 2))
|
|||
|
|
else
|
|||
|
|
PBPriceAvg.Text := '';
|
|||
|
|
if StrToFloat(FRSQty) <> 0 then
|
|||
|
|
RSPriceAvg.Text := FloatToStr(RoundFloat(StrToFloat(FRSMoney) / StrToFloat(FRSQty), 2))
|
|||
|
|
else
|
|||
|
|
RSPriceAvg.Text := '';
|
|||
|
|
if StrToFloat(FHGYQty) <> 0 then
|
|||
|
|
HGYPriceAvg.Text := FloatToStr(RoundFloat(StrToFloat(FHGYMoney) / StrToFloat(FHGYQty), 2))
|
|||
|
|
else
|
|||
|
|
HGYPriceAvg.Text := '';
|
|||
|
|
FCPMoney := FloatToStr(StrToFloat(FPBMoney) + StrToFloat(FRSMoney) + StrToFloat(FHGYMoney));
|
|||
|
|
if StrToFloat(FCPMoney) <> 0 then
|
|||
|
|
CPMoney.Text := FCPMoney
|
|||
|
|
else
|
|||
|
|
CPMoney.Text := '';
|
|||
|
|
if CDS_Sub.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
FCPPS := FloatToStr(RoundFloat(StrToFloat(Tv1.DataController.Summary.FooterSummaryTexts[0]), 0));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FCPPS := '0';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if StrToFloat(FCPPS) <> 0 then
|
|||
|
|
CPPS.Text := FCPPS
|
|||
|
|
else
|
|||
|
|
CPPS.Text := '';
|
|||
|
|
if CDS_Sub.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
FCPQty := FloatToStr(RoundFloat(StrToFloat(Tv1.DataController.Summary.FooterSummaryTexts[1]), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FCPQty := '0';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if StrToFloat(FCPQty) <> 0 then
|
|||
|
|
CPQty.Text := FCPQty
|
|||
|
|
else
|
|||
|
|
CPQty.Text := '';
|
|||
|
|
if StrToFloat(FCPQty) <> 0 then
|
|||
|
|
CPPriceAvg.Text := FloatToStr(RoundFloat(StrToFloat(FCPMoney) / StrToFloat(FCPQty), 2))
|
|||
|
|
else
|
|||
|
|
CPPriceAvg.Text := '';
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
if (StrToFloat(FPBQty) <> 0) and (StrToFloat(FRSQty) <> 0) then
|
|||
|
|
RSSHQty.Text := FloatToStr(RoundFloat(100 - (StrToFloat(FRSQty) * 100 / StrToFloat(FPBQty)), 2))
|
|||
|
|
else
|
|||
|
|
RSSHQty.Text := '';
|
|||
|
|
if (StrToFloat(FRSQty) <> 0) and (StrToFloat(FHGYQty) <> 0) then
|
|||
|
|
HGYSHQty.Text := FloatToStr(RoundFloat(100 - (StrToFloat(FHGYQty) * 100 / StrToFloat(FRSQty)), 2))
|
|||
|
|
else
|
|||
|
|
HGYSHQty.Text := '';
|
|||
|
|
if (StrToFloat(FHGYQty) <> 0) and (StrToFloat(FCPQty) <> 0) then
|
|||
|
|
begin
|
|||
|
|
CKSHQty.Text := FloatToStr(RoundFloat(100 - (StrToFloat(FCPQty) * 100 / StrToFloat(FHGYQty)), 2));
|
|||
|
|
end
|
|||
|
|
else if (StrToFloat(FRSQty) <> 0) and (StrToFloat(FCPQty) <> 0) then
|
|||
|
|
begin
|
|||
|
|
CKSHQty.Text := FloatToStr(RoundFloat(100 - (StrToFloat(FCPQty) * 100 / StrToFloat(FRSQty)), 2))
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
CKSHQty.Text := '';
|
|||
|
|
end;
|
|||
|
|
if (StrToFloat(FPBQty) <> 0) and (StrToFloat(FCPQty) <> 0) then
|
|||
|
|
begin
|
|||
|
|
HZSHQty.Text := FloatToStr(RoundFloat(100 - (StrToFloat(FCPQty) * 100 / StrToFloat(FPBQty)), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
HZSHQty.Text := '';
|
|||
|
|
end;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
if TuiShuiFlag.Checked = True then
|
|||
|
|
begin
|
|||
|
|
FTuiShui := FloatToStr(RoundFloat((StrToFloat(FCPMoney) * 0.13 / 1.13), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FTuiShui := '0';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if StrToFloat(FTuiShui) <> 0 then
|
|||
|
|
TuiShui.Text := FTuiShui
|
|||
|
|
else
|
|||
|
|
TuiShui.Text := '';
|
|||
|
|
FShuilv := Trim(ShuiLv.Text);
|
|||
|
|
if Trim(FShuilv) = '' then
|
|||
|
|
FShuilv := '0';
|
|||
|
|
if (StrToFloat(FShuilv) <> 0) and (StrToFloat(FCPMoney) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FShuiFee := FloatToStr(RoundFloat((StrToFloat(FShuilv) * StrToFloat(FCPMoney)), 2));
|
|||
|
|
ShuiFee.Text := FShuiFee;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FShuiFee := '0';
|
|||
|
|
ShuiFee.Text := '';
|
|||
|
|
end;
|
|||
|
|
FXDXS := Trim(XDXS.Text);
|
|||
|
|
if Trim(FXDXS) = '' then
|
|||
|
|
FXDXS := '0';
|
|||
|
|
if (StrToFloat(FXDXS) <> 0) and (StrToFloat(FCPMoney) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FXDFee := FloatToStr(RoundFloat((StrToFloat(FXDXS) * StrToFloat(FCPMoney)), 2));
|
|||
|
|
XDFee.Text := FXDFee;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FXDFee := '0';
|
|||
|
|
XDFee.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FBXXS := Trim(BXXS.Text);
|
|||
|
|
if Trim(FBXXS) = '' then
|
|||
|
|
FBXXS := '0';
|
|||
|
|
if (StrToFloat(FBXXS) <> 0) and (StrToFloat(FCPMoney) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FBXFee := FloatToStr(RoundFloat((StrToFloat(FBXXS) * StrToFloat(FCPMoney)), 2));
|
|||
|
|
BXFee.Text := FBXFee;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FBXFee := '0';
|
|||
|
|
BXFee.Text := '';
|
|||
|
|
end;
|
|||
|
|
//FBXFee:=Trim(BXFee.Text);if Trim(FBXFee)='' then FBXFee:='0';
|
|||
|
|
FKPXS := Trim(KPXS.Text);
|
|||
|
|
if Trim(FKPXS) = '' then
|
|||
|
|
FKPXS := '0';
|
|||
|
|
if (StrToFloat(FKPXS) <> 0) and (StrToFloat(FCPMoney) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FKPFee := FloatToStr(RoundFloat((StrToFloat(FKPXS) * StrToFloat(FCPMoney)), 2));
|
|||
|
|
KPFee.Text := FKPFee;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FKPFee := '0';
|
|||
|
|
KPFee.Text := '';
|
|||
|
|
end;
|
|||
|
|
//FKPFee:=Trim(KPFee.Text);if Trim(FKPFee)='' then FKPFee:='0';
|
|||
|
|
FDJPrice := Trim(DJPrice.Text);
|
|||
|
|
if Trim(FDJPrice) = '' then
|
|||
|
|
FDJPrice := '0';
|
|||
|
|
if (StrToFloat(FDJPrice) <> 0) and (StrToFloat(FCPPS) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FDJFee := FloatToStr(RoundFloat((StrToFloat(FDJPrice) * StrToFloat(FCPPS)), 2));
|
|||
|
|
DJFee.Text := FDJFee;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FDJFee := '0';
|
|||
|
|
DJFee.Text := '';
|
|||
|
|
end;
|
|||
|
|
FKLFee := Trim(KLFee.Text);
|
|||
|
|
if Trim(FKLFee) = '' then
|
|||
|
|
FKLFee := '0';
|
|||
|
|
FHYFee := Trim(HYFee.Text);
|
|||
|
|
if Trim(FHYFee) = '' then
|
|||
|
|
FHYFee := '0';
|
|||
|
|
FYongJin := Trim(YongJin.Text);
|
|||
|
|
if Trim(FYongJin) = '' then
|
|||
|
|
FYongJin := '0';
|
|||
|
|
FSXFee := Trim(SXFee.Text);
|
|||
|
|
if Trim(FSXFee) = '' then
|
|||
|
|
FSXFee := '0';
|
|||
|
|
FZaFee := Trim(ZaFee.Text);
|
|||
|
|
if Trim(FZaFee) = '' then
|
|||
|
|
FZaFee := '0';
|
|||
|
|
FKuaiDiFee := Trim(KuaiDiFee.Text);
|
|||
|
|
if Trim(FKuaiDiFee) = '' then
|
|||
|
|
FKuaiDiFee := '0';
|
|||
|
|
FYunShuFee := Trim(YunShuFee.Text);
|
|||
|
|
if Trim(FYunShuFee) = '' then
|
|||
|
|
FYunShuFee := '0';
|
|||
|
|
FFOBFee := Trim(FOBFee.Text);
|
|||
|
|
if Trim(FFOBFee) = '' then
|
|||
|
|
FFOBFee := '0';
|
|||
|
|
|
|||
|
|
if Trim(YJUnit.Text) <> Trim(BZType.Text) then
|
|||
|
|
begin
|
|||
|
|
YJUnit.Text := BZType.Text;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_Sub.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
FXSQty := FloatToStr(RoundFloat(StrToFloat(Tv1.DataController.Summary.FooterSummaryTexts[2]), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FXSQty := '0';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if StrToFloat(FXSQty) <> 0 then
|
|||
|
|
XSQty.Text := FXSQty
|
|||
|
|
else
|
|||
|
|
XSQty.Text := '';
|
|||
|
|
if CDS_Sub.IsEmpty = False then
|
|||
|
|
begin
|
|||
|
|
FXSMoneyHJ := FloatToStr(RoundFloat(StrToFloat(Tv1.DataController.Summary.FooterSummaryTexts[3]), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FXSMoneyHJ := '0';
|
|||
|
|
end;
|
|||
|
|
if (StrToFloat(FXSMoneyHJ) <> 0) and (StrToFloat(FXSQty) <> 0) then
|
|||
|
|
begin
|
|||
|
|
XSPrice.Text := FloatToStr(RoundFloat(StrToFloat(FXSMoneyHJ) / StrToFloat(FXSQty), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
XSPrice.Text := '';
|
|||
|
|
end;
|
|||
|
|
//FXSPrice:=Trim(XSPrice.Text);if FXSPrice='' then FXSPrice:='0';
|
|||
|
|
FHuiLv := Trim(HuiLv.Text);
|
|||
|
|
if FHuiLv = '' then
|
|||
|
|
FHuiLv := '0';
|
|||
|
|
if (Trim(PriceType.Text) = 'CIF') and (StrToFloat(FXSMoneyHJ) <> 0) then
|
|||
|
|
begin
|
|||
|
|
if Trim(HYFeeUnit.Text) = Trim(BZType.Text) then
|
|||
|
|
begin
|
|||
|
|
FXSMoney := FloatToStr(RoundFloat((StrToFloat(FXSMoneyHJ) - StrToFloat(FHYFee)), 2)); //-StrToFloat(FYongJin)
|
|||
|
|
end
|
|||
|
|
else if (Trim(HYFeeUnit.Text) = '<27><>') and ((Trim(BZType.Text) = '<27><>') or (Trim(BZType.Text) = '<27>')) and (StrToFloat(FHuiLv) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FXSMoney := FloatToStr(RoundFloat((StrToFloat(FXSMoneyHJ) - (StrToFloat(FHYFee) * 1.00 / StrToFloat(FHuiLv))), 2)); //-StrToFloat(FYongJin)
|
|||
|
|
end
|
|||
|
|
else if (Trim(HYFeeUnit.Text) = '<27><>') and (Trim(BZType.Text) = '<27><>') and (StrToFloat(FHuiLv) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FXSMoney := FloatToStr(RoundFloat((StrToFloat(FXSMoneyHJ) - (StrToFloat(FHYFee) * 1.00 * StrToFloat(FHuiLv))), 2)); //-StrToFloat(FYongJin)
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FXSMoney := '0';
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FXSMoney := FXSMoneyHJ;
|
|||
|
|
end;
|
|||
|
|
FXSMoney := FloatToStr(RoundFloat((StrToFloat(FXSMoney) - StrToFloat(FYongJin) - StrToFloat(FSXFee)), 2));
|
|||
|
|
if Trim(BZType.Text) = '<27><>' then
|
|||
|
|
FXSMoneyRMB := FXSMoney
|
|||
|
|
else if ((Trim(BZType.Text) = '<27><>') or (Trim(BZType.Text) = '<27>')) and (StrToFloat(FHuiLv) <> 0) then
|
|||
|
|
begin
|
|||
|
|
FXSMoneyRMB := FloatToStr(RoundFloat(StrToFloat(FXSMoney) * StrToFloat(FHuiLv), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FXSMoneyRMB := '0';
|
|||
|
|
end;
|
|||
|
|
if StrToFloat(FXSMoney) <> 0 then
|
|||
|
|
XSMoney.Text := FXSMoney
|
|||
|
|
else
|
|||
|
|
XSMoney.Text := '';
|
|||
|
|
if StrToFloat(FXSMoneyRMB) <> 0 then
|
|||
|
|
XSMoneyRMB.Text := FXSMoneyRMB
|
|||
|
|
else
|
|||
|
|
XSMoneyRMB.Text := '';
|
|||
|
|
if StrToFloat(FXSMoneyRMB) <> 0 then
|
|||
|
|
begin
|
|||
|
|
FLiRun := FloatToStr(RoundFloat((StrToFloat(FXSMoneyRMB) - StrToFloat(FShuiFee) - StrToFloat(FXDFee) - StrToFloat(FBXFee) - StrToFloat(FKPFee) - StrToFloat(FDJFee) - StrToFloat(FKLFee) - StrToFloat(FZaFee) - StrToFloat(FKuaiDiFee)- StrToFloat(FYunShuFee) - StrToFloat(FFOBFee) + StrToFloat(FTuiShui) - StrToFloat(FCPMoney)), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FLiRun := '0';
|
|||
|
|
end;
|
|||
|
|
if StrToFloat(FLiRun) <> 0 then
|
|||
|
|
LiRun.Text := FLiRun
|
|||
|
|
else
|
|||
|
|
LiRun.Text := '';
|
|||
|
|
if (StrToFloat(FLiRun) <> 0) and (StrToFloat(FXSMoneyRMB) <> 0) then
|
|||
|
|
begin
|
|||
|
|
LiRunLv.Text := FloatToStr(RoundFloat(StrToFloat(FLiRun) * 100 / StrToFloat(FXSMoneyRMB), 2));
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
LiRunLv.Text := '';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.Tv1DblClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if TBSave.Visible = False then
|
|||
|
|
Exit;
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
if Trim(CDS_Sub.fieldbyname('HOID').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete Order_HS_OrderNo where HOID=''' + Trim(CDS_Sub.fieldbyname('HOID').AsString) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' exec P_Update_HSInfo_JD :HSID');
|
|||
|
|
Parameters.ParamByName('HSID').Value := Trim(CDS_Sub.fieldbyname('HSID').AsString);
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Sub.Delete;
|
|||
|
|
GetData();
|
|||
|
|
if Trim(FCYID) <> '' then
|
|||
|
|
begin
|
|||
|
|
SaveData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.PBQtyChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
GetData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.Tv1Column3PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FName: string;
|
|||
|
|
begin
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FName := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
if Trim(mvalue) <> '' then
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := mvalue;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := Null;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
GetData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.FKTypeBtnUpClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'FKTypeOrd';
|
|||
|
|
flagname := '<27><><EFBFBD>ʽ';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.FKType.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.FKTypeBtnDnClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FKType.Text := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.cxButton1Click(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FName: string;
|
|||
|
|
begin
|
|||
|
|
if Trim(FCYID) = '' then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('û<>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>~', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
frmFjList := TfrmFjList.Create(Application);
|
|||
|
|
with frmFjList do
|
|||
|
|
begin
|
|||
|
|
fkeyNO := Trim(FCYID);
|
|||
|
|
fType := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmFjList.Free;
|
|||
|
|
end;
|
|||
|
|
InitFJData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.InitFJData();
|
|||
|
|
var
|
|||
|
|
ListItem: TListItem;
|
|||
|
|
Flag: Cardinal;
|
|||
|
|
info: SHFILEINFOA;
|
|||
|
|
Icon: TIcon;
|
|||
|
|
begin
|
|||
|
|
ListView1.Items.Clear;
|
|||
|
|
with ADOQueryTmp do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select fileName from FJ_File ');
|
|||
|
|
sql.Add('where WBID=' + quotedstr(trim(FCYID)));
|
|||
|
|
sql.Add('and TFType=' + quotedstr(trim('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')));
|
|||
|
|
open;
|
|||
|
|
if not IsEmpty then
|
|||
|
|
begin
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ListView1 do
|
|||
|
|
begin
|
|||
|
|
LargeImages := ImageList1;
|
|||
|
|
Icon := TIcon.Create;
|
|||
|
|
ListItem := Items.Add;
|
|||
|
|
ListItem.Caption := trim(fieldbyname('fileName').AsString);
|
|||
|
|
Flag := (SHGFI_LARGEICON or SHGFI_ICON or SHGFI_USEFILEATTRIBUTES);
|
|||
|
|
SHGetFileInfo(Pchar(trim(fieldbyname('fileName').AsString)), 0, info, Sizeof(info), Flag);
|
|||
|
|
Icon.Handle := info.hIcon;
|
|||
|
|
ImageList1.AddIcon(Icon);
|
|||
|
|
ListItem.ImageIndex := ImageList1.Count - 1;
|
|||
|
|
end;
|
|||
|
|
next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.ListView1DblClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
sFieldName: string;
|
|||
|
|
fileName: string;
|
|||
|
|
begin
|
|||
|
|
if ListView1.Items.Count < 1 then
|
|||
|
|
EXIT;
|
|||
|
|
|
|||
|
|
if listView1.SelCount < 1 then
|
|||
|
|
exit;
|
|||
|
|
sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\ͼƬ<CDBC>鿴';
|
|||
|
|
|
|||
|
|
if not DirectoryExists(pchar(sFieldName)) then
|
|||
|
|
CreateDirectory(pchar(sFieldName), nil);
|
|||
|
|
|
|||
|
|
fileName := ListView1.Selected.Caption;
|
|||
|
|
|
|||
|
|
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
|
|||
|
|
|
|||
|
|
Panel2.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ե<EFBFBD>...';
|
|||
|
|
Panel2.Visible := true;
|
|||
|
|
application.ProcessMessages;
|
|||
|
|
try
|
|||
|
|
IdFTP1.Get('FJ\' + Trim(fileName), sFieldName, true, false);
|
|||
|
|
except
|
|||
|
|
Panel2.Visible := false;
|
|||
|
|
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Panel2.Visible := false;
|
|||
|
|
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
Panel2.Visible := false;
|
|||
|
|
if IdFTP1.Connected then
|
|||
|
|
IdFTP1.Quit;
|
|||
|
|
ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.Tv1Column6PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FXSMoney, FXSQty, mvalue, FName: string;
|
|||
|
|
begin
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FName := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
if Trim(CDS_Sub.fieldbyname('XSQty').AsString) <> '' then
|
|||
|
|
begin
|
|||
|
|
FXSQty := Trim(CDS_Sub.fieldbyname('XSQty').AsString);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FXSQty := '0';
|
|||
|
|
end;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
if Trim(mvalue) <> '' then
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := mvalue;
|
|||
|
|
FXSMoney := mvalue;
|
|||
|
|
if Trim(FXSQty) <> '0' then
|
|||
|
|
begin
|
|||
|
|
FieldByName('XSPrice').Value := RoundFloat(StrToFloat(FXSMoney) / StrToFloat(FXSQty), 2);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName('XSPrice').Value := null;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := Null;
|
|||
|
|
FXSMoney := '0';
|
|||
|
|
FieldByName('XSPrice').Value := null;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
GetData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.Tv1Column7PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FName: string;
|
|||
|
|
begin
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FName := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
if Trim(mvalue) <> '' then
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := mvalue;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := Null;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
if Trim(mvalue) <> '' then
|
|||
|
|
begin
|
|||
|
|
BZType.Text := mvalue;
|
|||
|
|
YJUnit.Text := mvalue;
|
|||
|
|
end;
|
|||
|
|
GetData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.Tv1Column10PropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FName: string;
|
|||
|
|
begin
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FName := Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
if Trim(mvalue) <> '' then
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := mvalue;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FieldByName(FName).Value := Null;
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
if Trim(mvalue) <> '' then
|
|||
|
|
begin
|
|||
|
|
XSUnit.Text := mvalue;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmOrderHSInPut.TuiShuiFlagClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
GetData();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|