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.
DS6JIEFENG/财务管理/u_ch_invoice_addone_jk.~pas

258 lines
9.5 KiB
Plaintext

11 months ago
unit u_ch_invoice_addone_jk;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, Grids, DBGridEh, StdCtrls, Mask, bsSkinBoxCtrls,
DB, ADODB, kbmMemTable, kbmMemBinaryStreamFormat;
type
Tfrmch_invoice_addone_jk = class(TForm)
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinGroupBox1: TbsSkinGroupBox;
DBGridEh1: TDBGridEh;
bsSkinRadioGroup1: TbsSkinRadioGroup;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinEdit1: TbsSkinEdit;
Label1: TLabel;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
ADOQuery2: TADOQuery;
t_ch_fee_do: TADOQuery;
bsSkinGroupBox2: TbsSkinGroupBox;
DBGridEh2: TDBGridEh;
t_fee_obj: TADOQuery;
t_fee_obj1: TDataSource;
memtblDetail: TkbmMemTable;
memtblDetailCH_ID: TIntegerField;
memtblDetailField: TStringField;
memtblDetailField2: TStringField;
memtblDetailField3: TFloatField;
memtblDetailField4: TFloatField;
memtblDetailField5: TFloatField;
memtblDetailField6: TStringField;
memtblDetailField7: TFloatField;
memtblDetailField8: TStringField;
memtblDetailField9: TFloatField;
memtblDetailField10: TFloatField;
memtblDetailField11: TStringField;
kbmBinaryStreamFormat1: TkbmBinaryStreamFormat;
memtblDetailField12: TBooleanField;
memtblDetailField13: TFloatField;
memtblDetailField14: TStringField;
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure t_fee_objAfterScroll(DataSet: TDataSet);
private
{ Private declarations }
public
MblNo:Boolean;
{ Public declarations }
end;
var
frmch_invoice_addone_jk: Tfrmch_invoice_addone_jk;
implementation
uses u_main, u_data_share, u_ch_invoice, my_sys_function;
{$R *.dfm}
procedure Tfrmch_invoice_addone_jk.FormShow(Sender: TObject);
begin
IF frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>','USD',[])THEN
bsSkinEdit1.Text:=frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
memtblDetail.LoadFromDataSet(ADOQuery1,[]);
memtblDetail.open;
memtblDetail.filtered:=false;
memtblDetail.First;
while not memtblDetail.Eof do begin
memtbldetail.Edit;
memtbldetail.fieldbyname('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtbldetail.fieldbyname('<27><><EFBFBD><EFBFBD>').AsFloat-memtbldetail.fieldbyname('<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>').AsFloat-memtbldetail.fieldbyname('<27><><EFBFBD>뿪Ʊ').AsFloat;
memtbldetail.fieldbyname('ѡ<><D1A1>').Asboolean:=true;
memtbldetail.post;
memtblDetail.Next;
end;
memtblDetail.filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+t_fee_obj.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+'''';
memtblDetail.filtered:=true;
end;
procedure Tfrmch_invoice_addone_jk.bsSkinButton1Click(Sender: TObject);
var
FeeStr,NameStr:TStringList;
jine:Double;
str:String;
begin
FeeStr:=TStringList.Create;
NameStr:=TStringList.Create;
try
frm_ch_invoice_jk.t_ch_invoice.Edit;
if not ADOQuery2.IsEmpty then begin
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=ADOQuery2['<27><><EFBFBD><EFBFBD>']+'/'+ADOQuery2['<27><><EFBFBD><EFBFBD>'];
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD>˸<EFBFBD>']:=ADOQuery2['<27><><EFBFBD>˸<EFBFBD>'];
frm_ch_invoice_jk.t_ch_invoice['ж<><D0B6><EFBFBD><EFBFBD>']:=ADOQuery2['ж<><D0B6><EFBFBD><EFBFBD>'];
frm_ch_invoice_jk.t_ch_invoice['Ŀ<>ĸ<EFBFBD>']:=ADOQuery2['Ŀ<>ĵ<EFBFBD>'];
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=ADOQuery2['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
if Mblno then
frm_ch_invoice_jk.t_ch_invoice['ί<>б<EFBFBD><D0B1><EFBFBD>']:=ADOQuery2['ί<>б<EFBFBD><D0B1><EFBFBD>']
else
frm_ch_invoice_jk.t_ch_invoice['<27><EFBFBD><E1B5A5>']:=ADOQuery2['<27><><EFBFBD><EFBFBD><E1B5A5>'];
if (frm_ch_invoice_jk.t_ch_invoice.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull) or (frm_ch_invoice_jk.t_ch_invoice.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='') then begin
Str:=get_no(date,'IA');
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=Str;
end else
Str:=frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end;
if bsSkinRadioGroup1.ItemIndex=1 then
frm_ch_invoice_jk.t_ch_invoice['<27>ұ<EFBFBD>']:='USD'
else
frm_ch_invoice_jk.t_ch_invoice['<27>ұ<EFBFBD>']:='RMB';
if (frm_ch_invoice_jk.t_ch_invoice.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').IsNull) or (frm_ch_invoice_jk.t_ch_invoice['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']='') then begin
frm_ch_invoice_jk.t_ch_invoice['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=t_fee_obj.fieldbyName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
end;
if not frm_data_share.t_crm_client_all.IsEmpty then
if frm_data_share.t_crm_client_all.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_fee_obj.fieldbyName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then
begin
if trim(frm_data_share.t_crm_client_all.fieldbyname('<27><>Ʊ̧ͷ').asstring)<>''then
frm_ch_invoice_jk.t_ch_invoice['<27><>Ʊ̧ͷ']:=frm_data_share.t_crm_client_all.fieldbyname('<27><>Ʊ̧ͷ').asstring;
end;
jine:=0;
memtblDetail.First;
t_ch_fee_do.Open;
while not memtblDetail.Eof do begin
if (memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat<>0) and (memtblDetail.FieldByNAME('ѡ<><D1A1>').Asboolean) then begin
if memtblDetail['<27>ұ<EFBFBD>']='USD' then begin
if bsSkinRadioGroup1.ItemIndex=1 then begin
if bsSkinCheckRadioBox1.Checked then begin
FeeStr.Add(FloatToStr(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat));
NameStr.Add(memtblDetail['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']);
jine:=jine+(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
end else begin
jine:=jine+(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
end;
t_ch_fee_do.Insert;
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=Str;
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblDetail['<27><><EFBFBD><EFBFBD>'];
t_ch_fee_do['CH_ID']:=memtblDetail['CH_ID'];
t_ch_fee_do['<27>ұ<EFBFBD>']:='USD';
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=1;
t_ch_fee_do.Post;
end else begin
IF bsSkinCheckRadioBox2.Checked then begin
if bsSkinCheckRadioBox1.Checked then begin
FeeStr.Add(FloatToStr((memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat)*strtofloatdef(bsSkinEdit1.Text,7.0)));
NameStr.Add(memtblDetail['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']);
jine:=jine+(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat)*strtofloatdef(bsSkinEdit1.Text,7.0);
end else begin
jine:=jine+(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat)*strtofloatdef(bsSkinEdit1.Text,7.0);
end;
t_ch_fee_do.Insert;
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=Str;
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblDetail['<27><><EFBFBD><EFBFBD>'];
t_ch_fee_do['CH_ID']:=memtblDetail['CH_ID'];
t_ch_fee_do['<27>ұ<EFBFBD>']:='RMB';
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat)*strtofloatdef(bsSkinEdit1.Text,7.0);
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=1;
t_ch_fee_do.Post;
end;
end;
end else begin
if bsSkinRadioGroup1.ItemIndex=1 then begin
end else begin
if bsSkinCheckRadioBox1.Checked then begin
FeeStr.Add(FloatToStr(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat));
NameStr.Add(memtblDetail['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']);
jine:=jine+(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
end else begin
jine:=jine+(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
end;
t_ch_fee_do.Insert;
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=Str;
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblDetail['<27><><EFBFBD><EFBFBD>'];
t_ch_fee_do['CH_ID']:=memtblDetail['CH_ID'];
t_ch_fee_do['<27>ұ<EFBFBD>']:='RMB';
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=(memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=memtblDetail.FieldByNAME('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=1;
t_ch_fee_do.Post;
end;
end;
end;
memtblDetail.Next;
end;
if bsSkinCheckRadioBox1.Checked then begin
if frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']=0 then begin
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=NameStr.Text;
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=FeeStr.Text;
frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']:=jine;
frm_ch_invoice_jk.t_ch_invoice['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']:=jine;
end else begin
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']+#10#13+NameStr.Text;
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']+#10#13+FeeStr.Text;
frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']:=frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']+jine;
frm_ch_invoice_jk.t_ch_invoice['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']:=frm_ch_invoice_jk.t_ch_invoice['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']+jine;
end;
end else begin
if frm_ch_invoice_jk.t_ch_invoice['<27>ұ<EFBFBD>']='USD' then
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=get_parameters_value(7,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>')
else
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=get_parameters_value(147,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD>');
if frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']=0 then begin
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=FloatToStr(jine);
frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']:=jine;
frm_ch_invoice_jk.t_ch_invoice['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']:=jine;
end else begin
frm_ch_invoice_jk.t_ch_invoice['<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>']:=FloatToStr(frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']+jine);
frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']:=frm_ch_invoice_jk.t_ch_invoice['<27>ϼƽ<CFBC><C6BD><EFBFBD>']+jine;
frm_ch_invoice_jk.t_ch_invoice['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']:=frm_ch_invoice_jk.t_ch_invoice['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']+jine;
end;
end;
frm_ch_invoice_jk.t_ch_invoice.Post;
finally
FreeAndNil(FeeStr);
FreeAndNil(NameStr);
end;
close;
end;
procedure Tfrmch_invoice_addone_jk.t_fee_objAfterScroll(DataSet: TDataSet);
begin
memtblDetail.filtered:=false;
memtblDetail.filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+t_fee_obj.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+'''';
memtblDetail.filtered:=true;
end;
end.