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.

219 lines
8.3 KiB
Plaintext

11 months ago
unit u_ch_invoice_do;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, bsSkinCtrls, StdCtrls, RxLookup, Mask,
bsSkinBoxCtrls, ComCtrls;
type
Tfrm_ch_invoice_do = class(TForm)
bsSkinGroupBox1: TbsSkinGroupBox;
Label6: TLabel;
Label7: TLabel;
Label10: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
Edit2: TEdit;
Memo1: TMemo;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
Label1: TLabel;
Edit1: TEdit;
RxDBLookupCombo1: TRxDBLookupCombo;
Label2: TLabel;
DateTimePicker1: TDateTimePicker;
Label3: TLabel;
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_invoice_do: Tfrm_ch_invoice_do;
implementation
uses u_ch_balance_accept, u_data_share, u_main, u_sys_progress,my_sys_function;
{$R *.dfm}
procedure Tfrm_ch_invoice_do.bsSkinButton1Click(Sender: TObject);
var
str,str_feeValid:string;
i:integer;
begin
bsSkinButton1.Enabled:=false;
str:=RxDBLookupCombo1.DisplayValue;
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ򡣡<C8BA><F2A1A3A1><EFBFBD>';
frm_sys_progress.Show;
frm_main.db.BeginTrans;
with frm_ch_balance_accept do
try
t_ch_balance.Insert;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='<27><>Ʊ';
t_ch_balance['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_invoice_shen['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_balance['<27><><EFBFBD>ʽ']:=str;
t_ch_balance['<27>ұ<EFBFBD>']:=t_ch_invoice_shen['<27>ұ<EFBFBD>'];
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=formatdatetime('YYYY-MM-DD',DateTimePicker1.date);
t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring:=get_no(date,'BA');
{
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_invoice_shen['<27>ϼƽ<CFBC><C6BD><EFBFBD>'];
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_invoice_shen['<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'];
}
t_ch_balance['Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
{
if t_ch_invoice_shen['<27>ұ<EFBFBD>']='USD' then
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']
else
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
}
t_ch_balance['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>']:=frm_ch_invoice_do.RxDBLookupCombo3.DisplayValues[0];
t_ch_balance['<27><><EFBFBD><EFBFBD>']:=frm_ch_invoice_do.RxDBLookupCombo3.DisplayValues[1];
t_ch_balance['ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>']:=frm_ch_invoice_do.Edit2.text;
t_ch_balance['<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>']:=frm_ch_invoice_do.Edit1.text;
t_ch_balance['<27><>ע']:=frm_ch_invoice_do.Memo1.text;
if t_ch_fee_do_invoice.RecordCount>0 then
frm_sys_progress.bsSkinGauge1.MaxValue:=t_ch_fee_do_invoice.RecordCount+2;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
t_ch_fee_do_detail.close;
t_ch_fee_do_detail.sql.text:='select top 0 * from t_ch_fee_do ';
t_ch_fee_do_detail.open;
if dxDBGrid10.SelectedCount>0 then
begin
for i:=0 to dxDBGrid10.SelectedCount-1 do
begin
t_ch_invoice_shen.GotoBookmark(pointer(dxDBGrid10.selectedrows[i]));
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_invoice_shen['<27>ϼƽ<CFBC><C6BD><EFBFBD>'];
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_invoice_shen['<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'];
if t_ch_invoice_shen['<27>ұ<EFBFBD>']='USD' then
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']+t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']
else
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']+t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
t_ch_fee_do_invoice.first;
while not t_ch_fee_do_invoice.eof do
begin
t_ch_fee_do_detail.insert;
t_ch_fee_do_detail['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do_detail['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee_do_invoice['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_fee_do_detail['CH_ID']:=t_ch_fee_do_invoice['CH_ID'];
t_ch_fee_do_detail['<27>ұ<EFBFBD>']:=t_ch_fee_do_invoice['<27>ұ<EFBFBD>'];
t_ch_fee_do_detail['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_do_invoice['<27><><EFBFBD><EFBFBD>'];
t_ch_fee_do_detail['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee_do_invoice['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>'];
t_ch_fee_do_detail['<27><><EFBFBD><EFBFBD>']:='3';
t_ch_fee_do_detail.Post;
Setfee(0,t_ch_fee_do_invoice.fieldbyname('CH_ID').AsInteger,t_ch_fee_do_invoice.fieldbyname('ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>').AsCurrency);
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_ch_fee_do_invoice.next;
end;
frm_main.qryTmp.Close;
frm_main.qryTmp.sql.Text:='update t_ch_invoice set <20>Ƿ<EFBFBD><C7B7>շ<EFBFBD>=1,<2C>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>=:<3A>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> where IN_ID=:IN_ID';
frm_main.qryTmp.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
frm_main.qryTmp.Parameters.ParamByName('IN_ID').Value:=t_ch_invoice_shen['IN_ID'];
frm_main.qryTmp.ExecSQL;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
end
else
begin
if t_ch_fee_do_invoice.RecordCount>0 then
frm_sys_progress.bsSkinGauge1.MaxValue:=t_ch_fee_do_invoice.RecordCount+2;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_invoice_shen['<27>ϼƽ<CFBC><C6BD><EFBFBD>'];
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+t_ch_invoice_shen['<27><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'];
if t_ch_invoice_shen['<27>ұ<EFBFBD>']='USD' then
t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']:=t_ch_balance['<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>']+t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>']
else
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>']+t_ch_invoice_shen['ʵ<>ʽ<EFBFBD><CABD><EFBFBD>'];
t_ch_fee_do_invoice.first;
while not t_ch_fee_do_invoice.eof do
begin
t_ch_fee_do_detail.insert;
t_ch_fee_do_detail['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do_detail['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee_do_invoice['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_fee_do_detail['CH_ID']:=t_ch_fee_do_invoice['CH_ID'];
t_ch_fee_do_detail['<27>ұ<EFBFBD>']:=t_ch_fee_do_invoice['<27>ұ<EFBFBD>'];
t_ch_fee_do_detail['<27><><EFBFBD><EFBFBD>']:=t_ch_fee_do_invoice['<27><><EFBFBD><EFBFBD>'];
t_ch_fee_do_detail['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee_do_invoice['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>'];
t_ch_fee_do_detail['<27><><EFBFBD><EFBFBD>']:='3';
t_ch_fee_do_detail.Post;
Setfee(0,t_ch_fee_do_invoice.fieldbyname('CH_ID').AsInteger,t_ch_fee_do_invoice.fieldbyname('ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>').AsCurrency);
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_ch_fee_do_invoice.next;
end;
frm_main.qryTmp.Close;
frm_main.qryTmp.sql.Text:='update t_ch_invoice set <20>Ƿ<EFBFBD><C7B7>շ<EFBFBD>=1,<2C>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>=:<3A>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> where IN_ID=:IN_ID';
frm_main.qryTmp.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
frm_main.qryTmp.Parameters.ParamByName('IN_ID').Value:=t_ch_invoice_shen['IN_ID'];
frm_main.qryTmp.ExecSQL;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
end;
t_ch_balance.Post;
dxDBGrid10.ClearSelection;
t_ch_invoice_shen.close;
t_ch_invoice_shen.open;
t_ch_balance.edit;
t_ch_balance.post;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
t_ch_fee_do_detail.close;
frm_main.db.CommitTrans;
finally
frm_sys_progress.Close;
frm_sys_progress.Free;
frm_sys_progress:=nil;
str_feeValid:=SetfeeValid(t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring);
if trim(str_feeValid) <>'' then
begin
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>'+#13#10+str_feeValid);
end;
if frm_main.db.InTransaction then
begin
MessageDlg('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رյ<D8B1>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>',mterror,[mbok],0);
frm_main.db.RollbackTrans;
end;
bsSkinButton1.Enabled:=true;
frm_ch_invoice_do.close;
end;
end;
procedure Tfrm_ch_invoice_do.bsSkinButton2Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_invoice_do.FormShow(Sender: TObject);
begin
DateTimePicker1.date:=Date;
end;
end.