|
|
|
|
unit u_cw_pingzheng;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, bsSkinCtrls, ComCtrls, bsSkinTabs, dxExEdtr, dxCntner, dxTL,
|
|
|
|
|
dxDBCtrl, dxDBGrid, StdCtrls, wwdbdatetimepicker, RxLookup, DB, ADODB,FileCtrl,
|
|
|
|
|
dxDBTLCl, dxGrClms, Mask, wwdbedit, Wwdotdot, Wwdbcomb, Grids, DBGrids,
|
|
|
|
|
ExtCtrls, DBGridEh, kbmMemTable, DBTables,inifiles;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
Tfrm_cw_pingzheng = class(TForm)
|
|
|
|
|
t_op_seae: TADOQuery;
|
|
|
|
|
t_op_seae1: TDataSource;
|
|
|
|
|
t_cw_design: TADOQuery;
|
|
|
|
|
t_cw_design1: TDataSource;
|
|
|
|
|
t_op_seai: TADOQuery;
|
|
|
|
|
t_op_seai1: TDataSource;
|
|
|
|
|
t_op_airi1: TDataSource;
|
|
|
|
|
t_op_airi: TADOQuery;
|
|
|
|
|
t_op_aire: TADOQuery;
|
|
|
|
|
t_op_aire1: TDataSource;
|
|
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
|
|
page1: TbsSkinPageControl;
|
|
|
|
|
tbbsVou: TbsSkinTabSheet;
|
|
|
|
|
tbbalvou: TbsSkinTabSheet;
|
|
|
|
|
bsSkinGroupBox2: TbsSkinGroupBox;
|
|
|
|
|
bsSkinPanel10: TbsSkinPanel;
|
|
|
|
|
Label25: TLabel;
|
|
|
|
|
Label65: TLabel;
|
|
|
|
|
Label26: TLabel;
|
|
|
|
|
Label27: TLabel;
|
|
|
|
|
Label28: TLabel;
|
|
|
|
|
Edit9: TEdit;
|
|
|
|
|
wwDBDateTimePicker17: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker18: TwwDBDateTimePicker;
|
|
|
|
|
wwDBComboBox1: TwwDBComboBox;
|
|
|
|
|
bsSkinPageControl1: TbsSkinPageControl;
|
|
|
|
|
bsSkinTabSheet1: TbsSkinTabSheet;
|
|
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
|
|
Label10: TLabel;
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
Label8: TLabel;
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
|
|
Edit4: TEdit;
|
|
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
|
|
Edit2: TEdit;
|
|
|
|
|
wwDBDateTimePicker3: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker4: TwwDBDateTimePicker;
|
|
|
|
|
bsSkinTabSheet2: TbsSkinTabSheet;
|
|
|
|
|
bsSkinPanel4: TbsSkinPanel;
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
Label6: TLabel;
|
|
|
|
|
Label7: TLabel;
|
|
|
|
|
Label9: TLabel;
|
|
|
|
|
Label12: TLabel;
|
|
|
|
|
wwDBDateTimePicker5: TwwDBDateTimePicker;
|
|
|
|
|
Edit1: TEdit;
|
|
|
|
|
wwDBDateTimePicker6: TwwDBDateTimePicker;
|
|
|
|
|
Edit3: TEdit;
|
|
|
|
|
wwDBDateTimePicker7: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker8: TwwDBDateTimePicker;
|
|
|
|
|
bsSkinTabSheet3: TbsSkinTabSheet;
|
|
|
|
|
bsSkinPanel6: TbsSkinPanel;
|
|
|
|
|
Label13: TLabel;
|
|
|
|
|
Label14: TLabel;
|
|
|
|
|
Label15: TLabel;
|
|
|
|
|
Label16: TLabel;
|
|
|
|
|
Label17: TLabel;
|
|
|
|
|
Label18: TLabel;
|
|
|
|
|
wwDBDateTimePicker9: TwwDBDateTimePicker;
|
|
|
|
|
Edit5: TEdit;
|
|
|
|
|
wwDBDateTimePicker10: TwwDBDateTimePicker;
|
|
|
|
|
Edit6: TEdit;
|
|
|
|
|
wwDBDateTimePicker11: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker12: TwwDBDateTimePicker;
|
|
|
|
|
bsSkinTabSheet4: TbsSkinTabSheet;
|
|
|
|
|
bsSkinPanel8: TbsSkinPanel;
|
|
|
|
|
Label19: TLabel;
|
|
|
|
|
Label20: TLabel;
|
|
|
|
|
Label21: TLabel;
|
|
|
|
|
Label22: TLabel;
|
|
|
|
|
Label23: TLabel;
|
|
|
|
|
Label24: TLabel;
|
|
|
|
|
wwDBDateTimePicker13: TwwDBDateTimePicker;
|
|
|
|
|
Edit7: TEdit;
|
|
|
|
|
wwDBDateTimePicker14: TwwDBDateTimePicker;
|
|
|
|
|
Edit8: TEdit;
|
|
|
|
|
wwDBDateTimePicker15: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker16: TwwDBDateTimePicker;
|
|
|
|
|
bsSkinPanel12: TbsSkinPanel;
|
|
|
|
|
DBGridEh1: TDBGridEh;
|
|
|
|
|
DBGridEh4: TDBGridEh;
|
|
|
|
|
DBGridEh5: TDBGridEh;
|
|
|
|
|
DBGridEh6: TDBGridEh;
|
|
|
|
|
DBGridEh7: TDBGridEh;
|
|
|
|
|
TBVouList: TbsSkinTabSheet;
|
|
|
|
|
bsSkinPanel16: TbsSkinPanel;
|
|
|
|
|
t_op_balance: TADOQuery;
|
|
|
|
|
t_op_balance1: TDataSource;
|
|
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
|
|
t_op_balanceDSDesigner: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner2: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner3: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner4: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner5: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner6: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner7: TBCDField;
|
|
|
|
|
t_op_balanceDSDesigner8: TBCDField;
|
|
|
|
|
t_op_balanceDSDesigner9: TBCDField;
|
|
|
|
|
t_op_balanceDSDesigner10: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner11: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner12: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner13: TDateTimeField;
|
|
|
|
|
t_op_balanceDSDesigner14: TBooleanField;
|
|
|
|
|
t_op_balanceDSDesigner15: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner16: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner17: TDateTimeField;
|
|
|
|
|
t_op_balanceDSDesigner18: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner19: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner20: TDateTimeField;
|
|
|
|
|
t_op_balanceDSDesigner21: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner22: TBooleanField;
|
|
|
|
|
t_op_balanceDSDesigner23: TStringField;
|
|
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
|
|
bsSkinButton7: TbsSkinButton;
|
|
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
|
|
bsSkinButton11: TbsSkinButton;
|
|
|
|
|
bsSkinButton12: TbsSkinButton;
|
|
|
|
|
bsSkinButton14: TbsSkinButton;
|
|
|
|
|
bsSkinButton15: TbsSkinButton;
|
|
|
|
|
bsSkinButton16: TbsSkinButton;
|
|
|
|
|
bsSkinButton18: TbsSkinButton;
|
|
|
|
|
bsSkinButton19: TbsSkinButton;
|
|
|
|
|
bsSkinButton20: TbsSkinButton;
|
|
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinCheckRadioBox5: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
|
|
Label30: TLabel;
|
|
|
|
|
wwDBDateTimePicker19: TwwDBDateTimePicker;
|
|
|
|
|
Label31: TLabel;
|
|
|
|
|
wwDBDateTimePicker20: TwwDBDateTimePicker;
|
|
|
|
|
Label33: TLabel;
|
|
|
|
|
EditMblNo: TEdit;
|
|
|
|
|
EditOrdNoTo: TEdit;
|
|
|
|
|
Label34: TLabel;
|
|
|
|
|
EditOrdNoFrm: TEdit;
|
|
|
|
|
Label35: TLabel;
|
|
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
|
|
bsSkinButton8: TbsSkinButton;
|
|
|
|
|
bsSkinButton13: TbsSkinButton;
|
|
|
|
|
bsSkinPanel7: TbsSkinPanel;
|
|
|
|
|
Splitter1: TSplitter;
|
|
|
|
|
bsSkinPanel9: TbsSkinPanel;
|
|
|
|
|
DBGridEh2: TDBGridEh;
|
|
|
|
|
bsSkinPanel11: TbsSkinPanel;
|
|
|
|
|
DBGridCarriageSum: TDBGridEh;
|
|
|
|
|
dsrvouitems: TDataSource;
|
|
|
|
|
dsrVou: TDataSource;
|
|
|
|
|
memTblVou: TkbmMemTable;
|
|
|
|
|
qryVouitems: TADOQuery;
|
|
|
|
|
Query1: TQuery;
|
|
|
|
|
bsSkinCheckRadioBox6: TbsSkinCheckRadioBox;
|
|
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
|
|
Label29: TLabel;
|
|
|
|
|
wwDBDateTimePicker21: TwwDBDateTimePicker;
|
|
|
|
|
Label36: TLabel;
|
|
|
|
|
RxDBLookupCombo6: TRxDBLookupCombo;
|
|
|
|
|
tblvouitems: TADOTable;
|
|
|
|
|
bsSkinButton17: TbsSkinButton;
|
|
|
|
|
bsSkinButton21: TbsSkinButton;
|
|
|
|
|
bsSkinButton22: TbsSkinButton;
|
|
|
|
|
bsSkinButton23: TbsSkinButton;
|
|
|
|
|
bsSkinButton24: TbsSkinButton;
|
|
|
|
|
bsSkinButton25: TbsSkinButton;
|
|
|
|
|
Label37: TLabel;
|
|
|
|
|
Edit10: TEdit;
|
|
|
|
|
Label38: TLabel;
|
|
|
|
|
Edit11: TEdit;
|
|
|
|
|
Label39: TLabel;
|
|
|
|
|
RxDBLookupCombo4: TRxDBLookupCombo;
|
|
|
|
|
Label40: TLabel;
|
|
|
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
Label41: TLabel;
|
|
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
|
|
Label42: TLabel;
|
|
|
|
|
RxDBLookupCombo5: TRxDBLookupCombo;
|
|
|
|
|
Label32: TLabel;
|
|
|
|
|
RxDBLookupCombo7: TRxDBLookupCombo;
|
|
|
|
|
Label43: TLabel;
|
|
|
|
|
Edit12: TEdit;
|
|
|
|
|
Label44: TLabel;
|
|
|
|
|
RxDBLookupCombo8: TRxDBLookupCombo;
|
|
|
|
|
Label45: TLabel;
|
|
|
|
|
RxDBLookupCombo9: TRxDBLookupCombo;
|
|
|
|
|
Label46: TLabel;
|
|
|
|
|
RxDBLookupCombo10: TRxDBLookupCombo;
|
|
|
|
|
Edit13: TEdit;
|
|
|
|
|
Label47: TLabel;
|
|
|
|
|
Label48: TLabel;
|
|
|
|
|
RxDBLookupCombo11: TRxDBLookupCombo;
|
|
|
|
|
Label49: TLabel;
|
|
|
|
|
RxDBLookupCombo12: TRxDBLookupCombo;
|
|
|
|
|
Label50: TLabel;
|
|
|
|
|
RxDBLookupCombo13: TRxDBLookupCombo;
|
|
|
|
|
Edit14: TEdit;
|
|
|
|
|
Label51: TLabel;
|
|
|
|
|
Label52: TLabel;
|
|
|
|
|
RxDBLookupCombo14: TRxDBLookupCombo;
|
|
|
|
|
Label53: TLabel;
|
|
|
|
|
RxDBLookupCombo15: TRxDBLookupCombo;
|
|
|
|
|
Label54: TLabel;
|
|
|
|
|
RxDBLookupCombo16: TRxDBLookupCombo;
|
|
|
|
|
Edit15: TEdit;
|
|
|
|
|
Label55: TLabel;
|
|
|
|
|
Label56: TLabel;
|
|
|
|
|
Edit16: TEdit;
|
|
|
|
|
Label57: TLabel;
|
|
|
|
|
Edit17: TEdit;
|
|
|
|
|
Label58: TLabel;
|
|
|
|
|
Edit18: TEdit;
|
|
|
|
|
Label59: TLabel;
|
|
|
|
|
Edit19: TEdit;
|
|
|
|
|
Label60: TLabel;
|
|
|
|
|
Edit20: TEdit;
|
|
|
|
|
Label61: TLabel;
|
|
|
|
|
Edit21: TEdit;
|
|
|
|
|
Label62: TLabel;
|
|
|
|
|
Edit22: TEdit;
|
|
|
|
|
Label63: TLabel;
|
|
|
|
|
Edit23: TEdit;
|
|
|
|
|
SaveDialog1: TSaveDialog;
|
|
|
|
|
chkUsdExRate: TCheckBox;
|
|
|
|
|
t_op_balanceDSDesigner24: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner25: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner26: TStringField;
|
|
|
|
|
t_op_balanceDSDesigner27: TBCDField;
|
|
|
|
|
t_op_balanceDSDesigner28: TBCDField;
|
|
|
|
|
t_op_balanceDSDesigner29: TStringField;
|
|
|
|
|
tab4: TbsSkinTabSheet;
|
|
|
|
|
bsSkinPanel5: TbsSkinPanel;
|
|
|
|
|
Label64: TLabel;
|
|
|
|
|
Label66: TLabel;
|
|
|
|
|
Label67: TLabel;
|
|
|
|
|
Label68: TLabel;
|
|
|
|
|
Label69: TLabel;
|
|
|
|
|
Label70: TLabel;
|
|
|
|
|
wwDBDateTimePicker22: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker23: TwwDBDateTimePicker;
|
|
|
|
|
Edit24: TEdit;
|
|
|
|
|
Edit25: TEdit;
|
|
|
|
|
Edit26: TEdit;
|
|
|
|
|
bsSkinButton27: TbsSkinButton;
|
|
|
|
|
bsSkinCheckRadioBox7: TbsSkinCheckRadioBox;
|
|
|
|
|
RxDBLookupCombo17: TRxDBLookupCombo;
|
|
|
|
|
Label71: TLabel;
|
|
|
|
|
RxDBLookupCombo18: TRxDBLookupCombo;
|
|
|
|
|
Label72: TLabel;
|
|
|
|
|
Edit27: TEdit;
|
|
|
|
|
DBGridEh3: TDBGridEh;
|
|
|
|
|
v_vouitems: TADOQuery;
|
|
|
|
|
v_vouitems1: TDataSource;
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
procedure bsSkinPageControl1Change(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton7Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton8Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton11Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton14Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton15Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton18Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton20Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
|
|
procedure DBGridEh2DrawColumnCell(Sender: TObject; const Rect: TRect;
|
|
|
|
|
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
|
|
|
|
|
procedure DBGridEh1DrawColumnCell(Sender: TObject; const Rect: TRect;
|
|
|
|
|
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
|
|
|
|
|
procedure DBGridEh4DrawColumnCell(Sender: TObject; const Rect: TRect;
|
|
|
|
|
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
|
|
|
|
|
procedure DBGridEh5DrawColumnCell(Sender: TObject; const Rect: TRect;
|
|
|
|
|
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
|
|
|
|
|
procedure DBGridEh6DrawColumnCell(Sender: TObject; const Rect: TRect;
|
|
|
|
|
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
|
|
|
|
|
procedure DBGridEh7DrawColumnCell(Sender: TObject; const Rect: TRect;
|
|
|
|
|
DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
|
|
|
|
|
procedure bsSkinButton12Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton16Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton17Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton21Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton22Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton23Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton24Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton13Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton25Click(Sender: TObject);
|
|
|
|
|
procedure Edit12KeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
procedure Edit10KeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
procedure bsSkinButton27Click(Sender: TObject);
|
|
|
|
|
private
|
|
|
|
|
procedure CreateMemTbl;
|
|
|
|
|
function NewDrCrVou(fDataSet:TDataSet;ZDR:String;voudate:TDate;VSLVOY:String):String;
|
|
|
|
|
function NewDCVou(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
|
|
|
|
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
function cw_client_yingshou_error():boolean;
|
|
|
|
|
function cw_client_yingfu_error():boolean;
|
|
|
|
|
function cw_client_shouru_error():boolean;
|
|
|
|
|
function cw_client_chengben_error():boolean;
|
|
|
|
|
procedure cw_add_1(op_type:integer);
|
|
|
|
|
function get_str(i:integer;head_str:string):widestring;
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frm_cw_pingzheng: Tfrm_cw_pingzheng;
|
|
|
|
|
frm_cw_pingzheng_open:boolean;
|
|
|
|
|
cw_load,cw_load_group:integer;
|
|
|
|
|
frm_cw_load_iflog:boolean;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses u_main, my_sys_function, dmAccu, u_data_share,
|
|
|
|
|
VouItemStlu, u_sys_progress, u_ch_piliang_seae, u_ch_piliang_seai,
|
|
|
|
|
u_ch_piliang_aire, u_ch_piliang_airi;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
function Tfrm_cw_pingzheng.NewDrCrVou(fDataSet:TDataSet;ZDR:String;voudate:TDate;VSLVOY:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQuery,aQuery2:TADOQuery;
|
|
|
|
|
Dr,Cr,UDr,UCr,UDrttl,UCrttl,UsdExrate,vatAmt:Real;
|
|
|
|
|
OrdNo:integer;
|
|
|
|
|
aPeriod:String;
|
|
|
|
|
|
|
|
|
|
function GetMblno(BSno:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQry:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQry:=CreateadoQuery;
|
|
|
|
|
try
|
|
|
|
|
aQry.Close;
|
|
|
|
|
aQry.SQL.Clear;
|
|
|
|
|
aQry.sql.add('select <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5> from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+Bsno+'''');
|
|
|
|
|
aQry.Open;
|
|
|
|
|
result:=aQry.fieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQry);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function GetCustID(CorpID,DC:String):String;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=createADOQuery;
|
|
|
|
|
with aQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+CorpID+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if DC='<27><>' then
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function GetEmpID(EmplName:String):String;
|
|
|
|
|
begin
|
|
|
|
|
with dmAcc.tempQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+EmplName+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if not FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
|
|
|
|
|
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else Result:='0';
|
|
|
|
|
finally
|
|
|
|
|
Close;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function GetDeptID(DeptName:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQry:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQry:=CreateadoQuery;
|
|
|
|
|
try
|
|
|
|
|
aQry.Close;
|
|
|
|
|
aQry.SQL.Clear;
|
|
|
|
|
aQry.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+DeptName+'''');
|
|
|
|
|
aQry.Open;
|
|
|
|
|
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQry);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function GetEmpDeptID(EmplName:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQry:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQry:=CreateadoQuery;
|
|
|
|
|
try
|
|
|
|
|
aQry.Close;
|
|
|
|
|
aQry.SQL.Clear;
|
|
|
|
|
aQry.sql.add('select e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,d.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee e left join t_sys_department d on (d.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) where e.<2E><><EFBFBD><EFBFBD>='''+EmplName+'''');
|
|
|
|
|
aQry.Open;
|
|
|
|
|
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQry);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
Result:='';
|
|
|
|
|
aQuery:=createADOQuery;
|
|
|
|
|
aQuery2:=CreateADOQuery;
|
|
|
|
|
Dr:=0.0;
|
|
|
|
|
Cr:=0.0;
|
|
|
|
|
UDr:=0.0;
|
|
|
|
|
UCr:=0.0;
|
|
|
|
|
UDrttl:=0.00;
|
|
|
|
|
UCrttl:=0.00;
|
|
|
|
|
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
|
|
|
|
|
vatAmt:=0.00;
|
|
|
|
|
|
|
|
|
|
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
with aQuery,SQL do begin
|
|
|
|
|
Close;sql.Clear;
|
|
|
|
|
Add('SELECT t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20><><EFBFBD><EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20>ϼƽ<CFBC><C6BD><EFBFBD>,SUM(<28><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>) AS <20><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0> from t_ch_fee WHERE <20><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD>='''+fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''' '
|
|
|
|
|
+'GROUP BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD> '
|
|
|
|
|
+'ORDER BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>');
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
Result:=dmAcc.AdotblVou.fieldByName('VOUNO').AsString;
|
|
|
|
|
aQuery.First;
|
|
|
|
|
while not aQuery.Eof do begin
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vatAmt:=vatAmt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat*dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat), 0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
UDr:=UDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
UDrttl:=UDrttl+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
UDrttl:=UDrttl+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vatAmt:=vatAmt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat), 0);
|
|
|
|
|
|
|
|
|
|
Dr:=DR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=GetMblno(fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CORPID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
|
|
|
|
|
// dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:=GetDeptID(fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
// dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(fDataSet.fieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
|
|
|
|
|
aQuery.Next;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if ((UDRttl+DR)<>0) and ((UDRttl+DR)>=0.0001) or ((UDRttl+DR)<=0.0001) then begin
|
|
|
|
|
dmAcc.ADOtblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ProfitAccID;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtCr').AsFloat:=UDRttl+DR-vatAmt;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD>'+GetMblno(fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
dmAcc.ADOtblVouItems.Post;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if vatAmt<>0 then
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.ADOtblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD>˰').AsString;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtCr').AsFloat:=vatAmt;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>'+GetMblno(fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
dmAcc.ADOtblVouItems.Post;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with aQuery,SQL do begin
|
|
|
|
|
Close;sql.Clear;
|
|
|
|
|
Add('SELECT t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20><><EFBFBD><EFBFBD>,SUM(t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD>) AS <20>ϼƽ<CFBC><C6BD><EFBFBD>,SUM(<28><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>) AS <20><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0> from t_ch_fee WHERE <20><><EFBFBD><EFBFBD>=''<27><>'' and <20><><EFBFBD><EFBFBD>='''+fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''' '
|
|
|
|
|
+'GROUP BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD> '
|
|
|
|
|
+'ORDER BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ұ<EFBFBD>');
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
Result:=dmAcc.AdotblVou.fieldByName('VOUNO').AsString;
|
|
|
|
|
aQuery.First;
|
|
|
|
|
vatAmt:=0;
|
|
|
|
|
while not aQuery.Eof do begin
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=accinfo.CreditAccIDU;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
|
|
|
|
|
vatAmt:=vatAmt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat*dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat), 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=0.0;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.0;
|
|
|
|
|
UCr:=UCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
UCrttl:=UCrttl+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
UCrttl:=UCrttl+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=accinfo.CreditAccID;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
// dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:='Ӧ<><D3A6>'+aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
|
|
|
|
vatAmt:=vatAmt+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>').AsFloat), 0);
|
|
|
|
|
|
|
|
|
|
Cr:=CR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=GetMblno(fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='T';
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CORPID').AsString:=GetCustID(aQuery.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,'<27><>');
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
aQuery.Next;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if ((UCRttl+CR)<>0) and ((UCRttl+CR)>=0.0001) or ((UCRttl+CR)<=-0.0001) then begin
|
|
|
|
|
dmAcc.ADOtblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.ImpProfitAccID;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtDR').AsFloat:=UCRttl+CR-vatAmt;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('EXPLAN').AsString:='֧<><D6A7>'+GetMblno(fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
dmAcc.ADOtblVouItems.Post;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if vatAmt<>0 then
|
|
|
|
|
begin
|
|
|
|
|
dmAcc.ADOtblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=t_cw_design.FieldByName('<27><><EFBFBD><EFBFBD>˰').AsString;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtDR').AsFloat:=vatAmt;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('EXPLAN').AsString:='<27><><EFBFBD><EFBFBD>˰<EFBFBD><CBB0>'+GetMblno(fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
dmAcc.ADOtblVouItems.Post;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
if ((UDRttl+DR)-(UCRttl+CR))<>0 then begin
|
|
|
|
|
dmAcc.ADOtblVouItems.Insert;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AccID').AsString:=AccInfo.ProfitAccID;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtCr').AsFloat:=(UDRttl+DR)-(UCRttl+CR);
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('AmtDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.ADOtblVouItems.FieldByName('EXPLAN').AsString:=GetMblno(fDataSet.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:=GetDeptID(fDataSet.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(fDataSet.fieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString);
|
|
|
|
|
dmAcc.ADOtblVouItems.Post;
|
|
|
|
|
end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
except
|
|
|
|
|
on e:Exception do
|
|
|
|
|
begin
|
|
|
|
|
ShowMessage(e.Message);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
// finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
FreeAndNil(aQuery2);
|
|
|
|
|
// end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_cw_pingzheng.NewDCVou(fDataSet:TDataSet;ZDR:String;voudate:TDatetime):Boolean;
|
|
|
|
|
var
|
|
|
|
|
aQuery,aQuery2:TADOQuery;
|
|
|
|
|
mAccOK:Boolean;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
StlAmtDR,StlAmtCR,StlUSDAmtDR,StlUSDAmtCR,UsdExRate:Double;
|
|
|
|
|
ordno:integer;
|
|
|
|
|
plan:string;
|
|
|
|
|
|
|
|
|
|
function GetMblno(BSno:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQry:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQry:=CreateadoQuery;
|
|
|
|
|
try
|
|
|
|
|
aQry.Close;
|
|
|
|
|
aQry.SQL.Clear;
|
|
|
|
|
aQry.sql.add('select <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5> from v_op_bscard where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+Bsno+'''');
|
|
|
|
|
aQry.Open;
|
|
|
|
|
result:=aQry.fieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQry);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function GetCustID(CorpID,DC:String):String;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=createADOQuery;
|
|
|
|
|
with aQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+CorpID+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if DC='<27><>' then
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function GetEmpID(EmplName:String):String;
|
|
|
|
|
begin
|
|
|
|
|
with dmAcc.tempQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+EmplName+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if not FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
|
|
|
|
|
Result:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else Result:='0';
|
|
|
|
|
finally
|
|
|
|
|
Close;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function GetDeptID(DeptName:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQry:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQry:=CreateadoQuery;
|
|
|
|
|
try
|
|
|
|
|
aQry.Close;
|
|
|
|
|
aQry.SQL.Clear;
|
|
|
|
|
aQry.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_department where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+DeptName+'''');
|
|
|
|
|
aQry.Open;
|
|
|
|
|
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQry);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function GetstlID(stlName:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQry:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQry:=CreateadoQuery;
|
|
|
|
|
try
|
|
|
|
|
aQry.Close;
|
|
|
|
|
aQry.SQL.Clear;
|
|
|
|
|
aQry.sql.add('select <20><><EFBFBD><EFBFBD> from t_code_stlmode where <20><><EFBFBD>㷽ʽ='''+stlName+'''');
|
|
|
|
|
aQry.Open;
|
|
|
|
|
if aQry.IsEmpty then
|
|
|
|
|
result:='1'
|
|
|
|
|
else
|
|
|
|
|
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQry);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function GetEmpDeptID(EmplName:String):String;
|
|
|
|
|
var
|
|
|
|
|
aQry:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQry:=CreateadoQuery;
|
|
|
|
|
try
|
|
|
|
|
aQry.Close;
|
|
|
|
|
aQry.SQL.Clear;
|
|
|
|
|
aQry.sql.add('select e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,d.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee e left join t_sys_department d on (d.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) where e.<2E><><EFBFBD><EFBFBD>='''+EmplName+'''');
|
|
|
|
|
aQry.Open;
|
|
|
|
|
result:=aQry.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQry);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function GetBankAccid(bank:string):String;
|
|
|
|
|
var
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
if fdataSet.FieldByName('<27><><EFBFBD>㷽ʽ').AsString='<27>ֽ<EFBFBD>' then
|
|
|
|
|
result:=t_cw_design.FieldByName('Ӧ<>պ<EFBFBD><D5BA><EFBFBD>һ').AsString
|
|
|
|
|
else begin
|
|
|
|
|
if bank='' then begin
|
|
|
|
|
if (fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString='') and (fDataSet.fieldbyname('<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString='') then begin
|
|
|
|
|
result:='';
|
|
|
|
|
end else begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
Close;sql.Clear;
|
|
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_bank where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if Recordcount<>0 then
|
|
|
|
|
result:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else
|
|
|
|
|
result:='';
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
Close;sql.Clear;
|
|
|
|
|
if bank='USD' then
|
|
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_bank where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString+'''')
|
|
|
|
|
else
|
|
|
|
|
sql.Add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_bank where <20><><EFBFBD><EFBFBD>='''+fDataSet.fieldbyname('<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if Recordcount<>0 then
|
|
|
|
|
result:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else
|
|
|
|
|
result:='';
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
function getbsno(zhno:String):string;
|
|
|
|
|
var
|
|
|
|
|
absQuery:TAdoQuery;
|
|
|
|
|
f:boolean;
|
|
|
|
|
s:string;
|
|
|
|
|
begin
|
|
|
|
|
absQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with absQuery do begin
|
|
|
|
|
close;SQL.Clear;
|
|
|
|
|
SQL.Add('Select distinct <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5> from v_fee_do_bscard where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+zhno+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if not IsEmpty then begin
|
|
|
|
|
if Recordset.RecordCount=1 then begin
|
|
|
|
|
result:=fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
|
|
end else begin
|
|
|
|
|
first;
|
|
|
|
|
f:=true;
|
|
|
|
|
while not eof do begin
|
|
|
|
|
s:=fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
|
|
if f then
|
|
|
|
|
if length(s)>=5 then
|
|
|
|
|
result:=copy(s,length(s)-4,5)
|
|
|
|
|
else
|
|
|
|
|
result:=fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString
|
|
|
|
|
else
|
|
|
|
|
if length(s)>=5 then
|
|
|
|
|
result:=result+'/'+copy(s,length(s)-4,5)
|
|
|
|
|
else
|
|
|
|
|
result:=result+'/'+fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
|
|
|
|
|
|
|
f:=false;
|
|
|
|
|
Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(absQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
Result:=false;
|
|
|
|
|
aQuery:=CreateADOQuery;
|
|
|
|
|
aQuery2:=CreateADOQuery;
|
|
|
|
|
StlAmtDR:=0.00;
|
|
|
|
|
StlAmtCR:=0.00;
|
|
|
|
|
StlUSDAmtDR:=0.00;
|
|
|
|
|
StlUSDAmtCR:=0.00;
|
|
|
|
|
UsdExRate:=StrToFloatDef(Edit10.Text,7.8);
|
|
|
|
|
|
|
|
|
|
with aQuery,SQL do begin
|
|
|
|
|
if chkUsdExRate.Checked then begin
|
|
|
|
|
Add('Select s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>,');
|
|
|
|
|
Add('sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
|
|
|
|
|
Add('from v_fee_balance_items s');
|
|
|
|
|
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
|
|
|
|
|
Add('Group By s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
|
|
|
|
|
Add('Order By s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,s.<2E><><EFBFBD><EFBFBD>');
|
|
|
|
|
end else begin
|
|
|
|
|
Add('Select s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>,');
|
|
|
|
|
Add('sum(S.<2E><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>,sum(S.<2E><><EFBFBD><EFBFBD>*s.<2E><><EFBFBD><EFBFBD>) <20>ϼƽ<CFBC><C6BD><EFBFBD>');
|
|
|
|
|
Add('from v_fee_balance_items s');
|
|
|
|
|
Add('where S.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+fDataSet.fieldbyName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString+'''');
|
|
|
|
|
Add('Group By s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>');
|
|
|
|
|
Add('Order By s.<2E>ո<EFBFBD>,s.<2E>ұ<EFBFBD>');
|
|
|
|
|
end;
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
aQuery.First;
|
|
|
|
|
OrdNo:=dmAcc.AdotblVou.fieldByName('OrdNo').AsInteger;
|
|
|
|
|
dmAcc.AdotblVouItems.Open;
|
|
|
|
|
while not aQuery.Eof do begin
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then begin
|
|
|
|
|
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccIDU;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
StlUSDAmtDR:=StlUSDAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.DebitAccID;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='F';
|
|
|
|
|
StlAmtDR:=StlAmtDR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
if aQuery.FieldByName('<27>ұ<EFBFBD>').AsString='USD' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccIDU;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='T';
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0)
|
|
|
|
|
else
|
|
|
|
|
StlUSDAmtCR:=StlUSDAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat*UsdExRate), 0);
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=AccInfo.CreditAccID;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CorpBf').AsString:='T';
|
|
|
|
|
StlAmtCR:=StlAmtCR+StrToFloatDef(FormatFloat('0.00;-0.00;0.0', aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat), 0);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if aQuery.FieldByName('<27>ո<EFBFBD>').AsString='<27><>' then
|
|
|
|
|
plan:='<27><>'+fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else
|
|
|
|
|
plan:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=plan;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('CORPID').AsString:=GetCustID(fDataSet.fieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,aQuery.FieldByName('<27>ո<EFBFBD>').AsString);
|
|
|
|
|
// dmAcc.AdotblVouItems.FieldByName('DEPTID').AsString:=GetDeptID(aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
// dmAcc.AdotblVouItems.FieldByName('EMPLID').AsString:=GetEmpID(aQuery.fieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString);
|
|
|
|
|
|
|
|
|
|
// dmAcc.AdotblVouItems.FieldByName('BSNO').AsString:=aQuery.fieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
|
|
|
|
|
aQuery.next;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if fDataSet.FieldByName('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').Asfloat<>0 then begin
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid('USD');
|
|
|
|
|
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlUSDAmtDR;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>').asfloat),0);
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlUSDAmtCR;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
|
|
|
|
|
end;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=GetstlID(fdataset.fieldbyname('<27><><EFBFBD>㷽ʽ').asstring);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=fdataset.fieldbyname('<27><>Ԫ<EFBFBD><D4AA><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=plan;
|
|
|
|
|
dmAcc.AdotblVouItems.post;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
if fDataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>').Asfloat<>0 then begin
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid('RMB');
|
|
|
|
|
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlAmtDR;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtCR;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
|
|
|
|
|
end;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=GetstlID(fdataset.fieldbyname('<27><><EFBFBD>㷽ʽ').asstring);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=plan;
|
|
|
|
|
dmAcc.AdotblVouItems.post;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat<>0 then begin
|
|
|
|
|
dmAcc.AdotblVouItems.Insert;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AccID').AsString:=GetbankAccid('');
|
|
|
|
|
if fDataSet.FieldByName('<27>ұ<EFBFBD>').AsString='USD'then begin
|
|
|
|
|
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlAmtDR;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=StrToFloatDef(FormatFloat('0.00;-0.00;0.0',fdataset.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat),0);
|
|
|
|
|
if chkUsdExRate.Checked then
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD>').AsFloat
|
|
|
|
|
else
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=UsdExRate;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtCR;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
if fdataset.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring='<27><>' then begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=0.0;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=StlAmtDR;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYDR').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYCr').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FCYEXRATE').AsFloat:=0.00;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtCr').AsFloat:=StlAmtCR;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('AmtDR').AsFloat:=0.00;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FSETTLCODE').AsString:=GetstlID(fdataset.fieldbyname('<27><><EFBFBD>㷽ʽ').asstring);
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('FSETTLENO').AsString:=fdataset.fieldbyname('<27><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>').asstring;
|
|
|
|
|
dmAcc.AdotblVouItems.FieldByName('EXPLAN').AsString:=plan;
|
|
|
|
|
dmAcc.AdotblVouItems.post;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.CreateMemTbl;
|
|
|
|
|
begin
|
|
|
|
|
memTblVou.Close;
|
|
|
|
|
memTblVou.Fields.Clear;
|
|
|
|
|
with memTblVou.FieldDefs do begin
|
|
|
|
|
Clear;
|
|
|
|
|
Add('Selected', ftsmallint, 0, false);
|
|
|
|
|
Add('status', ftsmallint, 0, false);
|
|
|
|
|
Add('VOUDATE', ftDate, 0, false);
|
|
|
|
|
Add('accyear', ftinteger, 0, false);
|
|
|
|
|
Add('AccMonth', ftsmallint, 0, false);
|
|
|
|
|
Add('VKNO', ftString, 6, false);
|
|
|
|
|
Add('VOUNO',ftString,16,false);
|
|
|
|
|
Add('ORDNO', ftinteger, 0, false);
|
|
|
|
|
Add('AMTDR', ftFloat, 0, false);
|
|
|
|
|
Add('AMTCR', ftFloat, 0, false);
|
|
|
|
|
Add('ATTACHS', ftinteger, 0, false);
|
|
|
|
|
Add('SourceType', ftinteger, 0, false);
|
|
|
|
|
Add('PREPARED', ftString,10, false);
|
|
|
|
|
memTblVou.CreateTable;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_cw_pingzheng.cw_client_yingshou_error():boolean;
|
|
|
|
|
begin
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_cw_pingzheng.cw_client_yingfu_error():boolean;
|
|
|
|
|
begin
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_cw_pingzheng.cw_client_shouru_error():boolean;
|
|
|
|
|
begin
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_cw_pingzheng.cw_client_chengben_error():boolean;
|
|
|
|
|
begin
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function Tfrm_cw_pingzheng.get_str(i:integer;head_str:string):widestring;
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
begin
|
|
|
|
|
case i of
|
|
|
|
|
1:
|
|
|
|
|
begin
|
|
|
|
|
str:=head_str;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+'<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27>ۿ<EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('ж<><D0B6><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asstring;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
2:
|
|
|
|
|
begin
|
|
|
|
|
str:=head_str;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+'<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27>ۿ<EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('װ<><D7B0><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asstring;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
3:
|
|
|
|
|
begin
|
|
|
|
|
str:=head_str;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+'<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean or t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('һ<>̺<EFBFBD><CCBA><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27>ۿ<EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('Ŀ<>ĸ<EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_aire.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asstring;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
4:
|
|
|
|
|
begin
|
|
|
|
|
str:=head_str;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+'<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('ί<>б<EFBFBD><D0B1><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('<27><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean or t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27>ۿ<EFBFBD>').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('ʼ<><CABC><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
end;
|
|
|
|
|
if t_cw_design.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asboolean then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').asstring;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
result:=str;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.cw_add_1(op_type:integer);
|
|
|
|
|
var
|
|
|
|
|
num_accept_rmb,num_accept_usd,num_accept_all,num_pay_rmb,num_pay_usd,num_pay_all:real;
|
|
|
|
|
bill_count:integer;
|
|
|
|
|
if_do:boolean;
|
|
|
|
|
get_date:Tdatetime;
|
|
|
|
|
begin
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
frm_cw_date:=Tfrm_cw_date.Create(application);
|
|
|
|
|
frm_cw_date.ShowModal;
|
|
|
|
|
if frm_cw_date.ModalResult = mrOk then
|
|
|
|
|
begin
|
|
|
|
|
if_do:=true;
|
|
|
|
|
get_date:=frm_cw_date.wwDBDateTimePicker1.Date;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if_do:=false;;
|
|
|
|
|
finally
|
|
|
|
|
frm_cw_date.free;
|
|
|
|
|
frm_cw_date:=nil;
|
|
|
|
|
end;
|
|
|
|
|
if not if_do then
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
|
|
T_Voucher_Main.Requery();
|
|
|
|
|
T_Voucher_fen.Requery();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
T_Voucher_Main.Insert;
|
|
|
|
|
T_Voucher_Main['FDate']:=get_date;//t_yingshou.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value;
|
|
|
|
|
T_Voucher_Main['FYear']:=
|
|
|
|
|
strtoint(FormatDateTime('yyyy',t_yingshou.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value));
|
|
|
|
|
T_Voucher_Main['FPeriod']:=
|
|
|
|
|
strtoint(FormatDateTime('mm',t_yingshou.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value));
|
|
|
|
|
T_Voucher_Main['FGroupID']:=t_cw_design.fieldbyname('ת<><D7AA>ƾ֤<C6BE><D6A4>').asinteger;
|
|
|
|
|
|
|
|
|
|
T_Voucher_Max_num.close;
|
|
|
|
|
T_Voucher_Max_num.Parameters.ParamByName('FYear').value:=
|
|
|
|
|
strtoint(FormatDateTime('yyyy',t_yingshou.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value));
|
|
|
|
|
T_Voucher_Max_num.Parameters.ParamByName('FPeriod').value:=
|
|
|
|
|
strtoint(FormatDateTime('mm',t_yingshou.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value));
|
|
|
|
|
T_Voucher_Max_num.Parameters.ParamByName('FGroupID').value:=t_cw_design.fieldbyname('ת<><D7AA>ƾ֤<C6BE><D6A4>').asinteger;
|
|
|
|
|
T_Voucher_Max_num.open;
|
|
|
|
|
if T_Voucher_Max_num.IsEmpty then
|
|
|
|
|
T_Voucher_Main['FNumber']:=1
|
|
|
|
|
else
|
|
|
|
|
T_Voucher_Main['FNumber']:=T_Voucher_Max_num.fieldbyname('FNumber').asinteger+1;
|
|
|
|
|
|
|
|
|
|
T_Voucher_Main['FReference']:='';
|
|
|
|
|
T_Voucher_Main['FExplanation']:=frm_cw_pingzheng.get_str(op_type,'');
|
|
|
|
|
T_Voucher_Main['FAttachments']:=1;
|
|
|
|
|
T_Voucher_Main['FEntryCount']:=t_yingshou.RecordCount+t_yingfu.RecordCount+t_shouru.RecordCount+t_chengben.RecordCount;
|
|
|
|
|
T_Voucher_Main['FDebitTotal']:=0;
|
|
|
|
|
T_Voucher_Main['FCreditTotal']:=0;
|
|
|
|
|
T_Voucher_Main['FInternalInd']:='';
|
|
|
|
|
T_Voucher_Main['FPreparerID']:=cw_load;
|
|
|
|
|
T_Voucher_Main['FHandler']:='';
|
|
|
|
|
T_Voucher_Main['FOwnerGroupID']:=cw_load_group;
|
|
|
|
|
T_Voucher_Main['FObjectName']:='';
|
|
|
|
|
T_Voucher_Main['FParameter']:='';
|
|
|
|
|
T_Voucher_Main['FTransDate']:=t_yingshou.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value;
|
|
|
|
|
T_Voucher_Max_seriel.close;
|
|
|
|
|
T_Voucher_Max_seriel.Parameters.ParamByName('FYear').value:=
|
|
|
|
|
strtoint(FormatDateTime('yyyy',t_yingshou.DataSource.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').value));
|
|
|
|
|
T_Voucher_Max_seriel.open;
|
|
|
|
|
if T_Voucher_Max_seriel.isempty then
|
|
|
|
|
T_Voucher_Main['FSerialNum']:=1
|
|
|
|
|
else
|
|
|
|
|
T_Voucher_Main['FSerialNum']:=T_Voucher_Max_seriel.fieldbyname('FSerialNum').asinteger+1;
|
|
|
|
|
T_Voucher_Main.post;
|
|
|
|
|
except
|
|
|
|
|
if T_Voucher_Main.state=dsinsert then
|
|
|
|
|
T_Voucher_Main.cancel;
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD>ƾ֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
T_Voucher_Max.requery;
|
|
|
|
|
T_Voucher_Main.close;
|
|
|
|
|
T_Voucher_Main.sql.clear;
|
|
|
|
|
T_Voucher_Main.sql.add('select * from t_Voucher where FVoucherID='+T_Voucher_Max.fieldbyname('FNext').asstring);
|
|
|
|
|
T_Voucher_Main.open;
|
|
|
|
|
//Ӧ<><D3A6><EFBFBD>ʿ<EFBFBD>
|
|
|
|
|
bill_count:=0;
|
|
|
|
|
t_yingshou.first;
|
|
|
|
|
while not t_yingshou.eof do
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
T_Voucher_fen.insert;
|
|
|
|
|
T_Voucher_fen['FVoucherID']:=T_Voucher_Main.fieldbyname('FVoucherID').value;
|
|
|
|
|
T_Voucher_fen['FEntryID']:=bill_count;
|
|
|
|
|
|
|
|
|
|
T_Voucher_fen['FExplanation']:=frm_cw_pingzheng.get_str(op_type,'Ӧ<><D3A6>');
|
|
|
|
|
T_Voucher_fen['FAccountID']:=t_yingshou.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
T_Voucher_fen['FAccountID2']:=t_yingshou.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
|
|
|
|
|
if t_cw_client.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_yingshou.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring,[]) then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FDetailID']:=t_cw_client.fieldbyname('Ӧ<>տͻ<D5BF><CDBB><EFBFBD><EFBFBD><EFBFBD>').asinteger;
|
|
|
|
|
end;
|
|
|
|
|
case t_cw_design.fieldbyname('<27><><EFBFBD>ɰ취').asinteger of
|
|
|
|
|
1:
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
2:
|
|
|
|
|
begin
|
|
|
|
|
if t_yingshou.fieldbyname('<27>ұ<EFBFBD>').asstring='USD'then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger;
|
|
|
|
|
if T_Currency.Locate('FCurrencyID',t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger,[])then
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=T_Currency.fieldbyname('FExchangeRate').asfloat;
|
|
|
|
|
if t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_yingshou.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
T_Voucher_fen.post;
|
|
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
except
|
|
|
|
|
if T_Voucher_fen.state=dsinsert then
|
|
|
|
|
T_Voucher_fen.cancel;
|
|
|
|
|
while not T_Voucher_fen.eof do
|
|
|
|
|
T_Voucher_fen.delete;
|
|
|
|
|
T_Voucher_main.delete;
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD>ƾ֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
t_yingshou.next;
|
|
|
|
|
end;
|
|
|
|
|
//Ӧ<><D3A6><EFBFBD>ʿ<EFBFBD>
|
|
|
|
|
t_yingfu.first;
|
|
|
|
|
while not t_yingfu.eof do
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
T_Voucher_fen.insert;
|
|
|
|
|
T_Voucher_fen['FVoucherID']:=T_Voucher_Main.fieldbyname('FVoucherID').value;
|
|
|
|
|
T_Voucher_fen['FEntryID']:=bill_count;
|
|
|
|
|
|
|
|
|
|
T_Voucher_fen['FExplanation']:=frm_cw_pingzheng.get_str(op_type,'Ӧ<><D3A6>');
|
|
|
|
|
T_Voucher_fen['FAccountID']:=t_yingfu.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
T_Voucher_fen['FAccountID2']:=t_yingfu.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
|
|
|
|
|
if t_cw_client.locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_yingfu.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring,[]) then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FDetailID']:=t_cw_client.fieldbyname('Ӧ<><D3A6><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asinteger;
|
|
|
|
|
end;
|
|
|
|
|
case t_cw_design.fieldbyname('<27><><EFBFBD>ɰ취').asinteger of
|
|
|
|
|
1:
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
2:
|
|
|
|
|
begin
|
|
|
|
|
if t_yingfu.fieldbyname('<27>ұ<EFBFBD>').asstring='USD'then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger;
|
|
|
|
|
if T_Currency.Locate('FCurrencyID',t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger,[])then
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=T_Currency.fieldbyname('FExchangeRate').asfloat;
|
|
|
|
|
if t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_yingfu.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
T_Voucher_fen.post;
|
|
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
except
|
|
|
|
|
if T_Voucher_fen.state=dsinsert then
|
|
|
|
|
T_Voucher_fen.cancel;
|
|
|
|
|
while not T_Voucher_fen.eof do
|
|
|
|
|
T_Voucher_fen.delete;
|
|
|
|
|
T_Voucher_main.delete;
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD>ƾ֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
t_yingfu.next;
|
|
|
|
|
end;
|
|
|
|
|
//ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
t_shouru.first;
|
|
|
|
|
while not t_shouru.eof do
|
|
|
|
|
begin
|
|
|
|
|
if t_shouru.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asstring<>''then
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
T_Voucher_fen.insert;
|
|
|
|
|
T_Voucher_fen['FVoucherID']:=T_Voucher_Main.fieldbyname('FVoucherID').value;
|
|
|
|
|
T_Voucher_fen['FEntryID']:=bill_count;
|
|
|
|
|
|
|
|
|
|
T_Voucher_fen['FExplanation']:=frm_cw_pingzheng.get_str(op_type,'<27><><EFBFBD><EFBFBD>');
|
|
|
|
|
T_Voucher_fen['FAccountID']:=t_shouru.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
T_Voucher_fen['FAccountID2']:=t_shouru.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
|
|
|
|
|
case t_cw_design.fieldbyname('<27><><EFBFBD>ɰ취').asinteger of
|
|
|
|
|
1:
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
2:
|
|
|
|
|
begin
|
|
|
|
|
if t_shouru.fieldbyname('<27>ұ<EFBFBD>').asstring='USD'then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger;
|
|
|
|
|
if T_Currency.Locate('FCurrencyID',t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger,[])then
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=T_Currency.fieldbyname('FExchangeRate').asfloat;
|
|
|
|
|
if t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_shouru.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
T_Voucher_fen.post;
|
|
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
except
|
|
|
|
|
if T_Voucher_fen.state=dsinsert then
|
|
|
|
|
T_Voucher_fen.cancel;
|
|
|
|
|
while not T_Voucher_fen.eof do
|
|
|
|
|
T_Voucher_fen.delete;
|
|
|
|
|
T_Voucher_main.delete;
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD>ƾ֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
t_shouru.next;
|
|
|
|
|
end;
|
|
|
|
|
//ҵ<><D2B5><EFBFBD>ɱ<EFBFBD>
|
|
|
|
|
t_chengben.first;
|
|
|
|
|
while not t_chengben.eof do
|
|
|
|
|
begin
|
|
|
|
|
if t_chengben.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asstring<>''then
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
T_Voucher_fen.insert;
|
|
|
|
|
T_Voucher_fen['FVoucherID']:=T_Voucher_Main.fieldbyname('FVoucherID').value;
|
|
|
|
|
T_Voucher_fen['FEntryID']:=bill_count;
|
|
|
|
|
|
|
|
|
|
T_Voucher_fen['FExplanation']:=frm_cw_pingzheng.get_str(op_type,'<27>ɱ<EFBFBD>');
|
|
|
|
|
T_Voucher_fen['FAccountID']:=t_chengben.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
T_Voucher_fen['FAccountID2']:=t_chengben.fieldbyname('<27><>Ŀ<EFBFBD><C4BF>ʾ').asinteger;
|
|
|
|
|
|
|
|
|
|
case t_cw_design.fieldbyname('<27><><EFBFBD>ɰ취').asinteger of
|
|
|
|
|
1:
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
2:
|
|
|
|
|
begin
|
|
|
|
|
if t_chengben.fieldbyname('<27>ұ<EFBFBD>').asstring='USD'then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger;
|
|
|
|
|
if T_Currency.Locate('FCurrencyID',t_cw_design.fieldbyname('<27>ұ<EFBFBD>USD').asinteger,[])then
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=T_Currency.fieldbyname('FExchangeRate').asfloat;
|
|
|
|
|
if t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*
|
|
|
|
|
T_Currency.fieldbyname('FExchangeRate').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FCurrencyID']:=t_cw_design.fieldbyname('<27>ұ<EFBFBD>RMB').asinteger;
|
|
|
|
|
T_Voucher_fen['FExchangeRate']:=1;
|
|
|
|
|
if t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat>0 then
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
T_Voucher_fen['FDC']:=1;
|
|
|
|
|
num_accept_all:=num_accept_all+s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen['FAmountFor']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FAmount']:=s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
T_Voucher_fen['FDC']:=0;
|
|
|
|
|
num_pay_all:=num_pay_all+s_w(2,t_chengben.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat*-1);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
T_Voucher_fen.post;
|
|
|
|
|
bill_count:=bill_count+1;
|
|
|
|
|
except
|
|
|
|
|
if T_Voucher_fen.state=dsinsert then
|
|
|
|
|
T_Voucher_fen.cancel;
|
|
|
|
|
while not T_Voucher_fen.eof do
|
|
|
|
|
T_Voucher_fen.delete;
|
|
|
|
|
T_Voucher_main.delete;
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD>ƾ֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
t_chengben.next;
|
|
|
|
|
end;
|
|
|
|
|
if round(num_accept_all)<>round(num_pay_all) then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('ƾ֤<C6BE><D6A4>:'+floattostr(num_accept_all)+',<2C><>:'+floattostr(num_pay_all)+',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD>');
|
|
|
|
|
T_Voucher_fen.first;
|
|
|
|
|
while not T_Voucher_fen.eof do
|
|
|
|
|
begin
|
|
|
|
|
T_Voucher_fen.delete;
|
|
|
|
|
end;
|
|
|
|
|
T_Voucher_main.delete;
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
T_Voucher_main.edit;
|
|
|
|
|
T_Voucher_main['FDebitTotal']:=num_accept_all;
|
|
|
|
|
T_Voucher_main['FCreditTotal']:=num_pay_all;
|
|
|
|
|
T_Voucher_main.post;
|
|
|
|
|
try
|
|
|
|
|
t_chengben.DataSource.DataSet.edit;
|
|
|
|
|
t_chengben.DataSource.DataSet['<27><><EFBFBD><EFBFBD>']:=1;
|
|
|
|
|
t_chengben.DataSource.DataSet['<27><><EFBFBD><EFBFBD>ƾ֤']:=T_Voucher_Main.fieldbyname('FVoucherID').asstring;
|
|
|
|
|
t_chengben.DataSource.DataSet.post;
|
|
|
|
|
except
|
|
|
|
|
if T_Voucher_fen.state=dsinsert then
|
|
|
|
|
T_Voucher_fen.cancel;
|
|
|
|
|
if T_Voucher_main.state=dsinsert then
|
|
|
|
|
T_Voucher_main.cancel;
|
|
|
|
|
if t_chengben.DataSource.DataSet.state=dsinsert then
|
|
|
|
|
t_chengben.DataSource.DataSet.cancel;
|
|
|
|
|
while not T_Voucher_fen.eof do
|
|
|
|
|
T_Voucher_fen.delete;
|
|
|
|
|
T_Voucher_main.delete;
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD>ƾ֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
}
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.FormShow(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
inifile:tinifile ;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
inifile:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
|
|
try
|
|
|
|
|
Edit10.Text:=inifile.READString('PINGZHENG','USDRATE','6.8');
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
inifile.free;
|
|
|
|
|
end ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t_cw_design.open;
|
|
|
|
|
AccInfo.DebitAccID:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD>').AsString;
|
|
|
|
|
AccInfo.DebitAccIDU:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
AccInfo.CreditAccID:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD>').AsString;
|
|
|
|
|
AccInfo.CreditAccIDU:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
AccInfo.ProfitAccID:=t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
AccInfo.ImpProfitAccID:=t_cw_design.fieldbyname('<27><>Ӫҵ<D3AA><D2B5>֧<EFBFBD><D6A7>').AsString;
|
|
|
|
|
AccInfo.ProfitAccIDU:=t_cw_design.fieldbyname('<27><>Ӫ<EFBFBD><D3AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
AccInfo.ImpProfitAccIDU:=t_cw_design.fieldbyname('<27><>Ӫ֧<D3AA><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
AccInfo.Cash:=t_cw_design.fieldbyname('Ӧ<>պ<EFBFBD><D5BA><EFBFBD>һ').AsString;
|
|
|
|
|
AccInfo.RMB:=t_cw_design.fieldbyname('Ӧ<>պ<EFBFBD><D5BA><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
AccInfo.USD:=t_cw_design.fieldbyname('Ӧ<>պ<EFBFBD><D5BA><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
AccInfo.charge:=t_cw_design.fieldbyname('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ').AsString;
|
|
|
|
|
|
|
|
|
|
CreateMemTbl;
|
|
|
|
|
wwDBDateTimePicker21.Date:=now;
|
|
|
|
|
RxDBLookupCombo6.DisplayValue:=employee;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.FormClose(Sender: TObject;
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
var
|
|
|
|
|
inifile:tinifile ;
|
|
|
|
|
begin
|
|
|
|
|
inifile:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
|
|
try
|
|
|
|
|
inifile.WriteString('PINGZHENG','USDRATE',Edit10.Text);
|
|
|
|
|
finally
|
|
|
|
|
inifile.free;
|
|
|
|
|
end ;
|
|
|
|
|
|
|
|
|
|
frm_cw_pingzheng_open:=false;
|
|
|
|
|
frm_cw_load_iflog:=false;
|
|
|
|
|
frm_cw_pingzheng.Hide;
|
|
|
|
|
frm_cw_pingzheng.ManualFloat(frm_cw_pingzheng.BoundsRect );
|
|
|
|
|
frm_main.freeTabs('frm_cw_pingzheng');
|
|
|
|
|
action:=cafree;
|
|
|
|
|
frm_cw_pingzheng:=nil;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinPageControl1Change(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if frm_cw_pingzheng_open then
|
|
|
|
|
begin
|
|
|
|
|
t_op_seae.close;
|
|
|
|
|
t_op_seai.close;
|
|
|
|
|
t_op_aire.close;
|
|
|
|
|
t_op_airi.close;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
begin
|
|
|
|
|
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
|
|
|
|
|
|
|
|
|
|
// str:='where 1=1 ';
|
|
|
|
|
if not bsSkinCheckRadioBox1.Checked then
|
|
|
|
|
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
|
|
|
|
|
if Edit4.text<>'' then begin
|
|
|
|
|
if Edit11.text<>'' then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit4.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit11.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit4.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
if Edit16.text<>'' then begin
|
|
|
|
|
if Edit17.text<>'' then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit16.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit17.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit16.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo4.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo4.DisplayValues[0]+'''';
|
|
|
|
|
if RxDBLookupCombo1.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo1.DisplayValues[0]+'''';
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo3.DisplayValue<>''then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo3.DisplayValues[0]+''''+')';
|
|
|
|
|
|
|
|
|
|
if Edit2.text<>'' then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5> like '+''''+'%'+Edit2.text+'%'+'''';
|
|
|
|
|
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>>='+''''+wwDBDateTimePicker3.text+'''';
|
|
|
|
|
if wwDBDateTimePicker4.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker4.text+'''';
|
|
|
|
|
t_op_seae.close;
|
|
|
|
|
t_op_seae.sql.clear;
|
|
|
|
|
t_op_seae.sql.add('select * from t_op_seae '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
t_op_seae.open;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton3Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
Edit4.text:='';
|
|
|
|
|
Edit2.text:='';
|
|
|
|
|
wwDBDateTimePicker1.text:='';
|
|
|
|
|
wwDBDateTimePicker2.text:='';
|
|
|
|
|
wwDBDateTimePicker3.text:='';
|
|
|
|
|
wwDBDateTimePicker4.text:='';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton4Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
begin
|
|
|
|
|
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
|
|
|
|
|
|
|
|
|
|
// str:='where 1=1 ';
|
|
|
|
|
if not bsSkinCheckRadioBox2.Checked then
|
|
|
|
|
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
|
|
|
|
|
if Edit1.text<>'' then begin
|
|
|
|
|
if Edit13.text<>'' then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit1.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit13.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit1.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if Edit18.text<>'' then begin
|
|
|
|
|
if Edit19.text<>'' then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit18.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit19.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit18.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo8.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo8.DisplayValues[0]+'''';
|
|
|
|
|
if RxDBLookupCombo9.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo9.DisplayValues[0]+'''';
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo10.DisplayValue<>''then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo10.DisplayValues[0]+''''+')';
|
|
|
|
|
|
|
|
|
|
if Edit3.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5> like '+''''+'%'+Edit3.text+'%'+'''';
|
|
|
|
|
if wwDBDateTimePicker5.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker5.text+'''';
|
|
|
|
|
if wwDBDateTimePicker6.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker6.text+'''';
|
|
|
|
|
if wwDBDateTimePicker7.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker7.text+'''';
|
|
|
|
|
if wwDBDateTimePicker8.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker8.text+'''';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t_op_seai.close;
|
|
|
|
|
t_op_seai.sql.clear;
|
|
|
|
|
t_op_seai.sql.add('select * from t_op_seai '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
t_op_seai.open;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton6Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
Edit1.text:='';
|
|
|
|
|
Edit3.text:='';
|
|
|
|
|
wwDBDateTimePicker5.text:='';
|
|
|
|
|
wwDBDateTimePicker6.text:='';
|
|
|
|
|
wwDBDateTimePicker7.text:='';
|
|
|
|
|
wwDBDateTimePicker8.text:='';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton7Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i,ordno:integer;
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
mAccOK:boolean;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
if wwDBDateTimePicker21.Text='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if RxDBLookupCombo6.DisplayValue='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
dmacc:=TdmAcc.Create(self);
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
dmAcc.ADOtblVou.Open;
|
|
|
|
|
dmAcc.ADOtblVouItems.Open;
|
|
|
|
|
aVKNO:=1;
|
|
|
|
|
aQuery.Close;
|
|
|
|
|
aQuery.SQL.Clear;
|
|
|
|
|
aQuery.SQL.add('update t_op_seai set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
VoucherDate:=wwDBDateTimePicker21.Date;
|
|
|
|
|
try
|
|
|
|
|
dmAcc.AdotblVou.Insert;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('VKNO').Asstring:='<27><>';
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
dmAcc.AdotblVou.Edit;
|
|
|
|
|
|
|
|
|
|
if DBGridEh4.SelectedRows.Count>1 then begin
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(self);
|
|
|
|
|
try
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ<D4BA><F3A1A3A1><EFBFBD>';
|
|
|
|
|
frm_sys_progress.Show;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh4.SelectedRows.Count;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
for i:=0 to DBGridEh4.SelectedRows.Count-1 do begin
|
|
|
|
|
t_op_seai.GotoBookmark(Pointer(DBGridEh4.SelectedRows.Items[I]));
|
|
|
|
|
if t_op_seai['<27><><EFBFBD><EFBFBD>'] then begin
|
|
|
|
|
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_seai['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_seai,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'-'+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seai.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_seai,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'-'+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seai.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
FrmVouItemStl:=TFrmVouItemStl.Create(Application);
|
|
|
|
|
try
|
|
|
|
|
dmACC.AdotblVouItems.Last;
|
|
|
|
|
FrmVouItemStl.DBGridVouItems.SelectedField:=dmACC.AdotblVouItems.FieldByName('AccID');
|
|
|
|
|
FrmVouItemStl.ShowModal;
|
|
|
|
|
mAccOK:=false;
|
|
|
|
|
aModal:=frmVouItemStl.ModalResult;
|
|
|
|
|
mAccOK:=aModal=mrok;
|
|
|
|
|
if mAccOK then begin
|
|
|
|
|
if dmAcc.AdotblVouItems.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
if dmAcc.AdotblVou.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('update t_op_seai set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
// dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(FrmVouItemStl);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
dmAcc.AdotblVouItems.Close;
|
|
|
|
|
dmAcc.AdotblVou.Close;
|
|
|
|
|
freeAndNil(dmacc);
|
|
|
|
|
end;
|
|
|
|
|
bsSkinButton4.OnClick(sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton8Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
Str:String;
|
|
|
|
|
begin
|
|
|
|
|
if not bsSkinCheckRadioBox6.checked then
|
|
|
|
|
str:=str+' and v.Status=0 ';
|
|
|
|
|
if wwDBDateTimePicker19.text<>''then
|
|
|
|
|
str:=str+' and v.voudate>='+''''+wwDBDateTimePicker19.text+'''';
|
|
|
|
|
if wwDBDateTimePicker20.text<>''then
|
|
|
|
|
str:=str+' and v.voudate<='+''''+wwDBDateTimePicker20.text+'''';
|
|
|
|
|
if EditOrdNoFrm.text<>''then
|
|
|
|
|
str:=str+' and v.ordno>='+''+EditOrdNoFrm.text+'';
|
|
|
|
|
if EditOrdNoTo.text<>''then
|
|
|
|
|
str:=str+' and v.ordno<='+''+EditOrdNoTo.text+'';
|
|
|
|
|
if RxDBLookupCombo5.DisplayValue<>''then
|
|
|
|
|
str:=str+' and v.prepared='+''''+RxDBLookupCombo5.DisplayValues[0]+'''';
|
|
|
|
|
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('Select 0 selected,V.* from Vouchers V where 1=1 ');
|
|
|
|
|
SQL.Add(str);
|
|
|
|
|
SQL.Add('Order by V.ORDNO');
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
memTblVou.LoadFromDataSet(aQuery,[]);
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
if memtblvou.IsEmpty then exit;
|
|
|
|
|
|
|
|
|
|
qryVouitems.Close;
|
|
|
|
|
qryVouitems.sql.Clear;
|
|
|
|
|
qryVouitems.SQL.Add('select * from vouitems where ordno=:ordno order by ordno,itemno');
|
|
|
|
|
qryVouitems.Open;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
begin
|
|
|
|
|
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
|
|
|
|
|
|
|
|
|
|
// str:='where 1=1 ';
|
|
|
|
|
if not bsSkinCheckRadioBox3.Checked then
|
|
|
|
|
str:=Str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
|
|
|
|
|
|
|
|
|
|
if Edit5.text<>'' then begin
|
|
|
|
|
if Edit14.text<>'' then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit5.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit14.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit5.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if Edit20.text<>'' then begin
|
|
|
|
|
if Edit21.text<>'' then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit20.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit21.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit20.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo11.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo11.DisplayValues[0]+'''';
|
|
|
|
|
if RxDBLookupCombo12.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo12.DisplayValues[0]+'''';
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo13.DisplayValue<>''then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo13.DisplayValues[0]+''''+')';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Edit6.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD> like '+''''+'%'+Edit6.text+'%'+'''';
|
|
|
|
|
if wwDBDateTimePicker9.text<>''then
|
|
|
|
|
str:=str+' and һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker9.text+'''';
|
|
|
|
|
if wwDBDateTimePicker10.text<>''then
|
|
|
|
|
str:=str+' and һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker10.text+'''';
|
|
|
|
|
if wwDBDateTimePicker11.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker11.text+'''';
|
|
|
|
|
if wwDBDateTimePicker12.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker12.text+'''';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t_op_aire.close;
|
|
|
|
|
t_op_aire.sql.clear;
|
|
|
|
|
t_op_aire.sql.add('select * from t_op_aire '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
t_op_aire.open;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton11Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
Edit5.text:='';
|
|
|
|
|
Edit6.text:='';
|
|
|
|
|
wwDBDateTimePicker9.text:='';
|
|
|
|
|
wwDBDateTimePicker10.text:='';
|
|
|
|
|
wwDBDateTimePicker11.text:='';
|
|
|
|
|
wwDBDateTimePicker12.text:='';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton14Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
begin
|
|
|
|
|
str:='where <20><><EFBFBD><EFBFBD>״̬='+''''+'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'+'''';
|
|
|
|
|
// str:='where 1=1 ';
|
|
|
|
|
if not bsSkinCheckRadioBox4.Checked then
|
|
|
|
|
str:=Str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
|
|
|
|
|
|
|
|
|
|
if Edit7.text<>'' then begin
|
|
|
|
|
if Edit15.text<>'' then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+Edit7.text+''''+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+Edit15.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit7.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if Edit22.text<>'' then begin
|
|
|
|
|
if Edit23.text<>'' then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤>='+''''+Edit22.text+''''+' and <20><><EFBFBD><EFBFBD>ƾ֤<='+''''+Edit23.text+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>ƾ֤ like '+''''+'%'+Edit22.text+'%'+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo14.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo14.DisplayValues[0]+'''';
|
|
|
|
|
if RxDBLookupCombo15.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo15.DisplayValues[0]+'''';
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo16.DisplayValue<>''then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select distinct bsno from v_vouitems where prepared='+''''+RxDBLookupCombo16.DisplayValues[0]+''''+')';
|
|
|
|
|
|
|
|
|
|
if Edit8.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD> like '+''''+'%'+Edit8.text+'%'+'''';
|
|
|
|
|
if wwDBDateTimePicker13.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker13.text+'''';
|
|
|
|
|
if wwDBDateTimePicker14.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker14.text+'''';
|
|
|
|
|
if wwDBDateTimePicker15.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker15.text+'''';
|
|
|
|
|
if wwDBDateTimePicker16.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker16.text+'''';
|
|
|
|
|
t_op_airi.close;
|
|
|
|
|
t_op_airi.sql.clear;
|
|
|
|
|
t_op_airi.sql.add('select * from t_op_airi '+str+' order by ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
t_op_airi.open;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton15Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
Edit7.text:='';
|
|
|
|
|
Edit8.text:='';
|
|
|
|
|
wwDBDateTimePicker13.text:='';
|
|
|
|
|
wwDBDateTimePicker14.text:='';
|
|
|
|
|
wwDBDateTimePicker15.text:='';
|
|
|
|
|
wwDBDateTimePicker16.text:='';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton1Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i,ordno:integer;
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
mAccOK:boolean;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
if wwDBDateTimePicker21.Text='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if RxDBLookupCombo6.DisplayValue='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
dmacc:=TdmAcc.Create(self);
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
dmAcc.ADOtblVou.Open;
|
|
|
|
|
dmAcc.ADOtblVouItems.Open;
|
|
|
|
|
aVKNO:=1;
|
|
|
|
|
aQuery.Close;
|
|
|
|
|
aQuery.SQL.Clear;
|
|
|
|
|
aQuery.SQL.add('update t_op_seae set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
VoucherDate:=wwDBDateTimePicker21.Date;
|
|
|
|
|
try
|
|
|
|
|
dmAcc.AdotblVou.Insert;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('VKNO').Asstring:='<27><>';
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
dmAcc.AdotblVou.Edit;
|
|
|
|
|
|
|
|
|
|
if DBGridEh1.SelectedRows.Count>1 then begin
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(self);
|
|
|
|
|
try
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ<D4BA><F3A1A3A1><EFBFBD>';
|
|
|
|
|
frm_sys_progress.Show;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh1.SelectedRows.Count;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
for i:=0 to DBGridEh1.SelectedRows.Count-1 do begin
|
|
|
|
|
t_op_seae.GotoBookmark(Pointer(DBGridEh1.SelectedRows.Items[I]));
|
|
|
|
|
if t_op_seae['<27><><EFBFBD><EFBFBD>'] then begin
|
|
|
|
|
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_seae['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_seae,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'-'+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_seae,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'-'+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_seae.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
|
|
|
|
|
|
|
|
|
|
FrmVouItemStl:=TFrmVouItemStl.Create(Application);
|
|
|
|
|
try
|
|
|
|
|
dmACC.AdotblVouItems.Last;
|
|
|
|
|
FrmVouItemStl.DBGridVouItems.SelectedField:=dmACC.AdotblVouItems.FieldByName('AccID');
|
|
|
|
|
FrmVouItemStl.ShowModal;
|
|
|
|
|
mAccOK:=false;
|
|
|
|
|
aModal:=frmVouItemStl.ModalResult;
|
|
|
|
|
mAccOK:=aModal=mrok;
|
|
|
|
|
if mAccOK then begin
|
|
|
|
|
if dmAcc.AdotblVouItems.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
if dmAcc.AdotblVou.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('update t_op_seae set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
// dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(FrmVouItemStl);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
dmAcc.AdotblVouItems.Close;
|
|
|
|
|
dmAcc.AdotblVou.Close;
|
|
|
|
|
freeAndNil(dmacc);
|
|
|
|
|
end;
|
|
|
|
|
bsSkinButton10.OnClick(sender);
|
|
|
|
|
// showmessage('<27><><EFBFBD><EFBFBD>');
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton18Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
Str:String;
|
|
|
|
|
begin
|
|
|
|
|
str:='where 1=1 ';
|
|
|
|
|
if not bsSkinCheckRadioBox5.Checked then
|
|
|
|
|
str:=str+' and (<28><><EFBFBD><EFBFBD> is null or <20><><EFBFBD><EFBFBD>=0)';
|
|
|
|
|
if Edit4.text<>''then
|
|
|
|
|
str:=str+' and <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit4.text+'%'+'''';
|
|
|
|
|
if Edit12.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+Trim(Edit12.text);
|
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo2.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
|
|
if RxDBLookupCombo7.DisplayValue<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='+''''+RxDBLookupCombo7.DisplayValues[0]+'''';
|
|
|
|
|
if wwDBDateTimePicker17.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker17.text+'''';
|
|
|
|
|
if wwDBDateTimePicker18.text<>''then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker18.text+'''';
|
|
|
|
|
if wwDBComboBox1.Text<>'' then begin
|
|
|
|
|
if wwDBComboBox1.ItemIndex=0 then
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>=''<27><>'''
|
|
|
|
|
else
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD>=''<27><>''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
t_op_balance.close;
|
|
|
|
|
t_op_balance.sql.clear;
|
|
|
|
|
t_op_balance.sql.add('select * from t_ch_balance '+str+' order by <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
t_op_balance.open;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton20Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i,ordno:integer;
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
mAccOK:boolean;
|
|
|
|
|
begin
|
|
|
|
|
if wwDBDateTimePicker21.Text='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if RxDBLookupCombo6.DisplayValue='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
dmacc:=TdmAcc.Create(self);
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
dmAcc.ADOtblVou.Open;
|
|
|
|
|
dmAcc.ADOtblVouItems.Open;
|
|
|
|
|
aVKNO:=1;
|
|
|
|
|
aQuery.Close;
|
|
|
|
|
aQuery.SQL.Clear;
|
|
|
|
|
aQuery.SQL.add('update t_ch_balance set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where <20>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>=:<3A>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
VoucherDate:=wwDBDateTimePicker21.Date;
|
|
|
|
|
try
|
|
|
|
|
dmAcc.AdotblVou.Insert;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=2;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('VKNO').Asstring:='<27><>';
|
|
|
|
|
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
dmAcc.AdotblVou.Edit;
|
|
|
|
|
|
|
|
|
|
if DBGridEh7.SelectedRows.Count>1 then begin
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(self);
|
|
|
|
|
try
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ<D4BA><F3A1A3A1><EFBFBD>';
|
|
|
|
|
frm_sys_progress.Show;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh7.SelectedRows.Count;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
for i:=0 to DBGridEh7.SelectedRows.Count-1 do begin
|
|
|
|
|
t_op_balance.GotoBookmark(Pointer(DBGridEh7.SelectedRows.Items[I]));
|
|
|
|
|
if t_op_balance['<27><><EFBFBD><EFBFBD>'] then begin
|
|
|
|
|
MessageDlg('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>:'+t_op_balance['<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
end else begin
|
|
|
|
|
NewDCVou(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
NewDCVou(t_op_balance,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_balance.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
FrmVouItemStl:=TFrmVouItemStl.Create(Application);
|
|
|
|
|
try
|
|
|
|
|
dmACC.AdotblVouItems.Last;
|
|
|
|
|
FrmVouItemStl.DBGridVouItems.SelectedField:=dmACC.AdotblVouItems.FieldByName('AccID');
|
|
|
|
|
FrmVouItemStl.ShowModal;
|
|
|
|
|
mAccOK:=false;
|
|
|
|
|
aModal:=frmVouItemStl.ModalResult;
|
|
|
|
|
mAccOK:=aModal=mrok;
|
|
|
|
|
if mAccOK then begin
|
|
|
|
|
if dmAcc.AdotblVouItems.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
if dmAcc.AdotblVou.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('update t_ch_balance set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
// dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(FrmVouItemStl);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
dmAcc.AdotblVouItems.Close;
|
|
|
|
|
dmAcc.AdotblVou.Close;
|
|
|
|
|
freeAndNil(dmacc);
|
|
|
|
|
end;
|
|
|
|
|
bsSkinButton18.OnClick(sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton2Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
Str,S,source,dbffile,exepath,adbftable:String;
|
|
|
|
|
connectstr:wideString;
|
|
|
|
|
selcount,itemno:integer;
|
|
|
|
|
sl:TStrings;
|
|
|
|
|
function GetSelCount:integer;
|
|
|
|
|
begin
|
|
|
|
|
result:=0;
|
|
|
|
|
memtblvou.First;
|
|
|
|
|
while not memtblvou.Eof do begin
|
|
|
|
|
result:=result+1;
|
|
|
|
|
memtblvou.Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
begin
|
|
|
|
|
{
|
|
|
|
|
if not selectDirectory('ѡ<><EFBFBD><F1B5BCB3>ļ<EFBFBD>Ŀ¼','',source) then begin
|
|
|
|
|
messagedlg( '<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>ƾ֤<C6BE>ļ<EFBFBD>',mterro,mbyes,0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if not memtblVou.Active then exit;
|
|
|
|
|
selcount:=GetSelCount;
|
|
|
|
|
if selcount=0 then begin
|
|
|
|
|
messagedlg( 'û<><C3BB>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5><EFBFBD>',mtError,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
aQuery:=CreateADOQuery;
|
|
|
|
|
aQuery.SQL.Add('Update Vouchers set Status=1 where ordno=:OrdNo');
|
|
|
|
|
|
|
|
|
|
sl:=TStringList.Create;
|
|
|
|
|
sl.Add('<27><><EFBFBD><EFBFBD>ƾ֤,V800');
|
|
|
|
|
memtblVou.First;
|
|
|
|
|
try
|
|
|
|
|
while not memtblVou.Eof do begin
|
|
|
|
|
if memtblVou.FieldByName('Selected').AsInteger=1 then begin
|
|
|
|
|
qryVouitems.First;
|
|
|
|
|
while not qryVouitems.Eof do begin
|
|
|
|
|
S:='';
|
|
|
|
|
S:=S+FormatDateTime('YY-MM-DD',memTblVou.FieldByName('VouDate').AsDateTime)+',';
|
|
|
|
|
S:=S+memTblVou.fieldByName('VKNO').AsString+',';
|
|
|
|
|
S:=S+memTblVou.fieldByName('ORDNO').AsString+',';
|
|
|
|
|
S:=S+memTblVou.fieldByName('ATTACHS').AsString+',';
|
|
|
|
|
S:=S+qryVouitems.fieldByName('Explan').AsString+',';
|
|
|
|
|
S:=S+Trim(qryVouitems.fieldByName('ACCID').AsString)+',';
|
|
|
|
|
S:=S+qryVouitems.fieldByName('AMTDR').AsString+',';
|
|
|
|
|
S:=S+qryVouitems.fieldByName('AMTCR').AsString+',,';
|
|
|
|
|
S:=S+FloattoStr(qryVouitems.fieldByName('FCYDR').AsFloat+qryVouitems.fieldByName('FCYCR').AsFloat)+',';
|
|
|
|
|
S:=S+qryVouitems.fieldByName('FCYExRate').AsString+',,';
|
|
|
|
|
S:=S+qryVouitems.FieldByName('FSETTLCODE').AsString+',';
|
|
|
|
|
S:=S+qryVouitems.FieldByName('FSETTLENO').AsString+',,';
|
|
|
|
|
S:=S+qryVouitems.fieldByName('DeptID').AsString+',';
|
|
|
|
|
S:=S+qryVouitems.fieldByName('EmplID').AsString+',';
|
|
|
|
|
// if qryVouitems.FieldByName('CorpBF').AsString='T' then
|
|
|
|
|
// S:=S+','+qryVouitems.fieldByName('CORPID').AsString+','
|
|
|
|
|
// else
|
|
|
|
|
S:=S+qryVouitems.fieldByName('CORPID').AsString+',,';
|
|
|
|
|
SL.Add(S);
|
|
|
|
|
qryVouitems.Next;
|
|
|
|
|
end;
|
|
|
|
|
aQuery.Parameters.ParamByName('OrdNO').value:=qryVouitems.fieldByName('OrdNO').AsInteger;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
memTblVou.Next;
|
|
|
|
|
end;
|
|
|
|
|
if sl.Count<>1 then begin
|
|
|
|
|
saveDialog1.Files.Add(FormatDateTime('YYMMDD', Date)+'.TXT');
|
|
|
|
|
if SaveDialog1.Execute then begin
|
|
|
|
|
sl.SaveToFile(SaveDialog1.FileName+'.txt');
|
|
|
|
|
MessageDlg('<27>Ѿ<EFBFBD><D1BE><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>'+SaveDialog1.FileName,mtInformation,[mbOK],0);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
FreeAndNil(Sl);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
bsSkinButton8Click(sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.DBGridEh2DrawColumnCell(Sender: TObject;
|
|
|
|
|
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
|
|
|
|
|
State: TGridDrawState);
|
|
|
|
|
begin
|
|
|
|
|
with TDBGridEh(Sender), Canvas, Brush do begin
|
|
|
|
|
case memTblVou.FieldByName('Status').AsInteger of
|
|
|
|
|
1 : Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
end;
|
|
|
|
|
if (gdSelected in State)or(gdFocused in State) then begin
|
|
|
|
|
Font.Color:=Color;
|
|
|
|
|
Color:=$00C08080;
|
|
|
|
|
end;
|
|
|
|
|
DefaultDrawColumnCell(Rect, dataCol,Column, State);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.DBGridEh1DrawColumnCell(Sender: TObject;
|
|
|
|
|
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
|
|
|
|
|
State: TGridDrawState);
|
|
|
|
|
begin
|
|
|
|
|
with TDBGridEh(Sender), Canvas, Brush do begin
|
|
|
|
|
if t_op_seae['<27><><EFBFBD><EFBFBD>'] then
|
|
|
|
|
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
if (gdSelected in State)or(gdFocused in State) then begin
|
|
|
|
|
Font.Color:=Color;
|
|
|
|
|
Color:=$00C08080;
|
|
|
|
|
end;
|
|
|
|
|
DefaultDrawColumnCell(Rect, dataCol,Column, State);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.DBGridEh4DrawColumnCell(Sender: TObject;
|
|
|
|
|
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
|
|
|
|
|
State: TGridDrawState);
|
|
|
|
|
begin
|
|
|
|
|
with TDBGridEh(Sender), Canvas, Brush do begin
|
|
|
|
|
if t_op_seai['<27><><EFBFBD><EFBFBD>'] then
|
|
|
|
|
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
if (gdSelected in State)or(gdFocused in State) then begin
|
|
|
|
|
Font.Color:=Color;
|
|
|
|
|
Color:=$00C08080;
|
|
|
|
|
end;
|
|
|
|
|
DefaultDrawColumnCell(Rect, dataCol,Column, State);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.DBGridEh5DrawColumnCell(Sender: TObject;
|
|
|
|
|
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
|
|
|
|
|
State: TGridDrawState);
|
|
|
|
|
begin
|
|
|
|
|
with TDBGridEh(Sender), Canvas, Brush do begin
|
|
|
|
|
if t_op_aire['<27><><EFBFBD><EFBFBD>'] then
|
|
|
|
|
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
if (gdSelected in State)or(gdFocused in State) then begin
|
|
|
|
|
Font.Color:=Color;
|
|
|
|
|
Color:=$00C08080;
|
|
|
|
|
end;
|
|
|
|
|
DefaultDrawColumnCell(Rect, dataCol,Column, State);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.DBGridEh6DrawColumnCell(Sender: TObject;
|
|
|
|
|
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
|
|
|
|
|
State: TGridDrawState);
|
|
|
|
|
begin
|
|
|
|
|
with TDBGridEh(Sender), Canvas, Brush do begin
|
|
|
|
|
if t_op_airi['<27><><EFBFBD><EFBFBD>'] then
|
|
|
|
|
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
if (gdSelected in State)or(gdFocused in State) then begin
|
|
|
|
|
Font.Color:=Color;
|
|
|
|
|
Color:=$00C08080;
|
|
|
|
|
end;
|
|
|
|
|
DefaultDrawColumnCell(Rect, dataCol,Column, State);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.DBGridEh7DrawColumnCell(Sender: TObject;
|
|
|
|
|
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
|
|
|
|
|
State: TGridDrawState);
|
|
|
|
|
begin
|
|
|
|
|
with TDBGridEh(Sender), Canvas, Brush do begin
|
|
|
|
|
if t_op_balance['<27><><EFBFBD><EFBFBD>'] then
|
|
|
|
|
Color:=$00FBE8FF;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
if (gdSelected in State)or(gdFocused in State) then begin
|
|
|
|
|
Font.Color:=Color;
|
|
|
|
|
Color:=$00C08080;
|
|
|
|
|
end;
|
|
|
|
|
DefaultDrawColumnCell(Rect, dataCol,Column, State);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton12Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i,ordno:integer;
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
mAccOK:boolean;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
if wwDBDateTimePicker21.Text='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if RxDBLookupCombo6.DisplayValue='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
dmacc:=TdmAcc.Create(self);
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
dmAcc.ADOtblVou.Open;
|
|
|
|
|
dmAcc.ADOtblVouItems.Open;
|
|
|
|
|
aVKNO:=1;
|
|
|
|
|
aQuery.Close;
|
|
|
|
|
aQuery.SQL.Clear;
|
|
|
|
|
aQuery.SQL.add('update t_op_aire set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
VoucherDate:=wwDBDateTimePicker21.Date;
|
|
|
|
|
try
|
|
|
|
|
dmAcc.AdotblVou.Insert;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('VKNO').Asstring:='<27><>';
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
dmAcc.AdotblVou.Edit;
|
|
|
|
|
|
|
|
|
|
if DBGridEh5.SelectedRows.Count>1 then begin
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(self);
|
|
|
|
|
try
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ<D4BA><F3A1A3A1><EFBFBD>';
|
|
|
|
|
frm_sys_progress.Show;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh5.SelectedRows.Count;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
for i:=0 to DBGridEh5.SelectedRows.Count-1 do begin
|
|
|
|
|
t_op_aire.GotoBookmark(Pointer(DBGridEh5.SelectedRows.Items[I]));
|
|
|
|
|
if t_op_aire['<27><><EFBFBD><EFBFBD>'] then begin
|
|
|
|
|
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_aire['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_aire,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_aire.fieldbyname('һ<>̺<EFBFBD><CCBA><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_aire.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_aire,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_aire.fieldbyname('һ<>̺<EFBFBD><CCBA><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_aire.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
|
|
|
|
|
FrmVouItemStl:=TFrmVouItemStl.Create(Application);
|
|
|
|
|
try
|
|
|
|
|
dmACC.AdotblVouItems.Last;
|
|
|
|
|
FrmVouItemStl.DBGridVouItems.SelectedField:=dmACC.AdotblVouItems.FieldByName('AccID');
|
|
|
|
|
FrmVouItemStl.ShowModal;
|
|
|
|
|
mAccOK:=false;
|
|
|
|
|
aModal:=frmVouItemStl.ModalResult;
|
|
|
|
|
mAccOK:=aModal=mrok;
|
|
|
|
|
if mAccOK then begin
|
|
|
|
|
if dmAcc.AdotblVouItems.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
if dmAcc.AdotblVou.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('update t_op_aire set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
// dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(FrmVouItemStl);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
dmAcc.AdotblVouItems.Close;
|
|
|
|
|
dmAcc.AdotblVou.Close;
|
|
|
|
|
freeAndNil(dmacc);
|
|
|
|
|
end;
|
|
|
|
|
bsSkinButton9.OnClick(sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton16Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i,ordno:integer;
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
aModal:TModalResult;
|
|
|
|
|
mAccOK:boolean;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
if wwDBDateTimePicker21.Text='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if RxDBLookupCombo6.DisplayValue='' then begin
|
|
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
dmacc:=TdmAcc.Create(self);
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
dmAcc.ADOtblVou.Open;
|
|
|
|
|
dmAcc.ADOtblVouItems.Open;
|
|
|
|
|
aVKNO:=1;
|
|
|
|
|
aQuery.Close;
|
|
|
|
|
aQuery.SQL.Clear;
|
|
|
|
|
aQuery.SQL.add('update t_op_airi set <20><><EFBFBD><EFBFBD>=1,<2C><><EFBFBD><EFBFBD>ƾ֤=:<3A><><EFBFBD><EFBFBD>ƾ֤ where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
VoucherDate:=wwDBDateTimePicker21.Date;
|
|
|
|
|
try
|
|
|
|
|
dmAcc.AdotblVou.Insert;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('SourceType').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('ATTACHS').AsInteger:=1;
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('VKNO').Asstring:='<27><>';
|
|
|
|
|
dmAcc.AdotblVou.FieldByName('PREPARED').AsString:=RxDBLookupCombo6.DisplayValues[0];
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
dmAcc.AdotblVou.Edit;
|
|
|
|
|
|
|
|
|
|
if DBGridEh6.SelectedRows.Count>1 then begin
|
|
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(self);
|
|
|
|
|
try
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD>Ժ<D4BA><F3A1A3A1><EFBFBD>';
|
|
|
|
|
frm_sys_progress.Show;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=DBGridEh6.SelectedRows.Count;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
for i:=0 to DBGridEh6.SelectedRows.Count-1 do begin
|
|
|
|
|
t_op_airi.GotoBookmark(Pointer(DBGridEh6.SelectedRows.Items[I]));
|
|
|
|
|
if t_op_airi['<27><><EFBFBD><EFBFBD>'] then begin
|
|
|
|
|
MessageDlg('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+t_op_airi['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+'<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>',mterror,[mbyes],0);
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_airi,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_airi.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(frm_sys_progress);
|
|
|
|
|
end;
|
|
|
|
|
end else begin
|
|
|
|
|
NewDrCrVou(t_op_airi,RxDBLookupCombo6.DisplayValues[0],wwDBDateTimePicker21.Date,t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
|
|
aQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ƾ֤').Value:=dmacc.ADOTblVou.fieldbyname('ordno').AsString;
|
|
|
|
|
aQuery.Parameters.ParamByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=t_op_airi.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
aQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
ordno:=dmAcc.AdotblVou.fieldbyname('ordno').asinteger;
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
|
|
|
|
|
FrmVouItemStl:=TFrmVouItemStl.Create(Application);
|
|
|
|
|
try
|
|
|
|
|
dmACC.AdotblVouItems.Last;
|
|
|
|
|
FrmVouItemStl.DBGridVouItems.SelectedField:=dmACC.AdotblVouItems.FieldByName('AccID');
|
|
|
|
|
FrmVouItemStl.ShowModal;
|
|
|
|
|
mAccOK:=false;
|
|
|
|
|
aModal:=frmVouItemStl.ModalResult;
|
|
|
|
|
mAccOK:=aModal=mrok;
|
|
|
|
|
if mAccOK then begin
|
|
|
|
|
if dmAcc.AdotblVouItems.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVouItems.Post;
|
|
|
|
|
if dmAcc.AdotblVou.State in [dsEdit,dsInsert] then
|
|
|
|
|
dmAcc.AdotblVou.Post;
|
|
|
|
|
end else begin
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('update t_op_airi set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
// dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
freeAndNil(FrmVouItemStl);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
except
|
|
|
|
|
dmAcc.TempQuery.Close;
|
|
|
|
|
dmAcc.TempQuery.SQL.Clear;
|
|
|
|
|
dmAcc.TempQuery.SQL.Add('delete from vouchers where ordno=:mOrdNo');
|
|
|
|
|
dmAcc.TempQuery.Parameters.ParamByName('mOrdNo').value:=OrdNo;
|
|
|
|
|
dmAcc.TempQuery.ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
dmAcc.AdotblVouItems.Close;
|
|
|
|
|
dmAcc.AdotblVou.Close;
|
|
|
|
|
freeAndNil(dmacc);
|
|
|
|
|
end;
|
|
|
|
|
bsSkinButton14.OnClick(sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton17Click(Sender: TObject);
|
|
|
|
|
procedure deleteBusiCardVt(ordno:integer);
|
|
|
|
|
var
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
close;SQl.Clear;
|
|
|
|
|
SQL.Add('delete from vouchers where ORDNO='+inttostr(OrdNo));
|
|
|
|
|
ExecSQL;
|
|
|
|
|
close;SQl.Clear;
|
|
|
|
|
SQL.Add('update t_op_seae set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
ExecSQL;
|
|
|
|
|
close;SQl.Clear;
|
|
|
|
|
SQL.Add('update t_op_seai set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
ExecSQL;
|
|
|
|
|
close;SQl.Clear;
|
|
|
|
|
SQL.Add('update t_op_aire set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
ExecSQL;
|
|
|
|
|
close;SQl.Clear;
|
|
|
|
|
SQL.Add('update t_op_airi set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
procedure deleteStlVt(ordno:integer);
|
|
|
|
|
var
|
|
|
|
|
aQuery:TAdoQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
try
|
|
|
|
|
with aQuery do begin
|
|
|
|
|
close;SQl.Clear;
|
|
|
|
|
SQL.Add('update t_ch_balance set <20><><EFBFBD><EFBFBD>=0,<2C><><EFBFBD><EFBFBD>ƾ֤='''' where <20><><EFBFBD><EFBFBD>ƾ֤='''+inttostr(OrdNo)+'''');
|
|
|
|
|
ExecSQL;
|
|
|
|
|
close;SQl.Clear;
|
|
|
|
|
SQL.Add('delete from vouchers where ORDNO='+inttostr(OrdNo));
|
|
|
|
|
ExecSQL;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
begin
|
|
|
|
|
memtblVou.First;
|
|
|
|
|
while not memtblVou.Eof do begin
|
|
|
|
|
if memtblVou.FieldByName('Selected').AsInteger=1 then begin
|
|
|
|
|
if memTblVou.FieldByName('SOURCETYPE').AsInteger=2 then
|
|
|
|
|
deleteStlVt(memTblVou.fieldByName('ordno').AsInteger)
|
|
|
|
|
else
|
|
|
|
|
deleteBusiCardVt(memTblVou.fieldByName('ordno').AsInteger);
|
|
|
|
|
end;
|
|
|
|
|
memtblvou.Next;
|
|
|
|
|
end;
|
|
|
|
|
bsSkinButton8Click(sender);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton21Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
if t_op_seae.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
if DBGridEh1.SelectedRows.Count<1 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if (t_op_seae.State=dsinsert)or(t_op_seae.State=dsedit) then
|
|
|
|
|
t_op_seae.post;
|
|
|
|
|
try
|
|
|
|
|
frm_ch_piliang_seae:=tfrm_ch_piliang_seae.Create (self);
|
|
|
|
|
t_op_seae.DisableControls;
|
|
|
|
|
|
|
|
|
|
for i:=0 to DBGridEh1.SelectedRows.Count-1 do
|
|
|
|
|
begin
|
|
|
|
|
t_op_seae.GotoBookmark(pointer(DBGridEh1.SelectedRows.Items[I]));
|
|
|
|
|
if str='' then
|
|
|
|
|
str:=''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+','+''''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
|
|
|
|
|
end;
|
|
|
|
|
str:='('+str+')';
|
|
|
|
|
str:='select * from t_op_seae where <20><><EFBFBD><EFBFBD> in '+str+default_sort(53,'t_op_seae','','desc');
|
|
|
|
|
frm_ch_piliang_seae.t_op_seae.Parameters.ParamByName('SQLStr').value:=str;
|
|
|
|
|
frm_ch_piliang_seae.t_op_seae.open;
|
|
|
|
|
frm_ch_piliang_seae.ShowModal;
|
|
|
|
|
finally
|
|
|
|
|
t_op_seae.EnableControls;
|
|
|
|
|
frm_ch_piliang_seae.Free;
|
|
|
|
|
frm_ch_piliang_seae:=nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton22Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
if t_op_seai.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
if DBGridEh4.SelectedRows.Count<1 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD><D2B5><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if (t_op_seai.State=dsinsert)or(t_op_seai.State=dsedit) then
|
|
|
|
|
t_op_seai.post;
|
|
|
|
|
try
|
|
|
|
|
frm_ch_piliang_seai:=tfrm_ch_piliang_seai.Create (self);
|
|
|
|
|
t_op_seai.DisableControls;
|
|
|
|
|
|
|
|
|
|
for i:=0 to DBGridEh4.SelectedRows.Count-1 do
|
|
|
|
|
begin
|
|
|
|
|
t_op_seai.GotoBookmark(pointer(DBGridEh4.SelectedRows.items[i]));
|
|
|
|
|
if str='' then
|
|
|
|
|
str:=''''+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+','+''''+t_op_seai.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
|
|
|
|
|
end;
|
|
|
|
|
str:='('+str+')';
|
|
|
|
|
str:='select * from t_op_seai where <20><><EFBFBD><EFBFBD> in '+str+default_sort(54,'t_op_seai','','desc');
|
|
|
|
|
frm_ch_piliang_seai.t_op_seai.Parameters.ParamByName('SQLStr').value:=str;
|
|
|
|
|
frm_ch_piliang_seai.t_op_seai.open;
|
|
|
|
|
frm_ch_piliang_seai.ShowModal;
|
|
|
|
|
finally
|
|
|
|
|
t_op_seai.EnableControls;
|
|
|
|
|
frm_ch_piliang_seai.Free;
|
|
|
|
|
frm_ch_piliang_seai:=nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton23Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
if t_op_aire.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
if DBGridEh5.SelectedRows.Count<1 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD><D2B5><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if (t_op_aire.State=dsinsert)or(t_op_aire.State=dsedit) then
|
|
|
|
|
t_op_aire.post;
|
|
|
|
|
try
|
|
|
|
|
frm_ch_piliang_aire:=tfrm_ch_piliang_aire.Create (self);
|
|
|
|
|
t_op_aire.DisableControls;
|
|
|
|
|
|
|
|
|
|
for i:=0 to DBGridEh5.SelectedRows.Count-1 do
|
|
|
|
|
begin
|
|
|
|
|
t_op_aire.GotoBookmark(pointer(DBGridEh5.SelectedRows.items[i]));
|
|
|
|
|
if str='' then
|
|
|
|
|
str:=''''+t_op_aire.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+','+''''+t_op_aire.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
|
|
|
|
|
end;
|
|
|
|
|
str:='('+str+')';
|
|
|
|
|
str:='select * from t_op_aire where <20><><EFBFBD><EFBFBD> in '+str+default_sort(55,'t_op_aire','','desc');
|
|
|
|
|
frm_ch_piliang_aire.t_op_aire.Parameters.ParamByName('SQLStr').value:=str;
|
|
|
|
|
frm_ch_piliang_aire.t_op_aire.open;
|
|
|
|
|
frm_ch_piliang_aire.ShowModal;
|
|
|
|
|
finally
|
|
|
|
|
t_op_aire.EnableControls;
|
|
|
|
|
frm_ch_piliang_aire.Free;
|
|
|
|
|
frm_ch_piliang_aire:=nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton24Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
if t_op_airi.IsEmpty then
|
|
|
|
|
exit;
|
|
|
|
|
if DBGridEh6.SelectedRows.Count<1 then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD><D2AA>ӡ<EFBFBD><D3A1>ҵ<EFBFBD><D2B5><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then
|
|
|
|
|
t_op_airi.post;
|
|
|
|
|
try
|
|
|
|
|
frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self);
|
|
|
|
|
t_op_airi.DisableControls;
|
|
|
|
|
|
|
|
|
|
for i:=0 to DBGridEh6.SelectedRows.Count-1 do
|
|
|
|
|
begin
|
|
|
|
|
t_op_airi.GotoBookmark(pointer(DBGridEh6.SelectedRows.items[i]));
|
|
|
|
|
if str='' then
|
|
|
|
|
str:=''''+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''
|
|
|
|
|
else
|
|
|
|
|
str:=str+','+''''+t_op_airi.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
|
|
|
|
|
end;
|
|
|
|
|
str:='('+str+')';
|
|
|
|
|
str:='select * from t_op_airi where <20><><EFBFBD><EFBFBD> in '+str+default_sort(56,'t_op_airi','','desc');
|
|
|
|
|
frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str;
|
|
|
|
|
frm_ch_piliang_airi.t_op_airi.open;
|
|
|
|
|
frm_ch_piliang_airi.ShowModal;
|
|
|
|
|
finally
|
|
|
|
|
t_op_airi.EnableControls;
|
|
|
|
|
frm_ch_piliang_airi.Free;
|
|
|
|
|
frm_ch_piliang_airi:=nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton13Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
memTblVou.First;
|
|
|
|
|
while not memtblvou.Eof do begin
|
|
|
|
|
memtblVou.Edit;
|
|
|
|
|
memtblVou.FieldByName('Selected').AsInteger:=1;
|
|
|
|
|
memtblVou.Post;
|
|
|
|
|
memtblvou.Next;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton25Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
memTblVou.First;
|
|
|
|
|
while not memtblvou.Eof do begin
|
|
|
|
|
memtblVou.Edit;
|
|
|
|
|
memtblVou.FieldByName('Selected').AsInteger:=0;
|
|
|
|
|
memtblVou.Post;
|
|
|
|
|
memtblvou.Next;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.Edit12KeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
begin
|
|
|
|
|
if not (key in ['0'..'9','.','-']) then key:=#0;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.Edit10KeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
begin
|
|
|
|
|
if not (key in ['0'..'9','.','-']) then key:=#0;
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_cw_pingzheng.bsSkinButton27Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
Str:String;
|
|
|
|
|
function GetCustID(CorpID,DC:String):String;
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
aQuery:TADOQuery;
|
|
|
|
|
begin
|
|
|
|
|
aQuery:=createADOQuery;
|
|
|
|
|
with aQuery do
|
|
|
|
|
try
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('select <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+CorpID+'''');
|
|
|
|
|
Open;
|
|
|
|
|
if DC='<27><>' then
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
else
|
|
|
|
|
Result:=fieldByName('<27><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(aQuery);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
if not bsSkinCheckRadioBox7.checked then
|
|
|
|
|
str:=str+' and v.Status=0 ';
|
|
|
|
|
if wwDBDateTimePicker22.text<>''then
|
|
|
|
|
str:=str+' and v.voudate>='+''''+wwDBDateTimePicker22.text+'''';
|
|
|
|
|
if wwDBDateTimePicker23.text<>''then
|
|
|
|
|
str:=str+' and v.voudate<='+''''+wwDBDateTimePicker23.text+'''';
|
|
|
|
|
if Edit26.text<>''then
|
|
|
|
|
str:=str+' and v.ordno>='+''+Edit26.text+'';
|
|
|
|
|
if Edit25.text<>''then
|
|
|
|
|
str:=str+' and v.ordno<='+''+Edit25.text+'';
|
|
|
|
|
if RxDBLookupCombo17.DisplayValue<>''then
|
|
|
|
|
str:=str+' and v.prepared='+''''+RxDBLookupCombo17.DisplayValues[0]+'''';
|
|
|
|
|
if Edit27.text<>'' then
|
|
|
|
|
str:=str+' and v.ACCID='+''''+Edit27.text+'''';
|
|
|
|
|
if RxDBLookupCombo18.DisplayValues[1]<>'' then begin
|
|
|
|
|
str:=str+' and (v.CorpID='+''''+GetCustID(RxDBLookupCombo18.DisplayValues[1],'<27><>')+''''+' or v.CorpID='+''''+GetCustID(RxDBLookupCombo18.DisplayValues[1],'<27><>')+''''+')';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
with v_vouitems do begin
|
|
|
|
|
Close;SQL.Clear;
|
|
|
|
|
SQL.Add('Select v.* from v_vouitems V where 1=1 ');
|
|
|
|
|
SQL.Add(str);
|
|
|
|
|
SQL.Add('Order by V.ORDNO');
|
|
|
|
|
Open;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|