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_balance_truck_accept.pas

873 lines
26 KiB
Plaintext

11 months ago
unit u_ch_balance_truck_accept;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, wwdbedit, Wwdotdot, Wwdbcomb, StdCtrls, DBCtrls,
bsdbctrls, RxLookup, Mask, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid,
wwdbdatetimepicker, DB, ADODB, dxDBTLCl, dxGrClms, Menus, XPMenu;
type
Tfrm_ch_balance_truck_accept = class(TForm)
bsSkinPanel2: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinNotebook1: TbsSkinNotebook;
bsSkinPanel1: TbsSkinPanel;
bsSkinPanel3: TbsSkinPanel;
Label25: TLabel;
Label17: TLabel;
Label12: TLabel;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
DBEdit14: TDBEdit;
DBEdit1: TDBEdit;
RxDBLookupCombo1: TRxDBLookupCombo;
bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
DBEdit8: TDBEdit;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
DBMemo1: TDBMemo;
wwDBComboBox1: TwwDBComboBox;
RxDBLookupCombo3: TRxDBLookupCombo;
dxDBGrid1: TdxDBGrid;
bsSkinPanel4: TbsSkinPanel;
Label11: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Edit1: TEdit;
Edit5: TEdit;
Edit6: TEdit;
wwDBDateTimePicker5: TwwDBDateTimePicker;
wwDBDateTimePicker6: TwwDBDateTimePicker;
wwDBDateTimePicker7: TwwDBDateTimePicker;
wwDBDateTimePicker8: TwwDBDateTimePicker;
RxDBLookupCombo4: TRxDBLookupCombo;
bsSkinButton7: TbsSkinButton;
bsSkinButton13: TbsSkinButton;
bsSkinPanel5: TbsSkinPanel;
dxDBGrid2: TdxDBGrid;
dxDBGrid3: TdxDBGrid;
bsSkinPanel6: TbsSkinPanel;
dxDBGrid4: TdxDBGrid;
bsSkinButton10: TbsSkinButton;
t_ch_balance: TADOQuery;
t_ch_balance1: TDataSource;
t_ch_fee_do: TADOQuery;
t_bill: TADOQuery;
t_bill1: TDataSource;
t_ch_fee: TADOQuery;
t_ch_fee1: TDataSource;
t_ch_balance_fee: TADOQuery;
t_ch_balance_fee1: TDataSource;
dxDBGrid4Column1: TdxDBGridColumn;
dxDBGrid4Column2: TdxDBGridColumn;
dxDBGrid4Column3: TdxDBGridColumn;
dxDBGrid4Column4: TdxDBGridColumn;
dxDBGrid4Column6: TdxDBGridColumn;
dxDBGrid4Column7: TdxDBGridColumn;
dxDBGrid4Column8: TdxDBGridColumn;
dxDBGrid4Column9: TdxDBGridColumn;
dxDBGrid4Column10: TdxDBGridColumn;
dxDBGrid4Column11: TdxDBGridColumn;
dxDBGrid4Column12: TdxDBGridColumn;
dxDBGrid4Column13: TdxDBGridColumn;
dxDBGrid4Column14: TdxDBGridColumn;
Label21: TLabel;
Edit2: TEdit;
Label65: TLabel;
Edit21: TEdit;
Label22: TLabel;
Edit4: TEdit;
Label23: TLabel;
wwDBComboBox2: TwwDBComboBox;
Label24: TLabel;
RxDBLookupCombo5: TRxDBLookupCombo;
Label26: TLabel;
Edit3: TEdit;
Label28: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
Label29: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label30: TLabel;
wwDBDateTimePicker3: TwwDBDateTimePicker;
Label31: TLabel;
wwDBDateTimePicker4: TwwDBDateTimePicker;
Label32: TLabel;
RxDBLookupCombo7: TRxDBLookupCombo;
Label33: TLabel;
RxDBLookupCombo8: TRxDBLookupCombo;
Label34: TLabel;
Edit7: TEdit;
Label35: TLabel;
Edit8: TEdit;
Label36: TLabel;
Edit9: TEdit;
bsSkinButton12: TbsSkinButton;
dxDBGrid3Column1: TdxDBGridMaskColumn;
dxDBGrid3Column2: TdxDBGridMaskColumn;
dxDBGrid3Column3: TdxDBGridMaskColumn;
dxDBGrid3Column4: TdxDBGridMaskColumn;
dxDBGrid3Column5: TdxDBGridMaskColumn;
dxDBGrid3Column6: TdxDBGridMaskColumn;
dxDBGrid3Column7: TdxDBGridDateColumn;
dxDBGrid3Column8: TdxDBGridDateColumn;
dxDBGrid3Column9: TdxDBGridMaskColumn;
dxDBGrid3Column10: TdxDBGridMaskColumn;
dxDBGrid3Column11: TdxDBGridMaskColumn;
dxDBGrid3Column12: TdxDBGridMaskColumn;
dxDBGrid3Column13: TdxDBGridMaskColumn;
dxDBGrid3Column14: TdxDBGridMaskColumn;
dxDBGrid3Column15: TdxDBGridMaskColumn;
dxDBGrid2Column1: TdxDBGridColumn;
dxDBGrid2Column2: TdxDBGridColumn;
dxDBGrid2Column3: TdxDBGridColumn;
dxDBGrid2Column4: TdxDBGridColumn;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
PopupMenu2: TPopupMenu;
MenuItem1: TMenuItem;
PopupMenu3: TPopupMenu;
MenuItem2: TMenuItem;
XPMenu1: TXPMenu;
Label2: TLabel;
wwDBDateTimePicker9: TwwDBDateTimePicker;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure RxDBLookupCombo1Enter(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton13Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
procedure bsSkinPanel2Resize(Sender: TObject);
procedure t_ch_balanceAfterDelete(DataSet: TDataSet);
procedure t_ch_balanceAfterInsert(DataSet: TDataSet);
procedure t_ch_balanceBeforeEdit(DataSet: TDataSet);
procedure t_ch_balanceBeforePost(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_balance_truck_accept: Tfrm_ch_balance_truck_accept;
implementation
uses u_main, my_sys_function;
{$R *.dfm}
procedure Tfrm_ch_balance_truck_accept.FormShow(Sender: TObject);
begin
t_ch_balance.Close;
t_ch_balance.SQL.clear;
t_ch_balance.SQL.Add('select * from t_ch_balance_truck where <20>ʵ<EFBFBD>״̬<>'+''''+'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'+''''
+' and <20><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''
+' order by <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> desc');
t_ch_balance.open;
t_ch_fee_do.open;
t_ch_balance_fee.open;
loadreggrid(dxdbgrid4,false,caption);
end;
procedure Tfrm_ch_balance_truck_accept.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid4,caption);
frm_ch_balance_truck_accept.Hide;
frm_ch_balance_truck_accept.ManualFloat(frm_ch_balance_truck_accept.BoundsRect );
frm_main.freeTabs('frm_ch_balance_truck_accept');
action:=cafree;
frm_ch_balance_truck_accept:=nil;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton9Click(Sender: TObject);
begin
sys_print('<27>ɳ<EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>',2,t_ch_balance1,nil,nil,nil,
t_ch_balance_fee1,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton1Click(Sender: TObject);
begin
t_ch_balance.insert;
bsSkinNotebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_ch_balance);
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_ch_balance);
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton11Click(
Sender: TObject);
var
answer:TModalResult;
begin
if bsSkinButton11.Caption='<27><EFBFBD>޸<EFBFBD>' then
begin
if t_ch_balance.IsEmpty then
exit;
bsSkinNotebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end
else
begin
if (t_ch_balance.State=dsinsert)or(t_ch_balance.State=dsedit) then
BEGIN
answer:=messagedlg( '<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE>޸ģ<DEB8><C4A3>Ƿ񱣴棿',mtWarning,mbYesNoCancel,0);
if answer=mrYes then
begin
t_ch_balance.post;
end;
if answer=mrNo then
begin
t_ch_balance.cancel;
end;
if answer=mrCancel then
begin
exit;
end;
END;
bsSkinNotebook1.PageIndex:=0;
bsSkinButton11.Caption:='<27><EFBFBD>޸<EFBFBD>';
end;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton6Click(Sender: TObject);
begin
if t_ch_balance.IsEmpty then
exit;
if t_ch_balance.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'then
begin
showmessage('<27>ʵ<EFBFBD><CAB5>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
end
else
begin
try
modify_all:=true;
t_ch_balance.edit;
t_ch_balance['<27>ʵ<EFBFBD>״̬']:='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>';
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_ch_balance.post;
modify_all:=false;
except
modify_all:=false;
showmessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
end;
t_ch_balance.Refresh;
end;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton8Click(Sender: TObject);
begin
if t_ch_balance.IsEmpty then
exit;
if t_ch_balance.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='¼<><C2BC>״̬'then
begin
showmessage('<27>ʵ<EFBFBD>û<EFBFBD>б<EFBFBD>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
end
else
begin
try
modify_all:=true;
t_ch_balance.edit;
t_ch_balance['<27>ʵ<EFBFBD>״̬']:='¼<><C2BC>״̬';
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='';
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
t_ch_balance.post;
modify_all:=false;
except
modify_all:=false;
showmessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
end;
t_ch_balance.Refresh;
end;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton12Click(
Sender: TObject);
begin
Edit2.text:='';
Edit21.text:='';
Edit4.text:='';
wwDBComboBox2.text:='';
RxDBLookupCombo5.ClearValue;
Edit3.text:='';
RxDBLookupCombo8.ClearValue;
RxDBLookupCombo7.ClearValue;
wwDBDateTimePicker1.text:='';
wwDBDateTimePicker2.text:='';
wwDBDateTimePicker3.text:='';
wwDBDateTimePicker4.text:='';
Edit7.text:='';
Edit8.text:='';
Edit9.text:='';
wwDBDateTimePicker9.text:='';
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton10Click(
Sender: TObject);
var
str,str_bill:widestring;
begin
str:='where <20><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
if (Edit2.text<>'')and(Edit21.text<>'')then
begin
str:=str+' and <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> between '+''''+Edit2.text+''''+' and '+''''+Edit21.text+'''';
end
else
begin
if Edit2.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><E3B5A5> like '+''''+Edit2.text+'''';
if Edit21.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><E3B5A5> like '+''''+Edit21.text+'''';
end;
if Edit4.text<>''then
str:=str+' and ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD> like '+''''+Edit4.text+'''';
if wwDBComboBox2.text<>''then
str:=str+' and <20>ʵ<EFBFBD>״̬='+''''+wwDBComboBox2.text+'''';
if RxDBLookupCombo5.DisplayValue<>''then
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo5.DisplayValues[1]+'''';
if Edit3.text<>''then
begin
try
strtoint(Edit3.text);
except
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>Ϊ<EFBFBD><CEAA><EFBFBD>֣<EFBFBD><D6A3><EFBFBD>');
exit;
end;
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+Edit3.text;
end;
if RxDBLookupCombo8.DisplayValue<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo8.DisplayValues[0]+'''';
if RxDBLookupCombo7.DisplayValue<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo7.DisplayValues[0]+'''';
if wwDBDateTimePicker1.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
if wwDBDateTimePicker2.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
if wwDBDateTimePicker3.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker3.text+'''';
if wwDBDateTimePicker4.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker4.text+'''';
if Edit7.text<>''then
str_bill:='where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+Edit7.text+'''';
if Edit8.text<>''then
begin
if str_bill=''then
str_bill:='where <20><><EFBFBD><EFBFBD><E1B5A5> like '+''''+Edit8.text+''''
else
str_bill:=str_bill+' and <20><><EFBFBD><EFBFBD><E1B5A5> like '+''''+Edit8.text+'''';
end;
if Edit9.text<>''then
begin
if str_bill=''then
str_bill:='where ί<>б<EFBFBD><D0B1><EFBFBD> like '+''''+Edit9.text+''''
else
str_bill:=str_bill+' and ί<>б<EFBFBD><D0B1><EFBFBD> like '+''''+Edit9.text+'''';
end;
if wwDBDateTimePicker9.text<>''then
begin
if str_bill=''then
str_bill:='where <20><><EFBFBD><EFBFBD>='+''''+wwDBDateTimePicker9.text+''''
else
str_bill:=str_bill+' and <20><><EFBFBD><EFBFBD>='+''''+wwDBDateTimePicker9.text+'''';
end;
if str_bill<>''then
str:=str+' and <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> in (select distinct <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from v_fee_do_truck_accept '
+str_bill+')';
t_ch_balance.close;
t_ch_balance.sql.clear;
t_ch_balance.sql.add('select * from t_ch_balance_truck '+str+' order by <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
t_ch_balance.open;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton4Click(Sender: TObject);
begin
if t_ch_balance.IsEmpty then
exit;
if (t_ch_balance.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)=IDOK then
begin
t_ch_fee_do.requery;
while not t_ch_fee_do.eof do
t_ch_fee_do.delete;
t_ch_balance.Delete;
t_ch_balance_fee.requery;
if t_bill.active then
t_bill.requery;
end;
end;
procedure Tfrm_ch_balance_truck_accept.RxDBLookupCombo1Enter(
Sender: TObject);
begin
if t_ch_balance_fee.IsEmpty then
begin
RxDBLookupCombo1.ReadOnly:=false;
end
else
begin
RxDBLookupCombo1.ReadOnly:=true;
end;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton7Click(Sender: TObject);
var
str,str_fee:widestring;
begin
str_fee:='where <20><><EFBFBD><EFBFBD>״̬ in ('+''''+'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>'+''''+','+''''+'<27><>ֹ<EFBFBD>޸<EFBFBD>'+''''+')'
+' and isnull(<28>շѽ<D5B7><D1BD><EFBFBD>,0)<>isnull(<28>շѽ<D5B7><D1BD><EFBFBD>,0)';
if RxDBLookupCombo4.DisplayValue<>''then
str_fee:=str_fee+' and <20>շѿͻ<D1BF>='+''''+RxDBLookupCombo4.DisplayValues[1]+'''';
str:='where <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from t_ch_fee_truck '+str_fee+')';
if Edit1.text<>''then
str:=str+' and ί<>б<EFBFBD><D0B1><EFBFBD> like '+''''+Edit1.text+'''';
if Edit5.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><E1B5A5> like '+''''+Edit5.text+'''';
if Edit6.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><E1B5A5> like '+''''+Edit6.text+'''';
if wwDBDateTimePicker5.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker5.text+'''';
if wwDBDateTimePicker7.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker7.text+'''';
if wwDBDateTimePicker6.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker6.text+'''';
if wwDBDateTimePicker8.text<>''then
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker8.text+'''';
t_ch_fee.close;
t_bill.close;
t_bill.sql.clear;
t_bill.sql.add('select * from v_sea '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
t_bill.open;
t_ch_fee.sql.Clear;
t_ch_fee.sql.add('select *,(isnull(<28>շѽ<D5B7><D1BD><EFBFBD>,0)-isnull(<28>շѽ<D5B7><D1BD><EFBFBD>,0)) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_ch_fee_truck '
+str_fee+' and <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> order by TF_ID');
t_ch_fee.open;
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinButton13Click(
Sender: TObject);
begin
RxDBLookupCombo1.ClearValue;
Edit1.text:='';
Edit5.Text:='';
Edit6.text:='';
wwDBDateTimePicker5.Clear;
wwDBDateTimePicker6.clear;
wwDBDateTimePicker7.clear;
wwDBDateTimePicker8.clear;
end;
procedure Tfrm_ch_balance_truck_accept.MenuItem1Click(Sender: TObject);
var
do_num:real;
i:integer;
jia_num:real;
begin
if (t_ch_balance.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if t_ch_fee.IsEmpty then
exit;
if (t_ch_balance.State=dsinsert)or(t_ch_balance.State=dsedit)then
begin
if t_ch_balance.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring=''then
t_ch_balance['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee['<27>շѿͻ<D1BF>'];
t_ch_balance.post;
end;
if not t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
do_num:=t_ch_balance.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
if do_num=0 then
exit;
end;
jia_num:=0;
if dxDBGrid2.SelectedCount>=1 then
begin
for i:=0 to dxDBGrid2.SelectedCount-1 do
begin
t_ch_fee.GotoBookmark(pointer(dxDBGrid2.selectedrows[i]));
if t_ch_balance.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring=t_ch_fee.FieldByName('<27>շѿͻ<D1BF>').asstring then
begin
if t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
t_ch_fee_do.Insert;
t_ch_fee_do['<27>ұ<EFBFBD>']:='RMB';
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['CH_ID']:=t_ch_fee.fieldbyname('TF_ID').asinteger;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:='1';
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do.post;
jia_num:=jia_num+t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
end
else
begin
t_ch_fee_do.Insert;
t_ch_fee_do['<27>ұ<EFBFBD>']:='RMB';
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
if do_num<>0 then
begin
if t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat<0 then
begin
if t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat>do_num then
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
jia_num:=jia_num+t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
do_num:=do_num-t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
end
else
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=do_num;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=do_num;
jia_num:=jia_num+do_num;
do_num:=0;
end;
end
else
begin
if t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat<do_num then
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
jia_num:=jia_num+t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
do_num:=do_num-t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
end
else
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=do_num;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=do_num;
jia_num:=jia_num+do_num;
do_num:=0;
end;
end;
end;
t_ch_fee_do['CH_ID']:=t_ch_fee.fieldbyname('TF_ID').asinteger;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:='1';
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do.post;
end;
end;
end;
end;
if jia_num<>0 then
begin
t_ch_balance.edit;
if t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+jia_num;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end
else
begin
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+jia_num;
end;
t_ch_balance.post;
end;
t_ch_fee.requery;
t_ch_balance_fee.requery;
end;
procedure Tfrm_ch_balance_truck_accept.N1Click(Sender: TObject);
var
do_num:real;
i:integer;
jia_num:real;
begin
if (t_ch_balance.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if t_ch_fee.IsEmpty then
exit;
if (t_ch_balance.State=dsinsert)or(t_ch_balance.State=dsedit)then
begin
if t_ch_balance.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring=''then
t_ch_balance['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee['<27>շѿͻ<D1BF>'];
t_ch_balance.post;
end;
if not t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
do_num:=t_ch_balance.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
if do_num=0 then
exit;
end;
jia_num:=0;
if dxDBGrid3.SelectedCount>=1 then
begin
for i:=0 to dxDBGrid3.SelectedCount-1 do
begin
t_bill.GotoBookmark(pointer(dxDBGrid3.selectedrows[i]));
t_ch_fee.first;
while not t_ch_fee.eof do
begin
if t_ch_balance.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring=t_ch_fee.FieldByName('<27>շѿͻ<D1BF>').asstring then
begin
if t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
t_ch_fee_do.Insert;
t_ch_fee_do['<27>ұ<EFBFBD>']:='RMB';
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['CH_ID']:=t_ch_fee.fieldbyname('TF_ID').asinteger;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:='1';
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do.post;
jia_num:=jia_num+t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
end
else
begin
t_ch_fee_do.Insert;
t_ch_fee_do['<27>ұ<EFBFBD>']:='RMB';
t_ch_fee_do['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
if do_num<>0 then
begin
if t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat<0 then
begin
if t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat>do_num then
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
jia_num:=jia_num+t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
do_num:=do_num-t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
end
else
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=do_num;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=do_num;
jia_num:=jia_num+do_num;
do_num:=0;
end;
end
else
begin
if t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat<do_num then
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
jia_num:=jia_num+t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
do_num:=do_num-t_ch_fee.fieldbyname('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat;
end
else
begin
t_ch_fee_do['ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>']:=do_num;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:=do_num;
jia_num:=jia_num+do_num;
do_num:=0;
end;
end;
end;
t_ch_fee_do['CH_ID']:=t_ch_fee.fieldbyname('TF_ID').asinteger;
t_ch_fee_do['<27><><EFBFBD><EFBFBD>']:='1';
t_ch_fee_do['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
t_ch_fee_do.post;
end;
end;
t_ch_fee.next;
end;
end;
end;
if jia_num<>0 then
begin
t_ch_balance.edit;
if t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+jia_num;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end
else
begin
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+jia_num;
end;
t_ch_balance.post;
end;
t_bill.Requery();
t_ch_balance_fee.Requery();
end;
procedure Tfrm_ch_balance_truck_accept.MenuItem2Click(Sender: TObject);
var
i:integer;
delete_num:real;
begin
if (t_ch_balance.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if t_ch_balance_fee.IsEmpty then
exit;
delete_num:=0;
if dxDBGrid1.SelectedCount>=1 then
begin
for i:=0 to dxDBGrid1.SelectedCount-1 do
begin
t_ch_balance_fee.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if t_ch_fee_do.Locate('CH_ID',t_ch_balance_fee.fieldbyname('TF_ID').asinteger,[])then
begin
t_ch_fee_do.delete;
delete_num:=delete_num+t_ch_balance_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
end;
end
end;
if delete_num<>0 then
begin
t_ch_balance.edit;
if t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']-delete_num;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end
else
begin
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']-delete_num;
end;
t_ch_balance.post;
end;
t_ch_balance_fee.requery;
if t_ch_fee.Active then
t_ch_fee.Requery();
end;
procedure Tfrm_ch_balance_truck_accept.bsSkinPanel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.Width/9);
bsSkinButton9.Width:=i;
bsSkinButton1.Width:=i;
bsSkinButton2.Width:=i;
bsSkinButton4.Width:=i;
bsSkinButton3.Width:=i;
bsSkinButton11.Width:=i;
bsSkinButton6.Width:=i;
bsSkinButton8.Width:=i;
end;
procedure Tfrm_ch_balance_truck_accept.t_ch_balanceAfterDelete(
DataSet: TDataSet);
begin
if t_bill.Active then
t_bill.Requery();
end;
procedure Tfrm_ch_balance_truck_accept.t_ch_balanceAfterInsert(
DataSet: TDataSet);
begin
t_ch_balance['<27>ʵ<EFBFBD>״̬']:='¼<><C2BC>״̬';
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=now;
t_ch_balance['<27>Զ<EFBFBD>']:=1;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
t_ch_balance['<27><><EFBFBD><EFBFBD>']:='<27><>';
end;
procedure Tfrm_ch_balance_truck_accept.t_ch_balanceBeforeEdit(
DataSet: TDataSet);
begin
if not modify_all then
begin
if (t_ch_balance.FieldByName('<27>ʵ<EFBFBD>״̬').asstring='<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>')then
begin
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
abort;
end;
end;
end;
procedure Tfrm_ch_balance_truck_accept.t_ch_balanceBeforePost(
DataSet: TDataSet);
begin
table_before_post(t_ch_balance,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
if t_ch_balance.FieldByName('<27>Զ<EFBFBD>').asboolean then
begin
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end;
if t_ch_balance.state=dsinsert then
t_ch_balance['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>']:=get_no(date,'TA');
t_ch_balance['<27>ʵ<EFBFBD>״̬']:=t_ch_balance['<27>ʵ<EFBFBD>״̬'];
t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_balance['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']-t_ch_balance['ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end;
end.