You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.7 KiB
Plaintext

unit u_fee_calc;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, cxTextEdit, cxControls, cxContainer, cxEdit,
cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,inifiles,
cxDBLookupComboBox, bsSkinCtrls, ExtCtrls, BusinessSkinForm, DB, ADODB,
Mask, DBCtrlsEh,Registry,Client_TLB,ShellApi, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxDBData, cxGridLevel,
cxClasses, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
cxGridDBTableView, cxGrid, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner,
kbmMemTable;
type
Tfrm_fee_calc = class(TForm)
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
edit1: TcxTextEdit;
bsBusinessSkinForm1: TbsBusinessSkinForm;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
t_ch_fee1: TDataSource;
t_op_ctn_sum1: TDataSource;
t_op_ctn_sum: TADOQuery;
kbmMemTable1: TkbmMemTable;
kbmMemTable1Field: TStringField;
kbmMemTable1Field2: TIntegerField;
kbmMemTable1Field3: TFloatField;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
kbmMemTable1Field4: TStringField;
procedure bsSkinButton1Click(Sender: TObject);
procedure edit1KeyPress(Sender: TObject; var Key: Char);
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_fee_calc: Tfrm_fee_calc;
implementation
uses u_data_share, u_main, u_tree_main, u_dxbar_main, u_sys_close,
my_sys_function;
{$R *.dfm}
procedure Tfrm_fee_calc.bsSkinButton1Click(Sender: TObject);
var amt:Double;
Fees:string;
begin
with kbmMemTable1 do
begin
First;
while not eof do
begin
amt:=amt+kbmMemTable1.FieldByName('ÊýÁ¿').AsFloat*kbmMemTable1.FieldByName('µ¥¼Û').AsFloat;
if Trim(Fees)='' then
begin
Fees:=kbmMemTable1.FieldByName('ÏäÐÍ').AsString+'*'+kbmMemTable1.FieldByName('ÊýÁ¿').AsString+'*'+kbmMemTable1.FieldByName('µ¥¼Û').AsString;
end
else
begin
Fees:=Fees+' '+kbmMemTable1.FieldByName('ÏäÐÍ').AsString+'*'+kbmMemTable1.FieldByName('ÊýÁ¿').AsString+'*'+kbmMemTable1.FieldByName('µ¥¼Û').AsString;
end;
Next;
end;
end;
t_ch_fee1.DataSet.Edit;
t_ch_fee1.DataSet.FieldByName('½ð¶î').AsFloat:=amt;
t_ch_fee1.DataSet.FieldByName('ÊýÁ¿').AsFloat:=1;
t_ch_fee1.DataSet.FieldByName('µ¥¼Û').AsFloat:=amt;
t_ch_fee1.DataSet.FieldByName('±ê×¼').AsString:=Trim(t_ch_fee1.DataSet.DataSource.DataSet.FieldByName('¼¯×°Ïä').AsString);
t_ch_fee1.DataSet.FieldByName('±¸×¢').AsString:=Trim(Fees);
t_ch_fee1.DataSet.Post;
close;
end;
procedure Tfrm_fee_calc.edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
frm_fee_calc.bsSkinButton1Click(Sender);
end;
end;
procedure Tfrm_fee_calc.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_fee_calc.FormShow(Sender: TObject);
begin
kbmMemTable1.EmptyTable;
if not t_op_ctn_sum.IsEmpty then
with t_op_ctn_sum do
begin
First;
while not eof do
begin
kbmMemTable1.Insert;
kbmMemTable1.FieldByName('ÏäÐÍ').AsString:=FieldByName('±íÏÖÐÎʽ').AsString;
kbmMemTable1.FieldByName('ÊýÁ¿').AsInteger:=FieldByName('ÊýÁ¿').AsInteger;
kbmMemTable1.FieldByName('µ¥¼Û').AsInteger:=0;
kbmMemTable1.Post;
Next;
end;
end;
end;
procedure Tfrm_fee_calc.dxDBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if dxDBGrid1.FocusedField.FieldName='È·ÈÏ' then
begin
frm_fee_calc.bsSkinButton1Click(Sender);
end;
end;
end.