D10xhGemei/A09财务通用管理/U_PayableEdit.pas
DESKTOP-E401PHE\Administrator a5b135ceb3 财务替换畅优
2025-07-17 14:27:41 +08:00

88 lines
2.3 KiB
ObjectPascal

unit U_PayableEdit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, DB, ADODB, cxGraphics, cxControls, cxLookAndFeels,
cxLookAndFeelPainters, cxContainer, cxEdit, Vcl.ComCtrls, dxCore, cxDateUtils,
dxSkinsCore, dxSkinsDefaultPainters, cxTextEdit, cxMaskEdit, cxDropDownEdit,
cxCalendar;
type
TfrmPayableEdit = class(TForm)
Panel1: TPanel;
Button1: TButton;
Label1: TLabel;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
Price: TEdit;
Label2: TLabel;
Button2: TButton;
ReconciliationDate: TcxDateEdit;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
FFFIDS: string;
{ Public declarations }
end;
var
frmPayableEdit: TfrmPayableEdit;
implementation
{$R *.dfm}
procedure TfrmPayableEdit.Button2Click(Sender: TObject);
begin
try
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' update Finance_Flow ');
sql.Add(' set ReconciliationDate=' + QuotedStr(Trim(FormatDateTime('yyyy-MM-dd', ReconciliationDate.Date))));
sql.Add(' where ISNULL(status, ''0'')=''0'' ');
sql.Add(' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FFFIDS) + ','','') X where X.RTValue=Finance_Flow.FFID) ');
// showmessage(sql.text);
ExecSQL;
end;
ModalResult := 1;
except
application.MessageBox(PChar(Exception(ExceptObject).Message), 'ÌáʾÐÅÏ¢', 0);
end;
end;
procedure TfrmPayableEdit.Button1Click(Sender: TObject);
begin
if StrToFloatDef(Price.Text, 0) = 0 then
Price.Text := '0';
try
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add(' update Finance_Flow ');
sql.Add(' set Price=' + Price.Text);
sql.Add(' ,Amount=Round((Qty * ' + Price.Text + ' + isnull(OtherFee,0) + isnull(OtherFee1,0)- isnull(Deduction,0)), 2)');
sql.Add(' where ISNULL(status, ''0'')=''0'' ');
sql.Add(' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FFFIDS) + ','','') X where X.RTValue=Finance_Flow.FFID) ');
// showmessage(sql.text);
ExecSQL;
end;
ModalResult := 1;
except
application.MessageBox(PChar(Exception(ExceptObject).Message), 'ÌáʾÐÅÏ¢', 0);
end;
end;
end.