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

588 lines
20 KiB
Plaintext

This file contains ambiguous Unicode characters!

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

unit u_rp_sales_profit2022;
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,IniFiles;
type
Tfrm_rp_sales_profit2022 = class(TForm)
Panel1: TPanel;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet4: TbsSkinTabSheet;
bsSkinTabSheet6: TbsSkinTabSheet;
bsSkinPageControl2: TbsSkinPageControl;
bsSkinTabSheet11: 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;
dxDBGrid2: 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;
kbmThreadDataSet1: TkbmThreadDataSet;
kbmBinaryStreamFormat1: TkbmBinaryStreamFormat;
memtblrpt_total: TkbmMemTable;
P_SUM: TkbmMemTable;
DataSource1: TDataSource;
DataSource4: TDataSource;
dxDBGrid1Column51: TdxDBGridColumn;
dxDBGrid1Column52: TdxDBGridColumn;
dxDBGrid1Column53: TdxDBGridColumn;
dxDBGrid1Column58: TdxDBGridColumn;
dxDBGrid1Column59: TdxDBGridColumn;
dxDBGrid2Column12: TdxDBGridColumn;
dxDBGrid2Column13: TdxDBGridColumn;
dxDBGrid2Column14: TdxDBGridColumn;
dxDBGrid2Column15: TdxDBGridColumn;
dxDBGrid2Column16: TdxDBGridColumn;
dxDBGrid2Column17: TdxDBGridColumn;
dxDBGrid2Column18: TdxDBGridColumn;
dxDBGrid2Column19: 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;
dxDBGrid2Column23: TdxDBGridColumn;
P_SUMField: TStringField;
P_SUMField2: TFloatField;
P_SUMField7: TFloatField;
P_SUMField8: TFloatField;
P_SUMField9: TFloatField;
P_SUMField10: TFloatField;
P_SUMField11: TFloatField;
P_SUMField12: TFloatField;
P_SUMField13: TFloatField;
P_SUMField16: TFloatField;
pnl1: TPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
dxDBGrid2Column21: TdxDBGridColumn;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinGroupBox2: TbsSkinGroupBox;
Label6: TLabel;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Edit4: TEdit;
Label5: TLabel;
Edit5: TEdit;
Label7: TLabel;
Edit6: TEdit;
Label8: TLabel;
bsSkinGroupBox3: TbsSkinGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Edit7: TEdit;
Edit8: TEdit;
wwDBComboBox2: TwwDBComboBox;
Label12: TLabel;
dxDBGrid1Column60: TdxDBGridColumn;
dxDBGrid1Column61: TdxDBGridColumn;
dxDBGrid1Column63: TdxDBGridColumn;
dxDBGrid1Column64: TdxDBGridColumn;
dxDBGrid1Column65: TdxDBGridColumn;
dxDBGrid1Column66: TdxDBGridColumn;
dxDBGrid1Column67: TdxDBGridColumn;
dxDBGrid1Column70: TdxDBGridColumn;
dxDBGrid1Column71: TdxDBGridColumn;
P_SUMA1: TFloatField;
P_SUMA2: TFloatField;
P_SUMField3: TFloatField;
P_SUMField4: TFloatField;
P_SUMField5: TFloatField;
dxDBGrid2Column20: TdxDBGridColumn;
dxDBGrid2Column22: TdxDBGridColumn;
dxDBGrid2Column24: TdxDBGridColumn;
dxDBGrid2Column25: TdxDBGridColumn;
dxDBGrid2Column26: TdxDBGridColumn;
dxDBGrid1Column72: 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 P_SUMAfterOpen(DataSet: TDataSet);
procedure memtblrpt_totalAfterOpen(DataSet: TDataSet);
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
sqlstr:WideString;
{ Public declarations }
end;
var
frm_rp_sales_profit2022: Tfrm_rp_sales_profit2022;
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_profit2022.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
function Tfrm_rp_sales_profit2022.GetSALEprofit(SALE:string;aMonth:Integer;profit:Double;tuo:boolean):Double;
begin
end;
procedure Tfrm_rp_sales_profit2022.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption+'1');
savereggrid(dxdbgrid2,caption+'2');
frm_rp_sales_profit2022.Hide;
frm_rp_sales_profit2022.ManualFloat(frm_rp_sales_profit2022.BoundsRect );
frm_main.freeTabs('frm_rp_sales_profit2022');
action:=cafree;
frm_rp_sales_profit2022:=nil;
end;
procedure Tfrm_rp_sales_profit2022.FormShow(Sender: TObject);
var
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
edit1.text:=inifile1.ReadString('TC2022','FA1DAY','17');
edit2.text:=inifile1.ReadString('TC2022','FABL1','15');
edit3.text:=inifile1.ReadString('TC2022','FABL2','10');
edit4.text:=inifile1.ReadString('TC2022','FBBL1','10');
edit5.text:=inifile1.ReadString('TC2022','FBBL2','10');
edit6.text:=inifile1.ReadString('TC2022','FBBL3','10');
edit7.text:=inifile1.ReadString('TC2022','SZKK','15');
edit8.text:=inifile1.ReadString('TC2022','SZTC','5');
inifile1.free;
loadreggrid(dxdbgrid1,true,caption+'1');
loadreggrid(dxdbgrid2,false,caption+'2');
end;
procedure Tfrm_rp_sales_profit2022.bsSkinButton9Click(Sender: TObject);
begin
sys_print('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2022',2,nil,nil,nil,DataSource4,DataSource1,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_rp_sales_profit2022.N10Click(Sender: TObject);
begin
if bsSkinTabSheet1.Showing then begin
if bsSkinTabSheet11.Showing then
begin
update_grid_view_no(dxdbgrid1);
exit;
end;
end else begin
if bsSkinTabSheet4.Showing then
begin
update_grid_view_no(dxdbgrid2);
exit;
end;
end;
end;
procedure Tfrm_rp_sales_profit2022.N14Click(Sender: TObject);
begin
if bsSkinTabSheet1.Showing then begin
if bsSkinTabSheet11.Showing then
begin
update_grid_view_all(dxdbgrid1);
exit;
end;
end else begin
if bsSkinTabSheet4.Showing then
begin
update_grid_view_all(dxdbgrid2);
exit;
end;
end;
end;
procedure Tfrm_rp_sales_profit2022.N12Click(Sender: TObject);
begin
if bsSkinTabSheet1.Showing then
begin
if bsSkinTabSheet11.Showing then
begin
update_grid(dxdbgrid1,211);
exit;
end;
end;
if bsSkinTabSheet4.Showing then
begin
update_grid(dxdbgrid2,212);
exit;
end;
end;
procedure Tfrm_rp_sales_profit2022.N16Click(Sender: TObject);
begin
if bsSkinTabSheet1.Showing then begin
if bsSkinTabSheet11.Showing then
begin
grid_save_xls(dxdbgrid1);
exit;
end;
end else begin
if bsSkinTabSheet4.Showing then
begin
grid_save_xls(dxdbgrid2);
exit;
end;
end;
end;
procedure Tfrm_rp_sales_profit2022.bsSkinButton10Click(Sender: TObject);
var
betd,eetd:TDate;
aquery:TADOQuery;
str:String;
inifile1:Tinifile;
begin
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
inifile1.WriteString('TC2022','FA1DAY',edit1.text);
inifile1.WriteString('TC2022','FABL1',edit2.text);
Inifile1.WriteString('TC2022','FABL2',edit3.text);
inifile1.WriteString('TC2022','FBBL1',edit4.text);
inifile1.WriteString('TC2022','FBBL2',edit5.text);
Inifile1.WriteString('TC2022','FBBL3',edit6.text);
inifile1.WriteString('TC2022','SZKK',edit7.text);
inifile1.WriteString('TC2022','SZTC',edit8.text);
inifile1.free;
if (Trim(wwDBComboBox2.text)='') then begin
ShowMessage('<27><><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><E5B2BB>Ϊ<EFBFBD>գ<EFBFBD>');
exit;
end;
sqlstr:='';
query_seae(22,'0001');
sqlstr:=StringReplace(sqlstr,'t_op_seae','v_op_bscard_MAX_2022',[replaceAll]);
memtblrpt_total.EmptyTable;
P_SUM.EmptyTable;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
aQuery.Close;
aquery.sql.Clear;
aquery.SQL.Add('select * from v_op_bscard_MAX_2022 ');
aquery.SQL.Add(sqlstr);
aquery.Open;
memtblrpt_total.LoadFromDataSet(aQuery,[mtcpostructure,mtcpoProperties,mtcpoFieldIndex]);
end;
GetProfit;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_rp_sales_profit2022.GetProfit;
var
aQuery,aQuery3:TADOQuery;
aStlDate:TDate;
bYear,bMonth,bDate,eYear,eMonth,eDate:Word;
btMonth,l,d,Aday:Integer;
Abl1,Abl2,Bbl1,Bbl2,Bbl3,Szbl,Sztc:Double;
ED:Boolean;
begin
if not P_SUM.Active then
P_SUM.Open;
Aday:=StrToIntDef(Edit1.Text,0);
Abl1:=StrToFloatDef(Edit2.Text,0);
Abl2:=StrToFloatDef(Edit3.Text,0);
Bbl1:=StrToFloatDef(Edit4.Text,0);
Bbl2:=StrToFloatDef(Edit5.Text,0);
Bbl3:=StrToFloatDef(Edit6.Text,0);
Szbl:=StrToFloatDef(Edit7.Text,0);
Sztc:=StrToFloatDef(Edit8.Text,0);
if memtblrpt_total.RecordCount=0 then exit;
l:=memtblrpt_total.RecordCount;
if l=0 then l:=100;
memtblrpt_total.FieldByName('A<><41><EFBFBD><EFBFBD>1').ReadOnly:=false;
memtblrpt_total.FieldByName('A<><41><EFBFBD><EFBFBD>2').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD>˿۳<CBBF>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>1').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>2').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD>մ<EFBFBD><D5B4>½<EFBFBD><C2BD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD>մζ<D5B4><CEB6>½<EFBFBD><C2BD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').ReadOnly:=false;
memtblrpt_total.FieldByName('<27>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>').ReadOnly:=false;
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;
memtblrpt_total.First;
while not memtblrpt_total.eof do begin
memtblrpt_total.Edit;
if (memtblrpt_total.FieldByName('<27>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>').AsFloat=memtblrpt_total.FieldByName('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat) then begin
if (wwDBComboBox2.Text='A<><41><EFBFBD><EFBFBD>') then begin
memtblrpt_total.fieldbyname('<27>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=DaysBetween(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,memtblrpt_total.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
if (memtblrpt_total.fieldbyname('<27>ؿ<EFBFBD><D8BF><EFBFBD><EFBFBD><EFBFBD>').AsInteger<=Aday) then begin
memtblrpt_total.fieldbyname('A<><41><EFBFBD><EFBFBD>1').AsFloat:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*Abl1/100;
memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>1').AsFloat:=memtblrpt_total.fieldbyname('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
end else begin
memtblrpt_total.fieldbyname('A<><41><EFBFBD><EFBFBD>2').AsFloat:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*Abl2/100;
memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>2').AsFloat:=memtblrpt_total.fieldbyname('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
end;
end else if (wwDBComboBox2.Text='B<><42><EFBFBD><EFBFBD>') then begin
if (GetBetwMonth(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,memtblrpt_total.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)<=1) then begin
memtblrpt_total.fieldbyname('<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*Bbl1/100;
memtblrpt_total.fieldbyname('<27><><EFBFBD>մ<EFBFBD><D5B4>½<EFBFBD><C2BD><EFBFBD>').AsFloat:=memtblrpt_total.fieldbyname('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
end else if (GetBetwMonth(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,memtblrpt_total.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)<=2) then begin
memtblrpt_total.fieldbyname('<27><><EFBFBD>մζ<D5B4><CEB6>½<EFBFBD><C2BD><EFBFBD>').AsFloat:=memtblrpt_total.fieldbyname('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
memtblrpt_total.fieldbyname('<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>').AsFloat:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*Bbl2/100;
end else if (GetBetwMonth(memtblrpt_total.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,memtblrpt_total.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)<=6) then begin
memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*Bbl3/100;
memtblrpt_total.fieldbyname('<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat:=memtblrpt_total.fieldbyname('<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
end;
end;
if (GetBetwMonth(Date,memtblrpt_total.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)>6) then begin
memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*Sztc/100;
end;
end else begin
if (GetBetwMonth(Date,memtblrpt_total.FieldByName('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)>=6) then begin
memtblrpt_total.fieldbyname('<27><><EFBFBD>˿۳<CBBF>').AsFloat:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat*Szbl/100;
end;
end;
memtblrpt_total.Post;
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['A<><41><EFBFBD><EFBFBD>1']:=memtblrpt_total.fieldbyname('A<><41><EFBFBD><EFBFBD>1').AsFloat;
P_SUM['A<><41><EFBFBD><EFBFBD>2']:=memtblrpt_total.fieldbyname('A<><41><EFBFBD><EFBFBD>2').AsFloat;
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=memtblrpt_total.fieldbyname('<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat;
P_SUM['<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>']:=memtblrpt_total.fieldbyname('<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>').AsFloat;
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat;
P_SUM['<27><><EFBFBD>˿۳<CBBF>']:=memtblrpt_total.fieldbyname('<27><><EFBFBD>˿۳<CBBF>').AsFloat;
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
P_SUM['ë<><C3AB><EFBFBD><EFBFBD>']:=memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
P_SUM['<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['A<><41><EFBFBD><EFBFBD>1']+P_SUM['A<><41><EFBFBD><EFBFBD>2']+P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+P_SUM['<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>']+P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']-P_SUM['<27><><EFBFBD>˿۳<CBBF>'];
P_SUM.Post;
end
else
begin
P_SUM.edit;
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
P_SUM['A<><41><EFBFBD><EFBFBD>1']:=P_SUM.fieldbyname('A<><41><EFBFBD><EFBFBD>1').AsFloat+memtblrpt_total.fieldbyname('A<><41><EFBFBD><EFBFBD>1').AsFloat;
P_SUM['A<><41><EFBFBD><EFBFBD>2']:=P_SUM.fieldbyname('A<><41><EFBFBD><EFBFBD>2').AsFloat+memtblrpt_total.fieldbyname('A<><41><EFBFBD><EFBFBD>2').AsFloat;
P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM.fieldbyname('<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat+memtblrpt_total.fieldbyname('<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat;
P_SUM['<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM.fieldbyname('<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>').AsFloat+memtblrpt_total.fieldbyname('<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>').AsFloat;
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']:=P_SUM.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat+memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>').AsFloat;
P_SUM['<27><><EFBFBD>˿۳<CBBF>']:=P_SUM.fieldbyname('<27><><EFBFBD>˿۳<CBBF>').AsFloat+memtblrpt_total.fieldbyname('<27><><EFBFBD>˿۳<CBBF>').AsFloat;
P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat+memtblrpt_total.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
P_SUM['ë<><C3AB><EFBFBD><EFBFBD>']:=P_SUM.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat+memtblrpt_total.fieldbyname('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
P_SUM['<27>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>']:=P_SUM['A<><41><EFBFBD><EFBFBD>1']+P_SUM['A<><41><EFBFBD><EFBFBD>2']+P_SUM['<27><><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+P_SUM['<27>ζ<EFBFBD><CEB6>½<EFBFBD><C2BD><EFBFBD>']+P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>']+P_SUM['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']-P_SUM['<27><><EFBFBD>˿۳<CBBF>'];
P_SUM.Post;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
memtblrpt_total.Next;
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_profit2022.GetProfitSum;
begin
end;
procedure Tfrm_rp_sales_profit2022.Getlx;
begin
end;
function Tfrm_rp_sales_profit2022.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_profit2022.issameMonth(aBe, aEe: TDate): Boolean;
begin
end;
procedure Tfrm_rp_sales_profit2022.Getcq;
begin
end;
procedure Tfrm_rp_sales_profit2022.P_SUMAfterOpen(DataSet: TDataSet);
begin
AdoFormatdxDBGrid(DataSet);
end;
procedure Tfrm_rp_sales_profit2022.memtblrpt_totalAfterOpen(DataSet: TDataSet);
begin
AdoFormatdxDBGrid(DataSet);
end;
function Tfrm_rp_sales_profit2022.gettotalprofit(sale: string): double;
begin
end;
end.