|
|
unit u_rp_sales_profit;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, dxExEdtr, RxMemDS, DB, ADODB, Menus, XPMenu, bsSkinCtrls,
|
|
|
dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, ComCtrls,DateUtils,
|
|
|
bsSkinTabs, ExtCtrls, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb,
|
|
|
kbmMemTable, kbmMemBinaryStreamFormat, wwdbdatetimepicker, RxLookup;
|
|
|
|
|
|
type
|
|
|
Tfrm_rp_sales_profit = class(TForm)
|
|
|
Panel1: TPanel;
|
|
|
bsSkinPageControl1: TbsSkinPageControl;
|
|
|
bsSkinTabSheet1: TbsSkinTabSheet;
|
|
|
bsSkinTabSheet4: TbsSkinTabSheet;
|
|
|
bsSkinTabSheet6: TbsSkinTabSheet;
|
|
|
bsSkinPageControl2: TbsSkinPageControl;
|
|
|
bsSkinTabSheet11: TbsSkinTabSheet;
|
|
|
bsSkinTabSheet13: TbsSkinTabSheet;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column5: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column3: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column4: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column6: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column7: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column8: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column9: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column10: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column11: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column24: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column25: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column26: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column31: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column54: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column55: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column56: TdxDBGridColumn;
|
|
|
dxDBGrid1Column57: TdxDBGridColumn;
|
|
|
dxDBGrid11: TdxDBGridMaskColumn;
|
|
|
dxDBGrid12: TdxDBGridMaskColumn;
|
|
|
dxDBGrid13: TdxDBGridMaskColumn;
|
|
|
dxDBGrid14: TdxDBGridMaskColumn;
|
|
|
dxDBGrid15: TdxDBGridMaskColumn;
|
|
|
dxDBGrid16: TdxDBGridMaskColumn;
|
|
|
dxDBGrid17: TdxDBGridMaskColumn;
|
|
|
dxDBGrid18: TdxDBGridMaskColumn;
|
|
|
dxDBGrid19: TdxDBGridMaskColumn;
|
|
|
dxDBGrid110: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column80: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1TEU: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column82: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column83: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column84: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column89: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column90: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column92: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column85: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column87: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column86: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1USD: TdxDBGridColumn;
|
|
|
dxDBGrid1RMB: TdxDBGridColumn;
|
|
|
dxDBGrid1Column102: TdxDBGridColumn;
|
|
|
dxDBGrid1Column105: TdxDBGridColumn;
|
|
|
dxDBGrid1Column108: TdxDBGridColumn;
|
|
|
dxDBGrid1Column111: TdxDBGridColumn;
|
|
|
dxDBGrid1Column114: TdxDBGridColumn;
|
|
|
dxDBGrid1Column115: TdxDBGridColumn;
|
|
|
dxDBGrid1Column116: TdxDBGridColumn;
|
|
|
dxDBGrid1Column117: TdxDBGridMaskColumn;
|
|
|
dxDBGrid7: TdxDBGrid;
|
|
|
dxDBGridMaskColumn93: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column68: TdxDBGridColumn;
|
|
|
dxDBGrid1Column69: TdxDBGridColumn;
|
|
|
PopupMenu2: TPopupMenu;
|
|
|
N10: TMenuItem;
|
|
|
N11: TMenuItem;
|
|
|
N14: TMenuItem;
|
|
|
N13: TMenuItem;
|
|
|
N12: TMenuItem;
|
|
|
N15: TMenuItem;
|
|
|
N16: TMenuItem;
|
|
|
XPMenu2: TXPMenu;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
dxDBGrid3: TdxDBGrid;
|
|
|
dxDBGridMaskColumn39: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn42: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn47: TdxDBGridMaskColumn;
|
|
|
dxDBGridDateColumn7: TdxDBGridDateColumn;
|
|
|
dxDBGridMaskColumn75: TdxDBGridMaskColumn;
|
|
|
t_salepriftset: TADOQuery;
|
|
|
ds1: TDataSource;
|
|
|
kbmThreadDataSet1: TkbmThreadDataSet;
|
|
|
kbmBinaryStreamFormat1: TkbmBinaryStreamFormat;
|
|
|
memtblrpt_total: TkbmMemTable;
|
|
|
Label2: TLabel;
|
|
|
wwDBComboBox20: TwwDBComboBox;
|
|
|
Label3: TLabel;
|
|
|
wwDBComboBox1: TwwDBComboBox;
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
Label14: TLabel;
|
|
|
kbmMemTable1: TkbmMemTable;
|
|
|
kbmMemTable2: TkbmMemTable;
|
|
|
P_SUM: TkbmMemTable;
|
|
|
DataSource1: TDataSource;
|
|
|
DataSource2: TDataSource;
|
|
|
DataSource3: TDataSource;
|
|
|
DataSource4: TDataSource;
|
|
|
dxDBGrid1Column51: TdxDBGridColumn;
|
|
|
dxDBGrid1Column52: TdxDBGridColumn;
|
|
|
dxDBGrid1Column53: TdxDBGridColumn;
|
|
|
dxDBGrid1Column58: TdxDBGridColumn;
|
|
|
dxDBGrid1Column59: TdxDBGridColumn;
|
|
|
dxDBGrid1Column60: TdxDBGridColumn;
|
|
|
dxDBGrid1Column61: TdxDBGridColumn;
|
|
|
dxDBGrid3Column57: TdxDBGridColumn;
|
|
|
dxDBGrid7Column12: TdxDBGridColumn;
|
|
|
dxDBGrid7Column13: TdxDBGridColumn;
|
|
|
dxDBGrid7Column14: TdxDBGridColumn;
|
|
|
dxDBGrid7Column15: TdxDBGridColumn;
|
|
|
dxDBGrid7Column16: TdxDBGridColumn;
|
|
|
dxDBGrid7Column17: TdxDBGridColumn;
|
|
|
dxDBGrid7Column18: TdxDBGridColumn;
|
|
|
dxDBGrid7Column19: TdxDBGridColumn;
|
|
|
dxDBGrid7Column20: TdxDBGridColumn;
|
|
|
dxDBGrid1Column62: TdxDBGridColumn;
|
|
|
dxDBGrid9: TdxDBGrid;
|
|
|
dxDBGridMaskColumn77: TdxDBGridMaskColumn;
|
|
|
dxDBGridColumn27: TdxDBGridColumn;
|
|
|
dxDBGridColumn28: TdxDBGridColumn;
|
|
|
dxDBGridColumn29: TdxDBGridColumn;
|
|
|
dxDBGridColumn30: TdxDBGridColumn;
|
|
|
dxDBGridColumn31: TdxDBGridColumn;
|
|
|
dxDBGridColumn32: TdxDBGridColumn;
|
|
|
dxDBGridColumn33: TdxDBGridColumn;
|
|
|
dxDBGridColumn34: TdxDBGridColumn;
|
|
|
dxDBGridColumn35: TdxDBGridColumn;
|
|
|
dxDBGridColumn36: TdxDBGridColumn;
|
|
|
dxDBGridColumn37: TdxDBGridColumn;
|
|
|
dxDBGridColumn38: TdxDBGridColumn;
|
|
|
dxDBGridColumn39: TdxDBGridColumn;
|
|
|
dxDBGridColumn40: TdxDBGridColumn;
|
|
|
dxDBGridColumn41: TdxDBGridColumn;
|
|
|
dxDBGridColumn42: TdxDBGridColumn;
|
|
|
dxDBGridColumn43: TdxDBGridColumn;
|
|
|
dxDBGridColumn44: TdxDBGridColumn;
|
|
|
dxDBGridColumn45: TdxDBGridColumn;
|
|
|
dxDBGridColumn56: TdxDBGridColumn;
|
|
|
bskntbsht1: TbsSkinTabSheet;
|
|
|
dxDBGrid4: TdxDBGrid;
|
|
|
dxDBGridMaskColumn78: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn79: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn80: TdxDBGridMaskColumn;
|
|
|
dxDBGridDateColumn11: TdxDBGridDateColumn;
|
|
|
dxDBGridMaskColumn81: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn82: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn83: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn84: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn85: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn86: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn87: TdxDBGridMaskColumn;
|
|
|
dxDBGridDateColumn12: TdxDBGridDateColumn;
|
|
|
dxDBGridDateColumn13: TdxDBGridDateColumn;
|
|
|
dxDBGridDateColumn14: TdxDBGridDateColumn;
|
|
|
dxDBGridMaskColumn88: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn89: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn90: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn91: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn92: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn94: TdxDBGridMaskColumn;
|
|
|
dxDBGridColumn57: TdxDBGridColumn;
|
|
|
dxDBGridColumn58: TdxDBGridColumn;
|
|
|
dxDBGridMaskColumn95: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn96: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn97: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn98: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn99: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn100: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn101: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn102: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn103: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn104: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn105: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn106: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn107: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn108: TdxDBGridMaskColumn;
|
|
|
dxDBGridDateColumn15: TdxDBGridDateColumn;
|
|
|
dxDBGridMaskColumn109: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn110: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn111: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn112: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn113: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn114: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn115: TdxDBGridMaskColumn;
|
|
|
dxDBGridColumn59: TdxDBGridColumn;
|
|
|
dxDBGridColumn60: TdxDBGridColumn;
|
|
|
dxDBGridColumn61: TdxDBGridColumn;
|
|
|
dxDBGridColumn62: TdxDBGridColumn;
|
|
|
dxDBGridColumn63: TdxDBGridColumn;
|
|
|
dxDBGridColumn64: TdxDBGridColumn;
|
|
|
dxDBGridColumn65: TdxDBGridColumn;
|
|
|
dxDBGridColumn66: TdxDBGridColumn;
|
|
|
dxDBGridColumn67: TdxDBGridColumn;
|
|
|
dxDBGridMaskColumn116: TdxDBGridMaskColumn;
|
|
|
dxDBGridColumn68: TdxDBGridColumn;
|
|
|
dxDBGridColumn69: TdxDBGridColumn;
|
|
|
dxDBGridColumn70: TdxDBGridColumn;
|
|
|
dxDBGridColumn71: TdxDBGridColumn;
|
|
|
kbmMemTable4: TkbmMemTable;
|
|
|
DataSource5: TDataSource;
|
|
|
dxDBGrid7Column22: TdxDBGridColumn;
|
|
|
dxDBGrid7Column23: TdxDBGridColumn;
|
|
|
P_SUMField: TStringField;
|
|
|
P_SUMField2: TFloatField;
|
|
|
P_SUMField3: TFloatField;
|
|
|
P_SUMField4: TFloatField;
|
|
|
P_SUMField5: TFloatField;
|
|
|
P_SUMField6: TFloatField;
|
|
|
P_SUMField7: TFloatField;
|
|
|
P_SUMField8: TFloatField;
|
|
|
P_SUMField9: TFloatField;
|
|
|
P_SUMField10: TFloatField;
|
|
|
P_SUMField11: TFloatField;
|
|
|
P_SUMField12: TFloatField;
|
|
|
P_SUMField13: TFloatField;
|
|
|
P_SUMField14: TFloatField;
|
|
|
P_SUMField15: TFloatField;
|
|
|
P_SUMField16: TFloatField;
|
|
|
pnl1: TPanel;
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
Label9: TLabel;
|
|
|
Label22: TLabel;
|
|
|
RxDBLookupCombo10: TRxDBLookupCombo;
|
|
|
bskntbsht2: TbsSkinTabSheet;
|
|
|
bsSkinPageControl3: TbsSkinPageControl;
|
|
|
bskntbshtpg1: TbsSkinTabSheet;
|
|
|
bskntbsht3: TbsSkinTabSheet;
|
|
|
dxDBGrid2: TdxDBGrid;
|
|
|
dxDBGridMaskColumn32: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn33: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn34: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn35: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn36: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn37: TdxDBGridMaskColumn;
|
|
|
dxDBGridColumn10: TdxDBGridColumn;
|
|
|
dxDBGridColumn11: TdxDBGridColumn;
|
|
|
dxDBGridColumn47: TdxDBGridColumn;
|
|
|
memtblDetail: TkbmMemTable;
|
|
|
StringField1: TStringField;
|
|
|
FloatField1: TFloatField;
|
|
|
FloatField2: TFloatField;
|
|
|
FloatField3: TFloatField;
|
|
|
FloatField4: TFloatField;
|
|
|
FloatField5: TFloatField;
|
|
|
FloatField7: TFloatField;
|
|
|
FloatField8: TFloatField;
|
|
|
FloatField15: TFloatField;
|
|
|
memtblDetailField: TStringField;
|
|
|
memtblDetailField2: TDateTimeField;
|
|
|
memtblDetailField3: TStringField;
|
|
|
memtblDetailField4: TStringField;
|
|
|
memtblDetailField5: TDateTimeField;
|
|
|
memtblDetailField6: TStringField;
|
|
|
memtblDetailField7: TFloatField;
|
|
|
memtblLX: TkbmMemTable;
|
|
|
StringField2: TStringField;
|
|
|
StringField3: TStringField;
|
|
|
DateTimeField1: TDateTimeField;
|
|
|
DateTimeField2: TDateTimeField;
|
|
|
StringField6: TStringField;
|
|
|
FloatField10: TFloatField;
|
|
|
FloatField11: TFloatField;
|
|
|
FloatField19: TFloatField;
|
|
|
memtblLXField: TIntegerField;
|
|
|
memtblLXField2: TFloatField;
|
|
|
memtblDetailField8: TStringField;
|
|
|
memtblDetailField9: TStringField;
|
|
|
memtblLXField3: TStringField;
|
|
|
memtblLXField4: TStringField;
|
|
|
DataSource6: TDataSource;
|
|
|
DataSource7: TDataSource;
|
|
|
dxDBGrid2Column11: TdxDBGridColumn;
|
|
|
dxDBGrid2Column12: TdxDBGridColumn;
|
|
|
dxDBGrid2Column13: TdxDBGridColumn;
|
|
|
dxDBGrid2Column14: TdxDBGridColumn;
|
|
|
dxDBGrid2Column15: TdxDBGridColumn;
|
|
|
dxDBGrid2Column16: TdxDBGridColumn;
|
|
|
dxDBGrid2Column17: TdxDBGridColumn;
|
|
|
dxDBGrid5: TdxDBGrid;
|
|
|
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
|
|
|
dxDBGridMaskColumn3: TdxDBGridMaskColumn;
|
|
|
dxDBGridColumn1: TdxDBGridColumn;
|
|
|
dxDBGridColumn2: TdxDBGridColumn;
|
|
|
dxDBGridColumn3: TdxDBGridColumn;
|
|
|
dxDBGridColumn5: TdxDBGridColumn;
|
|
|
dxDBGridColumn6: TdxDBGridColumn;
|
|
|
dxDBGridColumn8: TdxDBGridColumn;
|
|
|
memtblDetailField10: TStringField;
|
|
|
memtblDetailField11: TStringField;
|
|
|
memtblDetailField12: TDateTimeField;
|
|
|
memtblDetailField13: TDateTimeField;
|
|
|
memtblLXField5: TFloatField;
|
|
|
P_SUMField17: TFloatField;
|
|
|
dxDBGrid2Column18: TdxDBGridColumn;
|
|
|
dxDBGrid2Column19: TdxDBGridColumn;
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
P_SUMField18: TFloatField;
|
|
|
dxDBGrid7Column21: TdxDBGridColumn;
|
|
|
dxDBGrid3Column7: TdxDBGridColumn;
|
|
|
dxDBGrid3Column8: TdxDBGridColumn;
|
|
|
dxDBGrid3Column9: TdxDBGridColumn;
|
|
|
dxDBGrid3Column10: TdxDBGridColumn;
|
|
|
dxDBGrid3Column11: TdxDBGridColumn;
|
|
|
dxDBGrid3Column12: TdxDBGridColumn;
|
|
|
dxDBGrid3Column13: TdxDBGridColumn;
|
|
|
dxDBGrid3Column14: TdxDBGridColumn;
|
|
|
dxDBGrid3Column15: TdxDBGridColumn;
|
|
|
kbmMemTable2Field: TStringField;
|
|
|
kbmMemTable2Field2: TStringField;
|
|
|
kbmMemTable2Field3: TStringField;
|
|
|
kbmMemTable2Field4: TDateField;
|
|
|
kbmMemTable2Field5: TStringField;
|
|
|
kbmMemTable2USD: TFloatField;
|
|
|
kbmMemTable2RMB: TFloatField;
|
|
|
kbmMemTable2Field6: TFloatField;
|
|
|
kbmMemTable2USD2: TFloatField;
|
|
|
kbmMemTable2RMB2: TFloatField;
|
|
|
kbmMemTable2Field7: TFloatField;
|
|
|
kbmMemTable2USD3: TFloatField;
|
|
|
kbmMemTable2RMB3: TFloatField;
|
|
|
kbmMemTable2Field8: TFloatField;
|
|
|
kbmMemTable2Field9: TFloatField;
|
|
|
kbmMemTable2Field10: TStringField;
|
|
|
kbmMemTable2USD4: TFloatField;
|
|
|
kbmMemTable2RMB4: TFloatField;
|
|
|
kbmMemTable2Field11: TFloatField;
|
|
|
dxDBGrid3Column16: TdxDBGridColumn;
|
|
|
dxDBGrid3Column17: TdxDBGridColumn;
|
|
|
dxDBGrid3Column18: TdxDBGridColumn;
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
procedure N10Click(Sender: TObject);
|
|
|
procedure N14Click(Sender: TObject);
|
|
|
procedure N12Click(Sender: TObject);
|
|
|
procedure N16Click(Sender: TObject);
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
procedure kbmMemTable4AfterOpen(DataSet: TDataSet);
|
|
|
procedure kbmMemTable2AfterOpen(DataSet: TDataSet);
|
|
|
procedure P_SUMAfterOpen(DataSet: TDataSet);
|
|
|
procedure memtblrpt_totalAfterOpen(DataSet: TDataSet);
|
|
|
procedure kbmMemTable1AfterOpen(DataSet: TDataSet);
|
|
|
procedure memtblDetailAfterOpen(DataSet: TDataSet);
|
|
|
procedure memtblLXAfterOpen(DataSet: TDataSet);
|
|
|
procedure dxDBGridColumn70CustomDraw(Sender: TObject; ACanvas: TCanvas;
|
|
|
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
|
|
|
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
|
|
|
AFocused: Boolean; var ADone: Boolean);
|
|
|
private
|
|
|
procedure GetProfit;
|
|
|
procedure Getlx;
|
|
|
procedure Getcq;
|
|
|
procedure GetProfitSum;
|
|
|
function GetSALEprofit(SALE:string;aMonth:Integer;profit:Double;tuo:boolean):Double;
|
|
|
function GetBetwMonth(aBe,aEe:TDate):Integer;
|
|
|
function issameMonth(aBe,aEe:TDate):Boolean;
|
|
|
function gettotalprofit(sale:string):double;
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_rp_sales_profit: Tfrm_rp_sales_profit;
|
|
|
rp_rp_total_open:boolean;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, my_sys_function, u_rp_query, u_sys_progress,
|
|
|
u_data_share;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_sales_profit.GetSALEprofit(SALE:string;aMonth:Integer;profit:Double;tuo:boolean):Double;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
BL:Double;
|
|
|
begin
|
|
|
BL:=0.00;
|
|
|
if profit=0 then begin
|
|
|
result:=0.0;
|
|
|
exit;
|
|
|
end;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select * from t_crm_salesproftSet where <20><><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>='+inttostr(aMonth)+' and <20><><EFBFBD><EFBFBD>='''+wwDBComboBox20.Text+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=(select <20><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+SALE+''') Order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ASC');
|
|
|
Open;
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
if (Profit>FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat) and (Profit<=FieldByName('<27><><EFBFBD><EFBFBD>ֹ').AsFloat) then begin
|
|
|
if tuo then begin
|
|
|
BL:=FieldByName('<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat;
|
|
|
end else begin
|
|
|
if aMonth<>0 then
|
|
|
BL:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat
|
|
|
else
|
|
|
BL:=FieldByName('<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end;
|
|
|
Next;
|
|
|
end;
|
|
|
Result:=BL;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
savereggrid(dxdbgrid1,caption+'1');
|
|
|
savereggrid(dxdbgrid2,caption+'2');
|
|
|
savereggrid(dxdbgrid3,caption+'3');
|
|
|
savereggrid(dxdbgrid9,caption+'9');
|
|
|
frm_rp_sales_profit.Hide;
|
|
|
frm_rp_sales_profit.ManualFloat(frm_rp_sales_profit.BoundsRect );
|
|
|
frm_main.freeTabs('frm_rp_sales_profit');
|
|
|
action:=cafree;
|
|
|
frm_rp_sales_profit:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.FormShow(Sender: TObject);
|
|
|
var
|
|
|
bYear,bMonth,bDate:Word;
|
|
|
begin
|
|
|
DecodeDate(incmonth(Now,-5),bYear,bMonth,bDate);
|
|
|
wwDBComboBox20.Text:=IntToStr(bYear);
|
|
|
wwDBComboBox1.Text:=IntToStr(bMonth);
|
|
|
loadreggrid(dxdbgrid1,true,caption+'1');
|
|
|
loadreggrid(dxdbgrid2,true,caption+'2');
|
|
|
loadreggrid(dxdbgrid3,false,caption+'3');
|
|
|
loadreggrid(dxdbgrid4,false,caption+'4');
|
|
|
loadreggrid(dxdbgrid9,false,caption+'9');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.bsSkinButton9Click(Sender: TObject);
|
|
|
begin
|
|
|
sys_print('ҵ<><D2B5><EFBFBD>ۺ<EFBFBD>ͳ<EFBFBD><CDB3>',2,nil,nil,nil,DataSource4,DataSource6,DataSource7,DataSource3,nil,nil,nil,nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.N10Click(Sender: TObject);
|
|
|
begin
|
|
|
if bsSkinTabSheet1.Showing then begin
|
|
|
if bskntbsht2.Showing then
|
|
|
begin
|
|
|
if bskntbshtpg1.Showing then
|
|
|
begin
|
|
|
update_grid_view_no(dxdbgrid2);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht3.Showing then
|
|
|
begin
|
|
|
update_grid_view_no(dxdbgrid5);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinTabSheet11.Showing then
|
|
|
begin
|
|
|
update_grid_view_no(dxdbgrid1);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht1.Showing then
|
|
|
begin
|
|
|
update_grid_view_no(dxdbgrid4);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet13.Showing then
|
|
|
begin
|
|
|
update_grid_view_no(dxdbgrid3);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
if bsSkinTabSheet4.Showing then
|
|
|
begin
|
|
|
update_grid_view_no(dxdbgrid7);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.N14Click(Sender: TObject);
|
|
|
begin
|
|
|
|
|
|
if bsSkinTabSheet1.Showing then begin
|
|
|
if bskntbsht2.Showing then
|
|
|
begin
|
|
|
if bskntbshtpg1.Showing then
|
|
|
begin
|
|
|
update_grid_view_all(dxdbgrid2);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht3.Showing then
|
|
|
begin
|
|
|
update_grid_view_all(dxdbgrid5);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinTabSheet11.Showing then
|
|
|
begin
|
|
|
update_grid_view_all(dxdbgrid1);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht1.Showing then
|
|
|
begin
|
|
|
update_grid_view_all(dxdbgrid4);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet13.Showing then
|
|
|
begin
|
|
|
update_grid_view_all(dxdbgrid3);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
if bsSkinTabSheet4.Showing then
|
|
|
begin
|
|
|
update_grid_view_all(dxdbgrid7);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.N12Click(Sender: TObject);
|
|
|
begin
|
|
|
{
|
|
|
if bsSkinTabSheet1.Showing then
|
|
|
begin
|
|
|
if bsSkinTabSheet11.Showing then
|
|
|
begin
|
|
|
update_grid(dxdbgrid1,108);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet12.Showing then
|
|
|
begin
|
|
|
update_grid(dxdbgrid2,109);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet13.Showing then
|
|
|
begin
|
|
|
update_grid(dxdbgrid3,110);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht1.Showing then
|
|
|
begin
|
|
|
update_grid(dxdbgrid4,111);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
if bsSkinTabSheet4.Showing then
|
|
|
begin
|
|
|
update_grid(dxdbgrid7,112);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet6.Showing then
|
|
|
begin
|
|
|
update_grid(dxdbgrid9,95);
|
|
|
exit;
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.N16Click(Sender: TObject);
|
|
|
begin
|
|
|
if bsSkinTabSheet1.Showing then begin
|
|
|
if bskntbsht2.Showing then
|
|
|
begin
|
|
|
if bskntbshtpg1.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid2);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht3.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid5);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if bsSkinTabSheet11.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid1);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht1.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid4);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet13.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid3);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
if bsSkinTabSheet4.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid7);
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
{
|
|
|
if bsSkinTabSheet1.Showing then
|
|
|
begin
|
|
|
if bsSkinTabSheet11.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid1);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet12.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid2);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet13.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid3);
|
|
|
exit;
|
|
|
end;
|
|
|
if bskntbsht1.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid4);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
if bsSkinTabSheet4.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid7);
|
|
|
exit;
|
|
|
end;
|
|
|
if bsSkinTabSheet6.Showing then
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid9);
|
|
|
exit;
|
|
|
end;
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.bsSkinButton10Click(Sender: TObject);
|
|
|
var
|
|
|
betd,eetd:TDate;
|
|
|
aquery:TADOQuery;
|
|
|
str:String;
|
|
|
begin
|
|
|
|
|
|
memtblrpt_total.EmptyTable;
|
|
|
kbmMemTable2.EmptyTable;
|
|
|
kbmMemTable1.EmptyTable;
|
|
|
kbmMemTable4.EmptyTable;
|
|
|
memtblDetail.EmptyTable;
|
|
|
memtblLX.EmptyTable;
|
|
|
P_SUM.EmptyTable;
|
|
|
|
|
|
betd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), 1);
|
|
|
eetd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), MonthDays[isLeapYear(StrToInt(wwDBComboBox20.Text)),StrToInt(wwDBComboBox1.Text)]);
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
str:='select * from v_op_bscard_MAX where <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=<3D>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> and ';
|
|
|
str:=Str+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(betd)+'''';
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+DateToStr(eetd)+'''';
|
|
|
if not bsSkinCheckRadioBox1.Checked then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+'''2008-01-01''';
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) ';
|
|
|
str:=str+' and '+open_data('0039','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
SQL.Add(str);
|
|
|
Open;
|
|
|
memtblrpt_total.LoadFromDataSet(aQuery,[mtcpostructure,mtcpoProperties,mtcpoFieldIndex]);
|
|
|
|
|
|
Close;SQL.Clear;
|
|
|
str:='select *,ë<><C3AB><EFBFBD><EFBFBD>*0.05 as <20><><EFBFBD><EFBFBD> from v_op_bscard where 1=1 and ';
|
|
|
str:=Str+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(betd)+'''';
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+DateToStr(eetd)+'''';
|
|
|
if not bsSkinCheckRadioBox1.Checked then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+'''2008-01-01''';
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) ';
|
|
|
str:=str+' and '+open_data('0039','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
SQL.Add(str);
|
|
|
Open;
|
|
|
kbmMemTable4.LoadFromDataSet(aQuery,[mtcpostructure,mtcpoProperties,mtcpoFieldIndex]);
|
|
|
end;
|
|
|
GetProfit;
|
|
|
Getlx;
|
|
|
Getcq;
|
|
|
GetProfitSum;
|
|
|
finally
|
|
|
FreeAndNil(aquery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.GetProfit;
|
|
|
var
|
|
|
aQuery,aQuery3:TADOQuery;
|
|
|
aStlDate:TDate;
|
|
|
bYear,bMonth,bDate,eYear,eMonth,eDate:Word;
|
|
|
btMonth,l,d:Integer;
|
|
|
LXBL:Double;
|
|
|
ED:Boolean;
|
|
|
|
|
|
function getstlDate(aetd:TDateTime;Cust,SaleID:String):TDate;
|
|
|
var
|
|
|
aQuery2:TADOQuery;
|
|
|
aYear,aMonth,aDay,bDay:word;
|
|
|
aStlDate:TDateTime;
|
|
|
bMonth:Integer;
|
|
|
|
|
|
begin
|
|
|
aQuery2:=CreateAdoQuery;
|
|
|
aStlDate:=aetd;
|
|
|
result:=aStlDate;
|
|
|
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',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 IsEmpty then begin
|
|
|
Result:=aetd;
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
Exit;
|
|
|
end;
|
|
|
if FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString='<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>' then begin
|
|
|
Result:=aetd;
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
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;
|
|
|
bMonth:=GetBetwMonth(aetd,result);
|
|
|
if bMonth=0 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if bMonth=1 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if bMonth=2 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if bMonth=3 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
|
|
|
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
|
|
|
result:=EncodeDate(aYear,aMonth,fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger);
|
|
|
end else
|
|
|
result:=IncMonth(aStlDate,StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0));
|
|
|
if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=0 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=1 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=2 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=3 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
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
|
|
|
result:=EncodeDate(aYear,aMonth,fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2').AsInteger);
|
|
|
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
|
|
|
result:=EncodeDate(aYear,aMonth,fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger);
|
|
|
|
|
|
result:=EncodeDate(aYear,aMonth,fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger);
|
|
|
end;
|
|
|
|
|
|
if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=0 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=1 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=2 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>'
|
|
|
else if StrToIntDef(FieldByName('<27><><EFBFBD><EFBFBD>ģʽ').AsString,0)=3 then
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
end else begin
|
|
|
Result:=aetd;
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
end;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery2);
|
|
|
end;
|
|
|
end;
|
|
|
begin
|
|
|
if not P_SUM.Active then
|
|
|
P_SUM.Open;
|
|
|
if not t_salepriftset.Active then
|
|
|
t_salepriftset.Open;
|
|
|
if not memtblLX.Active then
|
|
|
memtblLX.Open;
|
|
|
|
|
|
if NOT memtblDetail.Active then
|
|
|
memtblDetail.Open;
|
|
|
|
|
|
if memtblrpt_total.RecordCount=0 then exit;
|
|
|
l:=memtblrpt_total.RecordCount+kbmMemTable4.RecordCount;
|
|
|
if l=0 then l:=100;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
aQuery3:=CreateAdoQuery;
|
|
|
|
|
|
try
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=l;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
|
|
|
|
{
|
|
|
memtblDetail.Open;
|
|
|
if not memtblDetail.IsEmpty then begin
|
|
|
memtblDetail.First;
|
|
|
while not memtblDetail.Eof do begin
|
|
|
memtblDetail.Delete;
|
|
|
end;
|
|
|
end;
|
|
|
P_SUM.Open;
|
|
|
if not P_SUM.IsEmpty then begin
|
|
|
P_SUM.First;
|
|
|
while not P_SUM.Eof do begin
|
|
|
P_SUM.Delete;
|
|
|
end;
|
|
|
end;
|
|
|
}
|
|
|
memtblrpt_total.First;
|
|
|
while not memtblrpt_total.eof do begin
|
|
|
{
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,bYear,bMonth,bDate);
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,eYear,eMonth,eDate);
|
|
|
if bYear=eYear then
|
|
|
btMonth:=bMonth-eMonth
|
|
|
else begin
|
|
|
btMonth:=bMonth+(12-eMonth);
|
|
|
end;
|
|
|
if btMonth>3 then begin
|
|
|
if not memtblLX.Active then
|
|
|
memtblLX.Open;
|
|
|
memtblLX.insert;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=memtblrpt_total.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring:=memtblrpt_total.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring:=memtblrpt_total.FieldByName('ί<>е<EFBFBD>λ').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
|
|
|
memtblLX.FieldByName('δ<><CEB4>USD').AsFloat:=memtblrpt_total.FieldByName('Ӧ<><D3A6>USD').AsFloat;
|
|
|
memtblLX.FieldByName('δ<><CEB4>RMB').AsFloat:=memtblrpt_total.FieldByName('Ӧ<><D3A6>RMB').AsFloat;
|
|
|
memtblLX.FieldByName('δ<>պϼ<D5BA>').AsFloat:=memtblrpt_total.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat;
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').value:=IncMonth(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value,4);
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsInteger:=btMonth;
|
|
|
if t_salepriftset.Locate('<27><><EFBFBD><EFBFBD>',Trim(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),[]) then
|
|
|
LXBL:=t_salepriftset.FieldByName('<27><>Ϣ').AsFloat
|
|
|
else
|
|
|
LXBL:=0;
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsFloat:=LXBL;
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsFloat:=(memtblrpt_total.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat)*LXBL/100;
|
|
|
memtblLX.post;
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
aQuery3.Close;aQuery3.SQL.Clear;
|
|
|
aQuery3.SQL.Add('select * from t_crm_salesproftt where <20><><EFBFBD><EFBFBD>='''+wwDBComboBox20.Text+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+''')');
|
|
|
aQuery3.open;
|
|
|
if aQuery3.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
|
|
|
d:=0
|
|
|
else
|
|
|
d:=aQuery3.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger;
|
|
|
ED:=not aQuery3.FieldByName('<27><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>').AsBoolean;
|
|
|
|
|
|
|
|
|
if not P_SUM.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,[])then
|
|
|
begin
|
|
|
P_SUM.insert;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD>Ϣ']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>']:=0.00;
|
|
|
P_SUM['<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['ë<><C3AB><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['Ӧ<><D3A6><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
P_SUM.edit;
|
|
|
end;
|
|
|
|
|
|
memtblDetail.Insert;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtblDetail.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
aQuery.Close;
|
|
|
aQuery.SQL.Clear;
|
|
|
aQuery.SQL.Add('select top 1 * from v_fee_do where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString+''' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DESC ');
|
|
|
aQuery.Open;
|
|
|
|
|
|
if not aQuery.IsEmpty then begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtblDetail.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=aQuery.fieldByName('<27>ұ<EFBFBD>').AsString+Floattostr(aQuery.fieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=aQuery.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=aQuery.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value;
|
|
|
end else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='';
|
|
|
memtblDetail.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:='';
|
|
|
end;
|
|
|
|
|
|
memtblDetail.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=memtblrpt_total.FieldByName('ί<>е<EFBFBD>λ').AsString;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value;
|
|
|
memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').Value:=memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').Value;
|
|
|
P_SUM['ë<><C3AB><EFBFBD><EFBFBD>']:=P_SUM['ë<><C3AB><EFBFBD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ʿۿ<CABF>').AsFloat:=0;
|
|
|
memtblDetail.FieldByName('ʣ<><CAA3>ë<EFBFBD><C3AB>').AsFloat:=0;
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat:=0;
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat:=0;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>').AsFloat:=0;
|
|
|
aStlDate:=getstlDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,memtblrpt_total.FieldByName('ί<>е<EFBFBD>λ').AsString,memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=EncodeDate(YearOf(aStlDate),strtoint(FormatDateTime('MM',aStlDate)),MonthDays[isLeapYear(YearOf(aStlDate)),strtoint(FormatDateTime('MM',aStlDate))]);
|
|
|
if ED then aStlDate:=aStlDate+d;
|
|
|
if memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime<memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime+d+1 then begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end else begin
|
|
|
if aStlDate>=memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then begin
|
|
|
if memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime>memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then begin
|
|
|
if ED then
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime-d,bYear,bMonth,bDate)
|
|
|
else
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,bYear,bMonth,bDate);
|
|
|
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,eYear,eMonth,eDate);
|
|
|
if bYear=eYear then
|
|
|
btMonth:=bMonth-eMonth
|
|
|
else begin
|
|
|
btMonth:=bMonth+(12-eMonth);
|
|
|
end;
|
|
|
case btMonth of
|
|
|
0: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
1: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
2: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
3: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
4: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
// P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
5: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
// P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
|
|
|
else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
end else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end else begin
|
|
|
if ED then
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime-d,bYear,bMonth,bDate)
|
|
|
else
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,bYear,bMonth,bDate);
|
|
|
|
|
|
DecodeDate(aStlDate,eYear,eMonth,eDate);
|
|
|
if bMonth=eMonth then begin
|
|
|
if memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime>memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then begin
|
|
|
if ED then
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime-d,bYear,bMonth,bDate)
|
|
|
else
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,bYear,bMonth,bDate);
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,eYear,eMonth,eDate);
|
|
|
if bYear=eYear then
|
|
|
btMonth:=bMonth-eMonth
|
|
|
else begin
|
|
|
btMonth:=bMonth+(12-eMonth);
|
|
|
end;
|
|
|
case btMonth of
|
|
|
0: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
1: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
2: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
3: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
4: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
// P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
5: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
// P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
|
|
|
else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
end else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end else begin
|
|
|
if memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime>memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then begin
|
|
|
if ED then
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime-d,bYear,bMonth,bDate)
|
|
|
else
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,bYear,bMonth,bDate);
|
|
|
DecodeDate(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,eYear,eMonth,eDate);
|
|
|
if bYear=eYear then
|
|
|
btMonth:=bMonth-eMonth
|
|
|
else begin
|
|
|
btMonth:=bMonth+(12-eMonth);
|
|
|
end;
|
|
|
case btMonth of
|
|
|
0: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
1: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
2: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
3: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
4: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
// P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
5: begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
// P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
|
|
|
else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=0;
|
|
|
end;
|
|
|
|
|
|
|
|
|
end;
|
|
|
end else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>';
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+memtblrpt_total.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
memtblDetail.Post;
|
|
|
P_SUM.post;
|
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
memtblrpt_total.Next;
|
|
|
end;
|
|
|
if not kbmMemTable4.IsEmpty then begin
|
|
|
kbmMemTable4.First;
|
|
|
while not kbmMemTable4.Eof do begin
|
|
|
memtblDetail.Insert;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=kbmMemTable4.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtblDetail.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=kbmMemTable4.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=kbmMemTable4.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=kbmMemTable4.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='';
|
|
|
memtblDetail.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:='';
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=null;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=null;
|
|
|
memtblDetail.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=kbmMemTable4.FieldByName('ί<>е<EFBFBD>λ').AsString;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=kbmMemTable4.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value;
|
|
|
memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').Value:=kbmMemTable4.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').Value;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ʿۿ<CABF>').AsFloat:=0;
|
|
|
memtblDetail.FieldByName('ʣ<><CAA3>ë<EFBFBD><C3AB>').AsFloat:=kbmMemTable4.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').Value;
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=5;
|
|
|
memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat:=kbmMemTable4.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat:=kbmMemTable4.FieldByName('<27><><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>').AsFloat:=0;
|
|
|
aStlDate:=getstlDate(kbmMemTable4.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,kbmMemTable4.FieldByName('ί<>е<EFBFBD>λ').AsString,kbmMemTable4.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=aStlDate;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>';
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=5;
|
|
|
memtblDetail.Post;
|
|
|
kbmMemTable4.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.MaxValue;
|
|
|
frm_sys_progress.free;
|
|
|
frm_sys_progress:=nil;
|
|
|
FreeAndNil(aQuery);
|
|
|
FreeAndNil(aQuery3);
|
|
|
end;
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.GetProfitSum;
|
|
|
var
|
|
|
aK,YB,SB:Double;
|
|
|
aSBDATE:TDate;
|
|
|
aQuery3:TAdoQuery;
|
|
|
d:integer;
|
|
|
ED:Boolean;
|
|
|
|
|
|
begin
|
|
|
if not memtblrpt_total.Active then
|
|
|
exit;
|
|
|
aQuery3:=CreateAdoQuery;
|
|
|
try
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=memtblLX.RecordCount+kbmMemTable4.RecordCount+memtblDetail.RecordCount*2;
|
|
|
// frm_sys_progress.bsSkinGauge1.MaxValue:=kbmMemTable2.RecordCount+kbmMemTable4.RecordCount+memtblDetail.RecordCount*2;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
frm_sys_progress.Update;
|
|
|
P_SUM.Open;
|
|
|
if not memtblLX.IsEmpty then begin
|
|
|
memtblLX.First;
|
|
|
while not memtblLX.Eof do begin
|
|
|
if not P_SUM.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',memtblLX.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,[])then
|
|
|
begin
|
|
|
P_SUM.insert;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblLX.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD>Ϣ']:=memtblLX.fieldbyname('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
P_SUM['<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>']:=0;
|
|
|
P_SUM['Ӧ<><D3A6><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>']:=-memtblLX.fieldbyname('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
P_SUM.Edit;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblLX.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD>Ϣ']:=P_SUM['<27><><EFBFBD><EFBFBD>Ϣ']+memtblLX.fieldbyname('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM.post;
|
|
|
end;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
memtblLX.Next;
|
|
|
end;
|
|
|
end;
|
|
|
if kbmMemTable2.Active then
|
|
|
if not kbmMemTable2.IsEmpty then begin
|
|
|
kbmMemTable2.First;
|
|
|
while not kbmMemTable2.Eof do begin
|
|
|
if not P_SUM.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',kbmMemTable2.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,[])then
|
|
|
begin
|
|
|
P_SUM.insert;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=kbmMemTable2.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=kbmMemTable2.fieldbyname('<27>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM['<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD>Ϣ']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['Ӧ<><D3A6><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
P_SUM.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
P_SUM.Edit;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=kbmMemTable2.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']+kbmMemTable2.fieldbyname('<27>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM.post;
|
|
|
end;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
kbmMemTable2.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if not kbmMemTable4.IsEmpty then begin
|
|
|
kbmMemTable4.First;
|
|
|
while not kbmMemTable4.Eof do begin
|
|
|
if not P_SUM.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',kbmMemTable4.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,[])then
|
|
|
begin
|
|
|
P_SUM.insert;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=kbmMemTable4.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>']:=kbmMemTable4.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM['<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD>Ϣ']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['Ӧ<><D3A6><EFBFBD><EFBFBD>']:=0.00;
|
|
|
P_SUM['<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>']:=kbmMemTable4.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
P_SUM.Edit;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=kbmMemTable4.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>']:=P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>']+kbmMemTable4.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat;
|
|
|
P_SUM.post;
|
|
|
end;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
kbmMemTable4.Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
P_SUM.First;
|
|
|
while not P_SUM.Eof do begin
|
|
|
P_SUM.Edit;
|
|
|
P_SUM.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat:=gettotalprofit(P_SUM.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
P_SUM.post;
|
|
|
P_sum.Next;
|
|
|
end;
|
|
|
|
|
|
|
|
|
if not memtblDetail.IsEmpty then begin
|
|
|
memtblDetail.SortOn('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]);
|
|
|
memtblDetail.Last;
|
|
|
while not memtblDetail.Bof do begin
|
|
|
if P_SUM.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,[]) then begin
|
|
|
memtblDetail.Edit;
|
|
|
P_SUM.Edit;
|
|
|
{
|
|
|
if (P_SUM.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat>P_SUM.FieldByName('<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>').AsFloat) AND (P_SUM.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat<>0) then begin
|
|
|
|
|
|
aK:=P_SUM.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat-P_SUM.FieldByName('<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
|
|
|
if aK>memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat then begin
|
|
|
P_SUM.FieldByName('<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=P_SUM.FieldByName('<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>').AsFloat+memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ʿۿ<CABF>').AsFloat:=memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtblDetail.FieldByName('ʣ<><CAA3>ë<EFBFBD><C3AB>').AsFloat:=0;
|
|
|
end else begin
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ʿۿ<CABF>').AsFloat:=aK;
|
|
|
memtblDetail.FieldByName('ʣ<><CAA3>ë<EFBFBD><C3AB>').AsFloat:=memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat-aK;
|
|
|
P_SUM.FieldByName('<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=P_SUM.FieldByName('<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>').AsFloat+aK;
|
|
|
end;
|
|
|
end else begin
|
|
|
}
|
|
|
memtblDetail.FieldByName('ʣ<><CAA3>ë<EFBFBD><C3AB>').AsFloat:=memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
// end;
|
|
|
|
|
|
if memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString<>'<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>' then begin
|
|
|
aQuery3.Close;aQuery3.SQL.Clear;
|
|
|
aQuery3.SQL.Add('select * from t_crm_salesproftt where <20><><EFBFBD><EFBFBD>='''+wwDBComboBox20.Text+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (select <20><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+''')');
|
|
|
aQuery3.open;
|
|
|
if aQuery3.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').IsNull then
|
|
|
d:=0
|
|
|
else
|
|
|
d:=aQuery3.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger;
|
|
|
ED:=NOT aQuery3.FieldByName('<27><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>').AsBoolean;
|
|
|
|
|
|
if (d<>0) and (memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime<memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime+d+1) then begin
|
|
|
YB:=GetSALEprofit(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,0,P_SUM.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat,true);
|
|
|
if memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime>memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then
|
|
|
aSBDATE:=memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDatetime
|
|
|
else
|
|
|
aSBDATE:=memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDatetime;
|
|
|
SB:=GetSALEprofit(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,0,P_SUM.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat,true);
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=SB;
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=YB;
|
|
|
end else begin
|
|
|
YB:=GetSALEprofit(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,GetBetwMonth(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime),P_SUM.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat,true);
|
|
|
if memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime>memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime then
|
|
|
aSBDATE:=memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDatetime
|
|
|
else
|
|
|
aSBDATE:=memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDatetime;
|
|
|
if ED then begin
|
|
|
aSBDATE:=aSBDATE-d;
|
|
|
SB:=GetSALEprofit(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,GetBetwMonth(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,aSBDATE),P_SUM.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat,issameMonth(memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime+d,memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime));
|
|
|
end else
|
|
|
SB:=GetSALEprofit(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,GetBetwMonth(memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,aSBDATE),P_SUM.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat,issameMonth(memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,memtblDetail.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime));
|
|
|
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=SB;
|
|
|
memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat:=YB;
|
|
|
end;
|
|
|
end;
|
|
|
memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*memtblDetail.FieldByName('ԭ<><D4AD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat/100;
|
|
|
memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat:=memtblDetail.FieldByName('ʣ<><CAA3>ë<EFBFBD><C3AB>').AsFloat*memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD>').AsFloat/100;
|
|
|
memtblDetail.FieldByName('<27><><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>').AsFloat:=memtblDetail.FieldByName('Ӧ<><D3A6><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat-memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat;
|
|
|
P_SUM['Ӧ<><D3A6><EFBFBD><EFBFBD>']:=P_SUM['Ӧ<><D3A6><EFBFBD><EFBFBD>']+memtblDetail.FieldByName('ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>').AsFloat;
|
|
|
P_SUM.Post;
|
|
|
memtblDetail.Post;
|
|
|
end;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
memtblDetail.Prior;
|
|
|
end;
|
|
|
memtblDetail.SortOn('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]);
|
|
|
end;
|
|
|
|
|
|
p_sum.First;
|
|
|
while not p_sum.eof do begin
|
|
|
P_SUM.edit;
|
|
|
P_SUM['<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['Ӧ<><D3A6><EFBFBD><EFBFBD>']+P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>']-P_SUM['<27><><EFBFBD><EFBFBD>Ϣ'];
|
|
|
P_SUM.post;
|
|
|
P_SUM.Next;
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
FreeAndNil(aQuery3);
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.MaxValue;
|
|
|
frm_sys_progress.free;
|
|
|
frm_sys_progress:=nil;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.Getlx;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
Str:String;
|
|
|
nostr,nostr2:WideString;
|
|
|
betd,eetd:TDate;
|
|
|
LXBL:Double;
|
|
|
function GetHistryno(nodate:Tdate;bsno:String):double;
|
|
|
var
|
|
|
aQuery2:TADOQuery;
|
|
|
begin
|
|
|
aQuery2:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery2 do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select sum(CASE <20><><EFBFBD><EFBFBD> when ''<27><>'' then ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA> ');
|
|
|
SQL.Add(' from v_fee_do_detail where <20><><EFBFBD><EFBFBD>='''+bsno+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+DateToStr(nodate)+'''');
|
|
|
SQL.Add(' Group by <20><><EFBFBD><EFBFBD>');
|
|
|
OPEN;
|
|
|
if IsEmpty then
|
|
|
result:=0.00
|
|
|
else
|
|
|
Result:=fieldbyName('δ<>պϼ<D5BA>').AsFloat;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery2);
|
|
|
end;
|
|
|
end;
|
|
|
begin
|
|
|
betd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), 1);
|
|
|
eetd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), MonthDays[isLeapYear(StrToInt(wwDBComboBox20.Text)),StrToInt(wwDBComboBox1.Text)]);
|
|
|
t_salepriftset.Close;
|
|
|
t_salepriftset.SQL.Clear;
|
|
|
t_salepriftset.SQL.Add('select t_sys_employee.<2E><><EFBFBD><EFBFBD>,t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>,t_crm_salesproftt.* from t_sys_employee ');
|
|
|
t_salepriftset.SQL.Add('left join t_crm_salesproftt on t_crm_salesproftt.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD> ');
|
|
|
t_salepriftset.SQL.Add('where t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><>'''' and t_crm_salesproftt.<2E><>Ϣ<>0 ');
|
|
|
t_salepriftset.Open;
|
|
|
if t_salepriftset.IsEmpty then exit;
|
|
|
|
|
|
|
|
|
t_salepriftset.First;
|
|
|
while not t_salepriftset.eof do begin
|
|
|
str:='(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+t_salepriftset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''+' and '+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-(t_salepriftset.fieldbyname('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>').Asinteger-2)))+''''
|
|
|
+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(incmonth(betd,-(t_salepriftset.fieldbyname('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asinteger-1)))+''''+')';
|
|
|
if nostr='' then
|
|
|
nostr:='('+str
|
|
|
else
|
|
|
nostr:=nostr+' or '+str;
|
|
|
|
|
|
str:='(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+t_salepriftset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''+' and '+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-(t_salepriftset.fieldbyname('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>').Asinteger-2)))+''''
|
|
|
+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(incmonth(betd,-(t_salepriftset.fieldbyname('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asinteger-1)))+''''+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(betd)+''''+')';
|
|
|
if nostr2='' then
|
|
|
nostr2:='('+str
|
|
|
else
|
|
|
nostr2:=nostr2+' or '+str;
|
|
|
|
|
|
t_salepriftset.Next;
|
|
|
end;
|
|
|
nostr:=nostr+')';
|
|
|
nostr2:=nostr2+')';
|
|
|
|
|
|
|
|
|
if not memtblLX.Active then
|
|
|
memtblLX.Open;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
str:='select *,(<28>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>-<2D>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>)*0.01 as <20>۳<EFBFBD><DBB3><EFBFBD>Ϣ from v_op_bscard where <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD><><3E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> and ';
|
|
|
str:=Str+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-3))+'''';
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(incmonth(betd,-9))+'''';
|
|
|
if not bsSkinCheckRadioBox1.Checked then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+'''2008-01-01''';
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) ';
|
|
|
str:=str+' and '+open_data('0039','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
|
|
|
SQL.Add(str);
|
|
|
|
|
|
Open;
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
|
|
|
if not IsEmpty then begin
|
|
|
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=RecordCount;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
memtblLX.insert;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ί<>е<EFBFBD>λ').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
|
|
|
memtblLX.FieldByName('δ<><CEB4>USD').AsFloat:=FieldByName('Ӧ<><D3A6>USD').AsFloat-FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
|
|
|
memtblLX.FieldByName('δ<><CEB4>RMB').AsFloat:=FieldByName('Ӧ<><D3A6>RMB').AsFloat-FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
|
|
|
memtblLX.FieldByName('δ<>պϼ<D5BA>').AsFloat:=FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat-GetHistryno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').value:=IncMonth(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value,3);
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsInteger:=1;
|
|
|
if t_salepriftset.Locate('<27><><EFBFBD><EFBFBD>',Trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),[]) then
|
|
|
LXBL:=t_salepriftset.FieldByName('<27><>Ϣ').AsFloat
|
|
|
else
|
|
|
LXBL:=0;
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsFloat:=LXBL;
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsFloat:=(memtblLX.FieldByName('δ<>պϼ<D5BA>').AsFloat)*LXBL/100;
|
|
|
memtblLX.post;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
Close;SQL.Clear;
|
|
|
str:='select * from v_op_bscard_MAX where <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=<3D>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> and ';
|
|
|
str:=Str+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-3))+'''';
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(incmonth(betd,-9))+'''';
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(betd)+'''';
|
|
|
if not bsSkinCheckRadioBox1.Checked then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+'''2008-01-01''';
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) ';
|
|
|
str:=str+' and '+open_data('0039','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
|
|
|
SQL.Add(str);
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
memtblLX.insert;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
memtblLX.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ί<>е<EFBFBD>λ').asstring;
|
|
|
memtblLX.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
|
|
|
memtblLX.FieldByName('δ<><CEB4>USD').AsFloat:=FieldByName('Ӧ<><D3A6>USD').AsFloat-FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
|
|
|
memtblLX.FieldByName('δ<><CEB4>RMB').AsFloat:=FieldByName('Ӧ<><D3A6>RMB').AsFloat-FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
|
|
|
memtblLX.FieldByName('δ<>պϼ<D5BA>').AsFloat:=FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat-GetHistryno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').value:=IncMonth(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value,3);
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsInteger:=1;
|
|
|
if t_salepriftset.Locate('<27><><EFBFBD><EFBFBD>',Trim(FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring),[]) then
|
|
|
LXBL:=t_salepriftset.FieldByName('<27><>Ϣ').AsFloat
|
|
|
else
|
|
|
LXBL:=0;
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsFloat:=LXBL;
|
|
|
memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsFloat:=(memtblLX.FieldByName('δ<>պϼ<D5BA>').AsFloat)*LXBL/100;
|
|
|
memtblLX.post;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
memtblLX.first;
|
|
|
while not memtblLX.Eof do begin
|
|
|
if memtblLX.FieldByName('<27><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>').AsFloat=0 then
|
|
|
memtblLX.Delete
|
|
|
else
|
|
|
memtblLX.Next;
|
|
|
end;
|
|
|
memtblLX.SortOn('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]);
|
|
|
finally
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.MaxValue;
|
|
|
frm_sys_progress.free;
|
|
|
frm_sys_progress:=nil;
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_sales_profit.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_sales_profit.issameMonth(aBe, aEe: TDate): Boolean;
|
|
|
var
|
|
|
bYear,bMonth,bDate,eYear,eMonth,eDate:Word;
|
|
|
begin
|
|
|
DecodeDate(aBe,bYear,bMonth,bDate);
|
|
|
DecodeDate(aEe,eYear,eMonth,eDate);
|
|
|
if (eMonth=bMonth) or (aBe>aEe) then
|
|
|
Result:=True
|
|
|
else result:=false;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.Getcq;
|
|
|
var
|
|
|
aQuery:TADOQuery;
|
|
|
Str:String;
|
|
|
nostr,nostr2:WideString;
|
|
|
betd,eetd:TDate;
|
|
|
LXBL:Double;
|
|
|
function GetHistryno(nodate:Tdate;bsno:String):double;
|
|
|
var
|
|
|
aQuery2:TADOQuery;
|
|
|
begin
|
|
|
aQuery2:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery2 do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select sum(CASE <20><><EFBFBD><EFBFBD> when ''<27><>'' then ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA> ');
|
|
|
SQL.Add(' from v_fee_do_detail where <20><><EFBFBD><EFBFBD>='''+bsno+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+DateToStr(nodate)+'''');
|
|
|
SQL.Add(' Group by <20><><EFBFBD><EFBFBD>');
|
|
|
OPEN;
|
|
|
if IsEmpty then
|
|
|
result:=0.00
|
|
|
else
|
|
|
Result:=fieldbyName('δ<>պϼ<D5BA>').AsFloat;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery2);
|
|
|
end;
|
|
|
end;
|
|
|
function GetHistryUSDno(nodate:Tdate;bsno:String):double;
|
|
|
var
|
|
|
aQuery2:TADOQuery;
|
|
|
begin
|
|
|
aQuery2:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery2 do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select sum(CASE <20><><EFBFBD><EFBFBD> when ''<27><>'' then ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA> ');
|
|
|
SQL.Add(' from v_fee_do_detail where ԭʼ<D4AD>ұ<EFBFBD>=''USD'' and <20><><EFBFBD><EFBFBD>='''+bsno+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+DateToStr(nodate)+'''');
|
|
|
SQL.Add(' Group by <20><><EFBFBD><EFBFBD>');
|
|
|
OPEN;
|
|
|
if IsEmpty then
|
|
|
result:=0.00
|
|
|
else
|
|
|
Result:=fieldbyName('δ<>պϼ<D5BA>').AsFloat;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery2);
|
|
|
end;
|
|
|
end;
|
|
|
function GetHistryRMBno(nodate:Tdate;bsno:String):double;
|
|
|
var
|
|
|
aQuery2:TADOQuery;
|
|
|
begin
|
|
|
aQuery2:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery2 do begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('select sum(CASE <20><><EFBFBD><EFBFBD> when ''<27><>'' then ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> else 0 end) as δ<>պϼ<D5BA> ');
|
|
|
SQL.Add(' from v_fee_do_detail where ԭʼ<D4AD>ұ<EFBFBD><>''USD'' and <20><><EFBFBD><EFBFBD>='''+bsno+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'''+DateToStr(nodate)+'''');
|
|
|
SQL.Add(' Group by <20><><EFBFBD><EFBFBD>');
|
|
|
OPEN;
|
|
|
if IsEmpty then
|
|
|
result:=0.00
|
|
|
else
|
|
|
Result:=fieldbyName('δ<>պϼ<D5BA>').AsFloat;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aQuery2);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
begin
|
|
|
|
|
|
t_salepriftset.Close;
|
|
|
t_salepriftset.SQL.Clear;
|
|
|
t_salepriftset.SQL.Add('select t_sys_employee.<2E><><EFBFBD><EFBFBD>,t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>,t_crm_salesproftt.* from t_sys_employee ');
|
|
|
t_salepriftset.SQL.Add('left join t_crm_salesproftt on t_crm_salesproftt.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD> ');
|
|
|
t_salepriftset.SQL.Add('where t_sys_employee.<2E><><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><>'''' and t_crm_salesproftt.<2E><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD><>0 ');
|
|
|
t_salepriftset.Open;
|
|
|
|
|
|
if t_salepriftset.IsEmpty then exit;
|
|
|
|
|
|
betd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), 1);
|
|
|
eetd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), MonthDays[isLeapYear(StrToInt(wwDBComboBox20.Text)),StrToInt(wwDBComboBox1.Text)]);
|
|
|
t_salepriftset.First;
|
|
|
while not t_salepriftset.eof do begin
|
|
|
str:='(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+t_salepriftset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''+' and '+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-(t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger-1)))+''''
|
|
|
+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'+''''+DateToStr(incmonth(betd,-t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger))+''''+')';
|
|
|
if nostr='' then
|
|
|
nostr:='('+str
|
|
|
else
|
|
|
nostr:=nostr+' or '+str;
|
|
|
|
|
|
str:='(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+t_salepriftset.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''''+' and '+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-(t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger-1)))+''''
|
|
|
+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'+''''+DateToStr(incmonth(betd,-t_salepriftset.fieldbyname('<27><><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD>').Asinteger))+''''+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(betd)+''''+')';
|
|
|
if nostr2='' then
|
|
|
nostr2:='('+str
|
|
|
else
|
|
|
nostr2:=nostr2+' or '+str;
|
|
|
|
|
|
t_salepriftset.Next;
|
|
|
end;
|
|
|
nostr:=nostr+')';
|
|
|
nostr2:=nostr2+')';
|
|
|
|
|
|
if not kbmMemTable2.Active then
|
|
|
kbmMemTable2.Open;
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
str:='select *,<2C>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>-<2D>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> as <20>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD> from v_op_bscard where <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD><><3E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> and ';
|
|
|
// str:=Str+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-10))+'''';
|
|
|
// str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'+''''+DateToStr(incmonth(betd,-11))+'''';
|
|
|
str:=str+nostr;
|
|
|
if not bsSkinCheckRadioBox1.Checked then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+'''2008-01-01''';
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) ';
|
|
|
str:=str+' and '+open_data('0039','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
|
|
|
SQL.Add(str);
|
|
|
Open;
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
|
|
|
if not IsEmpty then begin
|
|
|
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=RecordCount;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
frm_sys_progress.Update;
|
|
|
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
kbmMemTable2.insert;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
kbmMemTable2.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
kbmMemTable2.FieldByName('ί<>е<EFBFBD>λ').asstring:=FieldByName('ί<>е<EFBFBD>λ').asstring;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
|
|
|
kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat:=FieldByName('Ӧ<><D3A6>USD').AsFloat;
|
|
|
kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat:=FieldByName('Ӧ<><D3A6>RMB').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=GetHistryusdno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=GetHistryRMBno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=GetHistryno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
kbmMemTable2.FieldByName('δ<><CEB4>USD').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
|
|
|
kbmMemTable2.FieldByName('δ<><CEB4>RMB').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat-kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
|
|
|
kbmMemTable2.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat:=FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat;
|
|
|
kbmMemTable2.post;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
Close;SQL.Clear;
|
|
|
str:='select * from v_op_bscard_MAX where <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=<3D>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> and ';
|
|
|
str:=str+nostr2;
|
|
|
|
|
|
// str:=Str+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><'+''''+DateToStr(incmonth(betd,-10))+'''';
|
|
|
// str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>'+''''+DateToStr(incmonth(betd,-11))+'''';
|
|
|
// str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(betd)+'''';
|
|
|
if not bsSkinCheckRadioBox1.Checked then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+'''2008-01-01''';
|
|
|
if RxDBLookupCombo3.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
|
|
|
if RxDBLookupCombo2.DisplayValue<>'' then
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
|
|
|
if RxDBLookupCombo10.DisplayValue<>'' then
|
|
|
str:=Str+' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='+''''+RxDBLookupCombo10.DisplayValue+'''';
|
|
|
str:=Str+' and ί<>е<EFBFBD>λ not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>=1) ';
|
|
|
str:=str+' and '+open_data('0039','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
|
|
|
SQL.Add(str);
|
|
|
Open;
|
|
|
if not IsEmpty then begin
|
|
|
|
|
|
first;
|
|
|
while not eof do begin
|
|
|
kbmMemTable2.insert;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
kbmMemTable2.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').asstring;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
kbmMemTable2.FieldByName('ί<>е<EFBFBD>λ').asstring:=FieldByName('ί<>е<EFBFBD>λ').asstring;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value;
|
|
|
kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat:=FieldByName('Ӧ<><D3A6>USD').AsFloat;
|
|
|
kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat:=FieldByName('Ӧ<><D3A6>RMB').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat:=FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=GetHistryusdno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=GetHistryRMBno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=GetHistryno(eetd+1,FieldByName('<27><><EFBFBD><EFBFBD>').asstring);
|
|
|
kbmMemTable2.FieldByName('δ<><CEB4>USD').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>USD').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
|
|
|
kbmMemTable2.FieldByName('δ<><CEB4>RMB').AsFloat:=kbmMemTable2.FieldByName('Ӧ<><D3A6>RMB').AsFloat-kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat:=kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat-kbmMemTable2.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>USD').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD>RMB').AsFloat;
|
|
|
kbmMemTable2.FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat:=FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
kbmMemTable2.FieldByName('<27>۳<EFBFBD><DBB3><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=kbmMemTable2.FieldByName('<27>ϼ<EFBFBD>δ<EFBFBD><CEB4>').AsFloat;
|
|
|
kbmMemTable2.post;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
kbmMemTable2.SortOn('ί<>е<EFBFBD>λ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',[]);
|
|
|
finally
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.MaxValue;
|
|
|
frm_sys_progress.free;
|
|
|
frm_sys_progress:=nil;
|
|
|
FreeAndNil(aQuery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.kbmMemTable4AfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.kbmMemTable2AfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.P_SUMAfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.memtblrpt_totalAfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.kbmMemTable1AfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.memtblDetailAfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.memtblLXAfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_sales_profit.dxDBGridColumn70CustomDraw(Sender: TObject;
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
|
|
|
begin
|
|
|
if kbmMemTable4.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').Asfloat<>kbmMemTable4.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').Asfloat then
|
|
|
AColor:=clRed;
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_rp_sales_profit.gettotalprofit(sale: string): double;
|
|
|
var
|
|
|
betd,eetd:TDate;
|
|
|
aquery:TADOQuery;
|
|
|
str:String;
|
|
|
begin
|
|
|
|
|
|
betd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), 1);
|
|
|
eetd:=EncodeDate(StrToInt(wwDBComboBox20.Text), StrToInt(wwDBComboBox1.Text), MonthDays[isLeapYear(StrToInt(wwDBComboBox20.Text)),StrToInt(wwDBComboBox1.Text)]);
|
|
|
aQuery:=CreateAdoQuery;
|
|
|
try
|
|
|
with aQuery do begin
|
|
|
Close;SQL.Clear;
|
|
|
str:='select sum(ë<><C3AB><EFBFBD><EFBFBD>) as ë<><C3AB><EFBFBD><EFBFBD> from v_op_bscard where 1=1 and ';
|
|
|
str:=Str+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+DateToStr(betd)+'''';
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+DateToStr(eetd)+'''';
|
|
|
str:=Str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+sale+'''';
|
|
|
SQL.Add(str);
|
|
|
Open;
|
|
|
if IsEmpty then begin
|
|
|
result:=0.00;
|
|
|
end else
|
|
|
result:=fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').asfloat;
|
|
|
end;
|
|
|
finally
|
|
|
FreeAndNil(aquery);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end.
|