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

1319 lines
55 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_rp_drstl_self;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, ComCtrls, bsSkinTabs, DB, ADODB,DateUtils,
dxExEdtr, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner,
kbmMemTable, kbmMemBinaryStreamFormat, Menus, StdCtrls,
wwdbdatetimepicker, Grids, DBGridEh, bsSkinBoxCtrls, DBGrids, wwdblook;
type
Tfrm_rp_drstl_self = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
p_total_client1: TDataSource;
p_total_sales1: TDataSource;
SaveDialog: TSaveDialog;
bsSkinPageControl4: TbsSkinPageControl;
bsSkinTabSheet3: TbsSkinTabSheet;
dxDBGrid3: TdxDBGrid;
dxDBGrid3Column22: TdxDBGridColumn;
dxDBGridColumn59: TdxDBGridColumn;
dxDBGridColumn60: TdxDBGridColumn;
dxDBGridColumn61: TdxDBGridColumn;
dxDBGridColumn62: TdxDBGridColumn;
dxDBGridColumn63: TdxDBGridColumn;
dxDBGridColumn64: TdxDBGridColumn;
dxDBGridColumn65: TdxDBGridColumn;
dxDBGridColumn66: TdxDBGridColumn;
dxDBGridColumn67: TdxDBGridColumn;
dxDBGridColumn68: TdxDBGridColumn;
dxDBGridColumn69: TdxDBGridColumn;
dxDBGridColumn70: TdxDBGridColumn;
dxDBGridColumn71: TdxDBGridColumn;
dxDBGridColumn72: TdxDBGridColumn;
dxDBGridColumn73: TdxDBGridColumn;
dxDBGridColumn74: TdxDBGridColumn;
dxDBGridColumn75: TdxDBGridColumn;
dxDBGridColumn76: TdxDBGridColumn;
dxDBGridColumn77: TdxDBGridColumn;
dxDBGridColumn78: TdxDBGridColumn;
dxDBGridColumn79: TdxDBGridColumn;
p_accept_bill: TADOStoredProc;
p_accept_bill1: TDataSource;
kbmBinaryStreamFormat1: TkbmBinaryStreamFormat;
kbmThreadDataSet1: TkbmThreadDataSet;
memtblrpt_total2: TkbmMemTable;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N1101: TMenuItem;
memtblrpt_total1: TDataSource;
memtblDetail: TkbmMemTable;
memtblField: TkbmMemTable;
memtblFieldFieldName: TStringField;
memtblFieldDisplayName: TStringField;
memtblFieldlength: TIntegerField;
memtblFieldFooterSum: TSmallintField;
bstab1: TbsSkinTabSheet;
bsSkinPanel1: TbsSkinPanel;
bsSkinPageControl1: TbsSkinPageControl;
tab1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
tab3: TbsSkinTabSheet;
tab4: TbsSkinTabSheet;
dxDBGrid2: TdxDBGrid;
dxDBGridColumn18: TdxDBGridColumn;
dxDBGridColumn22: TdxDBGridColumn;
dxDBGrid4: TdxDBGrid;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGrid4Column3: TdxDBGridColumn;
dxDBGrid6: TdxDBGrid;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGrid7: TdxDBGrid;
dxDBGridColumn6: TdxDBGridColumn;
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
dxDBGridMaskColumn3: TdxDBGridMaskColumn;
dxDBGridMaskColumn4: TdxDBGridMaskColumn;
dxDBGridMaskColumn5: TdxDBGridMaskColumn;
dxDBGridMaskColumn6: TdxDBGridMaskColumn;
dxDBGridColumn10: TdxDBGridColumn;
dxDBGridColumn11: TdxDBGridColumn;
dxDBGridColumn12: TdxDBGridColumn;
dxDBGridColumn13: TdxDBGridColumn;
dxDBGridColumn14: TdxDBGridColumn;
dxDBGridColumn15: TdxDBGridColumn;
dxDBGridColumn16: TdxDBGridColumn;
dxDBGridColumn17: TdxDBGridColumn;
dxDBGridColumn19: TdxDBGridColumn;
dxDBGridColumn20: TdxDBGridColumn;
dxDBGridColumn21: TdxDBGridColumn;
dxDBGridColumn23: TdxDBGridColumn;
dxDBGridColumn24: TdxDBGridColumn;
dxDBGridColumn25: TdxDBGridColumn;
dxDBGridDateColumn1: TdxDBGridDateColumn;
dxDBGridColumn26: TdxDBGridColumn;
dxDBGridMaskColumn7: TdxDBGridMaskColumn;
dxDBGridMaskColumn8: TdxDBGridMaskColumn;
dxDBGridMaskColumn9: TdxDBGridMaskColumn;
dxDBGridMaskColumn10: TdxDBGridMaskColumn;
dxDBGridMaskColumn11: TdxDBGridMaskColumn;
dxDBGridMaskColumn12: TdxDBGridMaskColumn;
dxDBGridDateColumn2: TdxDBGridDateColumn;
dxDBGridMaskColumn13: TdxDBGridMaskColumn;
dxDBGridMaskColumn14: TdxDBGridMaskColumn;
dxDBGridMaskColumn15: TdxDBGridMaskColumn;
dxDBGridMaskColumn16: TdxDBGridMaskColumn;
dxDBGridMaskColumn17: TdxDBGridMaskColumn;
dxDBGridColumn27: TdxDBGridColumn;
dxDBGridColumn28: TdxDBGridColumn;
dxDBGridMaskColumn18: TdxDBGridMaskColumn;
dxDBGridMaskColumn19: TdxDBGridMaskColumn;
dxDBGridMaskColumn20: TdxDBGridMaskColumn;
dxDBGridMaskColumn21: TdxDBGridMaskColumn;
dxDBGridMaskColumn22: TdxDBGridMaskColumn;
dxDBGridMaskColumn23: TdxDBGridMaskColumn;
dxDBGridMaskColumn24: TdxDBGridMaskColumn;
dxDBGridMaskColumn25: TdxDBGridMaskColumn;
dxDBGridMaskColumn26: TdxDBGridMaskColumn;
dxDBGridMaskColumn27: TdxDBGridMaskColumn;
dxDBGridMaskColumn28: TdxDBGridMaskColumn;
dxDBGridMaskColumn29: TdxDBGridMaskColumn;
dxDBGridMaskColumn30: TdxDBGridMaskColumn;
dxDBGridMaskColumn31: TdxDBGridMaskColumn;
dxDBGridMaskColumn32: TdxDBGridMaskColumn;
dxDBGridMaskColumn33: TdxDBGridMaskColumn;
dxDBGridMaskColumn34: TdxDBGridMaskColumn;
dxDBGridMaskColumn35: TdxDBGridMaskColumn;
dxDBGridMaskColumn36: TdxDBGridMaskColumn;
dxDBGridMaskColumn37: TdxDBGridMaskColumn;
dxDBGridColumn29: TdxDBGridColumn;
dxDBGridColumn30: TdxDBGridColumn;
dxDBGridColumn31: TdxDBGridColumn;
dxDBGridColumn32: TdxDBGridColumn;
mem_total_sales: TkbmMemTable;
mem_total_client: TkbmMemTable;
mem_total_dept: TkbmMemTable;
p_total_dept1: TDataSource;
p_total1: TDataSource;
mem_total_deptField: TStringField;
mem_total_deptField2: TFloatField;
mem_total_salesField: TStringField;
mem_total_salesField2: TStringField;
mem_total_clientField: TStringField;
mem_total_clientField2: TStringField;
dxDBGrid2Column3: TdxDBGridColumn;
dxDBGrid4Column4: TdxDBGridColumn;
dxDBGrid6Column5: TdxDBGridColumn;
mem_client: TkbmMemTable;
StringField1: TStringField;
StringField2: TStringField;
FloatField1: TFloatField;
mem_clientField: TFloatField;
dxDBGrid7Column64: TdxDBGridColumn;
dxDBGrid4Column5: TdxDBGridColumn;
dxDBGrid4Column6: TdxDBGridColumn;
dxDBGrid6Column6: TdxDBGridColumn;
dxDBGrid7Column65: TdxDBGridColumn;
memtblrpt_total2Field: TStringField;
memtblrpt_total2Field2: TStringField;
memtblrpt_total2Field3: TStringField;
memtblrpt_total2Field4: TIntegerField;
memtblrpt_total2Field5: TIntegerField;
memtblrpt_total2Field6: TStringField;
memtblrpt_total2Field7: TStringField;
memtblrpt_total2Field8: TStringField;
memtblrpt_total2Field9: TDateTimeField;
memtblrpt_total2USD: TFloatField;
memtblrpt_total2USD2: TFloatField;
memtblrpt_total2USD3: TFloatField;
memtblrpt_total2RMB: TFloatField;
memtblrpt_total2RMB2: TFloatField;
memtblrpt_total2RMB3: TFloatField;
memtblrpt_total2Field11: TFloatField;
memtblrpt_total2Field12: TFloatField;
memtblrpt_total2Field13: TFloatField;
memtblrpt_total2Field14: TFloatField;
memtblrpt_total2Field15: TFloatField;
memtblrpt_total2Field16: TFloatField;
memtblrpt_total2Field17: TFloatField;
memtblrpt_total2Field19: TIntegerField;
memtblrpt_total2Field20: TStringField;
memtblrpt_total2Field21: TStringField;
memtblrpt_total2Field22: TStringField;
memtblrpt_total2Field23: TStringField;
memtblrpt_total2Field24: TStringField;
memtblrpt_total2Field25: TStringField;
memtblrpt_total2Field26: TStringField;
memtblrpt_total2Field27: TStringField;
memtblrpt_total2Field28: TStringField;
memtblrpt_total2Field29: TIntegerField;
memtblrpt_total2Field30: TStringField;
memtblrpt_total2Field31: TFloatField;
memtblrpt_total2Field32: TFloatField;
memtblrpt_total2Field1: TIntegerField;
memtblrpt_total2Field210: TIntegerField;
memtblrpt_total2Field33: TIntegerField;
memtblrpt_total2Field42: TIntegerField;
memtblrpt_total2Field52: TIntegerField;
memtblrpt_total2Field62: TIntegerField;
memtblrpt_total2Field72: TIntegerField;
memtblrpt_total2Field82: TIntegerField;
memtblrpt_total2Field92: TIntegerField;
memtblrpt_total2Field102: TIntegerField;
memtblrpt_total2Field34: TIntegerField;
memtblrpt_total2TEU: TIntegerField;
memtblrpt_total2Field35: TStringField;
memtblrpt_total2Field36: TStringField;
memtblrpt_total2Field37: TStringField;
memtblrpt_total2Field38: TStringField;
memtblrpt_total2Field39: TStringField;
memtblrpt_total2Field40: TStringField;
memtblrpt_total2Field41: TStringField;
memtblrpt_total2Field43: TStringField;
memtblrpt_total2Field44: TStringField;
memtblrpt_total2Field45: TStringField;
memtblrpt_total2Field46: TStringField;
memtblrpt_total2Field47: TStringField;
memtblrpt_total2Field48: TStringField;
memtblrpt_total2Field50: TStringField;
memtblrpt_total2Field10: TDateField;
memtblrpt_total2Field18: TDateField;
bsSkinButton12: TbsSkinButton;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N13: TMenuItem;
N12: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
mem_clientUSD: TFloatField;
mem_clientRMB: TFloatField;
mem_clientFloatField: TFloatField;
mem_clientFloatField2: TFloatField;
mem_clientmonth: TkbmMemTable;
StringField3: TStringField;
StringField4: TStringField;
FloatField2: TFloatField;
FloatField3: TFloatField;
FloatField4: TFloatField;
FloatField5: TFloatField;
FloatField6: TFloatField;
FloatField7: TFloatField;
mem_clientmonthStringField: TStringField;
mem_clientsum: TkbmMemTable;
StringField5: TStringField;
StringField6: TStringField;
FloatField8: TFloatField;
FloatField9: TFloatField;
FloatField10: TFloatField;
FloatField11: TFloatField;
FloatField12: TFloatField;
FloatField13: TFloatField;
memtblrpt_total2Field51: TStringField;
memtblrpt_total2StringField: TStringField;
mem_sum: TkbmMemTable;
StringField7: TStringField;
StringField8: TStringField;
FloatField14: TFloatField;
FloatField15: TFloatField;
FloatField16: TFloatField;
FloatField17: TFloatField;
FloatField18: TFloatField;
FloatField19: TFloatField;
mem_clientField2: TStringField;
dxDBGrid7Column66: TdxDBGridColumn;
mem_clientsumField: TStringField;
memtblrpt_total2Field53: TStringField;
dxDBGrid7Column67: TdxDBGridColumn;
memtblrpt_total2Field54: TStringField;
memtblrpt_total2Field55: TFloatField;
memtblrpt_total2Field56: TFloatField;
mem_total_deptFloatField: TFloatField;
mem_total_deptFloatField2: TFloatField;
dxDBGrid2Column4: TdxDBGridColumn;
dxDBGrid6Column9: TdxDBGridColumn;
mem_clientmonth1: TDataSource;
mem_clientmonthUSD: TFloatField;
mem_clientmonthUSD2: TFloatField;
mem_clientmonthRMB: TFloatField;
mem_clientmonthRMB2: TFloatField;
mem_clientmonthFloatField: TFloatField;
mem_clientmonthFloatField2: TFloatField;
mem_clientmonthFloatField3: TFloatField;
mem_clientmonthFloatField4: TFloatField;
mem_clientmonthFloatField5: TFloatField;
mem_clientmonthFloatField6: TFloatField;
mem_clientmonthIntegerField: TIntegerField;
mem_clientmonthDateTimeField: TDateTimeField;
memtblrpt_total2Field57: TDateField;
dxDBGrid7Column68: TdxDBGridColumn;
mem_total_deptField3: TStringField;
dxDBGrid2Column5: TdxDBGridColumn;
mem_total_salesFloatField: TFloatField;
mem_total_salesFloatField2: TFloatField;
mem_total_salesStringField: TStringField;
mem_total_salesFloatField3: TFloatField;
mem_total_clientFloatField: TFloatField;
mem_total_clientFloatField2: TFloatField;
mem_total_clientStringField: TStringField;
mem_total_clientFloatField3: TFloatField;
memtblrpt_total2Field49: TStringField;
memtblrpt_total2Field58: TStringField;
memtblrpt_total2Field59: TStringField;
dxDBGrid7Column69: TdxDBGridColumn;
dxDBGrid7Column70: TdxDBGridColumn;
memtblrpt_total2FloatField: TFloatField;
dxDBGrid7Column71: TdxDBGridColumn;
bsSkinComboBox1: TbsSkinComboBox;
Label1: TLabel;
memtblrpt_total: TkbmMemTable;
memtblrpt_totalField: TStringField;
memtblrpt_totalField2: TStringField;
memtblrpt_totalField3: TStringField;
memtblrpt_totalField6: TStringField;
memtblrpt_totalField7: TStringField;
memtblrpt_totalField8: TStringField;
memtblrpt_totalField9: TDateTimeField;
memtblrpt_totalUSD: TFloatField;
memtblrpt_totalUSD2: TFloatField;
memtblrpt_totalUSD3: TFloatField;
memtblrpt_totalRMB: TFloatField;
memtblrpt_totalRMB2: TFloatField;
memtblrpt_totalRMB3: TFloatField;
memtblrpt_totalField11: TFloatField;
memtblrpt_totalField12: TFloatField;
memtblrpt_totalField13: TFloatField;
memtblrpt_totalField14: TFloatField;
memtblrpt_totalField15: TFloatField;
memtblrpt_totalField16: TFloatField;
memtblrpt_totalField17: TFloatField;
memtblrpt_totalUSD4: TFloatField;
memtblrpt_totalField19: TIntegerField;
memtblrpt_totalField20: TStringField;
memtblrpt_totalField21: TStringField;
memtblrpt_totalField22: TStringField;
memtblrpt_totalField23: TStringField;
memtblrpt_totalField24: TStringField;
memtblrpt_totalField25: TStringField;
memtblrpt_totalField26: TStringField;
memtblrpt_totalField27: TStringField;
memtblrpt_totalField28: TStringField;
memtblrpt_totalField29: TIntegerField;
memtblrpt_totalField30: TStringField;
memtblrpt_totalField31: TFloatField;
memtblrpt_totalField32: TFloatField;
memtblrpt_totalField1: TIntegerField;
memtblrpt_totalField210: TIntegerField;
memtblrpt_totalField33: TIntegerField;
memtblrpt_totalField42: TIntegerField;
memtblrpt_totalField52: TIntegerField;
memtblrpt_totalField62: TIntegerField;
memtblrpt_totalField72: TIntegerField;
memtblrpt_totalField82: TIntegerField;
memtblrpt_totalField92: TIntegerField;
memtblrpt_totalField102: TIntegerField;
memtblrpt_totalField34: TIntegerField;
memtblrpt_totalTEU: TIntegerField;
memtblrpt_totalField35: TStringField;
memtblrpt_totalField36: TStringField;
memtblrpt_totalField37: TStringField;
memtblrpt_totalField38: TStringField;
memtblrpt_totalField39: TStringField;
memtblrpt_totalField40: TStringField;
memtblrpt_totalField41: TStringField;
memtblrpt_totalField43: TStringField;
memtblrpt_totalField44: TStringField;
memtblrpt_totalField45: TStringField;
memtblrpt_totalField46: TStringField;
memtblrpt_totalField47: TStringField;
memtblrpt_totalField48: TStringField;
memtblrpt_totalField50: TStringField;
memtblrpt_totalField10: TDateField;
memtblrpt_totalField18: TDateField;
memtblrpt_totalField51: TStringField;
memtblrpt_totalStringField: TStringField;
memtblrpt_totalField53: TStringField;
memtblrpt_totalField54: TStringField;
memtblrpt_totalField55: TFloatField;
memtblrpt_totalField56: TFloatField;
memtblrpt_totalField57: TDateField;
wwDBLookupCombo49: TwwDBLookupCombo;
Label2: TLabel;
bsSkinButton2: TbsSkinButton;
memtblrpt_totalField4: TStringField;
Label24: TLabel;
wwDBDateTimePicker5: TwwDBDateTimePicker;
Label26: TLabel;
wwDBDateTimePicker6: TwwDBDateTimePicker;
memtblrpt_totalField5: TIntegerField;
dxDBGrid7Column72: TdxDBGridColumn;
bsSkinTabSheet5: TbsSkinTabSheet;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridMaskColumn;
dxDBGrid1Column12: TdxDBGridDateColumn;
dxDBGrid1Column15: TdxDBGridColumn;
dxDBGrid1Column16: TdxDBGridColumn;
dxDBGrid1Column13: TdxDBGridMaskColumn;
dxDBGrid1Column14: TdxDBGridDateColumn;
dxDBGrid1Column18: TdxDBGridColumn;
dxDBGrid1Column19: TdxDBGridColumn;
dxDBGrid1Column20: TdxDBGridColumn;
t_ch_fee_balance1: TDataSource;
t_ch_fee_balance: TADOQuery;
PopupMenu3: TPopupMenu;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
MenuItem6: TMenuItem;
MenuItem7: TMenuItem;
dxDBGrid7Column73: TdxDBGridColumn;
dxDBGrid1Column21: TdxDBGridColumn;
dxDBGrid1Column22: TdxDBGridColumn;
dxDBGrid7Column74: TdxDBGridColumn;
dxDBGrid6Column7: TdxDBGridColumn;
mem_total_clientField3: TStringField;
memtblrpt_totalField49: TStringField;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Panel1Resize(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure dxDBGrid5DblClick(Sender: TObject);
procedure dxDBGrid6DblClick(Sender: TObject);
procedure dxDBGrid7DblClick(Sender: TObject);
procedure dxDBGrid8DblClick(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure bsSkinCheckRadioBox3Click(Sender: TObject);
procedure bsSkinCheckRadioBox2Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure dxDBGrid7Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure MenuItem3Click(Sender: TObject);
procedure MenuItem5Click(Sender: TObject);
procedure MenuItem7Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
procedure do_1(str_bill:widestring);
procedure GetNoFee;
procedure Creatememtbl;
function GetZhangQi(SaleID,Cust:String):String;
function isChaoQi(SaleID,Cust:String):Boolean;
function GetZhangQiNum(SaleID,Cust:String;aetd:TDateTime;out zqstr:string):Double;
function GetZhangQiStr(SaleID,Cust:String):String;
function GetBetwMonth(aBe, aEe: TDate): Integer;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_drstl_self: Tfrm_rp_drstl_self;
FmDate,ToDate,zhangdate:String;
sqlstr:WideString;
implementation
uses u_main, u_rp_no_seae_query,my_sys_function, u_rp_total_query,
u_rp_no_total, u_sys_progress, u_code_skjlset, u_data_share;
{$R *.dfm}
function Tfrm_rp_drstl_self.GetBetwMonth(aBe, aEe: TDate): Integer;
var
bYear,bMonth,bDate,eYear,eMonth,eDate:Word;
begin
DecodeDate(aBe,bYear,bMonth,bDate);
DecodeDate(aEe,eYear,eMonth,eDate);
if bYear=eYear then
Result:=Abs(bMonth-eMonth)
else begin
if bYear>eYear then begin
Result:=bMonth+(12-eMonth);
end else begin
Result:=eMonth+(12-bMonth);
end;
end;
end;
function Tfrm_rp_drstl_self.GetZhangQi(SaleID,Cust:String):String;
var
aQuery:TADOQuery;
S,sub:String;
begin
if (FmDate='') then begin
FmDate:='2006-01-01';
end;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
// SQL.Add('Select * from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><='''+FmDate+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+ToDate+''' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
SQL.Add('Select * from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'''+FmDate+''' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
Open;
if not IsEmpty then begin
first;
S:='';
while not eof do begin
// S:=S+'<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>:'+FormatDateTime('YYYY-MM-DD',FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime)+',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+FormatDateTime('YYYY-MM-DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>' then begin
S:=S+'<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>;';
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
S:=S+'Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,['+fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+']<5D><>';
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC>ʱ<EFBFBD><CAB1>' then begin
if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=0 then
sub:='<27><><EFBFBD><EFBFBD>'
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=1 then
sub:='<27><>1<EFBFBD><31>'
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=2 then
sub:='<27><>2<EFBFBD><32>'
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=3 then
sub:='<27><>3<EFBFBD><33>'
else
sub:='<27><>'+inttostr(StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0))+'<27><>';
if FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString='<27>̶<EFBFBD>' then
S:=sub+FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><>'
else
S:=sub;
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ׶θ<D7B6><CEB8><EFBFBD>' then begin
S:=S+'<27>ֽ׶θ<D7B6><CEB8><EFBFBD>;';
end;
Next;
end;
result:=S;
end else begin
Result:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_rp_drstl_self.do_1(str_bill:widestring);
begin
end;
procedure Tfrm_rp_drstl_self.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_drstl_self.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption+'1');
savereggrid(dxdbgrid7,caption+'7');
frm_rp_drstl_self.Hide;
frm_rp_drstl_self.ManualFloat(frm_rp_drstl_self.BoundsRect );
frm_main.freeTabs('frm_rp_drstl_self');
action:=cafree;
frm_rp_drstl_self:=nil;
end;
procedure Tfrm_rp_drstl_self.Panel1Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.Width/7);
bsSkinButton10.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton1.Width:=i;
end;
procedure Tfrm_rp_drstl_self.bsSkinButton10Click(Sender: TObject);
var
zdate:Tdate;
num:double;
j,btdays:integer;
zqstr,sdate:string;
function getstlDate(Cust,SaleID:String;aetdDate:TDatetime):TDateTime;
var
aQuery2:TADOQuery;
aYear,aMonth,aDay,bDay:word;
aStlDate:TDateTime;
begin
aQuery2:=CreateAdoQuery;
aStlDate:=aetdDate;
try
with aQuery2 do begin
Close;SQL.Clear;
SQL.Add('Select * from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><='''+FormatDateTime('YYYY-MM-DD',aStlDate)+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+FormatDateTime('YYYY-MM-DD',aStlDate)+''' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
Open;
if not IsEmpty then begin
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>' then begin
Result:=aStlDate;
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
result:=aStlDate+fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger;
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC>ʱ<EFBFBD><CAB1>' then begin
if FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString='<27>̶<EFBFBD>' then begin
DecodeDate(IncMonth(aStlDate,StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)),aYear,aMonth,aDay);
bDay:=DaysInMonth(EncodeDate(aYear,aMonth,1));
if fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger>bDay then
result:=EncodeDate(aYear,aMonth,bDay)
else
if fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger>0 then
result:=EncodeDate(aYear,aMonth,fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger)
else
result:=EncodeDate(aYear,aMonth,1);
end else
result:=IncMonth(aStlDate,StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0));
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ׶θ<D7B6><CEB8><EFBFBD>' then begin
DecodeDate(IncMonth(aStlDate,StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)),aYear,aMonth,aDay);
if aDay>fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger then begin
bDay:=DaysInMonth(EncodeDate(aYear,aMonth,1));
if fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2').AsInteger>bDay then
result:=EncodeDate(aYear,aMonth,bDay)
else
if fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2').AsInteger>0 then
result:=EncodeDate(aYear,aMonth,fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2').AsInteger)
else
result:=EncodeDate(aYear,aMonth,1)
end else begin
bDay:=DaysInMonth(EncodeDate(aYear,aMonth,1));
if fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger>bDay then
result:=EncodeDate(aYear,aMonth,bDay)
else
if fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger>0 then
result:=EncodeDate(aYear,aMonth,fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger)
else
result:=EncodeDate(aYear,aMonth,1);
end;
end else begin
Result:=aStlDate;
end;
end else begin
Result:=aStlDate;
end;
end;
finally
FreeAndNil(aQuery2);
end;
end;
begin
if (wwDBLookupCombo49.Text='') then begin
ShowMessage('<27><>ѡ<EFBFBD><D1A1>ͳ<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
if (bsSkinComboBox1.Text='ʵ<>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
sdate:='Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
else sdate:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
try
frm_rp_total_query:=tfrm_rp_total_query.Create (self);
rp_seae_query_num:=5;
rp_seae_query_type:=5;
rp_seae_query_limited:='0033';
rp_seae_query_str:='<27>ҵ<EFBFBD><D2B5>տ<EFBFBD>';
frm_rp_total_query.ShowModal;
finally
frm_rp_total_query.Free;
end;
if not p_accept_bill.Active then Exit;
if p_accept_bill.IsEmpty then Exit;
zdate:=date;
{
if zhangdate='' then
zdate:=date
else
zdate:=StrToDateDef(zhangdate,date);
}
memtblrpt_total.DisableControls;
memtblrpt_total.LoadFromDataSet(p_accept_bill,[mtcpostructure,mtcpoProperties,mtcpoFieldIndex]);
// p_accept_bill.Close;
{
memtblrpt_total.open;
p_accept_bill.First;
while not p_accept_bill.eof do begin
if (p_accept_bill.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat=0.00) or p_accept_bill.FieldByName('Ӧ<>պϼ<D5BA>').IsNull then
else begin
memtblrpt_total.insert;
for j:=0 to p_accept_bill.FieldCount-1 do begin
if memtblrpt_total.FindField(p_accept_bill.Fields[j].FieldName)<>nil then begin
memtblrpt_total.FieldByName(p_accept_bill.Fields[j].FieldName).Value:=p_accept_bill.Fields[j].Value;
end;
end;
memtblrpt_total.post;
end;
p_accept_bill.next;
end;
}
// memtblrpt_total.SortOn('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]);
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
{
memtblrpt_total.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB>ϼ<EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27>·ݺϼ<DDBA>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
}
memtblrpt_total.First;
mem_client.Close;
mem_client.EmptyTable;
mem_client.Open;
mem_clientsum.Close;
mem_clientsum.EmptyTable;
mem_clientsum.Open;
mem_clientmonth.Close;
mem_clientmonth.EmptyTable;
mem_clientmonth.Open;
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=memtblrpt_total.RecordCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
memtblrpt_total.First;
while not memtblrpt_total.eof do begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
btdays:=DaysBetween(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>').AsDateTime,memtblrpt_total.FieldByName(sdate).AsDateTime);
memtblrpt_total.Edit;
memtblrpt_total.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=btdays;
// if memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>').AsDateTime>=memtblrpt_total.FieldByName(sdate).AsDateTime then
// else btdays
if (btdays>frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>1').AsInteger) and (btdays<=frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1').AsInteger) then begin
memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>1').AsString;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1').AsString+'%';
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat*frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1').AsFloat/100;
end;
if (btdays>frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>2').AsInteger) and (btdays<=frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2').AsInteger) then begin
memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>2').AsString;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2').AsString+'%';
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat*frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2').AsFloat/100;
end;
if (btdays>frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>3').AsInteger) and (btdays<=frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3').AsInteger) then begin
memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>3').AsString;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3').AsString+'%';
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat*frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3').AsFloat/100;
end;
if (btdays>frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>4').AsInteger) and (btdays<=frm_data_share.t_sys_skjlset.FieldByName('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4').AsInteger) then begin
memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>4').AsString;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4').AsString+'%';
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat*frm_data_share.t_sys_skjlset.fieldbyname('<27><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4').AsFloat/100;
end;
memtblrpt_total.Post;
// ShowMessage(memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString);
{
if memtblrpt_total.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime<=zDate then begin
memtblrpt_total.Edit;
memtblrpt_total.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=1;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=MonthsBetween(zdate,memtblrpt_total.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=DaysBetween(ZDate,memtblrpt_total.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDatetime);
memtblrpt_total.Post;
end else begin
if mem_client.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',VarArrayOf([memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring,memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsStRING]),[]) then begin
if mem_client.FieldByName('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>').AsFloat<=0 then begin
memtblrpt_total.Edit;
memtblrpt_total.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=0;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=0;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=0;
memtblrpt_total.Post;
end else if mem_client.FieldByName('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>').AsFloat=-1 then begin
end else begin
if (mem_client.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat)>mem_client.FieldByName('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>').AsFloat then begin
memtblrpt_total.Edit;
memtblrpt_total.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=1;
memtblrpt_total.Post;
end else begin
mem_client.Edit;
mem_client.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat:=mem_client.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_client.FieldByName('δ<><CEB4>USD').AsFloat:=mem_client.FieldByName('δ<><CEB4>USD').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4>USD').AsFloat;
mem_client.FieldByName('δ<><CEB4>RMB').AsFloat:=mem_client.FieldByName('δ<><CEB4>RMB').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4>RMB').AsFloat;
mem_client.FieldByName('δ<>պϼ<D5BA>').AsFloat:=mem_client.FieldByName('δ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('δ<>պϼ<D5BA>').AsFloat;
mem_client.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_client.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_client.Post;
end;
end;
end else begin
mem_client.Insert;
mem_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_client.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_client.FieldByName('δ<><CEB4>USD').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4>USD').AsFloat;
mem_client.FieldByName('δ<><CEB4>RMB').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4>RMB').AsFloat;
mem_client.FieldByName('δ<>պϼ<D5BA>').AsFloat:=memtblrpt_total.FieldByName('δ<>պϼ<D5BA>').AsFloat;
mem_client.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
num:=GetZhangQiNum(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,zqstr);
mem_client.FieldByName('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>').AsFloat:=num;
mem_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=zqstr;
mem_client.Post;
if mem_client.FieldByName('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>').AsFloat<=0 then begin
memtblrpt_total.Edit;
memtblrpt_total.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=0;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=0;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=0;
memtblrpt_total.Post;
end else
if mem_client.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat>mem_client.FieldByName('<27><><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>').AsFloat then begin
memtblrpt_total.Edit;
memtblrpt_total.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=1;
memtblrpt_total.Post;
end;
end;
end;
if mem_clientmonth.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B>·<EFBFBD>',VarArrayOf([memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring,memtblrpt_total.FieldByName('<27>·<EFBFBD>').AsStRING]),[]) then begin
mem_clientmonth.Edit;
mem_clientmonth.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat:=mem_clientmonth.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.FieldByName('δ<><CEB4>USD').AsFloat:=mem_clientmonth.FieldByName('δ<><CEB4>USD').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4>USD').AsFloat;
mem_clientmonth.FieldByName('δ<><CEB4>RMB').AsFloat:=mem_clientmonth.FieldByName('δ<><CEB4>RMB').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4>RMB').AsFloat;
mem_clientmonth.FieldByName('δ<>պϼ<D5BA>').AsFloat:=mem_clientmonth.FieldByName('δ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('δ<>պϼ<D5BA>').AsFloat;
mem_clientmonth.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_clientmonth.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.FieldByName('Ӧ<><D3A6>USD').AsFloat:=mem_clientmonth.FieldByName('Ӧ<><D3A6>USD').AsFloat+memtblrpt_total.FieldByName('Ӧ<><D3A6>USD').AsFloat;
mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
mem_clientmonth.FieldByName('Ӧ<><D3A6>RMB').AsFloat:=mem_clientmonth.FieldByName('Ӧ<><D3A6>RMB').AsFloat+memtblrpt_total.FieldByName('Ӧ<><D3A6>RMB').AsFloat;
mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
mem_clientmonth.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat:=mem_clientmonth.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
mem_clientmonth.FieldByName('<27><><EFBFBD>պϼ<D5BA>').AsFloat:=mem_clientmonth.FieldByName('<27><><EFBFBD>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD>պϼ<D5BA>').AsFloat;
mem_clientmonth.FieldByName('Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_clientmonth.FieldByName('Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.FieldByName('<27>Ѹ<EFBFBD><D1B8>ϼ<EFBFBD>').AsFloat:=mem_clientmonth.FieldByName('<27>Ѹ<EFBFBD><D1B8>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('<27>Ѹ<EFBFBD><D1B8>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.Post;
end else begin
mem_clientmonth.Insert;
mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_clientmonth.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_clientmonth.FieldByName('<27>·<EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27>·<EFBFBD>').AsString;
mem_clientmonth.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.FieldByName('δ<><CEB4>USD').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4>USD').AsFloat;
mem_clientmonth.FieldByName('δ<><CEB4>RMB').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4>RMB').AsFloat;
mem_clientmonth.FieldByName('δ<>պϼ<D5BA>').AsFloat:=memtblrpt_total.FieldByName('δ<>պϼ<D5BA>').AsFloat;
mem_clientmonth.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.FieldByName('Ӧ<><D3A6>USD').AsFloat:=memtblrpt_total.FieldByName('Ӧ<><D3A6>USD').AsFloat;
mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
mem_clientmonth.FieldByName('Ӧ<><D3A6>RMB').AsFloat:=memtblrpt_total.FieldByName('Ӧ<><D3A6>RMB').AsFloat;
mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
mem_clientmonth.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat:=memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
mem_clientmonth.FieldByName('<27><><EFBFBD>պϼ<D5BA>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD>պϼ<D5BA>').AsFloat;
mem_clientmonth.FieldByName('Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.FieldByName('<27>Ѹ<EFBFBD><D1B8>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('<27>Ѹ<EFBFBD><D1B8>ϼ<EFBFBD>').AsFloat;
mem_clientmonth.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_clientmonth.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_clientmonth.Post;
end;
if mem_clientsum.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',VarArrayOf([memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring]),[]) then begin
mem_clientsum.Edit;
mem_clientsum.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat:=mem_clientsum.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientsum.FieldByName('δ<><CEB4>USD').AsFloat:=mem_clientsum.FieldByName('δ<><CEB4>USD').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4>USD').AsFloat;
mem_clientsum.FieldByName('δ<><CEB4>RMB').AsFloat:=mem_clientsum.FieldByName('δ<><CEB4>RMB').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4>RMB').AsFloat;
mem_clientsum.FieldByName('δ<>պϼ<D5BA>').AsFloat:=mem_clientsum.FieldByName('δ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('δ<>պϼ<D5BA>').AsFloat;
mem_clientsum.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_clientsum.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientsum.Post;
end else begin
// num:=GetZhangQiNum(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,zqstr);
mem_clientsum.Insert;
mem_clientsum.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_clientsum.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_clientsum.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=GetZhangQi(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,memtblrpt_total.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring);
mem_clientsum.FieldByName('Ƿ<>Ѻϼ<D1BA>').AsFloat:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientsum.FieldByName('δ<><CEB4>USD').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4>USD').AsFloat;
mem_clientsum.FieldByName('δ<><CEB4>RMB').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4>RMB').AsFloat;
mem_clientsum.FieldByName('δ<>պϼ<D5BA>').AsFloat:=memtblrpt_total.FieldByName('δ<>պϼ<D5BA>').AsFloat;
mem_clientsum.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat:=memtblrpt_total.FieldByName('δ<><CEB4><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_clientsum.Post;
end;
}
memtblrpt_total.Next;
end;
memtblrpt_total.EnableControls;
freeAndNil(frm_sys_progress);
GetNoFee;
// mem_clientmonth.SortOn('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>',[]);
end;
procedure Tfrm_rp_drstl_self.bsSkinButton1Click(Sender: TObject);
begin
with SaveDialog do
begin
DefaultExt :='xls';
Filter := '(*.xls)|*.xls';
if Execute then
begin
if tab1.Showing then
dxDBGrid2.SaveToXLS(FileName,true)
else if bsSkinTabSheet2.Showing then
dxDBGrid4.SaveToXLS(FileName,true)
else if tab3.Showing then
dxDBGrid6.SaveToXLS(FileName,true)
else if tab4.Showing then
dxDBGrid7.SaveToXLS(FileName,true)
else if bsSkinTabSheet5.Showing then
dxDBGrid1.SaveToXLS(FileName,true)
end;
end;
end;
procedure Tfrm_rp_drstl_self.bsSkinButton9Click(Sender: TObject);
begin
sys_print('ҵ<><D2B5><EFBFBD>ۺ<EFBFBD>Ƿ<EFBFBD><C7B7>',2,nil,nil,nil,nil,p_total_dept1,p_total_sales1,p_total_client1,memtblrpt_total1,p_total1,nil,nil);
end;
procedure Tfrm_rp_drstl_self.dxDBGrid5DblClick(Sender: TObject);
begin
fee_view(p_accept_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_rp_drstl_self.dxDBGrid6DblClick(Sender: TObject);
begin
// fee_view(p_accept_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_rp_drstl_self.dxDBGrid7DblClick(Sender: TObject);
begin
// fee_view(p_pay_bill.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_rp_drstl_self.dxDBGrid8DblClick(Sender: TObject);
begin
// fee_view(p_pay_fee.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring);
end;
procedure Tfrm_rp_drstl_self.bsSkinButton15Click(Sender: TObject);
var
str_bill:widestring;
begin
str_bill:='';
if trim(str_bill)='' then
begin
str_bill:='where '+open_data('0033','v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_bscard.<2E><><EFBFBD><EFBFBD>Ա','v_op_bscard.<2E>ͷ<EFBFBD>Ա','no','no');
end
else
begin
str_bill:=str_bill+' and '+open_data('0033','v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_bscard.<2E><><EFBFBD><EFBFBD>Ա','v_op_bscard.<2E>ͷ<EFBFBD>Ա','no','no');
end;
if str_bill='' then
str_bill:='where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
else
str_bill:=str_bill+' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ';
do_1(str_bill);
GetNoFee;
end;
procedure Tfrm_rp_drstl_self.GetNoFee;
var
aQuery,aQuery2:TAdoQuery;
sumbal:Double;
hvcg:Boolean;
aYear,aMonth,aDay,bDay:word;
sDate,S:string;
begin
aQuery:=CreateAdoQuery;
aQuery2:=CreateAdoQuery;
try
if memtblrpt_total.IsEmpty then exit;
// Creatememtbl;
mem_total_sales.Close;
mem_total_sales.EmptyTable;
mem_total_sales.Open;
mem_total_client.Close;
mem_total_client.EmptyTable;
mem_total_client.Open;
mem_total_dept.Close;
mem_total_dept.EmptyTable;
mem_total_dept.Open;
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(application);
frm_sys_progress.Show;
frm_sys_progress.bsSkinGauge1.MaxValue:=memtblrpt_total.RecordCount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
memtblrpt_total.First;
with memtblrpt_total do begin
while not eof do begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
if mem_total_sales.Locate('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>',VarArrayOf([memtblrpt_total.FieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asstring,memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsStRING,memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').asstring]),[]) then begin
mem_total_sales.Edit;
if (memtblrpt_total.FieldByName('ISADD').AsInteger=1) then
mem_total_sales.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=mem_total_sales.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat+memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
mem_total_sales.FieldByName('ʵ<>պϼ<D5BA>').AsFloat:=mem_total_sales.FieldByName('ʵ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
mem_total_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_total_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_total_sales.Post;
end else begin
mem_total_sales.Insert;
mem_total_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_total_sales.FieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString;
mem_total_sales.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString;
if (memtblrpt_total.FieldByName('ISADD').AsInteger=1) then
mem_total_sales.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=mem_total_sales.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat+memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
mem_total_sales.FieldByName('ʵ<>պϼ<D5BA>').AsFloat:=mem_total_sales.FieldByName('ʵ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
mem_total_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_total_sales.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_total_sales.Post;
end;
if mem_total_dept.Locate('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>;<3B>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>',VarArrayOf([memtblrpt_total.FieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').asstring,memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').asstring]),[]) then begin
mem_total_dept.Edit;
if (memtblrpt_total.FieldByName('ISADD').AsInteger=1) then
mem_total_dept.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=mem_total_dept.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat+memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
mem_total_dept.FieldByName('ʵ<>պϼ<D5BA>').AsFloat:=mem_total_dept.FieldByName('ʵ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
mem_total_dept.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_total_dept.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_total_dept.Post;
end else begin
mem_total_dept.Insert;
mem_total_dept.FieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>').AsString;
mem_total_dept.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString;
if (memtblrpt_total.FieldByName('ISADD').AsInteger=1) then
mem_total_dept.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=mem_total_dept.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat+memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
mem_total_dept.FieldByName('ʵ<>պϼ<D5BA>').AsFloat:=mem_total_dept.FieldByName('ʵ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
mem_total_dept.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_total_dept.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_total_dept.Post;
end;
if mem_total_client.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>',VarArrayOf([memtblrpt_total.FieldByName('ί<>е<EFBFBD>λ').asstring,memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsStRING,memtblrpt_total.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').asstring]),[]) then begin
mem_total_client.Edit;
mem_total_client.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=mem_total_client.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat+memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
if (memtblrpt_total.FieldByName('ISADD').AsInteger=1) then
mem_total_client.FieldByName('ʵ<>պϼ<D5BA>').AsFloat:=mem_total_client.FieldByName('ʵ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
mem_total_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_total_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_total_client.Post;
end else begin
mem_total_client.Insert;
mem_total_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mem_total_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('ί<>е<EFBFBD>λ').AsString;
mem_total_client.FieldByName('ί<>е<EFBFBD>λȫ<CEBB><C8AB>').AsString:=memtblrpt_total.FieldByName('ί<>е<EFBFBD>λȫ<CEBB><C8AB>').AsString;
if (memtblrpt_total.FieldByName('ISADD').AsInteger=1) then
mem_total_client.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=mem_total_client.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat+memtblrpt_total.FieldByName('Ӧ<>պϼ<D5BA>').AsFloat;
mem_total_client.FieldByName('ʵ<>պϼ<D5BA>').AsFloat:=mem_total_client.FieldByName('ʵ<>պϼ<D5BA>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
mem_total_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat:=mem_total_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat+memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>').AsFloat;
mem_total_client.Post;
end;
next;
end;
end;
dxDBGrid2.FullExpand;
dxDBGrid4.FullExpand;
dxDBGrid6.FullExpand;
dxDBGrid7.FullExpand;
// memtblDetail.SortOn('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',[mtcoDescending]);
finally
freeAndNil(aQuery);
freeAndNil(aQuery2);
freeAndNil(frm_sys_progress);
end;
end;
procedure Tfrm_rp_drstl_self.Creatememtbl;
var
aDate,aToDate:TDate;
sDate,aYear,aMonth:String;
aColumn:TdxDBTreeListColumn;
aBand:TdxTreeListBand;
i:integer;
begin
if (fmDate='') or (ToDate='') then exit;
end;
function Tfrm_rp_drstl_self.GetZhangQiNum(SaleID, Cust: String;
aetd: TDateTime;out zqstr:string): Double;
var
aQuery:TAdoQuery;
sub:string;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select * from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><='''+FormatDateTime('YYYY-MM-DD',aetd)+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='''+FormatDateTime('YYYY-MM-DD',aetd)+''' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
Open;
if not IsEmpty then begin
if FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').IsNull or (FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').AsFloat<=0) then begin
Result:=0;
end else begin
Result:=FieldByName('<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>').AsFloat;
end;
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>' then begin
zqstr:=zqstr+'<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>;';
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
zqstr:=zqstr+'Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,['+fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+']<5D><>';
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='Լ<><D4BC>ʱ<EFBFBD><CAB1>' then begin
if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=0 then
sub:='<27><><EFBFBD><EFBFBD>'
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=1 then
sub:='<27><>1<EFBFBD><31>'
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=2 then
sub:='<27><>2<EFBFBD><32>'
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=3 then
sub:='<27><>3<EFBFBD><33>'
else
sub:='<27><>'+inttostr(StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0))+'<27><>';
if FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString='<27>̶<EFBFBD>' then
zqstr:=sub+FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'<27><>'
else
zqstr:=sub;
end else if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ׶θ<D7B6><CEB8><EFBFBD>' then begin
zqstr:=zqstr+'<27>ֽ׶θ<D7B6><CEB8><EFBFBD>;';
end;
end else begin
Result:=-1;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
function Tfrm_rp_drstl_self.isChaoQi(SaleID, Cust: String): Boolean;
begin
end;
procedure Tfrm_rp_drstl_self.bsSkinCheckRadioBox3Click(Sender: TObject);
begin
GetNoFee;
end;
procedure Tfrm_rp_drstl_self.bsSkinCheckRadioBox2Click(Sender: TObject);
begin
GetNoFee;
end;
function Tfrm_rp_drstl_self.GetZhangQiStr(SaleID, Cust: String): String;
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
Result:='';
try
with aQuery do begin
Close;SQL.Clear;
sql.Add(' select distinct SUBSTRING(CONVERT(char(15), dbo.v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 111), 1, 7) from v_op_bscard left join t_ch_fee on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD> ');
sql.Add(sqlstr);
sql.Add(' and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+Cust+''' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+SaleID+'''');
Open;
if not IsEmpty then begin
first;
while not eof do begin
if Result='' then
result:=Fields[0].value
else
Result:=Result+','+Fields[0].value;
Next;
end;
Result:=Result+'<27><>Ƿ<EFBFBD><C7B7>'
end else
result:='';
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_rp_drstl_self.bsSkinButton12Click(Sender: TObject);
begin
if bsSkinButton12.Caption='չ<><D5B9>' then
begin
dxdbgrid2.FullExpand;
dxdbgrid4.FullExpand;
dxdbgrid6.FullExpand;
dxdbgrid7.FullExpand;
bsSkinButton12.Caption:='<27>ϲ<EFBFBD>';
end
else
begin
dxdbgrid2.FullCollapse;
dxdbgrid4.FullCollapse;
dxdbgrid6.FullCollapse;
dxdbgrid7.FullCollapse;
bsSkinButton12.Caption:='չ<><D5B9>';
end;
end;
procedure Tfrm_rp_drstl_self.N10Click(Sender: TObject);
begin
update_grid_view_no(dxDBGrid7);
exit;
end;
procedure Tfrm_rp_drstl_self.N14Click(Sender: TObject);
begin
update_grid_view_all(dxdbgrid7);
exit;
end;
procedure Tfrm_rp_drstl_self.N12Click(Sender: TObject);
begin
update_grid(dxdbgrid7,220);
exit;
end;
procedure Tfrm_rp_drstl_self.N16Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid7);
exit;
end;
procedure Tfrm_rp_drstl_self.bsSkinButton2Click(Sender: TObject);
begin
try
frm_code_skjlset:=Tfrm_code_skjlset.Create (self);
frm_code_skjlset.ShowModal;
finally
frm_code_skjlset.Free;
end;
end;
procedure Tfrm_rp_drstl_self.dxDBGrid7Click(Sender: TObject);
begin
t_ch_fee_balance.Close;
t_ch_fee_balance.Parameters.ParamByName('BSNO').Value:=memtblrpt_total.FIELDBYNAME('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_fee_balance.Open;
end;
procedure Tfrm_rp_drstl_self.MenuItem1Click(Sender: TObject);
begin
update_grid_view_no(dxDBGrid1);
exit;
end;
procedure Tfrm_rp_drstl_self.MenuItem3Click(Sender: TObject);
begin
update_grid_view_all(dxdbgrid1);
exit;
end;
procedure Tfrm_rp_drstl_self.MenuItem5Click(Sender: TObject);
begin
update_grid(dxdbgrid1,221);
exit;
end;
procedure Tfrm_rp_drstl_self.MenuItem7Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
exit;
end;
procedure Tfrm_rp_drstl_self.FormShow(Sender: TObject);
begin
loadreggrid(dxdbgrid1,false,caption+'1');
loadreggrid(dxdbgrid7,false,caption+'7');
dxdbgrid1.ShowSummaryFooter:=true;
end;
end.