finace.pas
来自「一个非常好的桑拿浴管理系统」· PAS 代码 · 共 2,024 行 · 第 1/5 页
PAS
2,024 行
Open;
if IsEmpty then
begin
Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
Exit;
end;
While not Eof do
begin
Cells[0,RowCount - 1]:= FieldByName('ser_sym').AsString ; //服务代号
Cells[1,RowCount - 1]:= FieldByName('ser_name').AsString ; //服务名称
Cells[2,RowCount - 1]:= formatfloat('0.00',FieldByName('ser_price').AsFloat) ; //单价
Cells[3,RowCount - 1]:= FieldByName('amount').AsString ; //数量
Cells[4,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ; //总额
RowCount := RowCount + 1;
Next;
end ;
if not(recordCount = 0) then
RowCount := RowCount - 1;
end;
with aqr_sys,SGGRSF do //师傅明细 (个人)已结算
begin
GRL_SGClear(SGGRSF,0,5,1,SGGRSF.RowCount-1); //删除不加隐含列的数据 StingGrid
Close;
SQL.Clear;
// 师傅代号 服务名称 服务单价 数量 总额
SQL.Add(' Select craftsman_serial,ser_name,ser_price,Count(ser_kind) as amount,Sum(ser_total) as total');
SQL.Add(' From sny_serve,sny_craftsman');
//SQL.Add(' Where ser_craftsman_sym = '''+CoxID.Text+'''');
SQL.Add(' Where ser_craftsman_sym = '''+CoxID.Text+'''');
SQL.Add(' And ser_craftsman_sym = craftsman_serial');
SQL.Add(' And ser_end_time>=:StartDT');
SQL.Add(' And ser_end_time<=:EndDT');
SQL.Add(' And not (ser_end_op is null) ');
SQL.Add(' and ser_arrearage = 0 ');
Sql.Add(' group by craftsman_serial,ser_name,ser_price,ser_kind') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
Exit;
end;
While not Eof do
begin
Cells[0,RowCount - 1]:= FieldByName('craftsman_serial').AsString ; //师傅代号
Cells[1,RowCount - 1]:= FieldByName('ser_name').AsString ; //服务名称
Cells[2,RowCount - 1]:= formatfloat('0.00',FieldByName('ser_price').AsFloat) ; //服务单价
Cells[3,RowCount - 1]:= FieldByName('amount').AsString ; //数量
Cells[4,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ; //总额
RowCount := RowCount + 1;
Next;
end ;
if not(recordCount = 0) then
RowCount := RowCount - 1;
end;
FRM_HEJIZG ;
end;
5:begin
with aqr_sys,SGLSMX do //零售明细
begin
GRL_SGClear(SGLSMX,0,4,1,SGLSMX.RowCount-1); //删除不加隐含列的数据 StingGrid
Close;
SQL.Clear;
// 商品名称 单价 数量 总额
SQL.Add(' Select det_name,det_price,Sum(det_amount) as amount,Sum(det_total) as total');
SQL.Add(' From sny_detail');
SQL.Add(' where det_sell_time>=:StartDT');
SQL.Add(' And det_sell_time<=:EndDT');
Sql.Add(' group by det_name,det_price') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
Exit;
end;
While not Eof do
begin
Cells[0,RowCount - 1]:= FieldByName('det_name').AsString ; //商品名称
Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('det_price').AsFloat) ; //单价
Cells[2,RowCount - 1]:= FieldByName('amount').AsString ; //数量
Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ; //总额
RowCount := RowCount + 1;
Next;
end ;
RowCount := RowCount - 1;
end;
FRM_HEJIZG ;
end;
6:begin
with aqr_sys,SGRTJ do //日统计
begin
GRL_SGClear(SGRTJ,0,6,1,SGRTJ.RowCount-1); //删除不加隐含列的数据 StingGrid
if DateTimePicker2.Checked = true then //先按日期取时间付值到StringGrid里
begin
j:= DateTimePicker2.Date - DateTimePicker1.Date ;
g := strtoint(formatfloat('0',round(j)));
kaishi := DateTimePicker1.DateTime ;
for k:= 1 to g+1 do
begin
Cells[0,k]:=formatdatetime('yyyy-mm-dd',DateTimePicker1.Date);
DateTimePicker1.DateTime:=DateTimePicker1.DateTime+1;
RowCount := RowCount +1 ;
end ;
RowCount := RowCount -1 ;
DateTimePicker1.DateTime := kaishi ;
end
else
begin
cells[0,1]:=formatdatetime('yyyy-mm-dd',DateTimePicker1.Date);
end;
for k := 1 to SGRTJ.RowCount -1 do //按每个日期再查询出数据取每个日期的数据
begin
StartDT := StrToDateTime(Cells[0,k]+' ' +'00:00:00');
EndDT := StrToDateTime(Cells[0,k]+' ' +'23:59:59');
Close;
SQL.Clear;
SQL.Add(' Select Sum(reg_real_price) as reg_real_price');
SQL.Add(' From sny_reg');
SQL.Add(' where not(reg_out_op is null)');
SQL.Add(' And reg_time_out>=:StartDT');
SQL.Add(' And reg_time_out<=:EndDT');
//Sql.Add(' group by reg_real_price') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Cells[1,k]:= '0.00' ; //洗浴总额
end
else
begin
Cells[1,k]:= formatfloat('0.00',FieldByName('reg_real_price').AsFloat) ; //洗浴总额
end ;
Close;
SQL.Clear;
SQL.Add(' Select Sum(cons_total) as cons_total');
SQL.Add(' From sny_consume');
SQL.Add(' where not(cons_check_op is null)');
SQL.Add(' where cons_check_time>=:StartDT');
SQL.Add(' And cons_check_time<=:EndDT');
//Sql.Add(' group by cons_total') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Cells[2,k]:= '0.00' ; //物品总额
end
else
begin
Cells[2,k]:= formatfloat('0.00',FieldByName('cons_total').AsFloat) ; //物品总额
end ;
Close;
SQL.Clear;
SQL.Add(' Select Sum(ser_total) as ser_total');
SQL.Add(' From sny_serve');
SQL.Add(' where not(ser_end_op is null)');
SQL.Add(' where ser_end_time>=:StartDT');
SQL.Add(' And ser_end_time<=:EndDT');
//Sql.Add(' group by ser_total') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Cells[3,k]:= '0.00' ; //服务总额
end
else
begin
Cells[3,k]:= formatfloat('0.00',FieldByName('ser_total').AsFloat) ; //服务总额
end ;
Close;
SQL.Clear;
SQL.Add(' Select Sum(commticket_price) as commticket_price');
SQL.Add(' From sny_commticket');
SQL.Add(' where not(comm_op is null)');
SQL.Add(' where comm_selltime>=:StartDT');
SQL.Add(' And comm_selltime<=:EndDT');
//Sql.Add(' group by commticket_price') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Cells[4,k]:= '0.00' ; //服务总额
end
else
begin
Cells[4,k]:= formatfloat('0.00',FieldByName('commticket_price').AsFloat) ; //月票总额
end ;
Cells[5,k]:= formatfloat('0.00',(StrToFloat(Cells[1,k]) + StrToFloat(Cells[2,k]) + StrToFloat(Cells[3,k]) + StrToFloat(Cells[4,k]))) ; //合计
end ;
RTJheji := 0;
for i := 1 to RowCount -1 do
begin
RTJheji := RTJheji + StrtoFloat(Cells[5,i]) ;
end;
LabeledEdit7.Text := FormatFloat('0.00',RTJheji);
end;
FRM_HEJIZG ;
end;
7:begin
with aqr_sys,SGSZFW do //赊帐统计(赊帐服务)
begin
GRL_SGClear(SGSZFW,0,4,1,SGSZFW.RowCount-1); //删除不加隐含列的数据 StingGrid
Close;
SQL.Clear;
// 服务名称 单价 数量 总额
SQL.Add(' Select arre_ser_name,arre_ser_price,Count(arre_ser_name) as amount,Sum(arre_ser_total) as total');
SQL.Add(' From sny_arrearage_service');
SQL.Add(' Where arre_remark = 0');
SQL.Add(' And arre_company = '''+cbx_fkc_name.Text+'''');
SQL.Add(' And arre_end_time>=:StartDT');
SQL.Add(' And arre_end_time<=:EndDT');
Sql.Add(' group by arre_ser_name,arre_ser_price') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
//Exit;
end;
While not Eof do
begin
Cells[0,RowCount - 1]:= FieldByName('arre_ser_name').AsString ; //服务名称
Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('arre_ser_price').AsFloat) ; //单价
Cells[2,RowCount - 1]:= FieldByName('amount').AsString ; //数量
Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ; //总额
RowCount := RowCount + 1;
Next;
end ;
if not(recordCount = 0) then
RowCount := RowCount - 1;
end;
with aqr_sys,SGSZWP do //赊帐统计(赊帐物品)
begin
GRL_SGClear(SGSZWP,0,4,1,SGSZWP.RowCount-1); //删除不加隐含列的数据 StingGrid
Close;
SQL.Clear;
// 物品名称 物品价格 数量 总额
SQL.Add(' Select arre_ware_name,arre_ware_price,Sum(arre_ware_amount) as amount,Sum(arre_ware_total) as total');
SQL.Add(' From sny_arrearage_consume');
SQL.Add(' Where arre_mark = 0');
SQL.Add(' And arre_company = '''+cbx_fkc_name.Text+'''');
SQL.Add(' And arre_checkout_time>=:StartDT ');
SQL.Add(' And arre_checkout_time<=:EndDT');
Sql.Add(' group by arre_ware_name,arre_ware_price') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
//Exit;
end;
While not Eof do
begin
Cells[0,RowCount - 1]:= FieldByName('arre_ware_name').AsString ; //物品名称
Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('arre_ware_price').AsFloat) ; //物品价格
Cells[2,RowCount - 1]:= FieldByName('amount').AsString ; //数量
Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ; //总额
RowCount := RowCount + 1;
Next;
end ;
if not(recordCount = 0) then
RowCount := RowCount - 1;
end;
with aqr_sys,SGSZXY do //赊帐统计(赊帐洗浴)
begin
GRL_SGClear(SGSZXY,0,4,1,SGSZXY.RowCount-1); //删除不加隐含列的数据 StingGrid
Close;
SQL.Clear;
// 洗浴种类 单价 数量 总额
SQL.Add(' Select arre_bathe_kind,arre_price,Count(arre_bathe_kind) as amount,Sum(arre_real_price) as total');
SQL.Add(' From sny_arrearage_reg');
SQL.Add(' Where arre_mark = 0');
SQL.Add(' And arre_company = '''+cbx_fkc_name.Text+'''');
SQL.Add(' And arre_reg_time_out>=:StartDT');
SQL.Add(' And arre_reg_time_out<=:EndDT');
Sql.Add(' group by arre_bathe_kind,arre_price') ;
Parameters.ParamByName('StartDT').Value := StartDT;
Parameters.ParamByName('EndDT').Value := EndDT;
Open;
if IsEmpty then
begin
Application.MessageBox('查询完毕!','提示',Mb_OK+Mb_IconInformation);
Exit;
end;
While not Eof do
begin
Cells[0,RowCount - 1]:= FieldByName('arre_bathe_kind').AsString ; //洗浴种类
Cells[1,RowCount - 1]:= formatfloat('0.00',FieldByName('arre_price').AsFloat) ; //单价
Cells[2,RowCount - 1]:= FieldByName('amount').AsString ; //数量
Cells[3,RowCount - 1]:= formatfloat('0.00',FieldByName('total').AsFloat) ; //总额
RowCount := RowCount + 1;
Next;
end ;
if not(recordCount = 0) then
RowCount := RowCount - 1;
end;
FRM_HEJIZG ;
end;
end;
with aqr_sys,SGFLTJ do //分类统计
begin
GRL_SGClear(SGFLTJ,0,2,1,SGFLTJ.RowCount-1); //删除不加隐含列的数据 StingGrid
close;
SQL.Clear;// 物品种类 物品总额 洗浴种类 总额 服务种类 总额
//SQL.Add(' select cons_kind,sum(cons_total) cons_total,reg_bathe_kind,sum(reg_real_price) reg_real_price,ser_kind,sum(ser_total) ser_total from') ;
SQL.Add(' SELECT cons_kind as a,sum(cons_total) b');
SQL.Add(' FROM sny_consume ') ;
SQL.Add(' where not (cons_check_op is null) ');
SQL.Add(' And cons_check_time>=:StartDT');
SQL.Add(' And cons_check_time<=:EndDT');
SQL.Add(' and cons_arrearage = 0 ');
SQL.Add(' group by cons_kind');
SQL.Add(' union');
SQL.Add(' SELECT reg_bathe_kind as a,sum(reg_real_price) b');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?