944 lines
34 KiB
ObjectPascal
944 lines
34 KiB
ObjectPascal
|
|
unit U_PayableSel;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
|
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, ComCtrls, ToolWin,
|
|||
|
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
|
cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
|
|||
|
|
cxGridPopupMenu, ADODB, DBClient, cxButtonEdit, cxTextEdit, cxSpinEdit,
|
|||
|
|
StdCtrls, ExtCtrls, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
|||
|
|
dxDateRanges, dxBarBuiltInMenu, U_BaseInput, System.ImageList, Vcl.ImgList,
|
|||
|
|
dxScrollbarAnnotations, dxSkinsCore, dxSkinsDefaultPainters, cxImageList,
|
|||
|
|
dxSkinOffice2013White, dxSkinSharpPlus, dxSkinWXI, cxCheckBox, Vcl.Menus,
|
|||
|
|
Clipbrd, cxCurrencyEdit, cxPC;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmPayableSel = class(TfrmBaseInput)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBAdd: TToolButton;
|
|||
|
|
TBDel: TToolButton;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
DS_1: TDataSource;
|
|||
|
|
CDS_1: TClientDataSet;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
GPM_1: TcxGridPopupMenu;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
Tv1Column22: TcxGridDBColumn;
|
|||
|
|
Tv1FFTime: TcxGridDBColumn;
|
|||
|
|
TV1OurCoName: TcxGridDBColumn;
|
|||
|
|
Tv1OppCoName: TcxGridDBColumn;
|
|||
|
|
Tv1FFAbstract: TcxGridDBColumn;
|
|||
|
|
Tv1ConNo: TcxGridDBColumn;
|
|||
|
|
Tv1OrderNo: TcxGridDBColumn;
|
|||
|
|
Tv1BuyConNo: TcxGridDBColumn;
|
|||
|
|
Tv1F_Code: TcxGridDBColumn;
|
|||
|
|
Tv1F_Name: TcxGridDBColumn;
|
|||
|
|
Tv1F_Width: TcxGridDBColumn;
|
|||
|
|
Tv1F_GramWeight: TcxGridDBColumn;
|
|||
|
|
Tv1F_Color: TcxGridDBColumn;
|
|||
|
|
Tv1Piece: TcxGridDBColumn;
|
|||
|
|
Tv1Qty: TcxGridDBColumn;
|
|||
|
|
Tv1QtyUnit: TcxGridDBColumn;
|
|||
|
|
Tv1Currency: TcxGridDBColumn;
|
|||
|
|
Tv1NoTaxPrice: TcxGridDBColumn;
|
|||
|
|
Tv1NoTaxInclude: TcxGridDBColumn;
|
|||
|
|
Tv1TaxRate: TcxGridDBColumn;
|
|||
|
|
Tv1Tax: TcxGridDBColumn;
|
|||
|
|
Tv1TaxInclude: TcxGridDBColumn;
|
|||
|
|
Tv1Note: TcxGridDBColumn;
|
|||
|
|
Tv1FromID1: TcxGridDBColumn;
|
|||
|
|
cxGridLevel1: TcxGridLevel;
|
|||
|
|
TbOrdAdd: TToolButton;
|
|||
|
|
Tv1PurNo: TcxGridDBColumn;
|
|||
|
|
Tv1FinType: TcxGridDBColumn;
|
|||
|
|
TbPurSel: TToolButton;
|
|||
|
|
PM_1: TPopupMenu;
|
|||
|
|
N1: TMenuItem;
|
|||
|
|
N3: TMenuItem;
|
|||
|
|
N2: TMenuItem;
|
|||
|
|
TbSSel: TToolButton;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure TBAddClick(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure TbOrdAddClick(Sender: TObject);
|
|||
|
|
procedure TbPurSelClick(Sender: TObject);
|
|||
|
|
procedure Tv1OppCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure Tv1FFAbstractPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure N2Click(Sender: TObject);
|
|||
|
|
procedure N3Click(Sender: TObject);
|
|||
|
|
procedure N1Click(Sender: TObject);
|
|||
|
|
procedure Tv1PurNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure Tv1OrderNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure Tv1CurrencyPropertiesChange(Sender: TObject);
|
|||
|
|
procedure Tv1TaxRatePropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure TbSSelClick(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
procedure InitGrid();
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
FBCId, FKHName: string;
|
|||
|
|
FFFID: string;
|
|||
|
|
FNoTaxInclude, FTax, FTaxInclude: Double; //<2F><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD>˰<EEA3AC><EFBFBD><EEA3AC>˰<EFBFBD><CBB0><EFBFBD><EFBFBD> <20><>ѡ<EFBFBD><D1A1>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
FFFIDs: string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmPayableSel: TfrmPayableSel;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_FinTradePlanSel,
|
|||
|
|
U_FinPurchasePlanSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
// SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.InitGrid();
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
Filtered := False;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
sql.Add(' from Finance_Flow A ');
|
|||
|
|
sql.Add(' where CheckStatus = ''δ<><CEB4><EFBFBD><EFBFBD>'' ');
|
|||
|
|
SQL.Add(' and FFFlag = ''Ӧ<><D3A6><EFBFBD><EFBFBD>'' ');
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and EXISTS ( select 1 from Finance_FlowInvoice X where X.FFID=A.FFID ) ');
|
|||
|
|
end;
|
|||
|
|
1:
|
|||
|
|
begin
|
|||
|
|
sql.Add(' and not EXISTS ( select 1 from Finance_FlowInvoice X where X.FFID=A.FFID ) ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_1);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_1);
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
TV1.DataController.Filter.Clear;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.N1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_1, True);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.N2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Clipboard.SetTextBuf(PChar(Trim(CDS_1.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString)));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.N3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SelOKNo(CDS_1, false);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmPayableSel.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
Maxno, MFFID: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
CDS_1.DisableControls;
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Finance_Flow where FFID=''' + Trim(CDS_1.fieldbyname('FFID').AsString) + '''');
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
MFFID := Trim(ADOQueryTemp.fieldbyname('FFID').AsString);
|
|||
|
|
if Trim(MFFID) = '' then
|
|||
|
|
begin
|
|||
|
|
if not GetLSNo(ADOQueryCmd, Maxno, 'YFK', 'Finance_Flow', 3, 1) then
|
|||
|
|
raise Exception.Create('ȡӦ<C8A1>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Maxno := Trim(MFFID);
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Finance_Flow where FFID=''' + Trim(Maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(MFFID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Fillid').Value := Trim(Dcode);
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Editid').Value := Trim(Dcode);
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_1, 'Finance_Flow', 0);
|
|||
|
|
|
|||
|
|
FieldByName('FFID').Value := Maxno;
|
|||
|
|
FieldByName('FFFlag').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('FFType').Value := 'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
|||
|
|
FieldByName('CheckStatus').Value := 'δ<><CEB4><EFBFBD><EFBFBD>';
|
|||
|
|
|
|||
|
|
|
|||
|
|
//֯<>쵥<EFBFBD><ECB5A5>
|
|||
|
|
FieldByName('OrdMainId').Value := CDS_1.fieldbyname('OrdMainId').Value;
|
|||
|
|
FieldByName('OrdSubId').Value := CDS_1.fieldbyname('OrdSubId').Value;
|
|||
|
|
//֯<>쵥<EFBFBD><ECB5A5>
|
|||
|
|
FieldByName('PurMID').Value := CDS_1.fieldbyname('PurMID').Value;
|
|||
|
|
FieldByName('PurSID').Value := CDS_1.fieldbyname('PurSID').Value;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|||
|
|
FieldByName('ConMId').Value := CDS_1.fieldbyname('ConMId').value;
|
|||
|
|
FieldByName('ConSId').Value := CDS_1.fieldbyname('ConSId').value;
|
|||
|
|
//<2F><><EFBFBD>Ϻ<EFBFBD>ͬ
|
|||
|
|
FieldByName('BuyConMID').Value := CDS_1.fieldbyname('BuyConMID').value;
|
|||
|
|
FieldByName('BuyConSID').Value := CDS_1.fieldbyname('BuyConSID').Value;
|
|||
|
|
//<2F>Է<EFBFBD><D4B7><EFBFBD>λ
|
|||
|
|
FieldByName('OppCoNo').Value := CDS_1.fieldbyname('OppCoNo').Value;
|
|||
|
|
//<2F>ҷ<EFBFBD><D2B7><EFBFBD>λ
|
|||
|
|
FieldByName('OurCoNo').Value := CDS_1.fieldbyname('OurCoNo').Value;
|
|||
|
|
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails)');
|
|||
|
|
sql.Add('values(''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' ');
|
|||
|
|
sql.Add(',' + quotedstr(Maxno));
|
|||
|
|
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
|
|||
|
|
sql.Add(',' + quotedstr(DName));
|
|||
|
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
|
sql.Add(',' + quotedstr(Maxno));
|
|||
|
|
sql.Add(') ');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
CDS_1.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.TBAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
CDS_1.Append;
|
|||
|
|
CDS_1.FieldByName('FFTime').Value := SGetServerDateTime(ADOQueryCmd);
|
|||
|
|
CDS_1.FieldByName('ReconciliationDate').Value := SGetServerDate(ADOQueryCmd);
|
|||
|
|
CDS_1.FieldByName('OurCoName').Value := 'DESHINE VIETNAM CO., LTD';
|
|||
|
|
CDS_1.FieldByName('SSel').Value := False;
|
|||
|
|
CDS_1.Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.TBDelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
CDS_1.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.TbOrdAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmFinTradePlanSel := TfrmFinTradePlanSel.Create(Application);
|
|||
|
|
with frmFinTradePlanSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with frmFinTradePlanSel.CDS_1 do
|
|||
|
|
begin
|
|||
|
|
//֯<>쵥
|
|||
|
|
self.CDS_1.FieldByName('OrderNo').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('OrdMainId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('OrdSubId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('ConNo').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('ConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConMId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('ConMId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConSId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('ConSId').AsString);
|
|||
|
|
//<2F><><EFBFBD>Ϻ<EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('BuyConNo').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('BuyConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConMID').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('FROMCPSID').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConSID').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('FROMCPMID').AsString);
|
|||
|
|
|
|||
|
|
self.CDS_1.FieldByName('F_Code').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('F_Name').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('F_Width').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('F_GramWeight').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('F_Color').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmFinTradePlanSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ReadCxGrid('Ӧ<><D3A6><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>', Tv1, 'Ӧ<><D3A6><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>');
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.TBSaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_1.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_1.Locate('FFTime', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Ǽ<EFBFBD><C7BC><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_1.Locate('ReconciliationDate', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_1.Locate('FinType', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_1.Locate('Qty', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// CDS_1.First;
|
|||
|
|
// while not CDS_1.Eof do
|
|||
|
|
// begin
|
|||
|
|
// // ͬʱ<CDAC>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
// if (CDS_1.FieldByName('IOType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and (CDS_1.FieldByName('ToOrdNo').IsNull or (Trim(CDS_1.FieldByName('ToOrdNo').AsString) = '')) then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><>ѡ<EFBFBD><EFBFBD><F1B3B5BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>֯<EFBFBD>쵥!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// CDS_1.Next;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
//ModalResult:=1;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('Ӧ<><D3A6><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>', Tv1, 'Ӧ<><D3A6><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.TbPurSelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmFinPurchasePlanSel := TfrmFinPurchasePlanSel.Create(Application);
|
|||
|
|
with frmFinPurchasePlanSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with frmFinPurchasePlanSel.CDS_1 do
|
|||
|
|
begin
|
|||
|
|
first;
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if CDS_1.fieldbyname('SSel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_1 do
|
|||
|
|
begin
|
|||
|
|
append;
|
|||
|
|
//<2F>Է<EFBFBD><D4B7><EFBFBD>λ
|
|||
|
|
self.CDS_1.FieldByName('OppCoName').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('SellName').Value);
|
|||
|
|
self.CDS_1.FieldByName('OppCoNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('SellNo').Value);
|
|||
|
|
//<2F>ҷ<EFBFBD><D2B7><EFBFBD>λ
|
|||
|
|
self.CDS_1.FieldByName('FFTime').Value := SGetServerDateTime(ADOQueryCmd);
|
|||
|
|
self.CDS_1.FieldByName('ReconciliationDate').Value := SGetServerDate(ADOQueryCmd);
|
|||
|
|
self.CDS_1.FieldByName('OurCoName').Value := 'DESHINE VIETNAM CO., LTD';
|
|||
|
|
self.CDS_1.FieldByName('FinType').Value := 'ɴ<><C9B4>';
|
|||
|
|
self.CDS_1.FieldByName('Currency').Value := 'CNY';
|
|||
|
|
self.CDS_1.FieldByName('SSel').Value := False;
|
|||
|
|
self.CDS_1.FieldByName('FFAbstract').Value := 'ɴ<>߲ɹ<DFB2>';
|
|||
|
|
//<2F>ɹ<EFBFBD><C9B9><EFBFBD>
|
|||
|
|
self.CDS_1.FieldByName('PurNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('PurNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('PurMID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('PurMId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('PurSID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('PurSId').AsString);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('ConNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('ConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConMId').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('fromConMId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConSId').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('fromConSId').AsString);
|
|||
|
|
//<2F><><EFBFBD>Ϻ<EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('BuyConNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('CPConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConMID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('FROMCPSID').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConSID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('FROMCPMID').AsString);
|
|||
|
|
|
|||
|
|
self.CDS_1.FieldByName('F_Code').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Code').Value);
|
|||
|
|
self.CDS_1.FieldByName('F_Name').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Name').Value);
|
|||
|
|
// self.CDS_1.FieldByName('F_Width').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('F_GramWeight').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('C_GramWeight').AsString);
|
|||
|
|
self.CDS_1.FieldByName('F_Color').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Color').Value);
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('Piece').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('Piece').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Piece').AsString);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('Qty').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('Qty').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Qty').AsString);
|
|||
|
|
end;
|
|||
|
|
self.CDS_1.FieldByName('QtyUnit').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('QtyUnit').AsString);
|
|||
|
|
self.CDS_1.FieldByName('currency').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('currency').AsString);
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('Price').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('NoTaxPrice').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Price').AsString);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('Amount').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('NoTaxInclude').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Amount').AsString);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('TaxRate').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('TaxRate').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('TaxRate').AsString);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('Tax').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('Tax').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Tax').AsString);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('TaxInclude').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('TaxInclude').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('TaxInclude').AsString);
|
|||
|
|
end;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
frmFinPurchasePlanSel.CDS_1.Next;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmFinPurchasePlanSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_1 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('ToCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
|
FieldByName('ToCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1CurrencyPropertiesChange(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FFieldName: string;
|
|||
|
|
begin
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value := mvalue;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
// if not Assigned(Sender) or not (Sender is TComboBox) then
|
|||
|
|
// Exit;
|
|||
|
|
|
|||
|
|
if TComboBox(Sender).Text = 'VND' then
|
|||
|
|
begin
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڿɱ༭״̬
|
|||
|
|
if not (State in [dsEdit, dsInsert]) then
|
|||
|
|
Edit;
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>Ϊ<EFBFBD><CEAA>
|
|||
|
|
if not FieldByName('NoTaxPrice').IsNull and (FieldByName('NoTaxPrice').AsString <> '') then
|
|||
|
|
begin
|
|||
|
|
FieldByName('NoTaxPrice').Value := RoundFloat(FieldByName('NoTaxPrice').AsFloat, 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD>Qty<74><79>NoTaxPrice<63>ֶ<EFBFBD><D6B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>Ϊ<EFBFBD><CEAA>
|
|||
|
|
if not FieldByName('Qty').IsNull and not FieldByName('NoTaxPrice').IsNull and (FieldByName('Qty').AsString <> '') and (FieldByName('NoTaxPrice').AsString <> '') then
|
|||
|
|
begin
|
|||
|
|
FieldByName('NoTaxInclude').Value := RoundFloat(FieldByName('Qty').AsFloat * FieldByName('NoTaxPrice').AsFloat, 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not FieldByName('TaxRate').IsNull and (FieldByName('TaxRate').AsString <> '') then
|
|||
|
|
FieldByName('TaxRate').Value := RoundFloat(FieldByName('TaxRate').AsFloat, 0);
|
|||
|
|
|
|||
|
|
if not FieldByName('Tax').IsNull and (FieldByName('Tax').AsString <> '') then
|
|||
|
|
FieldByName('Tax').Value := RoundFloat(FieldByName('Tax').AsFloat, 0);
|
|||
|
|
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڿɱ༭״̬
|
|||
|
|
if not (State in [dsEdit, dsInsert]) then
|
|||
|
|
Edit;
|
|||
|
|
// ʹ<><CAB9>һ<EFBFBD>µĿ<C2B5>ֵ<EFBFBD><D6B5><EFBFBD>鷽ʽ
|
|||
|
|
if (not FieldByName('NoTaxPrice').IsNull) and (FieldByName('NoTaxPrice').AsString <> '') then
|
|||
|
|
begin
|
|||
|
|
FieldByName('NoTaxPrice').Value := FormatFloat('0.00', FieldByName('NoTaxPrice').AsFloat);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if (not FieldByName('Qty').IsNull) and (not FieldByName('NoTaxPrice').IsNull) and (FieldByName('Qty').AsString <> '') and (FieldByName('NoTaxPrice').AsString <> '') then
|
|||
|
|
begin
|
|||
|
|
FieldByName('NoTaxInclude').Value := FormatFloat('0.00', FieldByName('NoTaxInclude').AsFloat);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not FieldByName('TaxRate').IsNull and (FieldByName('TaxRate').AsString <> '') then
|
|||
|
|
begin
|
|||
|
|
FieldByName('TaxRate').Value := FormatFloat('0.00', FieldByName('TaxRate').AsFloat);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not FieldByName('Tax').IsNull and (FieldByName('Tax').AsString <> '') then
|
|||
|
|
begin
|
|||
|
|
FieldByName('Tax').Value := FormatFloat('0.00', FieldByName('Tax').AsFloat);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1FFAbstractPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag := 'FFAbstract';
|
|||
|
|
flagname := 'ժҪ';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.CDS_1.Edit;
|
|||
|
|
Self.CDS_1.FieldByName('FFAbstract').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
Self.CDS_1.Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
var
|
|||
|
|
FFSPID: string;
|
|||
|
|
begin
|
|||
|
|
// if CDS_Sub.IsEmpty then
|
|||
|
|
// Exit;
|
|||
|
|
// if Trim(CDS_Sub.fieldbyname('BYIOID').AsString) <> '' then
|
|||
|
|
// begin
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select * from BS_Yarn_IO where BYIOID=''' + Trim(CDS_Sub.fieldbyname('BYIOID').AsString) + '''');
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
// FFSPID := Trim(ADOQueryTemp.fieldbyname('BYIOID').AsString);
|
|||
|
|
// if Trim(FFSPID) <> '' then
|
|||
|
|
// begin
|
|||
|
|
// v1CRType.Options.Editing := False;
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// v1CRType.Options.Editing := True;
|
|||
|
|
// end;
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// v1CRType.Options.Editing := True;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1OppCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.CDS_1.Edit;
|
|||
|
|
Self.CDS_1.FieldByName('OppCoName').asstring := Trim(CDS_1.fieldbyname('CoName').AsString);
|
|||
|
|
Self.CDS_1.FieldByName('OurCoNo').asstring := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
|
Self.CDS_1.Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1OrderNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmFinTradePlanSel := TfrmFinTradePlanSel.Create(Application);
|
|||
|
|
with frmFinTradePlanSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with frmFinTradePlanSel.CDS_1 do
|
|||
|
|
begin
|
|||
|
|
//<2F>ɹ<EFBFBD><C9B9><EFBFBD>
|
|||
|
|
self.CDS_1.FieldByName('PurNo').value := null;
|
|||
|
|
self.CDS_1.FieldByName('PurMID').value := null;
|
|||
|
|
self.CDS_1.FieldByName('PurSID').value := null;
|
|||
|
|
|
|||
|
|
//֯<>쵥
|
|||
|
|
self.CDS_1.FieldByName('OrderNo').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('OrdMainId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('OrdSubId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('ConNo').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('ConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConMId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('ConMId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConSId').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('ConSId').AsString);
|
|||
|
|
//<2F><><EFBFBD>Ϻ<EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('BuyConNo').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('BuyConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConMID').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('FROMCPMID').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConSID').AsString := Trim(frmFinTradePlanSel.CDS_1.fieldbyname('FROMCPSID').AsString);
|
|||
|
|
|
|||
|
|
// self.CDS_1.FieldByName('F_Code').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Code').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('F_Name').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Name').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('F_Color').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Color').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('Piece').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Piece').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('Qty').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Qty').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('QtyUnit').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('QtyUnit').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('currency').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('currency').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('NoTaxPrice').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Piece').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('NoTaxInclude').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Amount').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('TaxRate').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('TaxRate').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('Tax').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Tax').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('TaxInclude').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('TaxInclude').AsString);
|
|||
|
|
self.CDS_1.Post;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmFinTradePlanSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1PurNoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmFinPurchasePlanSel := TfrmFinPurchasePlanSel.Create(Application);
|
|||
|
|
with frmFinPurchasePlanSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with frmFinPurchasePlanSel.CDS_1 do
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.Edit;
|
|||
|
|
//<2F>Է<EFBFBD><D4B7><EFBFBD>λ
|
|||
|
|
self.CDS_1.FieldByName('OppCoName').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('SellName').AsString);
|
|||
|
|
self.CDS_1.FieldByName('OppCoNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('SellNo').AsString);
|
|||
|
|
//֯<>쵥<EFBFBD><ECB5A5>
|
|||
|
|
self.CDS_1.FieldByName('OrderNo').value := null;
|
|||
|
|
self.CDS_1.FieldByName('OrdMainId').value := null;
|
|||
|
|
self.CDS_1.FieldByName('OrdSubId').value := null;
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>
|
|||
|
|
self.CDS_1.FieldByName('FinType').Value := 'ɴ<><C9B4>';
|
|||
|
|
self.CDS_1.FieldByName('FFAbstract').Value := 'ɴ<>߲ɹ<DFB2>';
|
|||
|
|
//<2F>ɹ<EFBFBD><C9B9><EFBFBD>
|
|||
|
|
self.CDS_1.FieldByName('PurNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('PurNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('PurMID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('PurMId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('PurSID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('PurSId').AsString);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('ConNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('ConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConMId').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('fromConMId').AsString);
|
|||
|
|
self.CDS_1.FieldByName('ConSId').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('fromConSId').AsString);
|
|||
|
|
//<2F><><EFBFBD>Ϻ<EFBFBD>ͬ
|
|||
|
|
self.CDS_1.FieldByName('BuyConNo').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('CPConNo').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConMID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('FROMCPSID').AsString);
|
|||
|
|
self.CDS_1.FieldByName('BuyConSID').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('FROMCPMID').AsString);
|
|||
|
|
|
|||
|
|
self.CDS_1.FieldByName('F_Code').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Code').AsString);
|
|||
|
|
self.CDS_1.FieldByName('F_Name').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Name').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('F_Width').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|||
|
|
// self.CDS_1.FieldByName('F_GramWeight').AsString := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('C_GramWeight').AsString);
|
|||
|
|
self.CDS_1.FieldByName('F_Color').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Y_Color').AsString);
|
|||
|
|
|
|||
|
|
self.CDS_1.FieldByName('Piece').asstring := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Piece').AsString);
|
|||
|
|
self.CDS_1.FieldByName('Qty').asstring := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Qty').AsString);
|
|||
|
|
self.CDS_1.FieldByName('QtyUnit').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('QtyUnit').AsString);
|
|||
|
|
self.CDS_1.FieldByName('currency').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('currency').AsString);
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('PRICE').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('NoTaxPrice').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('PRICE').Value);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('Amount').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('NoTaxInclude').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Amount').Value);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('TaxRate').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('TaxRate').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('TaxRate').Value);
|
|||
|
|
end;
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('Tax').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('Tax').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('Tax').Value);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not frmFinPurchasePlanSel.CDS_1.FieldByName('TaxInclude').IsNull then
|
|||
|
|
begin
|
|||
|
|
self.CDS_1.FieldByName('TaxInclude').Value := Trim(frmFinPurchasePlanSel.CDS_1.fieldbyname('TaxInclude').Value);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
self.CDS_1.Post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmFinPurchasePlanSel.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.Tv1TaxRatePropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
mvalue, FFieldName: string;
|
|||
|
|
FQty, FNoTaxPrice, FNoTaxInclude: Double; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD>ۣ<EFBFBD><DBA3><EFBFBD><EFBFBD><EFBFBD>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>
|
|||
|
|
mTaxRate, mTax, mTaxInclude: Double; //˰<>ʣ<EFBFBD>˰<EFBFBD><EFBFBD><EEA3AC>˰<EFBFBD><CBB0><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
// mCP_QTY, mCP_TPXS: Double; //<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ϵ<EFBFBD><CFB5>
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
mvalue := TcxTextEdit(Sender).EditingText;
|
|||
|
|
if Trim(mvalue) = '' then
|
|||
|
|
begin
|
|||
|
|
mvalue := '0';
|
|||
|
|
end;
|
|||
|
|
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName(FFieldName).Value := StrToFloat(Trim(mvalue));
|
|||
|
|
Post;
|
|||
|
|
// ShowMessage(Fieldbyname('TaxRate').AsString);
|
|||
|
|
if Fieldbyname('Qty').AsString <> '' then
|
|||
|
|
begin
|
|||
|
|
FQty := Fieldbyname('Qty').AsFloat;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FQty := 0;
|
|||
|
|
end;
|
|||
|
|
if Fieldbyname('NoTaxPrice').AsString <> '' then
|
|||
|
|
begin
|
|||
|
|
FNoTaxPrice := Fieldbyname('NoTaxPrice').AsFloat;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FNoTaxPrice := 0;
|
|||
|
|
end;
|
|||
|
|
if Fieldbyname('TaxRate').AsString <> '' then
|
|||
|
|
begin
|
|||
|
|
mTaxRate := Fieldbyname('TaxRate').AsFloat / 100;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
mTaxRate := 0;
|
|||
|
|
end;
|
|||
|
|
if Fieldbyname('Tax').AsString <> '' then
|
|||
|
|
begin
|
|||
|
|
mTax := Fieldbyname('Tax').AsFloat;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
mTax := 0;
|
|||
|
|
end;
|
|||
|
|
if Fieldbyname('TaxInclude').AsString <> '' then
|
|||
|
|
begin
|
|||
|
|
mTaxInclude := Fieldbyname('TaxInclude').AsFloat;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
mTaxInclude := 0;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FNoTaxInclude := RoundFloat(FQty * FNoTaxPrice, 2);
|
|||
|
|
mTax := RoundFloat(FNoTaxInclude * mTaxRate, 2);
|
|||
|
|
mTaxInclude := RoundFloat(FNoTaxInclude + mTax, 2);
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Qty').Value := FQty;
|
|||
|
|
// FieldByName('ConPrice').Value := FConPrice;
|
|||
|
|
FieldByName('NoTaxPrice').Value := FloatToStr(FNoTaxPrice);
|
|||
|
|
FieldByName('NoTaxInclude').Value := FloatToStr(FNoTaxInclude);
|
|||
|
|
FieldByName('TaxRate').Value := FloatToStr(mTaxRate * 100);
|
|||
|
|
FieldByName('Tax').Value := FloatToStr(mTax);
|
|||
|
|
FieldByName('TaxInclude').Value := FloatToStr(mTaxInclude);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
tv1.Controller.EditingController.ShowEdit();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmPayableSel.TbSSelClick(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
FirstOppCoName: string;
|
|||
|
|
bAllSame: Boolean;
|
|||
|
|
begin
|
|||
|
|
if not CDS_1.Locate('ssel', True, []) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_OK);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
//<2F>ж<EFBFBD><D0B6><EFBFBD>ѡ<EFBFBD><D1A1>Ӧ<EFBFBD><D3A6><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ͬһ<CDAC><D2BB>
|
|||
|
|
FNoTaxInclude := 0;
|
|||
|
|
FTax := 0;
|
|||
|
|
FTaxInclude := 0;
|
|||
|
|
FFFID := '';
|
|||
|
|
|
|||
|
|
CDS_1.First;
|
|||
|
|
FirstOppCoName := '';
|
|||
|
|
bAllSame := True;
|
|||
|
|
|
|||
|
|
with CDS_1 do
|
|||
|
|
begin
|
|||
|
|
while not Eof do
|
|||
|
|
begin
|
|||
|
|
if FieldByName('Ssel').AsBoolean then
|
|||
|
|
begin
|
|||
|
|
if FirstOppCoName = '' then
|
|||
|
|
FirstOppCoName := FieldByName('OppCoName').AsString
|
|||
|
|
else if FirstOppCoName <> FieldByName('OppCoName').AsString then
|
|||
|
|
begin
|
|||
|
|
bAllSame := False;
|
|||
|
|
Break;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FNoTaxInclude := FNoTaxInclude + CDS_1.FieldByName('NoTaxInclude').AsFloat;
|
|||
|
|
FTax := FTax + CDS_1.FieldByName('Tax').AsFloat;
|
|||
|
|
FTaxInclude := FTaxInclude + CDS_1.FieldByName('TaxInclude').AsFloat;
|
|||
|
|
if FFFIDs = '' then
|
|||
|
|
begin
|
|||
|
|
FFFIDs := CDS_1.FieldByName('FFID').AsString;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
FFFIDs := FFFIDs + ',' + CDS_1.FieldByName('FFID').AsString;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if not bAllSame then
|
|||
|
|
begin
|
|||
|
|
ShowMessage('ѡ<><D1A1><EFBFBD>ĶԷ<C4B6><D4B7><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ͬ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
ModalResult := 1;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|